:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0891b2;
  --primary-dark: #155e75;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Manrope, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 4px; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--bg); }
.login-brand-panel { padding: 64px; color: white; background: radial-gradient(circle at 15% 20%, rgba(34,211,238,.22), transparent 28%), linear-gradient(135deg, #0f172a, #155e75); display: flex; flex-direction: column; justify-content: space-between; }
.brand-lockup { display: flex; align-items: center; gap: 12px; font-weight: 900; }
.logo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: white; background: linear-gradient(135deg, #06b6d4, #14b8a6); box-shadow: 0 14px 30px rgba(6,182,212,.25); }
.login-brand-panel h1 { font-size: clamp(42px, 5vw, 72px); line-height: .96; letter-spacing: -.06em; max-width: 680px; margin: 40px 0 18px; }
.login-brand-panel p { color: rgba(255,255,255,.72); font-size: 17px; max-width: 560px; line-height: 1.7; }
.login-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 40px; }
.login-metrics div { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.08); border-radius: 20px; padding: 18px; }
.login-metrics strong { display: block; font-size: 24px; }
.login-metrics span { color: rgba(255,255,255,.66); font-size: 12px; }
.login-form-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 30px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 32px; margin: 0 0 24px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 14px; }
input, select { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 13px 14px; outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,145,178,.11); }
.primary, .secondary, .logout { border: 0; border-radius: 14px; font-weight: 900; padding: 12px 15px; }
.primary { color: white; background: var(--primary); }
.primary:hover { background: var(--primary-dark); }
.secondary { color: var(--primary-dark); background: #ecfeff; }
.full { width: 100%; padding: 15px; }
.error { color: var(--red); font-size: 13px; font-weight: 800; margin-top: 12px; }

.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; }
.sidebar nav { display: grid; gap: 6px; margin-top: 28px; }
.nav { border: 0; background: transparent; color: var(--muted); text-align: left; padding: 12px 14px; border-radius: 12px; font-weight: 900; }
.nav:hover { background: var(--surface-2); color: var(--ink); }
.nav.active { background: #ecfeff; color: var(--primary-dark); }
.logout { margin-top: auto; color: var(--red); background: #fef2f2; }
.main { min-width: 0; padding: 24px; }
.topbar { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 800; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-grid article { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 8px 24px rgba(15,23,42,.04); }
.kpi-grid span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 900; }
.kpi-grid strong { display: block; font-size: 28px; margin: 6px 0 2px; }
.kpi-grid small { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 22px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; padding: 12px; margin-bottom: 18px; }
.form-grid input:nth-child(5) { grid-column: span 2; }
.form-grid.compact { grid-template-columns: 1fr 2fr auto; }
.admin-list { display: grid; gap: 10px; }
.order-tile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--surface); }
.order-main { min-width: 0; }
.order-id { font-weight: 900; }
.order-sub { color: var(--muted); font-size: 12px; margin-top: 5px; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.order-items { color: var(--ink); font-size: 13px; margin-top: 8px; }
.order-side { text-align: right; }
.amount { color: var(--primary); font-size: 22px; font-weight: 900; }
.badge { display: inline-flex; margin-top: 6px; padding: 6px 9px; border-radius: 999px; font-size: 10px; text-transform: uppercase; font-weight: 900; background: #e2e8f0; color: var(--ink); }
.badge.pending { background: #fff7ed; color: var(--amber); }
.badge.confirmed { background: #ecfeff; color: var(--primary-dark); }
.badge.out_for_delivery { background: #eff6ff; color: var(--blue); }
.badge.delivered { background: #ecfdf5; color: var(--green); }
.badge.cancelled { background: #fef2f2; color: var(--red); }
.order-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.order-actions button { border: 0; border-radius: 11px; padding: 9px 11px; font-size: 12px; font-weight: 900; background: var(--surface-2); color: var(--ink); }
.order-actions .danger { color: var(--red); background: #fef2f2; }
.order-actions .ghost-map { color: var(--primary-dark); background: #ecfeff; }
.card-grid, .customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.catalog-card, .customer-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: var(--surface); }
.catalog-card img { width: 100%; height: 140px; object-fit: cover; border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; }
.catalog-title, .customer-card strong { display: block; font-size: 16px; font-weight: 900; }
.catalog-meta, .customer-card span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.catalog-price, .customer-value { color: var(--primary); font-size: 22px; font-weight: 900; margin-top: 8px; }
.delete { width: 100%; margin-top: 12px; border: 0; border-radius: 12px; padding: 10px; color: var(--red); background: #fef2f2; font-weight: 900; }
.map { height: 62vh; min-height: 440px; border-radius: 16px; border: 1px solid var(--line); overflow: hidden; }
.map-meta { margin-top: 10px; color: var(--muted); font-size: 13px; }
.mobile-nav { display: none; }

@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand-panel { padding: 32px 22px; min-height: 42vh; }
  .login-brand-panel h1 { font-size: 40px; margin: 30px 0 12px; }
  .login-form-panel { padding: 18px; align-items: start; }
  .admin-shell { grid-template-columns: 1fr; padding-bottom: 86px; }
  .sidebar { display: none; }
  .main { padding: 16px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 14px; border-radius: 18px; }
  .panel-head { align-items: flex-start; }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .form-grid input:nth-child(5) { grid-column: span 1; }
  .order-tile { grid-template-columns: 1fr; }
  .order-side { text-align: left; }
  .mobile-nav { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 50; display: flex; gap: 8px; overflow-x: auto; background: #0f172a; border-radius: 20px; padding: 8px; box-shadow: 0 18px 45px rgba(15,23,42,.28); }
  .mobile-nav .nav { color: rgba(255,255,255,.72); white-space: nowrap; text-align: center; min-width: 92px; }
  .mobile-nav .nav.active { background: white; color: var(--ink); }
}
.toast-host { position: fixed; right: 18px; top: 18px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 28px)); }
.toast { background: #0f172a; color: white; border-radius: 16px; padding: 14px 16px; box-shadow: 0 18px 50px rgba(15,23,42,.28); font-weight: 800; animation: toastIn .2s ease-out; }
.toast.success { background: #047857; }
.toast.error { background: #be123c; }
.toast.info { background: #075985; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-backdrop { position: fixed; inset: 0; z-index: 180; background: rgba(15,23,42,.48); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(6px); }
.modal-card { width: min(430px, 100%); background: white; border-radius: 24px; padding: 24px; box-shadow: 0 30px 90px rgba(15,23,42,.28); text-align: center; }
.modal-icon { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: #ecfeff; color: #155e75; font-weight: 900; }
.modal-card h3 { margin: 0; font-size: 22px; }
.modal-card p { color: var(--muted); line-height: 1.55; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.modal-secondary, .modal-primary { border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 900; }
.modal-secondary { background: #f1f5f9; color: var(--ink); }
.modal-primary { background: var(--primary); color: white; }
.order-actions button:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.4); }
@media (max-width: 820px) { .toast-host { left: 14px; right: 14px; top: auto; bottom: 96px; width: auto; } }
/* Mobile app polish */
@media (max-width: 820px) {
  body { background: #f7fafc; }
  .main { padding: 12px 12px 92px; }
  .topbar { margin-bottom: 12px; }
  .topbar h1 { font-size: 26px; line-height: 1.05; }
  .eyebrow { font-size: 10px; letter-spacing: .16em; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
  .kpi-grid article { border-radius: 14px; padding: 10px; min-height: 86px; box-shadow: 0 8px 18px rgba(15,23,42,.045); }
  .kpi-grid span { font-size: 9px; letter-spacing: .07em; }
  .kpi-grid strong { font-size: 22px; margin: 5px 0 0; }
  .kpi-grid small { display: none; }
  .panel { padding: 12px; border-radius: 18px; box-shadow: 0 10px 26px rgba(15,23,42,.06); }
  .panel-head { margin-bottom: 10px; }
  .panel-head h2 { font-size: 20px; }
  .panel-head p { font-size: 12px; line-height: 1.35; }
  .form-grid, .form-grid.compact { gap: 8px; padding: 9px; border-radius: 16px; margin-bottom: 10px; }
  input, select { border-radius: 12px; padding: 11px 12px; font-size: 14px; }
  .primary, .secondary { border-radius: 12px; padding: 11px 12px; font-size: 14px; }
  .card-grid, .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .catalog-card, .customer-card { border-radius: 14px; padding: 10px; }
  .catalog-card img { height: 82px; border-radius: 11px; margin-bottom: 8px; }
  .catalog-title, .customer-card strong { font-size: 13px; line-height: 1.2; }
  .catalog-meta, .customer-card span { font-size: 11px; line-height: 1.25; }
  .catalog-price, .customer-value { font-size: 18px; margin-top: 5px; }
  .badge { padding: 5px 7px; font-size: 8px; }
  .delete { border-radius: 10px; padding: 8px; font-size: 11px; margin-top: 8px; }
  .order-tile { border-radius: 14px; padding: 11px; gap: 8px; }
  .order-id { font-size: 13px; }
  .order-sub { font-size: 10px; gap: 5px 8px; }
  .order-items { font-size: 11px; margin-top: 6px; }
  .amount { font-size: 19px; }
  .order-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .order-actions button { font-size: 10px; padding: 8px 6px; border-radius: 9px; }
  .map { min-height: 62vh; height: 62vh; border-radius: 14px; }
  .mobile-nav { left: 12px; right: 12px; bottom: 12px; height: 58px; border-radius: 18px; padding: 6px; gap: 5px; overflow-x: auto; }
  .mobile-nav .nav { min-width: 74px; padding: 8px 9px; border-radius: 13px; font-size: 11px; display: flex; align-items: center; justify-content: center; }
  .toast-host { bottom: 80px; }
}
@media (max-width: 390px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid, .customer-grid { grid-template-columns: 1fr; }
  .mobile-nav .nav { min-width: 68px; font-size: 10px; }
}
.upload-guidance { background: #ecfeff; border: 1px solid #bae6fd; color: #155e75; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.banner-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.banner-actions button { border: 0; border-radius: 12px; padding: 10px; font-weight: 900; }
.banner-actions .edit { background: #ecfeff; color: #155e75; }
@media (max-width: 820px) { .upload-guidance { font-size: 11px; padding: 10px; border-radius: 12px; } }
/* Fixed 5-item mobile tab bar */
@media (max-width: 820px) {
  .admin-shell { padding-bottom: 76px; }
  .mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 80;
    height: 58px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: hidden;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px;
    padding: 6px;
    box-shadow: 0 20px 50px rgba(15,23,42,.28);
  }
  .mobile-nav .nav {
    min-width: 0;
    width: 100%;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    border-radius: 15px;
    color: rgba(255,255,255,.68);
    background: transparent;
    font-size: 10px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }
  .mobile-nav .nav span { overflow: hidden; text-overflow: ellipsis; }
  .mobile-nav .nav.active { background: white; color: var(--ink); }
}
@media (max-width: 360px) {
  .mobile-nav { left: 8px; right: 8px; gap: 2px; padding: 5px; }
  .mobile-nav .nav { font-size: 9px; }
}
/* Right-side mobile admin rail */
@media (max-width: 820px) {
  .admin-shell { padding-bottom: 0; }
  .main { padding: 12px 76px 18px 12px; }
  .mobile-nav {
    left: auto;
    right: 10px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 58px;
    height: auto;
    max-height: calc(100vh - 40px);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 54px);
    gap: 6px;
    overflow: visible;
    border-radius: 24px;
    padding: 7px;
  }
  .mobile-nav .nav {
    height: 54px;
    width: 100%;
    min-width: 0;
    border-radius: 18px;
    padding: 0 4px;
    font-size: 8px;
    white-space: normal;
    line-height: 1.05;
  }
  .toast-host { right: 76px; left: 12px; bottom: 18px; }
}
@media (max-width: 360px) {
  .main { padding-right: 68px; }
  .mobile-nav { right: 7px; width: 54px; padding: 6px; }
  .mobile-nav .nav { font-size: 7.5px; }
}
/* Mobile drawer menu */
.mobile-menu-toggle, .mobile-menu-backdrop { display: none; }
@media (max-width: 820px) {
  .main { padding: 12px 12px 18px 12px; }
  .mobile-menu-toggle {
    display: block;
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 90;
    width: 48px;
    height: 86px;
    border: 0;
    border-radius: 22px;
    background: #0f172a;
    color: white;
    font-size: 11px;
    font-weight: 900;
    writing-mode: vertical-rl;
    box-shadow: 0 18px 45px rgba(15,23,42,.28);
  }
  .mobile-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(15,23,42,.38);
    backdrop-filter: blur(4px);
  }
  .mobile-drawer {
    position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(82vw, 320px);
    height: 100vh;
    transform: translateX(105%);
    display: block;
    background: #0f172a;
    border-radius: 28px 0 0 28px;
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
    box-shadow: -24px 0 70px rgba(15,23,42,.35);
    transition: transform .22s ease;
    overflow-y: auto;
  }
  .mobile-drawer.open { transform: translateX(0); }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; color: white; padding: 8px 6px 18px; }
  .drawer-head button { width: 38px; height: 38px; border: 0; border-radius: 14px; background: rgba(255,255,255,.1); color: white; font-size: 24px; }
  .mobile-drawer .nav {
    width: 100%;
    min-width: 0;
    height: auto;
    display: block;
    text-align: left;
    padding: 15px 16px;
    margin-bottom: 8px;
    border-radius: 16px;
    color: rgba(255,255,255,.72);
    font-size: 15px;
    background: transparent;
  }
  .mobile-drawer .nav.active { background: white; color: var(--ink); }
  .toast-host { right: 12px; left: 12px; bottom: 18px; }
}

/* Final mobile menu: top-right hamburger -> open app-style drawer */
@media (min-width: 821px) {
  .mobile-menu-toggle,
  .mobile-menu-backdrop,
  .mobile-drawer { display: none !important; }
}

@media (max-width: 820px) {
  .admin-shell { padding-bottom: 0 !important; }
  .main { padding: 12px 12px 22px !important; }

  .mobile-menu-toggle {
    display: grid !important;
    place-items: center;
    gap: 4px;
    position: fixed;
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    top: auto !important;
    transform: none !important;
    z-index: 94;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, #0f172a, #155e75);
    color: white;
    box-shadow: 0 20px 45px rgba(15, 23, 42, .30);
    writing-mode: initial !important;
  }
  .mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 99px;
    background: white;
  }
  .mobile-menu-toggle[aria-expanded="true"] { opacity: 0; pointer-events: none; }

  .mobile-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(15, 23, 42, .44);
    backdrop-filter: blur(7px);
  }

  .mobile-drawer {
    display: block !important;
    position: fixed !important;
    top: auto !important;
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    left: 10px !important;
    z-index: 100 !important;
    width: auto !important;
    height: auto !important;
    max-height: min(76vh, 560px);
    padding: 14px !important;
    border-radius: 28px !important;
    background: #0b1220 !important;
    border: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 26px 70px rgba(15, 23, 42, .38);
    transform: translateY(calc(100% + 24px)) scale(.98) !important;
    opacity: 0;
    pointer-events: none;
    transition: transform .22s ease, opacity .18s ease;
    overflow-y: auto;
  }
  .mobile-drawer.open {
    transform: translateY(0) scale(1) !important;
    opacity: 1;
    pointer-events: auto;
  }
  .drawer-head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    color: white;
    padding: 4px 4px 14px !important;
  }
  .drawer-head strong { font-size: 17px; letter-spacing: -.02em; }
  .drawer-head button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 14px;
    background: rgba(255,255,255,.10);
    color: white;
    font-size: 24px;
  }
  .mobile-drawer .nav {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    padding: 15px 16px !important;
    margin: 0 0 8px !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,.06) !important;
    color: rgba(255,255,255,.78) !important;
    font-size: 15px !important;
    font-weight: 900;
    line-height: 1.1 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }
  .mobile-drawer .nav::after { content: '›'; opacity: .5; font-size: 22px; }
  .mobile-drawer .nav.active {
    background: linear-gradient(135deg, #e0f7ff, #ffffff) !important;
    color: #0f172a !important;
  }
  .toast-host { left: 12px !important; right: 12px !important; bottom: 84px !important; }
}


/* Top-right hamburger override */
@media (max-width: 820px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: 74px;
    margin: -12px -12px 12px;
    padding: 14px 76px 12px 12px;
    background: rgba(247, 250, 252, .92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, .72);
  }
  .mobile-menu-toggle {
    right: 14px !important;
    top: 14px !important;
    bottom: auto !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
    gap: 5px !important;
    background: #0f172a !important;
    box-shadow: 0 12px 26px rgba(15, 23, 42, .20) !important;
  }
  .mobile-menu-toggle span {
    width: 21px !important;
    height: 2px !important;
  }
  .mobile-menu-toggle[aria-expanded="true"] {
    opacity: 1 !important;
    pointer-events: auto !important;
    background: #172033 !important;
  }
  .mobile-drawer {
    top: 72px !important;
    right: 10px !important;
    bottom: auto !important;
    left: auto !important;
    width: min(86vw, 330px) !important;
    max-height: calc(100vh - 90px) !important;
    border-radius: 24px !important;
    transform: translateY(-10px) scale(.96) !important;
    transform-origin: top right;
  }
  .mobile-drawer.open {
    transform: translateY(0) scale(1) !important;
  }
  .mobile-menu-backdrop {
    top: 0 !important;
  }
  .toast-host { bottom: 18px !important; }
}


/* Reference-style fullscreen hamburger menu */
@media (max-width: 820px) {
  .mobile-menu-toggle {
    top: 16px !important;
    right: 16px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
    background: transparent !important;
    box-shadow: none !important;
    z-index: 94 !important;
  }
  .mobile-menu-toggle span {
    width: 24px !important;
    height: 2px !important;
    background: #0f172a !important;
  }
  .mobile-menu-toggle[aria-expanded="true"] { opacity: 0 !important; }
  .mobile-menu-backdrop {
    display: none !important;
  }
  .mobile-drawer {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: none !important;
    padding: max(34px, env(safe-area-inset-top)) 34px max(28px, env(safe-area-inset-bottom)) !important;
    border-radius: 0 !important;
    border: 0 !important;
    background: rgba(255, 255, 255, .96) !important;
    box-shadow: none !important;
    transform: translateY(-12px) !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease !important;
  }
  .mobile-drawer.open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .drawer-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    color: #0f172a !important;
    padding: 6px 0 40px !important;
  }
  .drawer-profile {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .drawer-avatar {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    letter-spacing: .02em;
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    box-shadow: 0 16px 34px rgba(8, 145, 178, .20);
  }
  .drawer-profile span {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 4px;
  }
  .drawer-profile strong {
    display: block;
    color: #0f172a;
    font-size: 16px;
    font-weight: 900;
  }
  .drawer-head > strong { display: none; }
  .drawer-head button {
    width: 42px !important;
    height: 42px !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #cbd5e1 !important;
    font-size: 34px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
  }
  .mobile-drawer .nav {
    display: block !important;
    width: max-content !important;
    min-width: 160px !important;
    margin: 0 0 24px 30px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #cbd5e1 !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    letter-spacing: -.01em;
    text-align: left !important;
    transition: color .15s ease, transform .15s ease;
  }
  .mobile-drawer .nav::after { content: none !important; }
  .mobile-drawer .nav.active,
  .mobile-drawer .nav:hover {
    color: #0f172a !important;
    background: transparent !important;
    transform: translateX(4px);
  }
  .mobile-drawer::after {
    content: '© 2026 Rida Enterprises';
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(22px, env(safe-area-inset-bottom));
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 900;
  }
}

/* Android-style mobile refinements: compact hamburger, right-slide menu, 3-up stats */
@media (max-width: 820px) {
  .topbar {
    min-height: 62px !important;
    padding: 12px 62px 10px 12px !important;
  }
  .topbar h1 {
    font-size: 22px !important;
    line-height: 1.08 !important;
  }
  .eyebrow {
    font-size: 9px !important;
    letter-spacing: .14em !important;
  }

  .mobile-menu-toggle {
    top: 10px !important;
    right: 12px !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 13px !important;
    gap: 0 !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .82) !important;
    border: 1px solid rgba(226, 232, 240, .9) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08) !important;
  }
  .mobile-menu-toggle span {
    width: 18px !important;
    height: 2px !important;
    margin: 2px 0 !important;
    border-radius: 999px !important;
    background: #0f172a !important;
  }

  .mobile-drawer {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(82vw, 320px) !important;
    height: 100vh !important;
    padding: max(30px, env(safe-area-inset-top)) 26px max(24px, env(safe-area-inset-bottom)) !important;
    transform: translateX(104%) !important;
    opacity: 1 !important;
    transition: transform .26s cubic-bezier(.22, 1, .36, 1) !important;
    box-shadow: -18px 0 55px rgba(15, 23, 42, .16) !important;
  }
  .mobile-drawer.open {
    transform: translateX(0) !important;
  }
  .mobile-menu-backdrop {
    display: block !important;
    background: rgba(15, 23, 42, .18) !important;
    backdrop-filter: blur(2px) !important;
  }
  .drawer-head {
    padding-bottom: 34px !important;
  }
  .drawer-avatar {
    width: 54px !important;
    height: 54px !important;
    font-size: 14px !important;
  }
  .drawer-profile span {
    font-size: 12px !important;
  }
  .drawer-profile strong {
    font-size: 14px !important;
  }
  .drawer-head button {
    width: 36px !important;
    height: 36px !important;
    font-size: 30px !important;
  }
  .mobile-drawer .nav {
    margin: 0 0 20px 20px !important;
    min-width: 130px !important;
    font-size: 15px !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  .kpi-grid article {
    min-height: 76px !important;
    padding: 9px 8px !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .045) !important;
  }
  .kpi-grid span {
    font-size: 8px !important;
    line-height: 1.15 !important;
    letter-spacing: .06em !important;
  }
  .kpi-grid strong {
    font-size: 21px !important;
    line-height: 1 !important;
    margin-top: 8px !important;
    letter-spacing: -.04em !important;
  }
  .kpi-grid small {
    display: none !important;
  }

  .panel {
    padding: 11px !important;
    border-radius: 16px !important;
  }
  .panel-head h2 {
    font-size: 19px !important;
  }
  .panel-head p {
    font-size: 11px !important;
  }
  .order-tile {
    padding: 10px !important;
    border-radius: 14px !important;
  }
  .order-id {
    font-size: 13px !important;
  }
  .order-sub,
  .order-items,
  .catalog-meta,
  .customer-card span {
    font-size: 10.5px !important;
  }
  .amount {
    font-size: 18px !important;
  }
  .order-actions button {
    font-size: 9.5px !important;
    padding: 8px 5px !important;
  }
}

@media (max-width: 360px) {
  .kpi-grid { gap: 6px !important; }
  .kpi-grid article { min-height: 70px !important; padding: 8px 7px !important; }
  .kpi-grid span { font-size: 7.5px !important; }
  .kpi-grid strong { font-size: 19px !important; }
}

@media (max-width: 820px) {
  .mobile-menu-backdrop.hidden { display: none !important; }
}

/* Premium mobile app shell: colorful light default, dark option, dashboard-only stats, icon tabbar */
body {
  background:
    radial-gradient(circle at 8% 0%, rgba(20, 184, 166, .18), transparent 30%),
    radial-gradient(circle at 94% 20%, rgba(14, 165, 233, .16), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #eefcf9 46%, #fff7ed 100%);
}
body.dark-theme {
  --bg: #07111f;
  --surface: #101b2e;
  --surface-2: #0b1627;
  --ink: #e5f3ff;
  --muted: #9fb2c9;
  --line: rgba(148, 163, 184, .22);
  --shadow: 0 18px 45px rgba(0, 0, 0, .24);
  background:
    radial-gradient(circle at 12% 0%, rgba(8, 145, 178, .30), transparent 32%),
    radial-gradient(circle at 90% 22%, rgba(20, 184, 166, .22), transparent 28%),
    linear-gradient(135deg, #050b14 0%, #071827 56%, #102116 100%);
}
body.dark-theme .panel,
body.dark-theme .kpi-grid article,
body.dark-theme .catalog-card,
body.dark-theme .customer-card,
body.dark-theme .order-tile,
body.dark-theme input,
body.dark-theme select {
  background: rgba(16, 27, 46, .86);
  color: var(--ink);
}
body.dark-theme .topbar { background: rgba(7, 17, 31, .82) !important; }
body.dark-theme .mobile-menu-toggle { background: rgba(16, 27, 46, .86) !important; border-color: rgba(148,163,184,.25) !important; }
body.dark-theme .mobile-menu-toggle span { background: #e5f3ff !important; }
body.dark-theme .mobile-drawer { background: rgba(7, 17, 31, .97) !important; }
body.dark-theme .drawer-profile strong,
body.dark-theme .mobile-drawer .nav.active,
body.dark-theme .mobile-drawer .nav:hover { color: #e5f3ff !important; }
body.dark-theme .mobile-bottom-nav { background: rgba(9, 18, 32, .92) !important; border-color: rgba(148,163,184,.24) !important; }
body.dark-theme .mobile-bottom-nav .nav.active { background: rgba(20, 184, 166, .18) !important; color: #67e8f9 !important; }

.theme-toggle {
  width: 100%;
  margin-top: 20px;
  border: 0;
  border-radius: 20px;
  padding: 15px 18px;
  background: linear-gradient(135deg, #fef3c7, #e0f2fe);
  color: #0f172a;
  font-weight: 900;
  text-align: center;
}
body.dark-theme .theme-toggle { background: linear-gradient(135deg, #155e75, #14532d); color: #ecfeff; }

@media (max-width: 820px) {
  body { background: linear-gradient(145deg, #f8fbff 0%, #effdf8 48%, #fff7ed 100%) !important; }
  body.dark-theme { background: linear-gradient(145deg, #050b14 0%, #071827 58%, #102116 100%) !important; }
  .main { padding: 12px 10px 88px !important; }
  .topbar {
    margin: -12px -10px 10px !important;
    background: linear-gradient(135deg, rgba(240, 253, 250, .94), rgba(255, 247, 237, .92)) !important;
  }
  body.dark-theme .topbar { background: linear-gradient(135deg, rgba(7,17,31,.92), rgba(15,36,43,.88)) !important; }

  .kpi-grid.hidden { display: none !important; }
  .screen:not(#ordersTab) {
    margin-top: 6px;
    background: rgba(255,255,255,.78) !important;
    backdrop-filter: blur(12px);
  }
  body.dark-theme .screen:not(#ordersTab) { background: rgba(16, 27, 46, .78) !important; }
  .screen:not(#ordersTab) .panel-head {
    padding: 2px 2px 12px;
    border-bottom: 1px solid rgba(226, 232, 240, .70);
  }
  body.dark-theme .screen:not(#ordersTab) .panel-head { border-bottom-color: rgba(148, 163, 184, .20); }
  .screen:not(#ordersTab) .panel-head h2 { font-size: 22px !important; letter-spacing: -.04em; }
  .screen:not(#ordersTab) .form-grid,
  .screen:not(#ordersTab) .form-grid.compact {
    background: linear-gradient(135deg, rgba(236, 254, 255, .78), rgba(255, 247, 237, .72)) !important;
    border: 1px solid rgba(186, 230, 253, .70) !important;
    border-radius: 20px !important;
  }
  body.dark-theme .screen:not(#ordersTab) .form-grid,
  body.dark-theme .screen:not(#ordersTab) .form-grid.compact {
    background: rgba(11, 22, 39, .82) !important;
    border-color: rgba(148, 163, 184, .18) !important;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 86;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 2px;
    padding: 6px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(226, 232, 240, .86);
    box-shadow: 0 20px 45px rgba(15, 23, 42, .16);
    backdrop-filter: blur(16px);
  }
  .mobile-bottom-nav .nav {
    height: 54px;
    border: 0;
    border-radius: 17px;
    background: transparent;
    color: #64748b;
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 4px 2px;
    font-weight: 900;
  }
  .mobile-bottom-nav .nav span { font-size: 18px; line-height: 1; }
  .mobile-bottom-nav .nav small { font-size: 9.5px; line-height: 1; }
  .mobile-bottom-nav .nav.active {
    background: linear-gradient(135deg, #ecfeff, #f0fdf4);
    color: #155e75;
  }

  .mobile-drawer .nav {
    color: #94a3b8 !important;
    font-size: 16px !important;
  }
  .mobile-drawer .nav.active,
  .mobile-drawer .nav:hover { color: #0f172a !important; }
  .mobile-drawer {
    background:
      radial-gradient(circle at 20% 4%, rgba(20,184,166,.12), transparent 28%),
      rgba(255,255,255,.97) !important;
  }
}
@media (min-width: 821px) {
  .mobile-bottom-nav { display: none !important; }
}

/* Compact add-product flow */
.compact-action {
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
}
.collapsible-form {
  overflow: hidden;
  animation: formSlideIn .22s ease-out;
}
@keyframes formSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  #productsTab .panel-head {
    display: grid !important;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start !important;
  }
  #productsTab .compact-action {
    padding: 9px 12px !important;
    min-height: 36px;
    border-radius: 14px !important;
    font-size: 12px !important;
    background: linear-gradient(135deg, #0891b2, #14b8a6) !important;
    color: white !important;
  }
  #productForm.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    padding: 9px !important;
    margin: 2px 0 10px !important;
    border-radius: 17px !important;
  }
  #productForm input,
  #productForm select {
    min-height: 38px !important;
    padding: 9px 10px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
  }
  #prodName,
  #prodImage,
  #createProduct {
    grid-column: 1 / -1;
  }
  #productForm .primary {
    min-height: 40px !important;
    padding: 10px !important;
    border-radius: 13px !important;
    font-size: 13px !important;
  }
}

/* Compact add-banner flow */
.banner-form-wrap.hidden { display: none !important; }
@media (max-width: 820px) {
  #bannersTab .panel-head {
    display: grid !important;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start !important;
  }
  #bannersTab .compact-action {
    padding: 9px 12px !important;
    min-height: 36px;
    border-radius: 14px !important;
    font-size: 12px !important;
    background: linear-gradient(135deg, #0891b2, #14b8a6) !important;
    color: white !important;
  }
  #bannerForm .upload-guidance {
    font-size: 10.5px !important;
    line-height: 1.35 !important;
    padding: 9px 10px !important;
    margin: 2px 0 8px !important;
  }
  #bannerForm .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    padding: 9px !important;
    margin: 0 0 10px !important;
    border-radius: 17px !important;
  }
  #bannerForm input,
  #bannerForm select {
    min-height: 38px !important;
    padding: 9px 10px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
  }
  #bannerTitle,
  #bannerSubtitle,
  #bannerImage,
  #bannerForm .primary,
  #cancelBannerEdit {
    grid-column: 1 / -1;
  }
}

/* Launch ops additions */
.slot-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.slot-editor select { padding: 9px 11px; border-radius: 11px; }
.slot-editor button,
.customer-quick-actions button,
.customer-order-row button {
  border: 0;
  border-radius: 11px;
  padding: 9px 11px;
  font-weight: 900;
  background: #ecfeff;
  color: #155e75;
}
.customer-card-rich { padding: 0; overflow: hidden; }
.customer-summary {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  text-align: left;
  color: var(--ink);
}
.customer-side { text-align: right; }
.customer-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}
.customer-orders {
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
  background: rgba(236, 254, 255, .42);
  border-top: 1px solid var(--line);
}
.customer-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}
.customer-order-row span { display: block; }
body.dark-theme .slot-editor,
body.dark-theme .customer-orders,
body.dark-theme .customer-order-row { background: rgba(16, 27, 46, .82); }

@media (max-width: 820px) {
  .slot-editor { grid-template-columns: 1fr; gap: 6px; padding: 7px; }
  .slot-editor select,
  .slot-editor button { min-height: 36px; font-size: 11px; }
  .customer-grid { grid-template-columns: 1fr !important; }
  .customer-summary { padding: 11px; }
  .customer-quick-actions { padding: 0 11px 11px; }
  .customer-order-row {
    grid-template-columns: 1fr 72px 64px;
    font-size: 11px;
  }
  .customer-order-row strong { grid-column: 2 / 4; text-align: right; }
  .customer-order-row button { font-size: 10px; padding: 8px 6px; }
}

/* Customer table + product stock switch */
.stock-switch { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 900; }
.stock-switch input { display: none; }
.stock-switch span { width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; transition: .18s ease; }
.stock-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: .18s ease; box-shadow: 0 2px 8px rgba(15,23,42,.20); }
.stock-switch input:checked + span { background: #10b981; }
.stock-switch input:checked + span::after { transform: translateX(18px); }
.out-of-stock-card { opacity: .56; filter: grayscale(.82); }
.out-of-stock-card img { opacity: .55; }
.customers-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.customers-table, .customer-orders-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.customers-table th, .customers-table td, .customer-orders-table th, .customer-orders-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: middle; }
.customers-table th, .customer-orders-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; background: rgba(236,254,255,.55); }
.customers-table td b, .customer-orders-table td b { display: block; font-size: 13px; color: var(--ink); }
.customers-table td span, .customer-orders-table td span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.customer-main-row { cursor: pointer; }
.customer-main-row:hover { background: #f8fafc; }
.customer-detail-row td { background: #f8fafc; padding: 12px !important; }
.customer-orders-table { min-width: 640px; background: white; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.icon-actions { display: flex; gap: 7px; align-items: center; }
.icon-actions button { width: 34px; height: 34px; border: 0; border-radius: 12px; display: grid; place-items: center; background: #ecfeff; color: #155e75; font-weight: 900; }
.customer-empty { padding: 14px; color: var(--muted); }
body.dark-theme .customers-table-wrap, body.dark-theme .customer-orders-table { background: rgba(16,27,46,.86); }
body.dark-theme .customers-table th, body.dark-theme .customer-orders-table th, body.dark-theme .customer-detail-row td { background: rgba(11,22,39,.75); }
body.dark-theme .customer-main-row:hover { background: rgba(30,41,59,.42); }
@media (max-width: 820px) {
  .customers-table-wrap { border-radius: 16px; }
  .customers-table, .customer-orders-table { min-width: 680px; }
  .customers-table th, .customers-table td, .customer-orders-table th, .customer-orders-table td { padding: 9px; font-size: 11px; }
  .icon-actions button { width: 30px; height: 30px; border-radius: 10px; }
}

/* Slot/store professional controls */
.store-control-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(135deg, #ecfeff, #fff7ed); margin-bottom: 14px; }
.store-control-card strong { display: block; font-size: 18px; }
.store-control-card span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.store-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.danger-soft { border: 0; border-radius: 14px; padding: 11px 14px; background: #fee2e2; color: #b91c1c; font-weight: 900; }
.slot-form { margin-bottom: 14px; }
.slots-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.slot-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.slot-row strong { display: block; }
.slot-row span { color: var(--muted); font-size: 12px; }
.disabled-slot { opacity: .55; filter: grayscale(.7); }
.actual-slot { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.slot-editor.hidden { display: none !important; }
#usersList { display: block !important; width: 100%; }
#usersTab.panel { overflow: hidden; }
.customers-table-wrap { max-width: 100%; }
@media (min-width: 821px) { .customers-table, .customer-orders-table { min-width: 100%; } }
@media (max-width: 820px) {
  .store-control-card { grid-template-columns: 1fr; padding: 12px; }
  .store-actions { justify-content: stretch; }
  .store-actions > * { flex: 1 1 140px; }
  .slots-list { grid-template-columns: 1fr; }
  .slot-row { grid-template-columns: 1fr; }
  .mobile-bottom-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Responsive typography polish: desktop roomy, mobile compact */
@media (min-width: 1180px) {
  .main { padding: 34px 38px; }
  .topbar { margin-bottom: 26px; }
  .eyebrow { font-size: 13px; letter-spacing: .16em; }
  .topbar h1 { font-size: 36px; line-height: 1.05; letter-spacing: -.045em; }
  .topbar-actions { font-size: 15px; padding: 10px 12px; }
  .panel { padding: 24px; border-radius: 24px; }
  .panel-head h2 { font-size: 28px; letter-spacing: -.04em; }
  .panel-head p { font-size: 15px; line-height: 1.5; }
  .customers-table th,
  .customer-orders-table th { font-size: 12px; letter-spacing: .09em; padding: 15px 16px; }
  .customers-table td,
  .customer-orders-table td { font-size: 15px; padding: 17px 16px; }
  .customers-table td b,
  .customer-orders-table td b { font-size: 15px; margin-bottom: 4px; }
  .customers-table td span,
  .customer-orders-table td span { font-size: 13px; }
  .icon-actions button { width: 40px; height: 40px; border-radius: 14px; font-size: 16px; }
  .kpi-grid article { min-height: 126px; padding: 22px; }
  .kpi-grid span { font-size: 12px; }
  .kpi-grid strong { font-size: 34px; }
  .order-id { font-size: 19px; }
  .order-sub { font-size: 14px; }
  .order-items { font-size: 15px; }
  .amount { font-size: 27px; }
  .catalog-title { font-size: 18px; }
  .catalog-meta { font-size: 14px; }
}

@media (min-width: 821px) and (max-width: 1179px) {
  .topbar h1 { font-size: 31px; }
  .panel-head h2 { font-size: 24px; }
  .panel-head p { font-size: 14px; }
  .customers-table td,
  .customer-orders-table td { font-size: 14px; padding: 14px; }
  .customers-table th,
  .customer-orders-table th { font-size: 11px; padding: 13px 14px; }
}

@media (max-width: 820px) {
  .topbar h1 { font-size: 22px !important; }
  .panel-head h2 { font-size: 20px !important; }
  .panel-head p { font-size: 11.5px !important; }
  .customers-table th,
  .customer-orders-table th { font-size: 10px !important; padding: 9px !important; }
  .customers-table td,
  .customer-orders-table td { font-size: 11.5px !important; padding: 9px !important; }
  .customers-table td b,
  .customer-orders-table td b { font-size: 12px !important; }
  .customers-table td span,
  .customer-orders-table td span { font-size: 10px !important; }
}

/* Desktop/mobile typography pass: desktop readable, mobile app-compact */
@media (min-width: 1180px) {
  body { font-size: 16px; }
  .main { padding: 36px 40px; }
  .topbar h1 { font-size: clamp(36px, 2.4vw, 44px) !important; line-height: 1.02; }
  .eyebrow { font-size: 13px !important; letter-spacing: .15em; }
  .topbar-actions { font-size: 15px; padding: 11px 14px; }
  .panel { padding: 26px; border-radius: 26px; }
  .panel-head h2 { font-size: 30px !important; line-height: 1.08; }
  .panel-head p { font-size: 16px !important; line-height: 1.55; }
  .customers-table-wrap { border-radius: 22px; }
  .customers-table th,
  .customer-orders-table th {
    font-size: 13px !important;
    padding: 17px 18px !important;
    letter-spacing: .085em;
  }
  .customers-table td,
  .customer-orders-table td {
    font-size: 16px !important;
    padding: 19px 18px !important;
    line-height: 1.35;
  }
  .customers-table td b,
  .customer-orders-table td b {
    font-size: 16px !important;
    line-height: 1.25;
  }
  .customers-table td span,
  .customer-orders-table td span {
    font-size: 13.5px !important;
    line-height: 1.35;
  }
  .icon-actions { gap: 10px; }
  .icon-actions button { width: 42px !important; height: 42px !important; font-size: 17px; border-radius: 15px; }
  .kpi-grid article { padding: 23px; min-height: 132px; }
  .kpi-grid span { font-size: 12.5px; }
  .kpi-grid strong { font-size: 36px; }
  .order-tile { padding: 18px; }
  .order-id { font-size: 20px !important; }
  .order-sub { font-size: 14.5px !important; }
  .order-items { font-size: 15.5px !important; }
  .order-actions button { font-size: 13.5px; padding: 11px 14px; }
}

@media (min-width: 821px) and (max-width: 1179px) {
  body { font-size: 15px; }
  .topbar h1 { font-size: 32px !important; }
  .panel-head h2 { font-size: 25px !important; }
  .panel-head p { font-size: 14.5px !important; }
  .customers-table th,
  .customer-orders-table th { font-size: 12px !important; padding: 14px 15px !important; }
  .customers-table td,
  .customer-orders-table td { font-size: 14.5px !important; padding: 15px !important; }
  .customers-table td b,
  .customer-orders-table td b { font-size: 14.5px !important; }
  .customers-table td span,
  .customer-orders-table td span { font-size: 12.5px !important; }
}

@media (max-width: 820px) {
  body { font-size: 13px !important; }
  .topbar h1 { font-size: 21px !important; }
  .panel-head h2 { font-size: 20px !important; }
  .panel-head p { font-size: 11.5px !important; }
  .customers-table,
  .customer-orders-table { min-width: 640px !important; }
  .customers-table th,
  .customer-orders-table th { font-size: 9.5px !important; padding: 8px !important; }
  .customers-table td,
  .customer-orders-table td { font-size: 11px !important; padding: 8px !important; }
  .customers-table td b,
  .customer-orders-table td b { font-size: 11.5px !important; }
  .customers-table td span,
  .customer-orders-table td span { font-size: 9.5px !important; }
  .icon-actions button { width: 29px !important; height: 29px !important; border-radius: 10px !important; font-size: 12px; }
}

/* Mobile customers: card layout, no horizontal table scrolling */
@media (max-width: 820px) {
  #usersTab .customers-table-wrap {
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
  }
  #usersTab .customers-table,
  #usersTab .customers-table tbody,
  #usersTab .customer-orders-table,
  #usersTab .customer-orders-table tbody {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 10px !important;
    border: 0 !important;
    background: transparent !important;
  }
  #usersTab .customers-table thead,
  #usersTab .customer-orders-table thead { display: none !important; }
  #usersTab .customer-main-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 9px 10px;
    padding: 12px !important;
    border: 1px solid rgba(186, 230, 253, .86) !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, .88) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .055);
  }
  body.dark-theme #usersTab .customer-main-row {
    background: rgba(16, 27, 46, .86) !important;
    border-color: rgba(148, 163, 184, .20) !important;
  }
  #usersTab .customers-table td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 !important;
    border: 0 !important;
    font-size: 12px !important;
    min-width: 0;
  }
  #usersTab .customers-table td:first-child {
    grid-column: 1 / -1;
    display: block !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(226, 232, 240, .86) !important;
  }
  body.dark-theme #usersTab .customers-table td:first-child { border-bottom-color: rgba(148, 163, 184, .20) !important; }
  #usersTab .customers-table td:first-child b { font-size: 14px !important; }
  #usersTab .customers-table td:first-child span { font-size: 10.5px !important; }
  #usersTab .customers-table td:nth-child(2)::before { content: 'Phone'; }
  #usersTab .customers-table td:nth-child(3)::before { content: 'Orders'; }
  #usersTab .customers-table td:nth-child(4)::before { content: 'Spent'; }
  #usersTab .customers-table td:nth-child(5)::before { content: 'Last'; }
  #usersTab .customers-table td:nth-child(2)::before,
  #usersTab .customers-table td:nth-child(3)::before,
  #usersTab .customers-table td:nth-child(4)::before,
  #usersTab .customers-table td:nth-child(5)::before {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 900;
  }
  #usersTab .customers-table td:nth-child(5) {
    grid-column: 1 / -1;
  }
  #usersTab .customers-table td.icon-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 4px !important;
  }
  #usersTab .customers-table td.icon-actions button {
    width: 100% !important;
    height: 36px !important;
    border-radius: 13px !important;
    font-size: 13px !important;
  }
  #usersTab .customer-detail-row:not(.hidden) {
    display: block !important;
    margin: -4px 0 2px;
  }
  #usersTab .customer-detail-row td {
    display: block !important;
    padding: 10px !important;
    border: 1px solid rgba(186, 230, 253, .70) !important;
    border-radius: 16px !important;
    background: rgba(236, 254, 255, .62) !important;
  }
  body.dark-theme #usersTab .customer-detail-row td {
    background: rgba(11, 22, 39, .78) !important;
    border-color: rgba(148, 163, 184, .18) !important;
  }
  #usersTab .customer-orders-table tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px !important;
    border: 1px solid rgba(226, 232, 240, .86) !important;
    border-radius: 14px !important;
    background: rgba(255,255,255,.82) !important;
  }
  body.dark-theme #usersTab .customer-orders-table tr { background: rgba(16, 27, 46, .74) !important; border-color: rgba(148, 163, 184, .18) !important; }
  #usersTab .customer-orders-table td {
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 11px !important;
  }
  #usersTab .customer-orders-table td:first-child { grid-column: 1 / -1; }
  #usersTab .customer-orders-table td.icon-actions {
    display: flex !important;
    justify-content: flex-end;
    gap: 7px;
  }
}

