:root {
    --sidebar-w: 240px;
    --sidebar-bg: #1e2433;
    --sidebar-hover: #2a3247;
    --accent: #ff6b35;
    --accent-dark: #e5561f;
    --content-bg: #f4f6fa;
    --card-radius: 14px;
}
* { -webkit-tap-highlight-color: transparent; }
body { background: var(--content-bg); font-family: 'Segoe UI', system-ui, sans-serif; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: var(--sidebar-bg); color: #cfd4e2;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040;
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; padding: 18px 18px;
    font-weight: 700; font-size: 1.05rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-icon { color: var(--accent); font-size: 1.5rem; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; }
.sidebar-nav { overflow-y: auto; padding: 10px 0; flex: 1; }
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 18px;
    color: #b6bdd1; text-decoration: none; font-size: .92rem; border-left: 3px solid transparent;
}
.sidebar-nav .nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-item.active { background: var(--sidebar-hover); color: #fff; border-left-color: var(--accent); }
.sidebar-nav .nav-item i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-item.nav-sub { padding: 6px 18px 6px 34px; font-size: .85rem; }

.main-panel { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: #fff; border-bottom: 1px solid #e8ecf3; padding: 10px 22px;
    display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; }
.topbar-icon { color: #4a5568; font-size: 1.15rem; text-decoration: none; }
.notif-badge {
    position: absolute; top: -6px; right: -8px; background: var(--accent); color: #fff;
    font-size: .62rem; border-radius: 10px; padding: 1px 5px; font-weight: 700;
}
.topbar-user { color: #2d3748; text-decoration: none; font-weight: 500; }

.content { padding: 22px; flex: 1; }

/* ---------- Cards / widgets ---------- */
.card { border: 0; border-radius: var(--card-radius); box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.kpi-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.kpi-icon {
    width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: .8rem; color: #718096; }
.bg-grad-green { background: linear-gradient(135deg,#34c38f,#2ab57d); }
.bg-grad-blue { background: linear-gradient(135deg,#4b7bec,#3867d6); }
.bg-grad-orange { background: linear-gradient(135deg,#f7b731,#e58e26); }
.bg-grad-red { background: linear-gradient(135deg,#f06595,#e84a7f); }
.bg-grad-purple { background: linear-gradient(135deg,#8854d0,#6c3fb5); }
.bg-grad-teal { background: linear-gradient(135deg,#2bcbba,#0fb9b1); }

.quick-action {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 8px; border-radius: 12px; background: #fff; text-decoration: none;
    color: #2d3748; box-shadow: 0 1px 3px rgba(16,24,40,.06); transition: .15s;
}
.quick-action:hover { transform: translateY(-2px); color: var(--accent); box-shadow: 0 4px 12px rgba(16,24,40,.12); }
.quick-action i { font-size: 1.5rem; color: var(--accent); }

/* ---------- Tables ---------- */
.table-card { background: #fff; border-radius: var(--card-radius); box-shadow: 0 1px 3px rgba(16,24,40,.06); overflow: hidden; }
.table-card thead th {
    background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: #64748b; font-weight: 600; padding: 12px 14px; white-space: nowrap;
}
.table-card tbody td { padding: 11px 14px; vertical-align: middle; font-size: .9rem; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: 8px; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }

/* ---------- POS ---------- */
.pos-wrap { display: grid; grid-template-columns: 110px 1fr 400px; gap: 14px; height: calc(100vh - 150px); }
.pos-cats { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pos-cat-btn {
    border: 0; border-radius: 10px; padding: 14px 6px; background: #fff; font-weight: 600;
    font-size: .8rem; color: #4a5568; box-shadow: 0 1px 2px rgba(16,24,40,.08); cursor: pointer;
}
.pos-cat-btn.active { background: var(--accent); color: #fff; }
.pos-products { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-content: start; }
.pos-product {
    background: #fff; border: 0; border-radius: 12px; padding: 0; overflow: hidden; text-align: left;
    box-shadow: 0 1px 3px rgba(16,24,40,.08); cursor: pointer; transition: .12s; position: relative;
}
.pos-product:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(16,24,40,.14); }
.pos-product .p-img { height: 90px; width: 100%; object-fit: cover; background: #eef1f6; }
.pos-product .p-body { padding: 8px 10px; }
.pos-product .p-name { font-size: .82rem; font-weight: 600; color: #2d3748; line-height: 1.2; min-height: 2em; }
.pos-product .p-price { font-size: .85rem; font-weight: 700; color: var(--accent); }
.pos-product.out-stock { opacity: .45; }
.pos-product .out-tag {
    position: absolute; top: 8px; right: 8px; background: #e53e3e; color: #fff; font-size: .62rem;
    padding: 2px 7px; border-radius: 8px; font-weight: 700;
}
.pos-cart { background: #fff; border-radius: var(--card-radius); box-shadow: 0 1px 3px rgba(16,24,40,.08); display: flex; flex-direction: column; overflow: hidden; }
.pos-cart-items { flex: 1; overflow-y: auto; }
.cart-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid #f0f2f7; }
.cart-row .c-name { flex: 1; min-width: 0; font-size: .86rem; font-weight: 600; }
.cart-row .c-qty { display: flex; align-items: center; gap: 5px; }
.cart-row .c-qty button { width: 26px; height: 26px; border: 0; border-radius: 6px; background: #eef1f6; font-weight: 700; }
.cart-row .c-price { font-weight: 700; font-size: .86rem; min-width: 72px; text-align: right; }
.pos-total-row { display: flex; justify-content: space-between; padding: 5px 14px; font-size: .9rem; }
.pos-grand { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.pos-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; padding: 10px 12px; }
.pos-actions .btn { border-radius: 9px; font-weight: 600; font-size: .8rem; padding: 9px 4px; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-panel { margin-left: 0; }
    .pos-wrap { grid-template-columns: 1fr; height: auto; }
    .pos-cart { min-height: 400px; }
}
@media (min-width: 992px) { .d-lg-none-sidebar { display: none; } }

/* ---------- KDS ---------- */
.kds-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 14px; }
.kds-ticket { border-radius: 12px; padding: 14px; color: #fff; box-shadow: 0 2px 8px rgba(16,24,40,.15); }
.kds-ticket.new { background: linear-gradient(135deg,#3867d6,#1e3799); }
.kds-ticket.accepted { background: linear-gradient(135deg,#8854d0,#5f27cd); }
.kds-ticket.preparing { background: linear-gradient(135deg,#f7b731,#e58e26); color: #212529; }
.kds-ticket.ready { background: linear-gradient(135deg,#20bf6b,#0a3d2f); }
.kds-ticket.completed, .kds-ticket.served { background: linear-gradient(135deg,#576574,#2f3542); }
.kds-ticket.cancelled { background: #b2bec3; color: #2d3436; }

/* ---------- Tables (dine-in) ---------- */
.table-tile {
    border-radius: 12px; padding: 16px 10px; text-align: center; color: #fff; cursor: pointer;
    font-weight: 600; box-shadow: 0 2px 6px rgba(16,24,40,.12); border: 0; width: 100%;
}
.table-tile.available { background: linear-gradient(135deg,#20bf6b,#16a085); }
.table-tile.occupied { background: linear-gradient(135deg,#eb3b5a,#c0392b); }
.table-tile.reserved { background: linear-gradient(135deg,#f7b731,#e58e26); color: #212529; }
.table-tile.cleaning { background: linear-gradient(135deg,#a5b1c2,#7f8c9b); }

.login-card { max-width: 420px; margin: 7vh auto; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand i { font-size: 3rem; color: var(--accent); }

/* ---------- POS fullscreen ---------- */
.pos-body { background: var(--content-bg); overflow: hidden; }
.pos-topbar {
    background: #fff; border-bottom: 1px solid #e8ecf3; padding: 8px 16px;
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1030;
}
.pos-brand { font-weight: 700; }
.pos-clock { font-variant-numeric: tabular-nums; color: #718096; font-size: .9rem; }
.order-type-group { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-type-btn {
    border: 1px solid #e2e8f0; background: #fff; border-radius: 9px; padding: 6px 12px;
    font-size: .82rem; font-weight: 600; color: #4a5568; cursor: pointer;
}
.pos-type-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pos-wrap-full {
    display: grid; grid-template-columns: 120px 1fr 400px; gap: 14px;
    height: calc(100vh - 60px); padding: 14px;
}
.pos-search-row { margin-bottom: 12px; }
.pos-products-area { overflow-y: auto; min-width: 0; }
.pos-cart-head { padding: 10px 12px; border-bottom: 1px solid #f0f2f7; }
.pos-cart-foot { border-top: 1px solid #f0f2f7; padding-top: 6px; }

.text-accent { color: var(--accent); }

.cart-x { border: 0; background: none; color: #cbd5e0; padding: 2px 4px; }
.cart-x:hover { color: #e53e3e; }

.mod-chip {
    border: 1.5px solid #e2e8f0; background: #fff; border-radius: 20px; padding: 6px 14px;
    font-size: .85rem; font-weight: 600; color: #4a5568; cursor: pointer;
}
.mod-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.pay-row .form-control, .pay-row .form-select { min-width: 0; }

.recall-item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    width: 100%; border: 0; border-bottom: 1px solid #f0f2f7; background: #fff;
    padding: 14px 16px; text-align: left; cursor: pointer;
}
.recall-item:hover { background: #fff7f2; }

.pos-toasts { position: fixed; top: 64px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.pos-toast {
    background: #2d3748; color: #fff; padding: 10px 16px; border-radius: 10px;
    font-size: .88rem; opacity: 0; transform: translateX(20px); transition: .25s;
    box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 340px;
}
.pos-toast.show { opacity: 1; transform: none; }
.pos-toast.success { background: #1f9d66; }
.pos-toast.danger { background: #d63a4e; }
.pos-toast.warning { background: #d99a18; color: #212529; }

@media (max-width: 991px) {
    .pos-body { overflow: auto; }
    .pos-wrap-full { grid-template-columns: 1fr; height: auto; }
    .pos-cart { min-height: 420px; }
}
