/* ==========================================================================
   Admin modules: reports, settings, finance statements, notifications, profile, help/welcome
   ========================================================================== */

/* Reports & settings two-pane layout */
.report-layout, .settings-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.report-nav, .settings-nav { position: sticky; top: calc(var(--header-h) + 16px); padding: 8px; max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; }
.rn-group { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; padding: 12px 10px 6px; }
.rn-group:first-child { padding-top: 6px; }
.rn-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--text-2); text-align: left; transition: background var(--transition), color var(--transition); }
.rn-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-3); }
.rn-item:hover { background: var(--surface-hover); color: var(--text); }
.rn-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 650; }
.rn-item.active svg { color: var(--primary-600); }
:root[data-theme="dark"] .rn-item.active { color: var(--primary-600); }
.report-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.report-kpis .mini-stat { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
.text-navy { color: var(--navy); }

/* P&L statement */
.pl-statement { display: flex; flex-direction: column; font-size: 13.5px; }
.pl-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--divider); }
.pl-line .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.pl-line.indent { padding-left: 20px; color: var(--text-2); }
.pl-line.muted { color: var(--text-3); }
.pl-line.total { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.pl-line.total .num { font-weight: 800; }
.pl-line.grand { font-family: var(--font-display); font-size: 16px; font-weight: 800; border-top: 2px solid var(--text); border-bottom: 2px solid var(--text); margin-top: 6px; padding: 12px 4px; }
.pl-line.success .num { color: var(--success); }
.pl-line.danger .num { color: var(--danger); }
.pl-sub { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; padding: 14px 4px 4px; }

.table tbody tr.row-overdue { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.table tbody tr.row-overdue:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); }

/* Settings bits */
.logo-preview { width: 72px; height: 72px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 6px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.receipt-preview { margin: 0 auto; background: #fff; color: #111; font-family: var(--font-mono); font-size: 12px; padding: 16px 14px; border-radius: 4px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; border-top: 6px dashed #eee; }
.receipt-preview .muted { color: #666; }
.rp-sep { border-top: 1px dashed #bbb; margin: 6px 0; }
.theme-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); text-align: left; transition: border-color var(--transition), box-shadow var(--transition); }
.theme-card:hover { border-color: var(--border-strong); }
.theme-card.active { border-color: var(--primary); box-shadow: var(--ring); }
.tc-preview { height: 110px; border-radius: 10px; display: grid; grid-template-columns: 26% 1fr; grid-template-rows: 22px 1fr; gap: 6px; padding: 8px; }
.tc-preview.light { background: #F5F4F1; border: 1px solid #ECE8E1; }
.tc-preview.dark { background: #0E1420; border: 1px solid #253148; }
.tc-preview span { border-radius: 6px; }
.tc-preview.light span { background: #fff; border: 1px solid #ECE8E1; }
.tc-preview.dark span { background: #151E2E; border: 1px solid #253148; }
.tc-preview span:first-child { grid-row: 1 / 3; }
.tc-preview span:nth-child(3) { background: linear-gradient(90deg, #E5762A 0 30%, transparent 30%) , var(--x, transparent); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: color-mix(in srgb, var(--danger) 3%, var(--surface)); }
.perm-wrap { max-height: 64vh; }
.perm-grid th { position: sticky; top: 0; z-index: 2; }
.perm-role { display: inline-block; white-space: nowrap; border-bottom: 3px solid; padding-bottom: 2px; font-size: 10.5px; }
.perm-grid tr.perm-group td { background: var(--surface-3); font-weight: 700; font-size: 12px; color: var(--text-2); text-align: left !important; }
.perm-grid tr.perm-group td svg { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.perm-item { display: flex; gap: 10px; align-items: flex-start; }
.profile-hero { background: linear-gradient(120deg, var(--primary-50), var(--surface) 60%); }

/* Notifications */
.notif-row { align-items: flex-start; }
.notif-row.is-read { opacity: .72; }
.notif-row.is-read .li-title { font-weight: 500; }
.notif-row .row-actions { flex-shrink: 0; }

/* Help center */
.help-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.help-list { display: flex; flex-direction: column; gap: 8px; }
.help-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: border-color var(--transition); }
.help-item:hover { border-color: var(--border-strong); }
.help-item.recommended { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-50); }
.scn-num { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
:root[data-theme="dark"] .scn-num { background: var(--primary); }

/* Welcome modal */
.welcome-modal .modal-body { padding: 34px 36px 28px; }
.welcome { text-align: center; display: flex; flex-direction: column; align-items: center; }
.welcome-art { position: relative; margin-bottom: 18px; }
.welcome-art .brand-mark { width: 72px; height: 72px; box-shadow: 0 12px 30px rgba(229, 118, 42, .35); border-radius: 18px; }
.wa-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.wa-dots span { width: 9px; height: 9px; border-radius: 50%; }
.welcome h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.welcome-sub { font-size: 16px; color: var(--primary-700); font-weight: 600; margin-top: 6px; }
:root[data-theme="dark"] .welcome-sub { color: var(--primary-600); }
.welcome > .text-2 { max-width: 580px; }
.welcome-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0 6px; width: 100%; text-align: left; }
.welcome-points > div { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.welcome-points svg { width: 20px; height: 20px; color: var(--primary-600); margin-bottom: 4px; }
.welcome-points b { font-size: 13px; }
.welcome-points span { font-size: 12px; color: var(--text-3); }
.welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }

@media (max-width: 1024px) {
  .report-layout, .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .report-nav, .settings-nav { position: static; max-height: none; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .report-nav .rn-group, .settings-nav .rn-group { display: none; }
  .report-nav .rn-item, .settings-nav .rn-item { width: auto; white-space: nowrap; flex-shrink: 0; }
  .help-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .welcome-points { grid-template-columns: minmax(0, 1fr); }
  .welcome-modal .modal-body { padding: 24px 18px; }
  .welcome h2 { font-size: 21px; }
  .welcome-actions .btn { width: 100%; }
  .help-item { flex-wrap: wrap; }
}