/* Mobile customer expanded orders: attached detail drawer */
@media (max-width: 820px) {
  #usersTab .customer-main-row:has(+ .customer-detail-row:not(.hidden)) {
    border-color: rgba(8, 145, 178, .52) !important;
    box-shadow: 0 14px 30px rgba(8, 145, 178, .12) !important;
    background: linear-gradient(135deg, rgba(236, 254, 255, .96), rgba(255, 255, 255, .92)) !important;
  }
  body.dark-theme #usersTab .customer-main-row:has(+ .customer-detail-row:not(.hidden)) {
    background: linear-gradient(135deg, rgba(8, 47, 73, .82), rgba(16, 27, 46, .92)) !important;
    border-color: rgba(103, 232, 249, .38) !important;
  }
  #usersTab .customer-detail-row:not(.hidden) {
    position: relative;
    margin: -8px 0 8px 10px !important;
    padding-left: 12px;
  }
  #usersTab .customer-detail-row:not(.hidden)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 10px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(#06b6d4, #14b8a6);
  }
  #usersTab .customer-detail-row > td::before {
    content: 'Orders for selected customer';
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #0f172a;
    color: white;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  body.dark-theme #usersTab .customer-detail-row > td::before {
    background: #67e8f9;
    color: #082f49;
  }
  #usersTab .customer-detail-row td {
    background:
      radial-gradient(circle at 6% 0%, rgba(6, 182, 212, .16), transparent 34%),
      linear-gradient(135deg, rgba(236, 254, 255, .92), rgba(240, 253, 244, .86)) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 12px 24px rgba(8, 145, 178, .08);
  }
  #usersTab .customer-orders-table tr {
    border-color: rgba(125, 211, 252, .55) !important;
    background: rgba(255,255,255,.92) !important;
  }
  #usersTab .customer-orders-table tr:nth-child(even) {
    background: rgba(240, 253, 250, .92) !important;
  }
  body.dark-theme #usersTab .customer-detail-row td {
    background:
      radial-gradient(circle at 6% 0%, rgba(34, 211, 238, .12), transparent 34%),
      linear-gradient(135deg, rgba(8, 47, 73, .72), rgba(11, 22, 39, .92)) !important;
  }
  body.dark-theme #usersTab .customer-orders-table tr,
  body.dark-theme #usersTab .customer-orders-table tr:nth-child(even) {
    background: rgba(16, 27, 46, .86) !important;
    border-color: rgba(103, 232, 249, .20) !important;
  }
}

