:root {
  --navy: #0F2739;
  --ink: #0F2739;
  --muted: #4A5D72;
  --paper: #FAF7F2;
  --card: #FFFFFF;
  --line: rgba(15, 39, 57, .08);
  --line2: rgba(15, 39, 57, .14);
  --accent: #2E7D32;
  --accent-d: #236127;
  --accent-t: rgba(46, 125, 50, .10);
  --red: #B42318;
  --red-t: rgba(180, 35, 24, .09);
  --amber: #A15C07;
  --amber-t: rgba(220, 140, 20, .14);
  --blue: #1D5FA8;
  --blue-t: rgba(29, 95, 168, .10);
  --gray-t: rgba(15, 39, 57, .06);
  --shadow: 0 1px 2px rgba(15, 39, 57, .05);
  --shadow-lg: 0 16px 48px rgba(15, 39, 57, .18);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Manrope', system-ui, sans-serif; font-size: 15px; line-height: 24px; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-size: 18px; line-height: 28px; }
h3 { font-size: 15px; line-height: 24px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 13px; line-height: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 20px; }
.center { text-align: center; }
.red-t { color: var(--red); }
.accent-t { color: var(--accent); }
.mono { font-variant-numeric: tabular-nums; }
.ic { flex: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s var(--ease); text-decoration: none !important; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { background: #fff; border-color: var(--line2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #8f1c13; }
.btn.danger-t { color: var(--red); }
.btn.danger-t:hover { border-color: var(--red); color: var(--red); }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.btn.xl { width: 100%; min-height: 56px; font-size: 17px; border-radius: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; color: inherit; transition: background .15s; }
.icon-btn:hover { background: var(--gray-t); }
.icon-btn.sm { width: 36px; height: 36px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--navy); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center; gap: 32px; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(46, 125, 50, .45), transparent 70%); }
.login-art h2 { font-size: 32px; line-height: 40px; max-width: 520px; }
.feat { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: rgba(255, 255, 255, .85); }
.feat li { display: flex; gap: 12px; align-items: flex-start; }
.feat .ic { color: #7BC67E; margin-top: 3px; }
.demo-note { color: rgba(255, 255, 255, .6); font-size: 13px; }
.login-card { padding: 64px 48px; display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.login-card h1 { font-size: 28px; line-height: 36px; }
.role-cards { display: grid; gap: 8px; }
.role-card { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 16px; min-height: 56px; background: #fff; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .2s var(--ease); }
.role-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.role-card .ic { color: var(--accent); }
.role-card b { display: block; }
.role-card small { color: var(--muted); }
.toggle { align-self: center; margin-top: 8px; min-height: 44px; }
.acct { display: grid; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.pw { position: relative; }
.pw .input { padding-right: 52px; }
.pw .eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.foot { text-align: center; margin-top: 8px; }

/* Brand */
.brand { display: flex; gap: 12px; align-items: center; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.brand b { display: block; font-size: 15px; line-height: 20px; }
.brand small { display: block; font-size: 12px; line-height: 16px; opacity: .7; }
.brand.big .logo { width: 48px; height: 48px; }
.brand.big b { font-size: 18px; line-height: 24px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 24px 16px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.sidebar .brand { padding: 0 8px 24px; }
.drawer-close { display: none; margin-left: auto; color: #fff; }
.nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px; border-radius: 12px; color: rgba(255, 255, 255, .78); font-weight: 600; text-decoration: none !important; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.side-foot { margin-top: auto; padding: 16px 8px 0; font-size: 12px; color: rgba(255, 255, 255, .5); border-top: 1px solid rgba(255, 255, 255, .08); }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.demo-strip { display: flex; align-items: center; justify-content: center; gap: 12px; background: #FFF4D6; color: #6B4E00; font-size: 13px; line-height: 20px; padding: 4px 16px; min-height: 36px; }
.demo-strip[hidden] { display: none; }
.demo-strip .link { color: #6B4E00; text-decoration: underline; min-height: 32px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 12px 32px; min-height: 72px; background: rgba(250, 247, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 24px; line-height: 32px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hamburger { display: none; }
.user-chip { display: flex; align-items: center; gap: 12px; }
.uc-text b { display: block; font-size: 14px; line-height: 20px; }
.uc-text small { display: block; color: var(--muted); font-size: 12px; line-height: 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-t); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.content { padding: 24px 32px 64px; display: grid; gap: 24px; align-content: start; max-width: 1400px; width: 100%; }

/* Cards and KPIs */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 24px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head > div { min-width: 0; flex: 1 1 260px; }
.card-head p { margin-top: 4px; }
.card-head.flat { margin: 8px 0 -8px; align-items: center; }
.card-head.flat > div { flex: 0 1 auto; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpis.k4 { grid-template-columns: repeat(4, 1fr); }
.kpis.k3 { grid-template-columns: repeat(3, 1fr); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 24px; box-shadow: var(--shadow); display: grid; gap: 4px; min-width: 0; }
.kpi small { color: var(--muted); font-weight: 600; }
.kpi b { font-size: 24px; line-height: 32px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi b em { font-style: normal; font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi span { color: var(--muted); font-size: 13px; line-height: 20px; }
.kpi.accent b { color: var(--accent); }
.kpi.red b { color: var(--red); }
.big-num { font-size: 24px; line-height: 32px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.big-num.sm { font-size: 18px; line-height: 24px; display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.chart { width: 100%; }
.linechart { display: block; overflow: visible; max-width: 100%; }
.linechart .grid { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.linechart .axis { fill: var(--muted); font-size: 12px; font-family: Manrope, sans-serif; }
.linechart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.linechart .area { fill: var(--accent-t); }
.linechart .dot { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.linechart .hit { fill: transparent; }
.linechart .pt:hover .dot, .linechart .pt:focus .dot { fill: var(--accent); }

/* Rows (ranked lists) */
.rows { display: grid; }
.rowlink { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 8px; min-height: 56px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none !important; border-radius: 8px; transition: background .15s; }
.rowlink:first-child { border-top: 0; }
a.rowlink:hover { background: var(--gray-t); }
.rowlink > span { display: grid; min-width: 0; }
.rowlink small { color: var(--muted); }
.rowlink .r { text-align: right; justify-items: end; font-variant-numeric: tabular-nums; }
.rowlink.total { border-top: 2px solid var(--line2); }
.rowlink.total b { color: var(--accent); }

/* Toolbar and inputs */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.toolbar.tight { margin-bottom: 16px; }
.toolbar .grow { flex: 1 1 260px; }
.input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-t); }
select.input { width: auto; padding-right: 32px; cursor: pointer; }
.toolbar select.input { min-width: 150px; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.date-f { display: grid; gap: 4px; }
.date-f span { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); }
.date-f .input { width: auto; }
.count { margin: -12px 0 -16px; font-size: 13px; }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; line-height: 20px; font-weight: 600; color: var(--muted); }
.field select.input { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.err { color: var(--red); background: var(--red-t); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.err[hidden] { display: none; }
.hint { background: var(--accent-t); color: #1f5a23; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 20px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line2); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; transition: border-color .15s, color .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.split { font-size: 13px; line-height: 20px; min-height: 20px; }

/* Tables */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: auto; max-height: 72vh; }
.card .table-wrap { box-shadow: none; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; z-index: 1; background: #F6F3EE; text-align: left; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #FBFAF7; }
.tbl tr.clickable { cursor: pointer; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl td.act { width: 52px; text-align: right; padding: 4px 8px; }
.tbl tfoot td { font-weight: 700; background: #F6F3EE; border-top: 1px solid var(--line2); position: sticky; bottom: 0; }
.sub { display: block; color: var(--muted); font-size: 12px; line-height: 16px; }
.who { display: flex; gap: 12px; align-items: center; }
.who > span { display: grid; }
.who small { color: var(--muted); font-size: 12px; line-height: 16px; }
a.plain { color: inherit; text-decoration: none; }
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 20px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pill.green { background: var(--accent-t); color: var(--accent-d); }
.pill.red { background: var(--red-t); color: var(--red); }
.pill.amber { background: var(--amber-t); color: var(--amber); }
.pill.blue { background: var(--blue-t); color: var(--blue); }
.pill.gray { background: var(--gray-t); color: var(--muted); }
.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--muted); text-align: center; }
.empty .ic { color: var(--line2); color: #9AA8B6; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: -8px; }
.pager-btns { display: flex; gap: 8px; }

/* Profile */
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; margin-bottom: -12px; min-height: 32px; }
.profile { display: grid; gap: 24px; }
.p-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.p-id { flex: 1 1 320px; min-width: 0; display: grid; gap: 4px; }
.p-id h2 { font-size: 22px; line-height: 30px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.msum, .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.facts { grid-template-columns: repeat(6, 1fr); }
.facts.state { padding-top: 16px; border-top: 1px solid var(--line); }
.msum > div, .facts > div { background: #FBFAF7; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid; gap: 2px; min-width: 0; }
.msum small, .facts small { color: var(--muted); font-weight: 600; font-size: 12px; line-height: 16px; }
.msum b, .facts b { font-size: 18px; line-height: 26px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.msum em, .facts em { font-style: normal; font-size: 12px; line-height: 16px; color: var(--muted); }
.msum em.red-t { color: var(--red); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line2); margin-bottom: -8px; overflow-x: auto; }
.tab { background: none; border: 0; padding: 12px 16px; min-height: 44px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Picker */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 320px; overflow: auto; padding: 4px; }
.picker-list[hidden] { display: none; }
.picker-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 8px 12px; min-height: 48px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.picker-item:hover, .picker-item:focus { background: var(--accent-t); }
.picker-item > span:last-child { display: grid; }
.picker-item small { color: var(--muted); font-size: 12px; line-height: 16px; }
.picker-none { padding: 12px; color: var(--muted); }

/* Collections */
.grid-teller { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.quick { position: sticky; top: 96px; display: grid; gap: 16px; }
.quick .card-head { margin-bottom: 0; }
.quick [data-member] { display: grid; gap: 16px; }
.quick .msum { grid-template-columns: 1fr; }
.quick .msum > div { grid-template-columns: 1fr auto; align-items: center; }
.quick .msum em { grid-column: 1 / -1; }
.qp-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qp { display: grid; justify-items: center; gap: 4px; padding: 12px 8px; min-height: 88px; border: 1px solid var(--line2); background: #fff; border-radius: 14px; cursor: pointer; text-align: center; transition: border-color .15s, transform .2s var(--ease); }
.qp:hover { border-color: var(--accent); transform: translateY(-1px); }
.qp .ic { color: var(--accent); }
.qp span { display: grid; }
.qp small { color: var(--muted); font-size: 12px; line-height: 16px; }
.mini { font-size: 13px; line-height: 20px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 -8px; }
.qloan { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.qloan > span { display: grid; min-width: 0; }
.qloan small { color: var(--muted); font-size: 12px; line-height: 16px; }
.sumrows { margin-bottom: 16px; }
.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; font-size: 13px; color: var(--muted); }
.signs span { display: block; border-top: 1px solid var(--ink); margin-bottom: 4px; height: 0; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid var(--ink); }
.doc-title { text-align: right; }
.doc-title h2 { font-size: 20px; }
.brand.doc .logo { width: 40px; height: 40px; }
.brand.doc small { opacity: 1; color: var(--muted); }

/* Statement */
.statement { display: grid; gap: 16px; }
.statement .doc-head { margin-bottom: 0; }
.st-member { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.st-member > div { display: grid; }
.st-member small { color: var(--muted); font-weight: 600; font-size: 12px; }
.st-member span { color: var(--muted); font-size: 13px; }
.st-note { border-top: 1px solid var(--line); padding-top: 12px; }
.stmt-bar { margin-bottom: 0; }

/* Settings */
.products { display: grid; gap: 16px; }
.product { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; background: #FBFAF7; }
.form-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.form.row2, .form.row3 { margin-bottom: 16px; }
.danger-zone .card-head { margin-bottom: 0; align-items: center; }

/* Member page */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hello h2 { font-size: 22px; line-height: 30px; }
.myloan h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.myloan .r { display: grid; text-align: right; }
.myloan .card-head { margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
details[open] summary { margin-bottom: 8px; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 39, 57, .45); display: grid; place-items: center; padding: 24px; z-index: 100; opacity: 0; transition: opacity .2s var(--ease); }
.modal-wrap.in { opacity: 1; }
.modal { background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; transform: translateY(12px) scale(.98); transition: transform .25s var(--ease); }
.modal.wide { width: min(880px, 100%); }
.modal-wrap.in .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 8px 24px; }
.modal-body { padding: 8px 24px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); }
.modal .msum { grid-template-columns: repeat(3, 1fr); }
.modal .msum b { font-size: 16px; line-height: 24px; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.modal .table-wrap { max-height: 280px; }
body.modal-open { overflow: hidden; }

/* Toast */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(480px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: center; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; line-height: 20px; opacity: 0; transform: translateY(8px); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast .ic { color: #7BC67E; }
.toast.err .ic { color: #FF9C94; }

.scrim { display: none; }

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

/* Tablet */
@media (max-width: 1180px) {
  .kpis, .kpis.k4 { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .grid-teller { grid-template-columns: 1fr; }
  .quick { position: static; }
  .row5 { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile */
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; gap: 16px; }
  .login-art h2 { font-size: 22px; line-height: 30px; }
  .login-art .feat { display: none; }
  .login-card { padding: 24px 16px 40px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); width: 280px; }
  body.drawer-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 39, 57, .4); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .drawer-close { display: inline-grid; }
  .hamburger { display: inline-grid; margin-left: -8px; }
  .topbar { padding: 8px 16px; min-height: 64px; gap: 8px; }
  .topbar h1 { font-size: 20px; line-height: 28px; }
  .uc-text { display: none; }
  .user-chip .avatar { display: none; }
  .signout span { display: none; }
  .signout { width: 44px; min-height: 44px; padding: 0; }
  .content { padding: 16px 16px 48px; gap: 16px; }
  .card { padding: 16px; }
  .kpis, .kpis.k4, .kpis.k3 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 12px 16px; }
  .kpi b { font-size: 18px; line-height: 26px; }
  .grid2 { grid-template-columns: 1fr; gap: 16px; }
  .toolbar { gap: 8px; }
  .toolbar > * { flex: 1 1 100%; }
  .toolbar select.input, .date-f, .date-f .input { width: 100%; min-width: 0; }
  .toolbar .date-f { flex: 1 1 calc(50% - 4px); }
  .toolbar select.input { flex: 1 1 calc(50% - 4px); }
  .toolbar .btn { flex: 1 1 calc(50% - 4px); }
  .row2, .row3, .row5 { grid-template-columns: 1fr; }
  .msum, .modal .msum { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .st-member { grid-template-columns: 1fr; gap: 8px; }
  .signs { grid-template-columns: 1fr; gap: 32px; }
  .doc-title { text-align: left; }
  .p-actions { justify-content: flex-start; width: 100%; }
  .p-actions .btn { flex: 1 1 calc(50% - 4px); }
  .card-head.flat { flex-direction: column; align-items: stretch; }
  .count { margin: -4px 0 -8px; }
  .pager { flex-wrap: wrap; }
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .modal-body { padding: 8px 16px 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .btn { flex: 1; }
  .demo-strip { justify-content: flex-start; padding: 4px 8px 4px 16px; }
  .demo-strip span { flex: 1; }
  .demo-strip .link, .demo-strip .icon-btn { min-height: 44px; min-width: 44px; }

  /* tables become stacked cards */
  .table-wrap { max-height: none; overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td, .tbl tfoot { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tbody tr, .tbl tfoot tr { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; padding: 8px 16px; box-shadow: var(--shadow); }
  .tbl tfoot tr { background: #F6F3EE; }
  .tbl tfoot td { position: static; background: none; border-top: 0; }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); text-align: right; min-height: 40px; }
  .tbl td:last-child { border-bottom: 0; }
  .tbl td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; flex: none; max-width: 45%; }
  .tbl td[data-label=""]::before { display: none; }
  .tbl td.num { white-space: normal; }
  .tbl td > .cv { text-align: right; min-width: 0; }
  .tbl td .who { justify-content: flex-end; }
  .tbl td.act { width: 100%; justify-content: flex-end; padding: 4px 0; }
  .tbl td.act::before { display: none; }
  .tbl td:first-child { font-weight: 600; }
  .card .tbl tbody tr { box-shadow: none; }
  .qp-actions { grid-template-columns: repeat(3, 1fr); }
}

/* Print: only the report or statement */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 11px; line-height: 16px; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; border: 0; box-shadow: none; padding: 0; }
  .no-print, .print-area .no-print { display: none !important; }
  .table-wrap { max-height: none; overflow: visible; border: 0; }
  .tbl th { position: static; background: #eee; }
  .tbl td, .tbl th { padding: 4px 8px; }
  .sidebar, .topbar, .demo-strip { display: none; }
  .content { padding: 0; }
  .shell { display: block; }
}
.tbl .nowrap { white-space: nowrap; }

/* Shared demo strip colours: identical on every EulClavie demo */
.demo-strip { background: #FFF6E5; color: #6B4A00; border-bottom: 1px solid rgba(183, 121, 31, .22); font-size: 13px; line-height: 20px; font-weight: 500; }
.demo-strip .ic, .demo-strip > svg { color: #6B4A00; }
.demo-strip .link { color: #6B4A00; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; background: none; }
.demo-strip .link:hover { background: rgba(183, 121, 31, .12); }
.demo-strip .icon-btn { color: #6B4A00; text-decoration: none; background: none; }
.demo-strip .icon-btn:hover { background: rgba(183, 121, 31, .14); color: #6B4A00; }
