/* ==========================================================================
   Loan System mockup — design tokens + shared components
   Source: design-system/loan-system/MASTER.md → "Project overrides" (client brand:
   muted leaf-green + gold, white ground, green-tinted silver; NO blue/grey/black chrome)
   Text: Noto Sans Thai · Figures: Fira Code (tabular) · Light-first
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

:root {
  /* brand green */
  --brand-950: #14230B;   /* text on gold CTA (4.7:1) */
  --brand-900: #1F3A12;   /* text-strong, logo tint */
  --brand-800: #345A1A;   /* primary hover */
  --brand-700: #3E6A1F;   /* primary buttons, active nav, links (6.5:1 on white) */
  --brand-500: #6B8F3E;   /* icons, chart series 1 */
  --brand-300: #A9C08A;   /* chart series 2, focus glow */
  --brand-100: #EEF3E6;   /* active nav bg, selected row */
  /* gold — one CTA per screen + key figures */
  --gold-700: #7A5F1C;    /* gold as TEXT (6:1 on white) */
  --gold-600: #A8842C;    /* CTA fill (with --brand-950 text) */
  --gold-500: #B8923A;    /* CTA hover */
  --gold-100: #F6EFD9;
  --gold-200: #E3D3A3;
  /* ground / surface / silver (green-tinted, never grey) */
  --ground: #FAFBF7;
  --surface: #FFFFFF;
  --silver-100: #EEF0EA;
  --silver-300: #D5DBCC;  /* borders */
  --silver-400: #C3CBB8;  /* input borders */
  --silver-500: #8E9886;  /* placeholder / disabled only */
  /* text */
  --text: #1F2A18;
  --muted: #4E5A45;       /* ≥7:1 on white — never lighter */
  /* LINE brand — allowed ONLY on the "เข้าสู่ระบบด้วย LINE" button */
  --line: #06C755; --line-hover: #05B24C;
  /* status tones — colour is never the only signal (MASTER status table) */
  --st-green-bg: #EEF3E6;   --st-green-text: #3E6A1F;   /* กำลังผ่อน */
  --st-gold-bg: #F6EFD9;    --st-gold-text: #7A5F1C;    /* ครบกำหนดวันนี้ */
  --st-red-bg: #F8E6E4;     --st-red-text: #A8322E;     /* เกินกำหนด */
  --st-deepred-bg: #F3DDE0; --st-deepred-text: #7E1F2A; /* หนี้เสีย */
  --st-purple-bg: #F0E8F8;  --st-purple-text: #6B3FA0;  /* ปิดด้วย refinance */
  --st-pink-bg: #F8E5EF;    --st-pink-text: #A33A6E;    /* ใบสมัครใหม่/รอตรวจ */
  --st-closed-bg: #E4EAD9;  --st-closed-text: #1F3A12;  /* ปิดสัญญา */
  --st-silver-bg: #EEF0EA;  --st-silver-text: #5E6657;  /* ยกเลิก / neutral */
  /* shape + depth (shadows tinted green, not black) */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(31,58,18,.06);
  --shadow-md: 0 4px 10px rgba(31,58,18,.09);
  --shadow-lg: 0 10px 24px rgba(31,58,18,.13);
  --shadow-xl: 0 20px 40px rgba(31,58,18,.18);
  /* type */
  --font: 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* motion */
  --t-fast: 150ms; --t-base: 200ms; --t-slow: 300ms; --ease: cubic-bezier(.2,.7,.3,1);
  /* z-scale */
  --z-sticky: 10; --z-drawer: 20; --z-overlay: 30; --z-modal: 40; --z-toast: 50;
}

/* ---------- scrollbars: thin, brand-tinted (no dark/grey system bars inside cards) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--silver-400) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--silver-400); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.6; color: var(--text); background: var(--ground); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; color: var(--brand-900); }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
::placeholder { color: var(--silver-500); }
:focus-visible { outline: 2px solid var(--brand-700); outline-offset: 2px; border-radius: 4px; box-shadow: 0 0 0 5px rgba(169,192,138,.45); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--brand-700); color: #fff; padding: 8px 12px; border-radius: var(--r-md); z-index: var(--z-toast); }
.skip-link:focus { top: 8px; }

/* ---------- logo (black wordmark → tinted brand-900 via feColorMatrix) ---------- */
.logo { display: block; height: 36px; width: auto; }
.logo-lg { height: 64px; } .logo-xl { height: 96px; }

