* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    color: #1f2937;
    background: #f5f7fb;
}

a {
    color: inherit;
    text-decoration: none;
}

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
}

.sidebar {
    background: linear-gradient(180deg, #101828 0%, #111c33 100%);
    color: #d7def0;
    padding: 24px 18px;
}

.brand {
    margin-bottom: 28px;
}

.brand h1 {
    margin: 0;
    font-size: 22px;
    color: #ffffff;
}

.brand p {
    margin: 8px 0 0;
    font-size: 13px;
    color: #94a3b8;
}

.nav-group {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: block;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    color: #cbd5e1;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.main {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.page-title h2 {
    margin: 0;
    font-size: 28px;
}

.page-title p {
    margin: 8px 0 0;
    font-size: 14px;
    color: #64748b;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    color: #475569;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.stat-label {
    color: #64748b;
    font-size: 13px;
}

.stat-value {
    margin-top: 10px;
    font-size: 30px;
    font-weight: 700;
}

.stat-sub {
    margin-top: 8px;
    color: #94a3b8;
    font-size: 12px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head h3 {
    margin: 0;
    font-size: 18px;
}

.section-head p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.toolbar,
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar-spread {
    justify-content: space-between;
    align-items: flex-start;
}

.toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.toolbar-inline {
    margin: 0;
}

.toolbar input:not([type="file"]),
.toolbar select,
.toolbar-file {
    min-height: 42px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    padding: 9px 12px;
    background: #ffffff;
    font: inherit;
    color: #1f2937;
}

.toolbar a,
.filters a,
.btn,
button {
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
}

.btn,
button {
    background: #f59e0b;
    color: #ffffff;
    font-weight: 600;
}

.btn.secondary,
button.secondary,
.filters a {
    background: #ffffff;
    color: #475569;
    border: 1px solid #dbe3ef;
}

.filters a.is-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: top;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.muted {
    color: #64748b;
}

.strong {
    font-weight: 700;
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    background: #fff7ed;
    color: #c2410c;
}

.pill.gray {
    background: #f1f5f9;
    color: #475569;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.field {
    display: grid;
    gap: 8px;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    padding: 11px 12px;
    font: inherit;
    color: #1f2937;
    background: #ffffff;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.toolbar-input,
.toolbar-file {
    max-width: 260px;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.9fr);
    gap: 18px;
}

.list-stack {
    display: grid;
    gap: 12px;
}

.marketing-block + .marketing-block {
    margin-top: 18px;
}

.meta-text {
    font-size: 12px;
    color: #94a3b8;
}

.product-cell {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.product-thumb {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
}

.banner-thumb {
    width: 88px;
    height: 52px;
    border-radius: 12px;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 12px;
}

.preview-card {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}

.preview-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: #f8fafc;
}

.preview-card p {
    margin: 0;
    padding: 10px 12px;
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid #eef2f7;
}

.preview-card-banner img {
    aspect-ratio: 16 / 9;
}

.preview-card-menu {
    text-align: center;
}

.menu-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
}

.menu-preview-circle,
.menu-icon-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fde68a;
}

.menu-preview-icon,
.menu-icon-thumb {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.preview-empty {
    padding: 16px 18px;
    border: 1px dashed #dbe3ef;
    border-radius: 16px;
    background: #f8fafc;
    color: #64748b;
    font-size: 13px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-pill-available {
    background: #ecfdf5;
    color: #047857;
}

.status-pill-used {
    background: #eff6ff;
    color: #1d4ed8;
}

.status-pill-expired {
    background: #f3f4f6;
    color: #6b7280;
}

.coupon-preview {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: stretch;
    min-width: 220px;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    background: #ffffff;
}

.coupon-preview-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 14px 12px;
    background: #fff7ed;
    border-right: 1px dashed #fdba74;
}

.coupon-preview-side strong {
    font-size: 18px;
    color: #d97706;
}

.coupon-preview-side span {
    font-size: 11px;
    color: #9a3412;
}

.coupon-preview-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 12px 14px;
    min-width: 0;
}

.coupon-preview-body p,
.coupon-preview-body small,
.coupon-preview-body em {
    margin: 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coupon-preview-body p {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.coupon-preview-body small {
    font-size: 11px;
    color: #64748b;
}

.coupon-preview-body em {
    font-style: normal;
    font-size: 11px;
    color: #94a3b8;
}

.coupon-preview-large {
    max-width: 520px;
}

.coupon-preview-used {
    opacity: 0.72;
}

.coupon-preview-expired {
    opacity: 0.56;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.recommend-card {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 14px;
    background: #f8fafc;
}

.recommend-card h4 {
    margin: 0 0 10px;
    font-size: 15px;
}

.recommend-card .field {
    margin-top: 10px;
}

.subcard-stack {
    display: grid;
    gap: 14px;
}

.subcard {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 16px;
    background: #f8fafc;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(6px);
}

.modal-card {
    width: min(100%, 860px);
    max-height: calc(100vh - 56px);
    overflow: hidden;
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    padding: 22px;
}

.modal-card-wide {
    width: min(100%, 1080px);
}

.modal-scroll {
    max-height: calc(100vh - 170px);
    overflow: auto;
    padding-right: 6px;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.pagination-meta {
    font-size: 13px;
    color: #64748b;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-links .btn {
    min-width: 42px;
    justify-content: center;
}

.pagination-links .is-page-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding-bottom: 8px;
    }

    .split {
        grid-template-columns: 1fr;
    }

    .toolbar-spread {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-group {
        width: 100%;
    }

    .modal-backdrop {
        padding: 14px;
    }

    .modal-card,
    .modal-card-wide {
        width: 100%;
        max-height: calc(100vh - 28px);
        padding: 18px;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}