/* Slot cards polish: sharper typography, compact switch, icon delete */
.slots-list {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.slot-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,250,252,.90));
  box-shadow: 0 10px 28px rgba(15, 23, 42, .045);
}
.slot-row strong {
  max-width: 130px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.22;
  letter-spacing: -.025em;
}
.slot-row span {
  margin-top: 7px;
  color: #55708f;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 700;
}
.slot-row .stock-switch {
  margin: 0;
  gap: 7px;
  font-size: 11.5px;
  color: #536783;
}
.slot-row .stock-switch span {
  width: 34px;
  height: 20px;
  margin: 0;
  background: #cbd5e1;
}
.slot-row .stock-switch span::after {
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
}
.slot-row .stock-switch input:checked + span::after { transform: translateX(14px); }
.slot-row .stock-switch b {
  font-size: 11.5px;
  line-height: 1;
}
.icon-delete {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0 !important;
  border-radius: 14px !important;
  font-size: 16px;
  background: #fff1f2 !important;
  color: #be123c !important;
}
.icon-delete:hover {
  background: #ffe4e6 !important;
  transform: translateY(-1px);
}
body.dark-theme .slot-row {
  background: linear-gradient(135deg, rgba(16, 27, 46, .92), rgba(11, 22, 39, .86));
}
body.dark-theme .slot-row span,
body.dark-theme .slot-row .stock-switch { color: #9fb2c9; }
body.dark-theme .icon-delete { background: rgba(127, 29, 29, .35) !important; color: #fecdd3 !important; }

@media (min-width: 1180px) {
  .slots-list { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
  .slot-row { padding: 18px; }
  .slot-row strong { font-size: 18px; }
  .slot-row span { font-size: 13px; }
}

@media (max-width: 820px) {
  .slots-list { grid-template-columns: 1fr !important; gap: 9px !important; }
  .slot-row {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    padding: 12px !important;
    gap: 9px !important;
    border-radius: 16px !important;
  }
  .slot-row strong { max-width: 120px; font-size: 14px !important; line-height: 1.2; }
  .slot-row span { font-size: 10.5px !important; margin-top: 5px; }
  .slot-row .stock-switch b { display: none; }
  .slot-row .stock-switch span { width: 32px; height: 18px; }
  .slot-row .stock-switch span::after { width: 12px; height: 12px; }
  .slot-row .stock-switch input:checked + span::after { transform: translateX(14px); }
  .icon-delete { width: 34px !important; height: 34px !important; border-radius: 12px !important; font-size: 14px; }
}

/* Friendly delivery-slot builder */
.slot-builder {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid rgba(186, 230, 253, .82);
  border-radius: 22px;
  background:
    radial-gradient(circle at 4% 0%, rgba(14, 165, 233, .10), transparent 30%),
    linear-gradient(135deg, rgba(236, 254, 255, .74), rgba(255, 247, 237, .66));
}
.slot-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.slot-builder-head strong {
  display: block;
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: -.035em;
}
.slot-builder-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.slot-tip {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(186, 230, 253, .72);
  color: #155e75 !important;
  font-size: 12px !important;
  font-weight: 900;
}
.slot-form-row {
  display: grid;
  grid-template-columns: minmax(150px, .72fr) minmax(260px, 1.35fr) minmax(160px, .75fr) 104px auto;
  gap: 10px;
  align-items: end;
}
.field-card {
  margin: 0;
  gap: 7px;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}
.field-card input,
.field-card select {
  min-height: 46px;
  border-radius: 15px;
  background: rgba(255,255,255,.92);
  font-weight: 750;
}
.add-slot-btn {
  min-height: 46px;
  padding-inline: 22px;
  border-radius: 15px;
  background: linear-gradient(135deg, #0891b2, #14b8a6);
  box-shadow: 0 12px 26px rgba(8, 145, 178, .16);
}
.slot-help {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}
body.dark-theme .slot-builder {
  background: linear-gradient(135deg, rgba(8, 47, 73, .68), rgba(11, 22, 39, .86));
  border-color: rgba(103, 232, 249, .20);
}
body.dark-theme .slot-tip,
body.dark-theme .field-card input,
body.dark-theme .field-card select {
  background: rgba(16, 27, 46, .88);
  border-color: rgba(148, 163, 184, .22);
}

@media (max-width: 820px) {
  .slot-builder {
    padding: 12px;
    border-radius: 18px;
    margin-bottom: 12px;
  }
  .slot-builder-head {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
  }
  .slot-builder-head strong { font-size: 16px; }
  .slot-builder-head span { font-size: 11px; margin-top: 3px; }
  .slot-tip {
    width: fit-content;
    padding: 6px 9px;
    font-size: 10px !important;
  }
  .slot-form-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .field-card { font-size: 10.5px; gap: 5px; }
  .field-card:nth-child(2),
  .add-slot-btn,
  .slot-help { grid-column: 1 / -1; }
  .field-card input,
  .field-card select {
    min-height: 40px;
    border-radius: 13px;
    font-size: 12px !important;
    padding: 9px 10px !important;
  }
  .add-slot-btn {
    min-height: 40px;
    border-radius: 13px;
    font-size: 13px !important;
  }
  .slot-help { font-size: 10.5px; line-height: 1.35; margin-top: 2px; }
}

/* Auto grouped delivery slots */
.auto-period-card {
  display: grid;
  align-content: end;
}
.auto-period-pill {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid rgba(186, 230, 253, .72);
  border-radius: 15px;
  background: rgba(255,255,255,.82);
  color: #155e75;
  font-size: 14px;
  font-weight: 900;
}
.auto-period-pill[data-period="afternoon"] {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}
.auto-period-pill[data-period="evening"] {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}
body.dark-theme .auto-period-pill {
  background: rgba(16, 27, 46, .88);
  border-color: rgba(148, 163, 184, .22);
}
@media (max-width: 820px) {
  .auto-period-pill {
    min-height: 40px;
    border-radius: 13px;
    font-size: 12px;
    padding: 0 10px;
  }
}

/* Slot group badges */
.slot-period-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  font-style: normal;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 900;
  background: #ecfeff;
  color: #155e75;
}
.slot-period-badge.afternoon {
  background: #fffbeb;
  color: #b45309;
}
.slot-period-badge.evening {
  background: #eff6ff;
  color: #1d4ed8;
}
body.dark-theme .slot-period-badge { background: rgba(34, 211, 238, .16); color: #67e8f9; }
body.dark-theme .slot-period-badge.afternoon { background: rgba(245, 158, 11, .18); color: #fcd34d; }
body.dark-theme .slot-period-badge.evening { background: rgba(59, 130, 246, .18); color: #93c5fd; }
@media (max-width: 820px) {
  .slot-period-badge { font-size: 8.5px; padding: 3px 5px; }
}
