/* ============================================================
   MÎZÂN — Styles (variables dynamiques injectées en JS)
   ============================================================ */
:root {
  --primary: #0db694;
  --secondary: #06285d;
  --accent: #d4a017;
  --danger: #e54848;
  --radius: 12px;
  --btn-radius: 12px;
  --font-base: 16px;
  --card-shadow: 0 1px 6px rgba(0,0,0,.06);
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #102038;
  --text-muted: #64748b;
  --border: #e1e8ed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-base);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

/* ── AUTH SCREEN ── */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(160deg, var(--secondary), var(--primary));
}
.auth-brand { color: white; text-align: center; margin-bottom: 24px; }
.auth-logo { font-size: 48px; margin-bottom: 6px; }
.auth-logo-img { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.auth-title { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.auth-tag { font-size: 13px; opacity: .75; margin-top: 4px; }
.auth-card { background: var(--card); border-radius: 18px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 16px 48px rgba(0,0,0,.25); }

@media (min-width: 768px) {
  .auth-card { max-width: 460px; padding: 32px; }
  .auth-logo { font-size: 60px; }
  .auth-logo-img { width: 88px; height: 88px; }
  .auth-title { font-size: 34px; }
}
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 9px; border: none; border-radius: 8px; background: transparent; color: var(--text-muted); font-weight: 700; font-size: 13px; }
.auth-tab.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-err { font-size: 13px; color: var(--danger); background: #ffebee; border-radius: 8px; padding: 9px 13px; }
.auth-note { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.auth-foot { color: rgba(255,255,255,.35); font-size: 11px; margin-top: 20px; }

/* ── LIGHT AUTH (PharmaPulse-style) ── */
.light-auth { background: var(--bg) !important; }
.light-brand { color: var(--text) !important; }
.light-title { color: var(--text) !important; }
.light-auth .auth-card { box-shadow: 0 1px 6px rgba(0,0,0,.08); border: 1px solid var(--border); }
.field-label { font-size: 12px; font-weight: 700; color: var(--text); display: block; margin-bottom: 4px; margin-top: 8px; }
.auth-msg { font-size: 13px; color: var(--primary); background: #e8f5e9; border-radius: 8px; padding: 9px 13px; }
.auth-secure { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.auth-back { color: rgba(0,0,0,.4); font-size: 12px; margin-top: 16px; text-decoration: none; }
.light-auth .auth-back { color: var(--text-muted); }

.demo-banner { background: #effaf3; border: 1px solid #b7e4c7; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.demo-banner-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.demo-banner-icon { font-size: 24px; }
.demo-tag { background: var(--primary); color: white; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.demo-banner-actions { display: flex; }

.field {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px; width: 100%;
  outline: none; background: var(--card); color: var(--text);
}
.field:focus { border-color: var(--primary); }
.field-sm { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 12px; outline: none; background: var(--card); color: var(--text); width: 100%; }

.btn-primary {
  background: var(--primary); color: white; border: none; border-radius: var(--btn-radius);
  padding: 12px 16px; font-weight: 700; width: 100%;
}
.btn-primary.danger { background: var(--danger); }
.btn-primary.gold { background: var(--accent); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); border-radius: var(--btn-radius); padding: 10px; font-weight: 700; width: 100%; }
.btn-ghost-sm { background: rgba(255,255,255,.15); border: none; color: white; border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 600; }
.btn-primary-sm { background: var(--primary); color: white; border: none; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 700; flex: 1; }
.btn-secondary-sm { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600; }
.btn-danger-sm { background: #ffebee; color: var(--danger); border: none; border-radius: 8px; padding: 6px 12px; font-size: 11px; font-weight: 600; width: 100%; margin-top: 8px; }

/* ── SHELL ── */
.shell { max-width: 480px; margin: 0 auto; padding-bottom: 100px; min-height: 100vh; }
.sidebar-brand, .sidebar-logout, .page-title { display: none; }


.topbar { background: linear-gradient(135deg, var(--secondary), var(--primary)); padding: 16px 14px 12px; color: white; }
.topbar-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.brand-mini { font-size: 9px; opacity: .6; letter-spacing: 2px; text-transform: uppercase; }
.hello { font-size: 16px; font-weight: 800; margin-top: 2px; }

.balance-box { background: rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; }
.balance-label { font-size: 9px; opacity: .7; letter-spacing: 1px; margin-bottom: 4px; }
.balance-amount { font-size: 26px; font-weight: 800; }
.balance-sub { font-size: 10px; opacity: .75; margin-top: 4px; }
.pos-balance .balance-amount { color: #b7e4c7; }
.neg-balance .balance-amount { color: #ffcdd2; }
.neg { color: var(--danger) !important; }
.pos { color: var(--primary) !important; }

.help-text { font-size: 12px; color: var(--text-muted); background: var(--bg); border-radius: 8px; padding: 9px 12px; margin: 6px 0; line-height: 1.5; }
.light-help { background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); }
.help-card { font-size: 13px; color: var(--text-muted); text-align: center; padding: 18px; line-height: 1.6; }

.balance-sheet { padding: 18px; }
.balance-sheet-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; margin-bottom: 6px; }
.balance-sheet-amount { font-size: 32px; font-weight: 800; margin-bottom: 6px; }
.balance-sheet-sub { font-size: 12px; opacity: .8; margin-bottom: 14px; }
.card.balance-pos { background: linear-gradient(135deg, var(--secondary), var(--primary)); color: white; }
.balance-pos .balance-sheet-label { color: #b7e4c7; }
.balance-pos .balance-sheet-amount { color: white; }
.card.balance-neg { background: linear-gradient(135deg, #4a1313, var(--danger)); color: white; }
.balance-neg .balance-sheet-label { color: #ffcdd2; }
.balance-neg .balance-sheet-amount { color: white; }
.balance-sheet .ana-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.balance-sheet .ana-cell { background: rgba(255,255,255,.16); border-radius: 9px; padding: 10px; user-select: none; }
.balance-sheet .ana-cell span { font-size: 10px; opacity: .85; display: block; margin-bottom: 2px; font-weight: 600; }
.balance-sheet .ana-cell b { font-size: 16px; font-weight: 800; }
.balance-sheet .ana-cell small { display: block; font-size: 10px; opacity: .85; margin-top: 2px; font-weight: 600; }
.neg-light { color: #ffcdd2 !important; }

.pills-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.pill { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 7px 11px; flex-shrink: 0; min-width: 128px; }
.pill-name { font-size: 9px; opacity: .7; }
.pill-dispo { font-size: 14px; font-weight: 800; }
.pill-sub { font-size: 8px; opacity: .55; }
.pill-bar { display: flex; height: 3px; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.pill-bar i { display: block; }

.tabbar { display: flex; background: var(--card); border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 10; }
.tabbtn { flex: 1; padding: 10px 2px; border: none; background: none; font-size: 10.5px; font-weight: 700; color: #98a3ad; border-bottom: 2.5px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; border-right: 1px solid var(--border); }
.tabbtn:last-child { border-right: none; }
.tabbtn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabbtn span { font-size: 17px; }

.content { padding: 14px; }

/* ── CARDS ── */
.card { background: var(--card); border-radius: var(--radius); padding: 15px; margin-bottom: 11px; box-shadow: var(--card-shadow); }
.card-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.empty-inline { text-align: center; padding: 18px; color: var(--text-muted); font-size: 13px; }

.empty-state { text-align: center; padding: 56px 20px; }
.empty-icon { font-size: 50px; margin-bottom: 12px; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.empty-text { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; line-height: 1.6; }

.section-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 14px 0 8px; }

.line-card { border-left: 4px solid var(--lc, var(--primary)); }
.line-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 9px; }
.line-title { font-size: 15px; font-weight: 700; color: var(--lc); }
.line-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.line-dispo { text-align: right; }
.line-dispo b { font-size: 18px; font-weight: 800; color: var(--primary); }
.line-dispo small { display: block; font-size: 10px; color: var(--text-muted); }

.tri-bar { display: flex; height: 9px; border-radius: 99px; overflow: hidden; margin-bottom: 5px; }
.tri-bar i { display: block; min-width: 2px; }
.tri-legend { display: flex; gap: 10px; font-size: 10px; margin-bottom: 8px; }
.c-dep { color: var(--danger); }
.c-ep { color: var(--accent); }
.c-ok { color: var(--primary); }

.dot-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--lc); }
.dot-tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--lc); display: inline-block; }
.dot-tag.sm { font-size: 10px; }

.top-tag { background: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 12px; }

.cat-line { display: flex; justify-content: space-between; padding: 4px 0; border-top: 0.5px solid var(--border); font-size: 13px; }

.alert-card { border-left: 4px solid #e65100; background: #fff8f0; }
.alert-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 11px; font-weight: 700; color: #e65100; text-transform: uppercase; letter-spacing: 1px; }
.alert-head b { background: #e65100; color: white; border-radius: 20px; padding: 2px 9px; font-size: 11px; }
.alert-main { font-size: 15px; font-weight: 800; }
.alert-tip { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }

.row-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 0.5px solid var(--border); }
.row-icon { font-size: 20px; }
.row-mid { flex: 1; }
.row-title { font-size: 14px; font-weight: 600; }
.row-amount { font-size: 15px; font-weight: 700; }

.filter-card { padding: 12px; }
.filter-pills { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 8px; }
.chip { padding: 5px 11px; border: 1.5px solid var(--border); border-radius: 20px; background: var(--card); color: var(--text-muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.chip.on { background: var(--primary); color: white; border-color: var(--primary); }
.filter-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.filter-dates label { font-size: 10px; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 3px; }
.filter-selects { display: flex; gap: 6px; }

.two-btn-row { display: flex; gap: 8px; margin-bottom: 11px; }
.two-btn-row .btn-primary, .two-btn-row .btn-outline { width: auto; flex: 1; }
.two-btn-row .btn-primary { flex: 2; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip { display: flex; align-items: center; gap: 5px; background: var(--bg); border-radius: 20px; padding: 5px 10px; font-size: 12px; font-weight: 600; }
.cat-chip button { background: none; border: none; color: #ccc; font-size: 12px; }

.tx-card { padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.tx-icon { font-size: 22px; width: 38px; text-align: center; background: var(--bg); border-radius: 8px; padding: 5px 0; }
.tx-mid { flex: 1; }
.tx-date { font-size: 10px; color: var(--text-muted); margin-left: 6px; }
.tx-note { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tx-right { text-align: right; }
.tx-right button { background: none; border: none; color: #ccc; font-size: 12px; margin-top: 3px; }

.info-card { background: #fffbe7; border: 1px solid #ffe082; color: #7a5c00; font-size: 12px; line-height: 1.6; }
.ep-card { border-left: 4px solid var(--accent); }
.ep-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.ep-title { font-size: 14px; font-weight: 700; color: var(--accent); }
.ep-right { text-align: right; }
.ep-right b { font-size: 17px; font-weight: 800; color: var(--accent); display: block; }
.ep-pct { background: #fffbe7; color: var(--accent); border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 700; display: inline-block; margin-top: 2px; }
.ep-pct.done { background: #e8f5e9; color: var(--primary); }
.ep-reste { font-size: 11px; color: var(--text-muted); margin: 6px 0 10px; }
.vers-row { display: flex; justify-content: space-between; padding: 5px 0; border-top: 0.5px solid var(--border); font-size: 12px; }
.vers-row .pos { color: var(--primary); font-weight: 700; }
.vers-note { color: var(--text-muted); }
.vers-date { color: var(--text-muted); font-size: 11px; }

.bar-track { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.bar-track.sm { height: 6px; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .4s; background: var(--primary); }
.bar-fill.gold { background: var(--accent); }
.bar-fill.orange { background: #e65100; }
.bar-fill.primary { background: var(--primary); }

.hero-card { background: linear-gradient(135deg, var(--secondary), var(--primary)); color: white; }
.ana-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.ana-cell { background: rgba(255,255,255,.12); border-radius: 9px; padding: 10px; }
.ana-cell span { font-size: 10px; opacity: .7; display: block; margin-bottom: 2px; }
.ana-cell b { font-size: 15px; font-weight: 800; }
.ana-cell small { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }

.cat-block { margin-bottom: 13px; }
.cat-block-head { display: flex; justify-content: space-between; margin-bottom: 4px; align-items: center; font-size: 13px; font-weight: 700; }
.cat-block-head small { display: block; font-size: 10px; color: var(--text-muted); font-weight: 400; }
.top-badge { font-size: 9px; background: #e65100; color: white; border-radius: 3px; padding: 1px 5px; font-weight: 700; margin-right: 4px; }
.cat-sub { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; padding-left: 6px; color: var(--text-muted); }

.sadaqa-card { border-left: 4px solid var(--accent); }
.sadaqa-amount { font-size: 22px; font-weight: 800; color: var(--accent); }
.sadaqa-quote { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

.fab {
  position: fixed; bottom: 22px; right: calc(50% - 240px + 18px); width: 54px; height: 54px;
  background: var(--primary); color: white; border: none; border-radius: 50%; font-size: 26px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 18px rgba(0,0,0,.3); z-index: 50;
}
@media (max-width: 480px) { .fab { right: 18px; } }
@media (min-width: 481px) and (max-width: 767px) { .fab { right: calc(50% - 240px + 18px); } }

/* ── MODALS ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); border-radius: 18px 18px 0 0; padding: 20px; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 800; color: var(--primary); margin-bottom: 14px; }
.modal-title.danger { color: var(--danger); }
.modal-title.gold { color: var(--accent); }
.form-col { display: flex; flex-direction: column; gap: 9px; }
.form-col label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.ligne-picker { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.ligne-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--card); text-align: left; }
.ligne-opt.sel { border-color: var(--lc); background: rgba(0,0,0,.02); }
.lop-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lc); flex-shrink: 0; }
.lop-mid { flex: 1; }
.lop-mid b { font-size: 13px; color: var(--lc); display: block; }
.lop-mid small { font-size: 11px; color: var(--text-muted); }
.lop-mid .pos { color: var(--primary); }
.lop-check { display: none; }
.ligne-opt.sel .lop-check { display: block; }

.emoji-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.emoji-preview { font-size: 28px; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 10px; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 5px; background: var(--bg); border-radius: 10px; padding: 8px; max-height: 130px; overflow-y: auto; }
.emoji-btn { font-size: 20px; background: none; border: none; padding: 3px; border-radius: 5px; }
.emoji-btn:hover { background: var(--border); }

/* ── ADMIN ── */
.admin-shell { background: #14141f; min-height: 100vh; }

@media (min-width: 900px) {
  .admin-shell.shell { box-shadow: 0 20px 60px rgba(0,0,0,.35); }
  .admin-shell .content { grid-template-columns: repeat(2, 1fr); }
  .admin-shell .content > .warn-card { grid-column: 1 / -1; }
  .theme-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1300px) {
  .admin-shell .content { grid-template-columns: repeat(3, 1fr); }
}
.admin-top { background: linear-gradient(135deg,#1a1a2e,#16213e); }
.admin-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.astat { background: rgba(255,255,255,.08); border-radius: 9px; padding: 9px; }
.astat span { font-size: 10px; opacity: .6; display: block; }
.astat b { font-size: 18px; font-weight: 800; color: white; }
.astat b.pos { color: #52b788; }
.astat b.gold-text { color: #ffe082; }
.admin-tabbar { background: #16213e; border-bottom: 1px solid rgba(255,255,255,.06); }
.admin-tabbar .tabbtn { color: rgba(255,255,255,.4); }
.admin-tabbar .tabbtn.active { color: white; border-bottom-color: #52b788; }
.admin-shell .content .card { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: white; box-shadow: none; }
.admin-shell .card-label { color: rgba(255,255,255,.5); }
.admin-shell .field, .admin-shell .field-sm { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); color: white; }
.admin-shell .form-col label { color: rgba(255,255,255,.5); }

.warn-card { background: rgba(201,168,76,.15); border: 1px solid rgba(201,168,76,.4); color: #ffe082; font-size: 13px; font-weight: 600; }
.admin-user-card .auc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 9px; }
.auc-email { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 2px; }
.auc-meta { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 1px; }
.status-badge { border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; }
.status-active { background: rgba(82,183,136,.2); color: #52b788; border: 1px solid #52b788; }
.status-pending { background: rgba(201,168,76,.2); color: #ffe082; border: 1px solid #ffe082; }
.status-suspended, .status-rejected { background: rgba(198,40,40,.2); color: #ff8a80; border: 1px solid #ff8a80; }
.auc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.theme-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 12px; }
.tform-group { display: flex; flex-direction: column; gap: 5px; }
.tform-group label { font-size: 11px; color: rgba(255,255,255,.6); }
.tform-group input[type=color] { width: 100%; height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,.15); background: none; cursor: pointer; }
.theme-note { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 8px; text-align: center; }

.text-group { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; margin-top: 14px; }
.text-group:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.text-group-label { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.admin-shell textarea.field { resize: vertical; font-family: inherit; min-height: 44px; }

input[type=range] { accent-color: var(--primary); }

@media (min-width: 481px) {
  .shell, .auth-card { box-shadow: 0 0 40px rgba(0,0,0,.06); }
}

/* ════════════════════════════════════════════════════════════
   DESKTOP LAYOUT (≥900px) — sidebar navigation + grid content
   ════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {
  body { background: var(--bg); }

  .shell {
    max-width: 1200px; margin: 0 auto; padding-bottom: 0; min-height: 100vh;
    display: grid; grid-template-columns: 272px 1fr; grid-template-rows: auto 1fr;
    grid-template-areas: "side top" "side main";
  }

  /* ── Sidebar ── */
  .tabbar {
    grid-area: side; display: flex; flex-direction: column; align-items: stretch;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--primary) 160%);
    border-bottom: none; padding: 26px 16px 20px; gap: 4px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .sidebar-brand {
    display: flex !important; align-items: center; gap: 12px; padding: 6px 12px 28px;
    font-size: 19px; font-weight: 800; color: white;
  }
  .sidebar-brand img { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
  .tabbtn {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; align-items: center;
    gap: 13px; padding: 13px 16px; border-radius: 11px; border-bottom: none;
    color: rgba(255,255,255,.6); font-size: 14px; font-weight: 600;
  }
  .tabbtn span { font-size: 19px; width: 22px; text-align: center; flex-shrink: 0; }
  .tabbtn.active { background: rgba(255,255,255,.2); color: white; }
  .tabbtn:hover { background: rgba(255,255,255,.1); color: white; }
  .sidebar-logout {
    display: flex !important; align-items: center; gap: 12px; margin-top: auto;
    padding: 13px 16px; color: rgba(255,255,255,.55); font-size: 14px; font-weight: 600;
    cursor: pointer; border-radius: 11px;
  }
  .sidebar-logout span { font-size: 17px; width: 22px; text-align: center; }
  .sidebar-logout:hover { background: rgba(255,255,255,.1); color: white; }

  /* ── Top header ── */
  .topbar {
    grid-area: top; background: var(--card); color: var(--text);
    border-bottom: 1px solid var(--border); padding: 0 36px;
    display: flex; align-items: center; gap: 24px; flex-wrap: nowrap;
    height: 84px; box-shadow: 0 1px 0 rgba(0,0,0,.02);
  }
  .page-title {
    display: block !important; font-size: 23px; font-weight: 800; color: var(--text);
    flex: 1; min-width: 0;
  }
  .topbar-row { margin-bottom: 0; flex: 0 0 auto; display: flex; }
  .topbar-row > div:first-child { display: none; }
  .topbar-row .btn-ghost-sm {
    background: var(--bg); color: var(--text-muted); border: 1px solid var(--border);
    font-size: 13px; padding: 9px 18px; font-weight: 700;
  }
  .topbar-row .btn-ghost-sm:hover { background: #fde8e8; color: var(--danger); border-color: #f5b8b8; }
  .balance-box {
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 18px; margin-bottom: 0; display: flex; align-items: center; gap: 10px;
    flex: 0 0 auto;
  }
  .balance-label { font-size: 10px; color: var(--text-muted); letter-spacing: .5px; font-weight: 700; }
  .balance-amount { font-size: 20px; font-weight: 800; color: var(--text) !important; }
  .pos-balance.balance-box .balance-amount { color: var(--primary) !important; }
  .neg-balance.balance-box .balance-amount { color: var(--danger) !important; }
  .balance-sub { display: none; }
  .pills-row { display: none !important; }

  /* ── Main content grid ── */
  .content {
    grid-area: main; padding: 30px 36px; display: grid;
    grid-template-columns: repeat(2, 1fr); gap: 20px; align-content: start;
    max-width: 1040px;
  }
  .content > .card:first-child,
  .content > .empty-state,
  .content > .filter-card,
  .content > .alert-card,
  .content > .balance-sheet,
  .content > .hero-card,
  .content > .info-card,
  .content > .help-card { grid-column: 1 / -1; }

  .card { padding: 20px; }
  .card-label { font-size: 12px; }
  .help-card { font-size: 14px; }

  .fab { right: 40px; bottom: 32px; width: 58px; height: 58px; font-size: 28px; }
}

@media (min-width: 1300px) {
  .shell { max-width: 1360px; grid-template-columns: 288px 1fr; }
  .content { grid-template-columns: repeat(3, 1fr); max-width: 1120px; }
}

/* Admin-specific desktop adjustments */
@media (min-width: 900px) {
  .admin-shell .topbar { padding: 0 36px; }
  .admin-shell .admin-stats {
    display: flex; gap: 10px; flex: 0 0 auto; margin: 0;
  }
  .admin-shell .astat { padding: 8px 16px; min-width: 90px; }
  .theme-grid { grid-template-columns: repeat(4, 1fr); }
  .admin-shell .content { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1300px) {
  .admin-shell .content { grid-template-columns: repeat(3, 1fr); }
}

/* ── TOAST (remplace alert/confirm natifs) ── */
.mz-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white; padding: 13px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 600; max-width: 90vw; box-shadow: 0 8px 28px rgba(0,0,0,.25);
  z-index: 999; opacity: 0; transition: opacity .25s, transform .25s;
}
.mz-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mz-toast-success { background: var(--primary); }
.mz-toast-error { background: var(--danger); }
.mz-toast-info { background: var(--secondary); }
@media (min-width: 900px) { .mz-toast { bottom: 32px; } }

/* Confirm dialog : centré verticalement sur desktop (au lieu du bottom-sheet mobile) */
@media (min-width: 900px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 18px; max-height: 80vh; }
}

/* ── DÉTAIL DE LIGNE ── */
.line-card-clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.line-card-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.line-card-cta { font-size: 12px; color: var(--lc); font-weight: 700; margin-top: 10px; text-align: right; }

.sheet-lg { max-width: 540px; }
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.close-modal-x { background: var(--bg); border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 14px; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }

.detail-summary { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 14px; }
.detail-stat { background: var(--bg); border-radius: 10px; padding: 12px; }
.detail-stat span { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.detail-stat b { font-size: 16px; font-weight: 800; }

.detail-section-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }

.color-pick-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 3px solid transparent; cursor: pointer; }
.color-dot.sel { border-color: var(--text); box-shadow: 0 0 0 2px white inset; }

@media (min-width: 900px) { .sheet-lg { max-width: 560px; } }

/* ── ZAKAT ── */
.zakat-asset-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); position: relative; }
.zakat-asset-row:last-child { border-bottom: none; }
.zakat-asset-main { flex: 1; }
.zakat-hawl-badge { font-size: 10px; font-weight: 700; color: var(--text-muted); margin-top: 3px; }
.zakat-hawl-badge.ok { color: var(--primary); }
.zakat-del-btn { background: none; border: none; color: #ccc; cursor: pointer; font-size: 13px; padding: 4px; margin-left: 4px; }
.btn-primary-sm.gold { background: var(--accent); }

/* ── RAPPORT PDF ── */
.report-check-list { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: 10px; padding: 12px; }
.report-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.report-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
