:root {
    --navy: #10243f;
    --navy-deep: #0b1a2e;
    --navy-soft: #1c3a5f;
    --beige: #f4ead8;
    --beige-deep: #e6d5b8;
    --beige-card: #fffaf2;
    --red-dark: #8b1e2d;
    --red-deeper: #6a1521;
    --gold: #c9a227;
    --gold-soft: #e8d39a;
    --ink: #162033;
    --muted: #6d5e4b;
    --sidebar-width: 270px;
}

* { box-sizing: border-box; }

body.app-body {
    font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(200, 162, 39, 0.12), transparent 28%),
        var(--beige);
    color: var(--ink);
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--navy-deep) 0%, var(--navy) 72%, #1a2438 100%);
    color: #fff;
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1040;
    box-shadow: -10px 0 32px rgba(11, 26, 46, 0.28);
    border-left: 3px solid var(--gold);
}

.sidebar-section {
    color: var(--gold-soft);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 0.9rem 1.4rem 0.15rem;
    opacity: 0.9;
}

.table-tight th,
.table-tight td {
    font-size: 0.82rem;
    white-space: nowrap;
}

.sidebar-brand {
    padding: 1.1rem 1rem 1rem;
    border-bottom: 1px solid rgba(201, 162, 39, 0.22);
}

.brand-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 0 0 2px var(--gold);
}

.sidebar-brand h1 {
    font-size: 1.12rem;
    margin: 0;
    color: #fff;
}

.sidebar-brand small {
    color: var(--gold-soft);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.84);
    border-radius: 12px;
    margin: 0.15rem 0.8rem;
    padding: 0.7rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.sidebar .nav-link:hover {
    background: rgba(244, 234, 216, 0.1);
    color: var(--gold-soft);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, var(--red-dark), #a32638);
    color: #fff;
    box-shadow: 0 8px 18px rgba(139, 30, 45, 0.28);
}

.main-wrap {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: var(--beige-card);
    border-bottom: 1px solid var(--beige-deep);
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
}

    .page-content { padding: 1.25rem; }

.page-content.wide-page {
    padding-left: 1rem;
    padding-right: 1rem;
}

.product-thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--beige);
    border: 1px solid var(--beige-deep);
}

.products-table tbody tr {
    cursor: pointer;
}

.products-table tbody tr:hover {
    background: #f8f0e0;
}

.products-table td,
.products-table th {
    vertical-align: middle;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    white-space: nowrap;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    border: 1px solid var(--beige-deep);
    border-radius: 999px;
    padding: 0.25rem 0.35rem 0.25rem 0.7rem;
}

.category-chip input[name="name"] {
    border: 0;
    background: transparent;
    width: 120px;
    font-weight: 700;
    color: var(--navy);
}

.quick-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 16px;
    background: var(--beige);
    border: 1px solid var(--beige-deep);
}

.stat-card {
    background: var(--beige-card);
    border: 1px solid var(--beige-deep);
    border-radius: 18px;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 10px 24px rgba(16, 36, 63, 0.06);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 100%;
    background: var(--red-dark);
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.9rem;
}

.stat-card .value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--navy);
}

.stat-card .icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(16, 36, 63, 0.08);
    color: var(--red-dark);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
}

.panel {
    background: var(--beige-card);
    border: 1px solid var(--beige-deep);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(16, 36, 63, 0.05);
}

.panel-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--beige-deep);
    font-weight: 700;
    color: var(--navy);
    background: linear-gradient(90deg, #f8f0e0, transparent);
}

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--navy-deep);
    font-weight: 700;
}

.btn-gold:hover {
    background: #b8911d;
    color: #fff;
}

.toolbar-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 420px;
}

.filter-bar .form-control,
.filter-bar .form-select,
.filter-bar .btn,
.btn-new-order {
    height: 42px;
}

.filter-bar .form-control {
    flex: 1 1 220px;
    min-width: 180px;
}