/* ---------- typography helpers ---------- */
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.num { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.text-red { color: var(--st-red-text); } .text-green { color: var(--brand-700); } .text-gold { color: var(--gold-700); } .text-purple { color: var(--st-purple-text); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- icons ---------- */
.ic { display: inline-block; vertical-align: -0.2em; width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 15px; height: 15px; } .ic-lg { width: 22px; height: 22px; } .ic-xl { width: 28px; height: 28px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; background: var(--surface); color: var(--text); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-cta { background: var(--gold-600); color: var(--brand-950); border-color: var(--gold-600); box-shadow: var(--shadow-sm); }
.btn-cta:hover { background: var(--gold-500); border-color: var(--gold-500); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.btn-primary:hover { background: var(--brand-800); border-color: var(--brand-800); }
.btn-secondary { background: var(--surface); color: var(--brand-700); border-color: var(--silver-400); }
.btn-secondary:hover { background: var(--brand-100); border-color: var(--brand-500); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--silver-100); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--st-red-text); border-color: #E6B5B2; }
.btn-danger:hover { background: var(--st-red-bg); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-line-login { background: var(--line); color: #fff; border-color: var(--line); } /* LINE brand rule: login only */
.btn-line-login:hover { background: var(--line-hover); border-color: var(--line-hover); }

/* ---------- badges + pills ---------- */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 22px; padding: 0 8px; border-radius: 999px; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; line-height: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 7px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.no-dot::before { display: none; }
.tone-green { background: var(--st-green-bg); color: var(--st-green-text); }
.tone-gold { background: var(--st-gold-bg); color: var(--st-gold-text); }
.tone-red { background: var(--st-red-bg); color: var(--st-red-text); }
.tone-deepred { background: var(--st-deepred-bg); color: var(--st-deepred-text); }
.tone-purple { background: var(--st-purple-bg); color: var(--st-purple-text); }
.tone-pink { background: var(--st-pink-bg); color: var(--st-pink-text); }
.tone-closed { background: var(--st-closed-bg); color: var(--st-closed-text); }
.tone-silver { background: var(--st-silver-bg); color: var(--st-silver-text); }
.q { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px dashed var(--gold-600); background: var(--gold-100); color: var(--gold-700); font-size: 11.5px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.q .ic { width: 12px; height: 12px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--silver-100); color: var(--st-silver-text); font-size: 12px; font-weight: 500; border: 1px solid var(--silver-300); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--silver-300); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--silver-300); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .ic { color: var(--brand-500); }
.card-body { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--silver-300); background: var(--ground); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 12.5px; color: var(--muted); }
.card-link { cursor: pointer; transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease); }
.card-link:hover { box-shadow: var(--shadow-md); border-color: var(--brand-300); }

/* a box inside a card is an inset region, not a second card */
.card-body .card, .card-body .card-link { box-shadow: none; border-color: transparent; background: var(--ground); }
.card-body .card-link:hover { background: var(--brand-100); border-color: var(--brand-300); box-shadow: none; }
.card-body .card .card-foot { background: transparent; }

/* ---------- KPI ---------- */
.kpi { position: relative; padding: 14px 16px; }
.kpi.tone-green, .kpi.tone-gold, .kpi.tone-red, .kpi.tone-deepred, .kpi.tone-purple { color: inherit; }
.kpi.tone-green { background: var(--surface); }
.kpi.tone-gold { background: var(--gold-100); border-color: var(--gold-200); }
.kpi.tone-red { background: var(--st-red-bg); border-color: #E6B5B2; }
.kpi.tone-deepred { background: var(--st-deepred-bg); border-color: #E2B9C0; }
.kpi.tone-purple { background: var(--st-purple-bg); border-color: #D7C6EA; }
.kpi.is-link { cursor: pointer; transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease); }
.kpi.is-link:hover { box-shadow: var(--shadow-md); border-color: var(--brand-300); }
.kpi-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 4px; color: var(--brand-900); }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; font-family: var(--font); }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.table { min-width: 720px; font-size: 13.5px; }
.table th, .table td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--silver-300); }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--ground); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.row-link { cursor: pointer; transition: background-color var(--t-fast) var(--ease); }
.table tbody tr.row-link:hover { background: var(--brand-100); }
.table tbody tr.row-muted td { color: var(--muted); }
.table tfoot td { font-weight: 600; background: var(--ground); }
.table-dense th, .table-dense td { padding: 7px 10px; }
.table .cell-primary { font-weight: 500; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--st-red-text); display: flex; align-items: center; gap: 4px; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--st-red-text); }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--silver-400); border-radius: var(--r-md); background: var(--surface); font: inherit; font-size: 14px; color: var(--text); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-700); box-shadow: 0 0 0 3px rgba(107,143,62,.22); }
.input[readonly], .input:disabled { background: var(--silver-100); color: var(--muted); }
.input.is-error { border-color: var(--st-red-text); }
.input.mono { font-family: var(--mono); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234E5A45' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--silver-400); border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--silver-100); color: var(--muted); font-size: 13px; white-space: nowrap; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; line-height: 1.5; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--brand-700); flex: 0 0 auto; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--silver-400); position: relative; transition: background-color var(--t-fast) var(--ease); flex: 0 0 auto; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t-fast) var(--ease); box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--brand-700); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand-700); outline-offset: 2px; }

/* ---------- segmented / tabs ---------- */
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-md); background: var(--silver-100); border: 1px solid var(--silver-300); gap: 2px; }
.segmented button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--silver-300); }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--muted); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); text-decoration: none; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"], .tabs button[aria-selected="true"] { color: var(--brand-700); border-bottom-color: var(--brand-700); }
.tabs .badge { margin-left: 2px; }

