:root {
    --brand: #16a34a;
    --brand-dark: #128c3f;
    --ink: #1f2937;
    --ink-soft: #6b7280;
    --line: #e8ecf1;
    --page-bg: #f6f8fb;
    --card-bg: #ffffff;
    --radius: 14px;
}

body {
    background: radial-gradient(1200px 600px at 100% 0%, #eef7f1 0%, transparent 55%), var(--page-bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------------- 侧边栏 ---------------- */
.app-sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 16px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .4px;
    color: var(--ink);
}

.sidebar-brand i {
    color: var(--brand);
    font-size: 20px;
}

.sidebar-nav {
    padding: 6px 12px;
    overflow-y: auto;
    flex: 1;
}

.sidebar-nav .nav-item,
.sidebar-footer .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 14px;
    text-decoration: none;
    transition: all .18s ease;
    white-space: nowrap;
}

.sidebar-nav .nav-item i,
.sidebar-footer .nav-item i {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.sidebar-nav .nav-item:hover,
.sidebar-footer .nav-item:hover {
    background: #f1f5f4;
    color: var(--ink);
    text-decoration: none;
}

.sidebar-nav .nav-item.active {
    background: linear-gradient(135deg, rgba(22, 163, 74, .12), rgba(22, 163, 74, .06));
    color: var(--brand-dark);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .16);
}

.sidebar-footer {
    padding: 10px 12px 18px;
    border-top: 1px solid var(--line);
}

/* ---------------- 主体 ---------------- */
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
}

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--ink-soft);
}

.user-name {
    font-weight: 600;
    color: var(--ink);
}

.app-content {
    padding: 22px 24px 40px;
}

/* ---------------- 卡片 ---------------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -18px rgba(16, 24, 40, .18);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    padding: 14px 18px;
}

.card-body {
    padding: 18px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    height: 100%;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    margin-top: 8px;
    letter-spacing: -.5px;
}

.stat-card .stat-foot {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 6px;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 163, 74, .1);
    color: var(--brand-dark);
}

/* ---------------- 表格 ---------------- */
.table {
    margin-bottom: 0;
    font-size: 14px;
}

.table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--line);
    background: #fafbfc;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    padding: 12px 14px;
}

.table td {
    vertical-align: middle;
    border-top: 1px solid #f1f4f7;
    padding: 12px 14px;
}

.dish-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f4f7;
    border: 1px solid var(--line);
}

/* ---------------- 控件 ---------------- */
.btn {
    border-radius: 10px;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-light {
    background: #f4f6f8;
    border-color: #e5e9ef;
}

.form-control,
.custom-select {
    border-radius: 10px;
    border-color: #e3e8ef;
    height: 42px;
}

.form-control:focus,
.custom-select:focus {
    border-color: rgba(22, 163, 74, .5);
    box-shadow: 0 0 0 .2rem rgba(22, 163, 74, .12);
}

textarea.form-control {
    height: auto;
}

.badge-soft {
    background: #f1f5f4;
    color: var(--brand-dark);
    font-weight: 600;
}

/* ---------------- 餐台 ---------------- */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.table-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    background: #fff;
    text-align: center;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: transform .16s ease, box-shadow .16s ease;
}

.table-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -18px rgba(16, 24, 40, .4);
}

.table-card.is-using {
    border-color: rgba(245, 158, 11, .4);
    background: #fffdf6;
}

.table-card.is-reserved {
    border-color: rgba(59, 130, 246, .35);
    background: #f7faff;
}

.table-card .table-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .5px;
}

.table-card .table-meta {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 4px;
}

/* ---------------- 点餐面板 ---------------- */
.pos-dish {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    cursor: pointer;
    transition: all .15s ease;
}

.pos-dish:hover {
    border-color: rgba(22, 163, 74, .45);
    background: #f9fdfb;
}

.pos-dish .dish-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.pos-dish .dish-price {
    color: #d97706;
    font-weight: 700;
    font-size: 14px;
}

.pos-dish .pos-thumb {
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f1f4f7;
}

.cart-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px dashed #eef1f4;
}

.cart-line .cart-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
}

.qty-box {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.qty-box button {
    border: 0;
    background: #f7f9fa;
    width: 26px;
    height: 28px;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
}

.qty-box span {
    width: 30px;
    text-align: center;
    font-size: 13px;
}

.cart-summary {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.total-amount {
    font-size: 22px;
    font-weight: 700;
    color: #d97706;
}

/* ---------------- 登录页 ---------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(900px 500px at 10% 10%, #eaf6ee 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #f2f6ff 0%, transparent 55%), #f7f9fb;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 32px 28px;
    box-shadow: 0 20px 50px -30px rgba(16, 24, 40, .5);
}

.login-card h3 {
    font-weight: 700;
    letter-spacing: .5px;
}

.login-card .brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(22, 163, 74, .1);
    color: var(--brand-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

/* ---------------- 移动端 ---------------- */
.sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .35);
    z-index: 25;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 40px rgba(16, 24, 40, .18);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .sidebar-mask.show {
        display: block;
    }

    .app-content {
        padding: 16px;
    }

    .app-topbar {
        padding: 12px 16px;
    }
}

@media (max-width: 575.98px) {
    .stat-card .stat-value {
        font-size: 22px;
    }

    .table-responsive {
        font-size: 13px;
    }
}

/* 打印小票 */
@media print {
    .app-sidebar,
    .app-topbar,
    .no-print {
        display: none !important;
    }

    .app-content {
        padding: 0;
    }

    body {
        background: #fff;
    }
}
