/* Injazat design system. Tokens follow spec §10. Light is the default; dark follows the device unless the user picks one. */

@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("/assets/fonts/plex-arabic-400-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("/assets/fonts/plex-arabic-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("/assets/fonts/plex-arabic-500-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("/assets/fonts/plex-arabic-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("/assets/fonts/plex-arabic-600-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("/assets/fonts/plex-arabic-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("/assets/fonts/plex-arabic-700-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("/assets/fonts/plex-arabic-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/assets/fonts/plex-mono-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2212; }

:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --ink: #1D2633;
  --muted: #6E7681;
  --line: #E6E1D8;
  --primary: #1F4E5F;
  --primary-hover: #183F4D;
  --primary-soft: #E3EEF0;
  --accent: #B08D57;
  --paid: #3F7D5B;
  --partial: #B7791F;
  --due: #2F6690;
  --overdue: #B4533C;
  --notdue: #8A8F98;
  --cancelled: #9AA0A6;
  --nodate: #6E7681;
  --on-primary: #FFFFFF;
  --shadow: 0 1px 2px rgba(29, 38, 51, 0.04), 0 12px 40px rgba(31, 78, 95, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171D;
    --surface: #1A2129;
    --surface-2: #1F2731;
    --ink: #E7E9EC;
    --muted: #9AA3AD;
    --line: #2A333D;
    --primary: #6FA8B8;
    --primary-hover: #8BBCCB;
    --primary-soft: #1E2E35;
    --accent: #CDAE7A;
    --paid: #7DB896;
    --partial: #E0B25C;
    --due: #7FB0D9;
    --overdue: #E08B74;
    --notdue: #A4AAB3;
    --cancelled: #7D848C;
    --nodate: #9AA3AD;
    --on-primary: #12171D;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 40px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12171D;
  --surface: #1A2129;
  --surface-2: #1F2731;
  --ink: #E7E9EC;
  --muted: #9AA3AD;
  --line: #2A333D;
  --primary: #6FA8B8;
  --primary-hover: #8BBCCB;
  --primary-soft: #1E2E35;
  --accent: #CDAE7A;
  --paid: #7DB896;
  --partial: #E0B25C;
  --due: #7FB0D9;
  --overdue: #E08B74;
  --notdue: #A4AAB3;
  --cancelled: #7D848C;
  --nodate: #9AA3AD;
  --on-primary: #12171D;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 40px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
}
[x-cloak] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 700; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 16px; font-weight: 600; }
code, .mono { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-weight: 500; font-size: 13px; }
.muted { color: var(--muted); }
.t-28 { font-size: 28px; font-weight: 700; }
.t-20 { font-size: 20px; font-weight: 600; }
.t-16 { font-size: 16px; font-weight: 600; }
.t-13 { font-size: 13px; }
.eyebrow { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.num { text-align: start; font-variant-numeric: tabular-nums; }
:is(.money, .kpi-value, .num, .kpi, td) { font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.skip-link {
  position: absolute; inset-inline-start: 16px; top: -48px; z-index: 100;
  background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ----- Shell ----- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30;
  width: var(--sidebar-w); background: var(--surface);
  border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px;
  transition: width 180ms ease;
}
.workspace { margin-inline-start: var(--sidebar-w); transition: margin 180ms ease; min-width: 0; }
.app.is-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.app.is-collapsed .workspace { margin-inline-start: var(--sidebar-w-collapsed); }
.app.is-collapsed .nav-label,
.app.is-collapsed .brand-text,
.app.is-collapsed .user-chip .nav-label { display: none; }
.app.is-collapsed .nav-link { justify-content: center; }
.app.is-collapsed .sidebar-toggle .icon { transform: rotate(180deg); }
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 4px 6px 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 16px; color: var(--primary); }
.brand-text span { font-size: 12.5px; color: var(--muted); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand-mark-lg { width: 48px; height: 48px; font-size: 22px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: 14px;
  background: none; border: 0; cursor: pointer; width: 100%; text-align: start;
  transition: background 150ms ease;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-form { margin: 0; }
.nav-button { color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px 12px; }
.user-chip strong { display: block; font-size: 14px; }
.user-chip .muted { font-size: 12.5px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 600;
}
.icon { width: 20px; height: 20px; flex: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; padding: 0 clamp(16px, 3vw, 32px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
.page { padding: clamp(16px, 3vw, 32px); max-width: 1200px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.guide-section { display: flex; flex-direction: column; gap: 12px; }

/* ----- Surfaces ----- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); min-width: 0;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field-wide { grid-column: 1 / -1; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 600; }
.kpi-note { font-size: 12.5px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.swatch-chip { height: 36px; border-radius: 8px; border: 1px solid var(--line); }
.swatch code { color: var(--muted); }
.money-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: baseline; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.icon-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border-radius: var(--radius-sm); background: var(--surface-2); }
.icon-cell code { font-size: 11px; color: var(--muted); }
.status-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0; }
.status-list div { display: flex; flex-direction: column; gap: 2px; }
.status-list dt { font-size: 13px; color: var(--muted); }
.status-list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.status-card, .empty-state { display: flex; flex-direction: column; gap: 10px; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.setup-steps li { display: flex; align-items: center; gap: 10px; }
.setup-steps .icon { color: var(--primary); }
.empty-state { align-items: center; text-align: center; padding: 36px 20px; }
.empty-icon { width: 40px; height: 40px; color: var(--accent); }
.skeleton {
  display: block; height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line { width: 100%; }
.skeleton-short { width: 45%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ----- Money ----- */
.money { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; direction: ltr; }
.money b { font-weight: 600; font-size: 16px; }
.money small { font-size: 12px; color: var(--muted); font-weight: 500; }
.money-lg b { font-size: 28px; }
.money-lg small { font-size: 14px; }

/* ----- Status pills (colour + dot + text) ----- */
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.pill-paid { --tone: var(--paid); }
.pill-partial { --tone: var(--partial); }
.pill-due { --tone: var(--due); }
.pill-overdue { --tone: var(--overdue); }
.pill-notdue { --tone: var(--notdue); }
.pill-cancelled { --tone: var(--cancelled); }
.pill-nodate { --tone: var(--nodate); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; transition: background 150ms ease, border-color 150ms ease;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--overdue); border-color: color-mix(in srgb, var(--overdue) 40%, transparent); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--overdue) 10%, transparent); }
.btn-sm { min-height: 36px; padding: 4px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- Forms ----- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.field-error-text { font-size: 12.5px; color: var(--overdue); }
.field-error .input { border-color: var(--overdue); }
.input {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 15px; transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ----- Alerts & toasts ----- */
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
}
.alert .icon { margin-top: 3px; }
.alert-error { border-color: color-mix(in srgb, var(--overdue) 40%, transparent); background: color-mix(in srgb, var(--overdue) 8%, var(--surface)); color: var(--ink); }
.alert-error .icon { color: var(--overdue); }
.alert-info { border-color: color-mix(in srgb, var(--paid) 35%, transparent); background: color-mix(in srgb, var(--paid) 8%, var(--surface)); }
.alert-info .icon { color: var(--paid); }
.toast {
  position: relative; display: flex; gap: 10px; align-items: center; padding: 12px 16px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.toast-success { border-color: color-mix(in srgb, var(--paid) 40%, transparent); }
.toast-success .icon { color: var(--paid); }
.toast-error { border-color: color-mix(in srgb, var(--overdue) 40%, transparent); }
.toast-error .icon { color: var(--overdue); }

/* ----- Tabs & tables ----- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.tab {
  min-height: 44px; padding: 8px 14px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table th { font-size: 13px; color: var(--muted); font-weight: 500; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; }

/* ----- Auth pages ----- */
.auth-stage { min-height: 100vh; display: grid; place-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: clamp(24px, 5vw, 40px); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong { display: block; color: var(--primary); }
.auth-brand .muted { font-size: 12.5px; }
.auth-foot { font-size: 13px; text-align: center; }
.error-card { text-align: center; align-items: center; }
.error-code { font-size: 36px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ----- Bottom navigation (phones) ----- */
.bottom-nav { display: none; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .workspace, .app.is-collapsed .workspace { margin-inline-start: 0; }
  .page { padding-bottom: 104px; }
  .bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
    display: flex; justify-content: space-around; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .bottom-link {
    flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; cursor: pointer; border-radius: 10px;
    text-decoration: none;
  }
  .bottom-link .icon { width: 22px; height: 22px; }
  .bottom-link.is-active { color: var(--primary); font-weight: 600; }
  .bottom-form { display: flex; flex: 1; margin: 0; }
  .bottom-button { width: 100%; }
  .topbar h2 { font-size: 15px; }
  h1 { font-size: 24px; }
  .money-lg b { font-size: 24px; }
  .kpi-value { font-size: 24px; }
  .toast { position: fixed; inset-inline: 16px; bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ----- Phase 3: collector workspace, ledger, accounting ----- */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.summary-grid .card { padding: 16px; }
.collect-list { display: grid; gap: 12px; }
.collect-card { display: flex; flex-direction: column; gap: 12px; }
.collect-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.collect-head strong { font-size: 16px; display: block; }
.collect-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.collect-amount { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.collect-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-bar .field { min-width: 150px; flex: 1 1 150px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form .input { min-height: 40px; width: auto; min-width: 160px; }
details.reverse-box summary { cursor: pointer; color: var(--overdue); font-size: 13px; min-height: 36px; display: inline-flex; align-items: center; }
details.reverse-box form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.check-cell { width: 44px; }
.check-cell input { width: 18px; height: 18px; accent-color: var(--primary); }
.type-tag { font-size: 12.5px; color: var(--muted); }
.type-tag.is-reversal { color: var(--overdue); }
.stmt-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 899px) {
  .table-wrap.is-compact td, .table-wrap.is-compact th { padding: 10px; font-size: 13px; }
}

/* ----- Phase 4: dashboard, customers, contracts, agency ----- */
.aging-row { display: flex; flex-direction: column; gap: 6px; }
.aging-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; font-size: 13.5px; }
.aging-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.aging-bar span { display: block; height: 100%; background: var(--overdue); border-radius: 999px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.detail-grid div { display: flex; flex-direction: column; gap: 2px; }
.detail-grid dt { font-size: 13px; color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 600; }
.search-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search-bar .input { flex: 1 1 260px; }
.form-section { display: flex; flex-direction: column; gap: 12px; }
.form-section h2 { font-size: 16px; font-weight: 600; }
.warn-box { border: 1px solid color-mix(in srgb, var(--partial) 45%, transparent); background: color-mix(in srgb, var(--partial) 10%, var(--surface)); border-radius: var(--radius-sm); padding: 12px 14px; }

/* ----- Phase 5: reports, printing, commission statements ----- */
.report-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.report-card { display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; transition: border-color 150ms ease; }
.report-card:hover { border-color: var(--primary); text-decoration: none; }
.report-card strong { font-size: 16px; color: var(--primary); }
.report-card .muted { font-size: 13.5px; }
.report-open { margin-top: auto; display: inline-flex; gap: 6px; align-items: center; color: var(--primary); font-weight: 600; font-size: 14px; }
.report-open .icon { width: 16px; height: 16px; }
.report-table { display: flex; flex-direction: column; gap: 8px; }
.report-note { font-size: 13px; }
.table .num, th.num, td.num { text-align: end; font-variant-numeric: tabular-nums; }
.table tfoot th { border-top: 2px solid var(--line); color: var(--ink); background: var(--surface-2); }
.table tr.is-total th { font-weight: 700; }

.is-print { background: #fff; color: #000; }
.is-print .print-sheet { max-width: none; padding: 0; }
.print-sheet { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.print-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #1F4E5F; padding-bottom: 8px; }
.print-head strong { display: block; font-size: 18px; color: #1F4E5F; }
.print-head span { font-size: 14px; }
.print-meta { font-size: 13px; color: #444; }
.print-foot { display: flex; justify-content: space-between; font-size: 11px; color: #666; border-top: 1px solid #ccc; padding-top: 6px; margin-top: 8px; }
.print-signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 30px; }
.print-signatures div { display: flex; flex-direction: column; gap: 30px; font-size: 13px; }
.print-signatures i { display: block; border-bottom: 1px solid #000; height: 1px; }
.print-signatures div { border-top: none; }
.is-print .card { box-shadow: none; border: 1px solid #ccc; }
.is-print .table th, .is-print .table td { padding: 6px 8px; font-size: 12px; }
.is-print .money b { font-size: 12px; }
.is-print .money small { font-size: 10px; }
.is-print .report-table { break-inside: auto; }
.is-print .table thead { display: table-header-group; }
.is-print tr { break-inside: avoid; }
@page { size: A4; margin: 14mm 12mm; }
@media print {
  .no-print, .sidebar, .topbar, .bottom-nav, .toast { display: none !important; }
  .card { box-shadow: none; }
}

/* ----- Priority 1 additions: receipts, settings, users ----- */
.receipt { display: flex; flex-direction: column; gap: 16px; max-width: 720px; margin: 0 auto; }
.receipt-title { font-size: 22px; text-align: center; border-bottom: 2px solid #1F4E5F; padding-bottom: 8px; }
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin: 0; }
.receipt-grid div { display: flex; flex-direction: column; }
.receipt-grid dt { font-size: 12px; color: #666; }
.receipt-grid dd { margin: 0; font-weight: 600; }
.receipt-amounts th { width: 60%; }
.receipt-note { font-size: 13px; }
.receipt-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.receipt-sign div { display: flex; flex-direction: column; gap: 36px; font-size: 13px; }
.receipt-sign i { display: block; border-bottom: 1px solid #000; height: 1px; }
.is-print .receipt-grid div { break-inside: avoid; }
@media (max-width: 899px) { .receipt-grid { grid-template-columns: 1fr; } }

/* ----- Company logo ----- */
.brand-logo { border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.brand-mark-lg.brand-logo { width: 56px; height: 56px; }
.print-brand { display: flex; align-items: center; gap: 12px; }
.print-logo { width: 56px; height: 56px; object-fit: contain; }

/* ----- Trial copy banner ----- */
.trial-banner { background: #B08D57; color: #fff; text-align: center; padding: 8px 12px; font-size: 13px; font-weight: 600; }