/* ---------- lists / definition ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.divider { height: 1px; background: var(--silver-300); margin: 4px 0; }

/* ---------- notes / callouts ---------- */
.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); font-size: 13px; line-height: 1.55; border: 1px solid; }
.note .ic { margin-top: 2px; }
.note-info { background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-900); }
.note-warn { background: var(--gold-100); border-color: var(--gold-200); color: var(--gold-700); }
.note-danger { background: var(--st-red-bg); border-color: #E6B5B2; color: var(--st-red-text); }
.note-ok { background: var(--st-closed-bg); border-color: #C5D3B0; color: var(--st-closed-text); }
.demo-banner { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--gold-100); color: var(--gold-700); border-bottom: 1px solid var(--gold-200); font-size: 12.5px; font-weight: 500; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 16px; text-align: center; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; color: var(--brand-300); }

/* ---------- avatar ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; font-size: 12px; font-weight: 600; flex: 0 0 auto; background: var(--brand-100); color: var(--brand-700); }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }

/* ---------- progress ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--silver-100); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-500); }
.progress.is-gold > span { background: var(--gold-600); }
.progress.is-red > span { background: var(--st-red-text); }
.progress.is-green > span { background: var(--brand-700); }

/* ---------- stepper ---------- */
.stepper { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stepper .step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.stepper .step .n { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; font-weight: 600; background: var(--silver-100); color: var(--muted); border: 1px solid var(--silver-400); }
.stepper .step.is-active { color: var(--brand-700); font-weight: 600; }

/* ---------- round 5: shared step indicator U.steps (§3.2 / §5.1) — shared so backoffice (sm) and LIFF (default) both get it ---------- */
.steps-dots { display: flex; align-items: center; }
.step-dot { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-family: var(--mono); font-size: 12px; font-weight: 600; flex: 0 0 auto; text-decoration: none; position: relative; }
.step-dot.is-done { background: var(--brand-100); color: var(--brand-700); }
.step-dot.is-current { background: var(--brand-700); color: #fff; box-shadow: 0 0 0 2px var(--brand-300); }
.step-dot.is-upcoming { background: var(--surface); color: var(--silver-500); border: 1.5px solid var(--silver-400); }
.step-dot .ic { width: 14px; height: 14px; }
/* a step dot that is a link needs a 44px touch target without growing the dot itself */
a.step-dot::after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; }
.step-connector { width: 24px; height: 2px; background: var(--silver-300); flex: 0 0 auto; }
.step-connector.is-done { background: var(--brand-300); }
.steps-caption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.steps.steps-sm .step-dot { width: 24px; height: 24px; font-size: 11px; }
.steps.steps-sm .step-connector { width: 18px; }
.steps.steps-sm .steps-caption { font-size: 12.5px; }
.steps.steps-mini .step-dot { width: 16px; height: 16px; font-size: 9px; }
.steps.steps-mini .step-connector { width: 10px; }
.steps.steps-mini .steps-caption { display: none; }
.stepper .step.is-active .n { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.stepper .step.is-done .n { background: var(--st-closed-bg); color: var(--st-closed-text); border-color: var(--brand-500); }
.stepper .sep { width: 24px; height: 1px; background: var(--silver-400); }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--silver-300); }
.timeline .tl { position: relative; padding: 0 0 14px; }
.timeline .tl::before { content: ''; position: absolute; left: -19px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-700); }
.timeline .tl.is-system::before { border-color: var(--silver-500); }
.timeline .tl.is-customer::before { border-color: var(--gold-600); }
.timeline .tl-time { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(31,42,24,.5); backdrop-filter: blur(3px); z-index: var(--z-overlay); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade var(--t-base) var(--ease); }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-xl); animation: rise var(--t-base) var(--ease); }
.modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--silver-300); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--silver-300); background: var(--ground); border-radius: 0 0 var(--r-xl) var(--r-xl); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-900); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: rise var(--t-base) var(--ease); }
.toast.is-ok { background: var(--brand-700); } .toast.is-warn { background: var(--gold-700); } .toast.is-danger { background: var(--st-deepred-text); }
.toast .ic { margin-top: 2px; }

/* ---------- money ledger colours ---------- */
.amt-in { color: var(--brand-700); } .amt-out { color: var(--st-red-text); }

/* ---------- inline svg charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