.filter-bar .form-select {
    width: 160px;
    flex: 0 0 160px;
}

.filter-bar .btn {
    min-width: 72px;
}

.btn-new-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
    font-weight: 800;
    padding: 0 1.2rem;
    flex: 0 0 auto;
}

.btn-palace {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.btn-palace:hover {
    background: var(--navy-soft);
    color: #fff;
}

.btn-accent {
    background: var(--red-dark);
    border-color: var(--red-dark);
    color: #fff;
}

.btn-accent:hover {
    background: var(--red-deeper);
    color: #fff;
}

.table thead th {
    background: var(--beige);
    color: var(--navy);
    font-weight: 700;
    border-bottom: none;
}

.badge-new { background: var(--navy-soft); }
.badge-preparing { background: #c47a12; }
.badge-ready { background: #1f7a4d; }
.badge-delivered { background: var(--red-dark); }
.badge-cancelled { background: #6b7280; }

.status-form {
    display: inline-block;
    min-width: 160px;
}

.status-select {
    font-weight: 700;
    color: #fff !important;
    border: 0;
    min-width: 160px;
    padding-inline-end: 0.75rem;
    padding-inline-start: 2rem;
    background-color: var(--navy-soft);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.65rem center;
    background-size: 16px 12px;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.status-select.status-new { background-color: var(--navy-soft); }
.status-select.status-preparing { background-color: #c47a12; }
.status-select.status-ready { background-color: #1f7a4d; }
.status-select.status-delivered { background-color: var(--red-dark); }
.status-select.status-cancelled { background-color: #6b7280; }

.status-select option {
    color: #10243f;
    font-weight: 600;
    background: #fff;
}

.product-tile {
    border: 1px solid var(--beige-deep);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    height: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
}

.product-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(16, 36, 63, 0.14);
    border-color: var(--gold);
}

.product-tile img,
.product-tile .thumb {
    height: 110px;
    object-fit: cover;
    width: 100%;
    background: var(--beige);
}

.cart-box {
    position: sticky;
    top: 84px;
}

.auth-screen {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(201, 162, 39, 0.22), transparent 34%),
        linear-gradient(145deg, var(--navy-deep), var(--navy) 58%, #241016);
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-card {
    width: min(460px, 100%);
    background: var(--beige-card);
    border-radius: 24px;
    padding: 2rem 2rem 1.5rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(201, 162, 39, 0.35);
}

.auth-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 6px;
    box-shadow: 0 0 0 4px var(--gold);
}

.receipt-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
    margin: 0 auto 6px;
}

.low-stock { color: var(--red-dark); font-weight: 700; }

.customer-suggest {
    position: absolute;
    top: calc(100% - 2px);
    right: 0.25rem;
    left: auto;
    width: min(320px, calc(100vw - 2rem));
    z-index: 40;
    background: #fff;
    border: 1px solid var(--beige-deep);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(16, 36, 63, 0.14);
    display: none;
    max-height: 240px;
    overflow: auto;
}

.suggest-item {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
    padding: 0.7rem 0.85rem;
    text-align: right;
}

.suggest-item:hover,
.suggest-item.active {
    background: var(--beige);
}

.suggest-item strong {
    display: block;
    color: var(--navy);
}

.suggest-item span {
    color: var(--muted);
    font-size: 0.82rem;
}

.suggest-empty {
    padding: 0.7rem 0.85rem;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-wrap { margin-right: 0; }
}

.cat-btn.active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.pos-tile {
    position: relative;
}

.pos-tile img {
    height: 150px;
}

.pos-tile .pos-price {
    color: var(--red-dark);
    font-weight: 800;
    font-size: 1rem;
}

.pos-tile .pos-name {
    font-weight: 800;
    color: var(--navy);
    line-height: 1.3;
}

.cart-page {
    min-height: calc(100vh - 130px);
}

.cart-list {
    min-height: 180px;
}

.cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto auto auto;
    gap: 0.85rem;
    align-items: center;
    background: #fff;
    border: 1px solid var(--beige-deep);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.7rem;
}

.cart-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    justify-content: space-between;
}

.cart-footer .grand-box {
    flex: 1;
    min-width: 240px;
    margin-bottom: 0;
}

.picker-modal .modal-header,
.picker-modal .modal-footer {
    background: linear-gradient(90deg, #f8f0e0, transparent);
}

.picker-tile {
    position: relative;
}

.picker-tile.selected {
    border-color: var(--navy);
    box-shadow: inset 0 0 0 3px var(--navy);
}

.picker-check {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    color: var(--navy);
    border: 2px solid var(--beige-deep);
    display: grid;
    place-items: center;
    font-size: 1rem;
    z-index: 2;
}

.picker-tile.selected .picker-check {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.cart-item img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 12px;
    background: var(--beige);
}

.cart-item-title {
    font-weight: 800;
    color: var(--navy);
    line-height: 1.35;
}

.cart-item-unit {
    color: var(--red-dark);
    font-weight: 800;
    font-size: 0.95rem;
}

.cart-item-total {
    font-weight: 800;
    color: var(--navy);
    white-space: nowrap;
    min-width: 110px;
    text-align: left;
}

@media (max-width: 767.98px) {
    .cart-item {
        grid-template-columns: 52px 1fr auto;
        grid-template-areas:
            "img title remove"
            "img qty total";
    }
    .cart-item img { grid-area: img; }
    .cart-item > div:nth-child(2) { grid-area: title; }
    .cart-item .qty-box { grid-area: qty; }
    .cart-item-total { grid-area: total; min-width: 0; }
    .cart-item .cart-remove { grid-area: remove; }
}

.qty-box {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--beige);
    border-radius: 999px;
    padding: 2px;
}

.qty-box button {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--navy);
    font-weight: 800;
}

.cart-remove {
    border: 0;
    background: transparent;
    color: var(--red-dark);
    font-size: 1.1rem;
    line-height: 1;
}

.cart-empty {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem 0.5rem;
}

.grand-box {
    background: var(--navy);
    color: #fff;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.order-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
}

.order-item-row td {
    vertical-align: middle;
}

.order-item-name {
    font-weight: 800;
    color: var(--navy);
}

.order-item-price {
    color: var(--red-dark);
    font-weight: 800;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0;
    color: var(--muted);
}

.summary-row.total {
    border-top: 1px dashed var(--beige-deep);
    margin-top: 0.4rem;
    padding-top: 0.8rem;
    color: var(--navy);
    font-size: 1.25rem;
    font-weight: 800;
}

.info-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0e6d4;
}

.info-line span:first-child { color: var(--muted); }
.info-line b { color: var(--navy); }

.hall-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--muted);
    font-weight: 600;
}
.hall-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}
.hall-dot.free { background: var(--gold); }
.hall-dot.busy { background: var(--navy); }
.hall-dot.off { background: #b9a98a; }
.hall-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.table-card-form { margin: 0; }
.table-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
    padding: 1rem;
    border-radius: 18px;
    text-align: center;
    text-decoration: none;
    width: 100%;
    border: 2px solid transparent;
    box-shadow: 0 10px 24px rgba(16, 36, 63, 0.08);
}
.table-card-name { font-size: 1.15rem; font-weight: 800; }
.table-card-meta { font-size: 0.85rem; margin-top: 0.25rem; }
.table-card-total { font-size: 1.05rem; font-weight: 800; margin-top: 0.4rem; }
.table-card-action { margin-top: 0.6rem; font-weight: 700; }
.table-card.free {
    background: var(--beige-card);
    border-color: var(--gold);
    color: var(--navy);
}
.table-card.free:hover { background: #fff6e4; }
.table-card.busy {
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-soft) 100%);
    color: #fff;
}
.table-card.busy:hover { color: #fff; }
.table-card.off {
    background: #efe4cf;
    color: var(--muted);
}
