/* Control center in the Gemini visual language: desktop dashboard, collapses to a single column on phones. */
body { background: var(--bg-app); color: var(--text-primary); font-family: 'Cairo', 'Inter', sans-serif; margin: 0; }
.av-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.av-side { background: var(--bg-surface); border-left: 1px solid var(--border-card); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.av-brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px 14px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 10px; }
.av-brand img { width: 30px; height: 30px; border-radius: 8px; }
.av-brand b { font-size: 14px; color: var(--accent-gold); }
.av-brand small { display: block; font-size: 10px; color: var(--text-muted); }
.av-x { display: none; }
.av-side-out { display: inline-flex; margin-inline-start: auto; width: 32px; height: 32px; flex: none; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(246,70,93,.45); background: transparent; color: var(--accent-red); cursor: pointer; }
body.av-staff .av-side-out { display: none; }
.av-group { font-size: 10px; color: var(--text-muted); margin: 12px 8px 5px; font-weight: 700; }
.av-nav { display: flex; align-items: center; justify-content: space-between; width: 100%; border: none; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: right; }
.av-nav:hover { background: var(--bg-card); color: var(--text-primary); }
.av-nav.on { background: var(--accent-gold-soft); color: var(--accent-gold); font-weight: 800; }
.av-nav .av-badge { font-size: 10px; background: var(--bg-elevated); color: var(--text-secondary); border-radius: 10px; padding: 0 7px; }
.av-nav .av-soon { font-size: 9.5px; color: var(--text-muted); }
.av-main { padding: 14px 18px 40px; min-width: 0; }
.av-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.av-top h1 { font-size: 17px; margin: 0; }
.av-top p { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; }
/* Inner tabs of a section (e.g. «النظام المحاسبي», M0 2026-11-26): full row under the title, scrolls sideways without a visible bar. */
.av-subtabs { flex: 0 0 100%; width: 100%; min-width: 0; contain: inline-size; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-top: 8px; }
.av-subtabs::-webkit-scrollbar { display: none; }
.av-subtabs .av-btn { white-space: nowrap; flex: 0 0 auto; }
.av-chip { font-size: 10.5px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border-card); background: var(--bg-surface); color: var(--text-secondary); }
.av-chip.gold { color: var(--accent-gold); border-color: rgba(252,213,53,0.4); background: var(--accent-gold-soft); }
.av-chip.green { color: var(--accent-green); border-color: rgba(14,203,129,0.35); background: var(--accent-green-soft); }
.av-chip.red { color: var(--accent-red); border-color: rgba(246,70,93,0.35); background: var(--accent-red-soft); }
.av-grid { display: grid; gap: 12px; }
.av-grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.av-grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.av-card { background: var(--bg-surface); border: 1px solid var(--border-card); border-radius: 12px; padding: 13px 14px; min-width: 0; }
.av-card h2 { font-size: 13.5px; margin: 0 0 3px; }
.av-card .av-sub { font-size: 10.5px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.6; }
.av-kpi .v { font-size: 20px; font-weight: 800; margin-top: 3px; }
.av-kpi .l { font-size: 10.5px; color: var(--text-muted); }
.av-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.av-table th { text-align: right; font-weight: 700; color: var(--text-muted); font-size: 10.5px; padding: 7px 6px; border-bottom: 1px solid var(--border-card); }
.av-table td { padding: 8px 6px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.av-btn { height: 30px; padding: 0 12px; border-radius: 7px; border: none; background: var(--accent-gold); color: #0B0E11; font: inherit; font-size: 11.5px; font-weight: 800; cursor: pointer; }
.av-btn.ghost { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-card); font-weight: 700; }
.av-btn.danger { background: transparent; color: var(--accent-red); border: 1px solid rgba(246,70,93,0.45); font-weight: 700; }
.av-btn[disabled] { opacity: .5; cursor: not-allowed; }
.av-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 9px; }
.av-form label { font-size: 10.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.av-form input, .av-form select, .av-form textarea { height: 34px; border-radius: 7px; border: 1px solid var(--border-card); background: var(--bg-app); color: var(--text-primary); padding: 0 9px; font: inherit; font-size: 12px; }
.av-form textarea { height: auto; padding: 8px; }
.av-switch { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-primary); }
.av-note { font-size: 10.5px; color: var(--text-muted); line-height: 1.6; }
.av-err { color: var(--accent-red); font-size: 11px; min-height: 14px; margin-top: 6px; }
.av-empty { text-align: center; padding: 18px; font-size: 11.5px; color: var(--text-muted); }
.av-bar { display: none; position: sticky; top: 0; z-index: 40; align-items: center; gap: 10px; height: 58px; padding: 0 14px; margin: -14px -18px 14px; background: var(--bg-surface); border-bottom: 1px solid var(--border-card); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.av-bar-logo { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.av-bar-t { flex: 1; min-width: 0; line-height: 1.25; }
.av-bar-t b { display: block; font-size: 15px; color: var(--accent-gold); }
.av-bar-t small { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-bar-out { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid rgba(246,70,93,.45); background: transparent; color: var(--accent-red); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.av-bar-out span { font-size: 15px; }
.av-burger { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border-card); background: var(--bg-card); color: var(--text-primary); font-size: 19px; cursor: pointer; flex: none; }
.av-card { overflow-x: auto; }
/* guest: only the login card */
body.av-guest .av-shell { display: block; }
body.av-guest .av-side, body.av-guest .av-top { display: none; }
/* staff: no sidebar, a slim bar on top */
body.av-staff .av-shell { display: block; }
body.av-staff .av-side { position: fixed; top: 0; bottom: 0; right: 0; width: 82vw; max-width: 320px; height: 100%; z-index: 90; transform: translateX(105%); transition: transform .22s ease; box-shadow: -10px 0 40px rgba(0,0,0,.5); }
body.av-staff.av-drawer .av-side { transform: none; }
body.av-staff.av-drawer::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; }
body.av-staff .av-x { display: inline-flex; margin-inline-start: auto; width: 30px; height: 30px; align-items: center; justify-content: center; border: none; border-radius: 8px; background: var(--bg-card); color: var(--text-primary); cursor: pointer; }
body.av-staff .av-group { display: none; }
body.av-owner .av-burger { display: none; }
body.av-staff .av-bar { display: flex; }
body.av-staff .av-main { max-width: 1200px; margin: 0 auto; }
@media (max-width: 860px) {
  .av-shell { display: block; }
  body.av-owner .av-bar { display: flex; }
  body.av-owner .av-burger { display: inline-flex; align-items: center; justify-content: center; }
  .av-bar { margin: -10px -10px 12px; height: 56px; padding: 0 10px; }
  .av-bar-out { padding: 0 11px; font-size: 12px; }
  .av-side { position: fixed; top: 0; bottom: 0; right: 0; width: 82vw; max-width: 320px; height: 100%; z-index: 90; transform: translateX(105%); transition: transform .22s ease; box-shadow: -10px 0 40px rgba(0,0,0,.5); }
  body.av-drawer .av-side { transform: none; }
  body.av-drawer::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; }
  .av-x { display: inline-flex; margin-inline-start: auto; width: 30px; height: 30px; align-items: center; justify-content: center; border: none; border-radius: 8px; background: var(--bg-card); color: var(--text-primary); cursor: pointer; }
  .av-nav { padding: 11px 12px; font-size: 13.5px; }
  .av-main { padding: 10px 10px 40px; }
  .av-top { gap: 6px; margin-bottom: 10px; }
  .av-top h1 { font-size: 16px; }
  .av-top p { font-size: 11px; }
  .av-grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .av-grid.k2, .av-grid.k3 { grid-template-columns: 1fr; }
  .av-card { padding: 11px 10px; border-radius: 11px; }
  .av-kpi .v { font-size: 18px; }
  .av-form { grid-template-columns: 1fr; }
  .av-form input, .av-form select, .av-form textarea { height: 42px; font-size: 14px; }
  .av-btn { height: 38px; }
  #avView [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* data tables → stacked cards */
  table.av-cards, table.av-cards tbody, table.av-cards tr, table.av-cards td { display: block; width: 100%; box-sizing: border-box; }
  table.av-cards thead { display: none; }
  table.av-cards tr { background: var(--bg-app); border: 1px solid var(--border-card); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  table.av-cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: none; padding: 7px 0; text-align: left; min-height: 30px; white-space: normal; }
  table.av-cards td + td { border-top: 1px solid var(--border-subtle); }
  table.av-cards td::before { content: attr(data-label); flex: none; max-width: 45%; color: var(--text-muted); font-size: 11.5px; text-align: right; }
  table.av-cards td[data-label=""]::before { display: none; }
  table.av-cards td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; }
  table.av-cards td:empty { display: none; }
  .av-card:has(> table.av-cards) { background: transparent; border: none; padding: 0; }
  #modalRoot .modal-backdrop { padding: 0 !important; align-items: flex-end !important; }
  #modalRoot .modal-sheet { width: 100vw !important; max-width: 100vw !important; max-height: 94vh !important; border-radius: 16px 16px 0 0 !important; padding: 14px 12px !important; box-sizing: border-box; }
  #modalRoot .modal-sheet [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}
/* login */
body.av-guest .av-main { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; box-sizing: border-box; }
body.av-guest #avView { width: 100%; max-width: 940px; }
body.av-guest .av-login { margin: 0 auto !important; max-width: 380px !important; padding: 26px 22px 22px; border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
body.av-guest .av-login h2 { font-size: 18px; }
body.av-guest .av-login .av-form label { font-size: 12px; text-align: right; }
body.av-guest .av-login .av-form input { height: 46px; font-size: 15px; border-radius: 10px; }
body.av-guest .av-login .av-btn { height: 46px !important; font-size: 14px; border-radius: 10px; margin-top: 4px; }

/* ===== Login v2 (owner 2026-11-18): split card on wide screens, branded hero on phones ===== */
body.av-guest .av-main { background: radial-gradient(1200px 600px at 85% -10%, rgba(240,185,11,.16), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(38,161,123,.12), transparent 60%), #0B0E11; }
.avl { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 540px; border-radius: 22px; overflow: hidden; border: 1px solid rgba(255,255,255,.07); box-shadow: 0 30px 80px rgba(0,0,0,.55); background: #161A1E; }
.avl-brand { position: relative; padding: 38px 36px; background: linear-gradient(155deg, #1E2329 0%, #15181C 60%), #1E2329; display: flex; flex-direction: column; justify-content: center; gap: 14px; overflow: hidden; }
.avl-brand::after { content: ''; position: absolute; width: 380px; height: 380px; left: -120px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(240,185,11,.22), transparent 65%); pointer-events: none; }
.avl-logo { display: flex; align-items: center; gap: 10px; } .avl-logo img { width: 46px; height: 46px; border-radius: 12px; }
.avl-logo b { display: block; font-size: 16px; } .avl-logo small { color: #F0B90B; font-size: 12px; font-weight: 700; }
.avl-brand h1 { margin: 18px 0 0; font-size: 30px; line-height: 1.35; font-weight: 900; }
.avl-brand p { margin: 0; color: #B7BDC6; font-size: 14px; line-height: 1.8; }
.avl-brand ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; font-size: 13px; color: #EAECEF; }
.avl-brand li i { display: inline-flex; width: 22px; height: 22px; margin-left: 8px; border-radius: 50%; align-items: center; justify-content: center; background: rgba(240,185,11,.15); color: #F0B90B; font-style: normal; font-size: 12px; font-weight: 900; }
.avl-form { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.avl-form h2 { margin: 0; font-size: 24px; font-weight: 900; } .avl-form .av-sub { margin: 6px 0 22px; }
.avl-form form { display: grid; gap: 14px; }
.avl-form label { display: grid; gap: 7px; font-size: 12.5px; color: #B7BDC6; font-weight: 700; }
.avl-form input { height: 50px; width: 100%; box-sizing: border-box; border-radius: 12px; border: 1px solid #2B3139; background: #0B0E11; color: #EAECEF; font-size: 15px; padding: 0 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.avl-form input:focus { border-color: #F0B90B; box-shadow: 0 0 0 3px rgba(240,185,11,.15); }
.avl-pw { position: relative; display: block; } .avl-pw input { padding-left: 46px; }
.avl-pw button { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: none; background: transparent; color: #B7BDC6; font-size: 16px; cursor: pointer; }
.avl-btn { height: 50px; border: none; border-radius: 12px; background: #F0B90B; color: #0B0E11; font-size: 15px; font-weight: 900; cursor: pointer; margin-top: 6px; }
.avl-btn:hover { filter: brightness(1.06); } .avl-btn:disabled { opacity: .6; }
.avl-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: #848E9C; }
.avl-mlogo { display: none; }
@media (max-width: 760px) {
  body.av-guest .av-main { padding: 0 !important; align-items: stretch; }
  body.av-guest #avView { max-width: none; }
  .avl { grid-template-columns: 1fr; min-height: 100dvh; border-radius: 0; border: 0; box-shadow: none; background: transparent; }
  .avl-brand { padding: 34px 22px 26px; background: linear-gradient(180deg, rgba(240,185,11,.10), transparent); text-align: center; align-items: center; gap: 8px; }
  .avl-brand h1 { font-size: 23px; margin-top: 8px; } .avl-brand p { font-size: 13px; max-width: 340px; }
  .avl-brand ul { display: none; }
  .avl-form { padding: 8px 20px 28px; justify-content: flex-start; }
  .avl-form h2 { font-size: 20px; }
}
/* Toast restored 2026-11-23: the rule was lost on 2026-11-18, so every success/error message rendered hidden at the page bottom. Above modals (90) and the confirm dialog (300). */
.av-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--accent-gold); padding: 11px 18px; border-radius: 10px; font-size: 13px; font-weight: 700; line-height: 1.7; text-align: center; z-index: 400; box-shadow: 0 10px 30px rgba(0,0,0,.45); }

/* Owner 2026-11-24: the logo keeps its own black disc (same as the customer header) so it never sits on a lighter square;
   logout is a compact power button; on phones it is icon-only. */
.av-bar-logo, .av-brand img { border-radius: 9px; object-fit: cover; }
.av-bar-out { gap: 5px; padding: 0 12px; }
.av-bar-out b { font-weight: 700; }
@media (max-width: 600px) {
  .av-bar-out { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 50%; }
  .av-bar-out svg { width: 15px; height: 15px; }
  #avBell.in-bar { width: 32px !important; height: 32px !important; font-size: 14px !important; }
  .av-bar-logo { width: 32px; height: 32px; }
  .av-bar-out b { display: none; }
}

@media (max-width: 860px) { .av-side-out { display: none; } }
