/* Loaded by the shared app shell after legacy page styles. */
@media (min-width:1025px){
  main{width:calc(100% - var(--sidebar-width));max-width:none;margin-left:var(--sidebar-width);margin-right:0}
}
@media (max-width:1024px){
  main{width:100%;margin-left:auto;margin-right:auto}
}
@media (max-width:640px){
  .dashboard-page .dash-actions{flex-wrap:nowrap}
}
/* Consistent semantic icon system. Icons inherit the surrounding control colour. */
.ui-icon{width:1.1em;height:1.1em;display:inline-block;vertical-align:-.16em;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.ui-icon-lg{width:1.45em;height:1.45em;stroke-width:1.65}
.ui-icon-xl{width:2em;height:2em;stroke-width:1.5}
.icon-label{display:inline-flex;align-items:center;gap:.42em}

/* Payee / agency logo tile (_payee-logo.ejs). Logo image over an initials fallback. */
.payee-logo{position:relative;flex:none;width:48px;height:48px;border-radius:12px;background:var(--brand-soft);color:var(--brand-strong);font-weight:800;font-size:16px;display:inline-flex;align-items:center;justify-content:center;overflow:hidden;border:1px solid var(--line)}
.payee-logo img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;padding:5px;background:#fff}
.payee-logo img.logo-kwsp{object-fit:cover;object-position:left center;padding:4px}
.payee-logo-sm{width:36px;height:36px;border-radius:10px;font-size:13px}
.payee-logo-sm img{padding:3px}
.payee-logo.tone-customer{background:var(--positive-soft);color:var(--positive)}
.payee-logo.tone-supplier{background:#eaf2ff;color:#345db1}
.payee-logo.tone-both{background:var(--brand-soft);color:var(--brand-strong)}
.role-tag{display:inline-block;font-size:11px;font-weight:700;padding:1px 8px;border-radius:999px;margin-top:2px}
.role-tag.customer{background:var(--positive-soft);color:var(--positive)}
.role-tag.supplier{background:#eaf2ff;color:#345db1}
.role-tag.both{background:var(--brand-soft);color:var(--brand-strong)}
/* Bank brand tile (_bank-mark.ejs) */
.bank-mark{flex:none;width:48px;height:48px;border-radius:12px;display:inline-grid;place-items:center;font-weight:800;font-size:16px;letter-spacing:.02em;background:var(--brand-soft);color:var(--brand-strong)}
.bank-mark .ui-icon{width:24px;height:24px}
.bank-mark-sm{width:34px;height:34px;border-radius:9px;font-size:12px}
.bank-mark-sm .ui-icon{width:18px;height:18px}

/* 2026.11 interface refresh — a quieter financial operating system. */
:root{
  --ink-strong:#172033;
  --ink:#3d475a;
  --ink-muted:#6d7585;
  --canvas:#f5f4f0;
  --surface:#fff;
  --surface-soft:#f8f7f4;
  --line:#e4e1da;
  --line-strong:#d5d1c8;
  --brand:#5846d6;
  --brand-strong:#4534ba;
  --brand-soft:#eeebff;
  --positive:#087956;
  --positive-soft:#e8f7ef;
  --warning:#9a5b06;
  --warning-soft:#fff3dc;
  --danger:#bd334b;
  --danger-soft:#ffedf0;
  --shadow-sm:0 1px 2px rgba(31,35,48,.04),0 8px 24px rgba(31,35,48,.035);
  --shadow-md:0 18px 48px rgba(31,35,48,.12);
  --radius-sm:10px;
  --radius-md:15px;
  --radius-lg:20px;
  --sidebar-width:264px;
}

html,body{background:var(--canvas)}
body{color:var(--ink-strong);letter-spacing:-.006em}

/* Light navigation rail: calmer, easier to scan, and distinct from work surfaces. */
@media (min-width:1025px){
  .app-sidebar{
    width:var(--sidebar-width);padding:20px 16px 16px;background:#fbfaf7;color:var(--ink-strong);
    border-right:1px solid var(--line);box-shadow:10px 0 36px rgba(42,43,54,.025)
  }
  .app-sidebar .brand{color:var(--ink-strong)}
  .app-sidebar .brand-accent{color:var(--brand)}
  .app-sidebar .nav-links a,.sidebar-foot a,.sidebar-foot button{color:#515a6d}
  .app-sidebar .nav-links a:hover,.sidebar-foot a:hover,.sidebar-foot button:hover{background:#f0eee9;color:var(--ink-strong)}
  .app-sidebar .nav-links a.active,.sidebar-foot a.active{background:#e9e5ff;color:#3e2eaa;box-shadow:inset 3px 0 #6653e4}
  .nav-section-label{color:#9a9388}
  .sidebar-foot{border-top-color:var(--line)}
  .biz-btn{color:var(--ink-strong);background:#f1efe9;border-color:transparent}
  .biz-btn:hover{background:#ece9e2}
  .biz-copy small,.biz-chevron{color:#8b8378}
  .biz-avatar{background:#ded8ff;color:#4534ba}
  .biz-dropdown{left:236px;top:80px}
  main{width:calc(100% - var(--sidebar-width));margin-left:var(--sidebar-width);padding:36px clamp(32px,3.5vw,64px) 64px}
}

/* A consistent top-of-page rhythm across every workflow. */
.page-header{min-height:52px;margin-bottom:24px;align-items:flex-end}
.page-header h1{font-size:30px;font-weight:780;letter-spacing:-.045em}
.page-count{font-size:13px}
.card{border-color:rgba(218,214,205,.8);box-shadow:var(--shadow-sm)}
.card>summary{min-height:26px}

/* Records are the primary object: denser, clearer and less card-heavy. */
.table-scroll{border-color:var(--line);border-radius:14px;box-shadow:none}
table{font-variant-numeric:tabular-nums}
th{height:40px;background:#f4f2ed;color:#777f8e;letter-spacing:.075em}
td{height:52px}
tbody tr{transition:background .12s ease}
tr:hover td,tr[data-href]:hover td{background:#faf9f6}
.num{font-variant-numeric:tabular-nums}
.badge{border-radius:7px;letter-spacing:.02em}

/* Forms read as guided work areas instead of stacks of generic inputs. */
input,select,textarea{background:#fff;border-color:var(--line-strong)}
.form-row,.filter-row{gap:12px}
details.card>summary{color:var(--ink-strong);font-weight:700;list-style:none}
details.card>summary::-webkit-details-marker{display:none}
details.card>summary::after{content:'+';float:right;color:var(--brand);font-size:18px;font-weight:500}
details.card[open]>summary::after{content:'–'}
.btn{border-radius:10px;box-shadow:none}
.btn:hover{box-shadow:0 8px 18px rgba(69,52,186,.14)}
.btn-outline:hover{box-shadow:none}

/* Predictable navigation for long ledgers and contact lists. */
.pagination{height:auto;position:static;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:14px;margin:18px 0 0;padding:14px 2px 0;background:transparent;color:var(--ink);box-shadow:none}
.pagination a,.pagination .is-disabled{min-height:40px;display:inline-flex;align-items:center;gap:7px;width:max-content;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--ink);font-size:13px;font-weight:700;text-decoration:none}
.pagination a:last-child,.pagination .is-disabled:last-child{justify-self:end}
.pagination a:hover{border-color:#bbb2ef;background:var(--brand-soft);color:var(--brand-strong)}
.pagination .is-disabled{opacity:.42}
.pagination-status{font-size:12px;color:var(--ink-muted);text-align:center}

/* Page-level distinctions keep major tasks recognizable at a glance. */
.transactions-page .transaction-tools{background:#efecff!important;border-color:#ddd7ff!important}
.transactions-page .transaction-tools>.tt-bar{min-height:58px!important}
.transactions-page main>.card{background:#fff}
.transactions-page .tx-result-line{justify-content:space-between}
.transactions-page .tx-clear{display:inline-flex;align-items:center;gap:4px}
.contacts-page details.card{background:#eef5f3}
.contacts-page main>section.card{background:#fff}
.accounts-page .account-add-card{background:#f0edf9}

/* Mobile keeps the primary records ahead of setup and avoids double framing. */
@media (max-width:1024px){
  .app-sidebar{background:#fbfaf7;border-bottom-color:var(--line)}
  main{padding:28px 24px 48px}
}
@media (max-width:640px){
  body{background:#f5f4f0}
  .app-sidebar{height:58px;min-height:58px;padding:0 14px}
  .app-sidebar .brand img{width:30px;height:30px}
  main{padding:22px 12px calc(94px + env(safe-area-inset-bottom))}
  .page-header{min-height:auto;margin-bottom:18px;align-items:center}
  .page-header h1{font-size:25px}
  .card{padding:16px;border-radius:17px}
  .table-scroll{border-radius:12px}
  .mobile-tabbar{background:rgba(255,255,255,.96);border-top-color:var(--line);box-shadow:0 -10px 30px rgba(30,32,43,.07);backdrop-filter:blur(12px)}
  .mobile-tabbar a.active,.mobile-tabbar button.active{background:#ece8ff;color:var(--brand-strong)}
  .pagination{grid-template-columns:1fr 1fr;margin-top:14px;padding-top:12px}
  .pagination-status{grid-column:1/-1;grid-row:1}
  .pagination a,.pagination .is-disabled{width:100%;justify-content:center}
  .transactions-page main>.card{padding:14px}
  .transactions-page .tx-cards{margin-left:-14px!important;margin-right:-14px!important}
  .transactions-page .tx-card{padding:13px 14px!important;background:#fff}
  .transactions-page .tx-result-line{margin-top:14px}
}

/* 2026.11 density pass — see more records per screen on desktop and phone. */
th,td{padding:7px 12px}
th{height:34px}
td{height:40px}
.card{padding:18px;margin-bottom:16px}
.card h2{margin-bottom:12px}
.page-header{min-height:40px;margin-bottom:16px}
.page-header h1{font-size:24px}
.dashboard-page .two-col td{white-space:nowrap;font-size:12.5px}
.dashboard-page .two-col td:nth-child(3){max-width:220px;overflow:hidden;text-overflow:ellipsis}
.dashboard-page .dash-actions{margin-bottom:16px}
.dashboard-page .dash-actions a,.dashboard-page .dash-actions button{min-height:58px;padding:9px 12px}
.dashboard-focus-grid{gap:16px;margin-bottom:20px}
.financial-pulse{padding:20px 22px}
.pulse-profit{margin:14px 0 14px}
.pulse-profit strong{font-size:32px}
.pulse-trend{margin-top:14px;padding-top:12px}
.pulse-pair{height:64px}
.attention-panel{padding:18px}
.attention-row{padding:10px 2px}
.reports-page .report-hero{padding:18px 24px;margin-bottom:16px}
@media (min-width:1025px){
  main{padding-top:24px;padding-bottom:40px}
  .app-sidebar{overflow-y:auto}
  .app-sidebar .nav-links a,.sidebar-foot a,.sidebar-foot button{min-height:36px;padding:6px 10px}
  .nav-section-label{padding:10px 10px 3px}
}
@media (max-width:640px){
  main{padding-top:14px}
  .page-header{margin-bottom:12px}
  .page-header h1{font-size:21px;text-align:left;align-self:flex-start}
  .card{padding:12px;margin-bottom:12px}
  th,td{padding:7px 8px}
  td{height:auto}
  /* Transactions: four create/export actions in one row instead of a 2x2 block. */
  .transactions-page .page-header > div{grid-template-columns:repeat(4,1fr)!important;gap:6px!important}
  .transactions-page .page-header > div .btn,.transactions-page .page-header > div > .menu-drop > summary{min-height:38px;padding:6px 4px;font-size:12px;white-space:nowrap}
  .transactions-page .transaction-tools>.tt-bar{min-height:46px!important}
  .transactions-page .tx-more > summary.tx-more-btn{min-height:38px!important}
  /* Contacts: search button inline, slimmer checkbox column. */
  .contacts-page .filter-row{flex-direction:row!important;flex-wrap:nowrap!important;align-items:stretch}
  .contacts-page .filter-row .btn{width:auto!important;flex:none}
  .contacts-page form input[name="q"]{min-width:0!important}
  .contacts-page td:first-child,.contacts-page th:first-child{width:36px;padding-left:6px;padding-right:0}
  /* Dashboard: compress the monthly pulse so recent work shows sooner. */
  .dashboard-page .dash-actions a,.dashboard-page .dash-actions button{min-height:56px}
  .financial-pulse{padding:16px}
  .pulse-profit{margin:12px 0}
  .pulse-profit strong{font-size:28px}
  .pulse-flows{grid-template-columns:1fr 1fr;gap:12px}
  .pulse-pair{height:52px}
  /* Reports: compact hero and KPIs. */
  .reports-page .report-hero{padding:14px 16px}
  .reports-page .report-hero p{display:none}
  .reports-page .report-hero h1{font-size:22px;margin:0}
  .reports-page .stat-item{padding:9px 11px}
  .reports-page .report-card{min-height:0;padding:12px}
  .reports-page .rc-desc{display:none}
  .reports-page .rc-icon{margin-bottom:6px}
}
@media (min-width:641px){
  /* Generic input min-height was stretching every table row with a checkbox. */
  td input[type=checkbox],th input[type=checkbox]{min-height:0;height:16px;width:16px;vertical-align:middle}
}
/* Dashboard recent lines: drop the account column so amount + status fit. */
.dashboard-page .two-col .card:first-child th:nth-child(2),.dashboard-page .two-col .card:first-child td:nth-child(2){display:none}
.dashboard-page .two-col th,.dashboard-page .two-col td{padding-left:8px;padding-right:8px}
.dashboard-page .two-col td:nth-child(3){max-width:150px}
/* Dashboard recent tables: drop the 540px table min-width so Status fits in the half-width card. */
.dashboard-page .two-col table{min-width:0;width:100%}
.dashboard-page .two-col td:nth-child(3),.dashboard-page .two-col th:nth-child(3){max-width:0;width:100%;overflow:hidden;text-overflow:ellipsis}
@media (max-width:1199px){.dashboard-page .two-col{grid-template-columns:1fr}}
@media (max-width:640px){
  .dashboard-page .two-col th,.dashboard-page .two-col td{padding-left:6px;padding-right:6px;font-size:12px}
  .dashboard-page .two-col .card:last-child th:nth-child(2),.dashboard-page .two-col .card:last-child td:nth-child(2){display:none}
  .dashboard-page .two-col .badge{padding:2px 5px;font-size:9px}
}
/* Transactions table: one line per record — long contact names / references truncate (full name on hover). */
.tx-table-wrap td,.tx-table-wrap th{white-space:nowrap}
.tx-table-wrap td.tx-contact{max-width:0;width:55%;min-width:100px;overflow:hidden;text-overflow:ellipsis}
.tx-table-wrap td.tx-ref{max-width:0;width:45%;min-width:80px}
.tx-ref-text{display:inline-block;max-width:calc(100% - 36px);overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}
.tx-ref-text:only-child{max-width:100%}
@media (max-width:1279px){.tx-table-wrap th:nth-child(2),.tx-table-wrap td:nth-child(2){display:none}.tx-table-wrap th,.tx-table-wrap td{padding-left:8px;padding-right:8px}}
@media (min-width:1025px) and (max-width:1120px){:root{--sidebar-width:228px}.biz-dropdown{left:200px}main{padding-left:20px;padding-right:20px}}

/* Follow-up pass: remaining pages. */
/* Report period / as-of filters: one compact row instead of a tall stacked box. */
.report-toolbar{flex-direction:row;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:10px 14px;margin-bottom:14px}
.report-toolbar label{margin:0}
.report-toolbar select,.report-toolbar input[type=date]{width:auto;min-width:160px;min-height:36px;margin:0}
.report-toolbar .btn{width:auto;min-height:36px}
/* Codes never break mid-code. */
td code,td[style*="monospace"]{white-space:nowrap}
/* Contact detail KPIs: slimmer. */
.stat-grid .stat-card{padding:12px 16px}
.stat-grid .stat-card .stat-value{font-size:22px}
/* Reconcile: bank cards fill the row instead of floating apart. */
.acct-cards{grid-template-columns:repeat(auto-fill,minmax(240px,1fr))}
.acct-cards .acct-card{width:auto;max-width:none}
/* Accounts: add form is a collapsed row above the table. */
.accounts-page .add-card{background:#f0edf9;order:0!important}
.accounts-page .add-card form{display:grid;grid-template-columns:130px minmax(160px,1.4fr) 140px 100px minmax(160px,1.4fr) auto;gap:10px;align-items:end;margin-top:12px}
.accounts-page .add-card .form-row{display:contents}
.accounts-page .add-card .form-group{margin:0}
.accounts-page .add-card button[type=submit]{width:auto!important;min-height:40px}
@media (max-width:1100px){.accounts-page .add-card form{grid-template-columns:1fr 1fr}}
@media (max-width:640px){
  .accounts-page .add-card form{grid-template-columns:1fr}
  .stat-grid{gap:8px}
  .stat-grid .stat-card{padding:10px;min-width:0}
  .stat-grid .stat-card .stat-value{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  /* Contacts / list counts sit beside the title, not on their own line. */
  .page-header:has(> h1 + .page-count){flex-direction:row;align-items:baseline;justify-content:space-between}
  /* Back-link headers (reports, contact, transaction): left-aligned, actions on the same row. */
  .page-header:has(.back-link){flex-direction:row;align-items:center;justify-content:space-between;text-align:left}
  .page-header:has(.back-link) > div:first-child{justify-content:flex-start;min-width:0}
  .page-header:has(.back-link) h1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .page-drop-hint-bar{display:none}
  /* Transaction line items fit the phone: wrap text columns, drop the (usually 0%) tax column. */
  table.line-items{min-width:0!important;font-size:11.5px}
  table.line-items th{white-space:normal}
  table.line-items th,table.line-items td{padding-left:4px;padding-right:4px}
  table.line-items td:first-child,table.line-items td:nth-child(4){white-space:normal}
  table.line-items th:nth-child(5),table.line-items td:nth-child(5){display:none}
  /* Comfortable 44px tap targets on the Transactions action row. */
  .transactions-page .page-header > div .btn,.transactions-page .page-header > div > .menu-drop > summary{min-height:44px}
  /* Dashboard statement lines: status as a coloured dot so descriptions get the room. */
  .dashboard-page .two-col .card:first-child td .badge{font-size:0;width:10px;height:10px;padding:0;border-radius:50%;display:inline-block;vertical-align:middle}
  .dashboard-page .two-col .card:first-child td .badge-green{background:var(--positive)}
  .dashboard-page .two-col .card:first-child td .badge-yellow{background:#e0a100}
  .dashboard-page .two-col .card:first-child th:last-child{font-size:0;width:22px}
}
@media (max-width:380px){table.line-items th:nth-child(3),table.line-items td:nth-child(3){display:none}}
/* Tax estimate: stack the add-backs and computation panels until there's room for both. */
@media (max-width:1279px){main:has(.tax-step) .two-col{grid-template-columns:1fr}}
/* Tablet transactions: let contact/reference shrink further so Status fits. */
@media (max-width:900px){.tx-table-wrap td.tx-contact{min-width:70px}.tx-table-wrap td.tx-ref{min-width:60px}}
/* Payment form lines on phone: description on its own row, account + amount below. */
@media (max-width:640px){
  .pline{display:grid!important;grid-template-columns:minmax(0,1fr) 96px auto;gap:6px}
  .pline .desc{grid-column:1/-1}
  .pline select{min-width:0!important;width:100%}
  .pline .amt{width:100%!important}
}
.contacts-page td.date{white-space:nowrap}
/* Line items when the detail card is narrow (sidebar + attachments panel). */
@media (max-width:1279px){
  table.line-items{min-width:0!important}
  table.line-items th,table.line-items td{padding-left:6px;padding-right:6px}
  table.line-items th:nth-child(5),table.line-items td:nth-child(5){display:none}
}
@media (max-width:640px){.page-header .page-sub{display:none}}
@media (max-width:900px){.contacts-page th,.contacts-page td{padding-left:7px;padding-right:7px}}
/* Root fix: the generic input sizing (width:100%, 40px min-height) must not stretch checkboxes/radios. */
input[type=checkbox],input[type=radio]{width:auto;padding:0;min-height:20px}
/* Invoice/bill form line items on tablet & narrow desktop: give Description the room. */
@media (min-width:641px) and (max-width:1100px){
  .inv-lines .c-qty,.inv-lines .c-tax{width:56px}
  .inv-lines .c-amt{width:90px}
  .inv-lines .c-acc{width:160px}
  .inv-lines .c-tot{width:96px}
  .inv-lines th,.inv-lines td{padding-left:4px;padding-right:4px}
}
@media (max-width:1279px){.page-header .page-sub{display:none}}
/* Smart Import review: stack receipt preview above the form until both fit; let the grid shrink. */
@media (min-width:861px) and (max-width:1360px){
  .si-review-layout{grid-template-columns:220px minmax(0,1fr)}
  .si-line-fields{grid-template-columns:minmax(0,1fr) 60px 100px 60px}
  .si-line-fields .si-line-acct{grid-column:1/2}
  .si-line-fields .si-line-total{grid-column:2/4}
}
@media (max-width:860px){.si-doc-img{max-height:300px;object-fit:contain}}
.si-review-layout>*{min-width:0}
