/* CK Payment Collections: shell styled after the lookbook (dark navy sidebar, teal primary). */
:root {
  --navy: #0b1f3a;
  --navy-2: #12305a;
  --teal: #0f6b5f;
  --teal-dark: #0b5248;
  --bg: #eef2f6;
  --card: #fff;
  --border: #d5dde6;
  --text: #14233a;
  --muted: #5a6b80;
  --amber-bg: #fdecc8;
  --amber-text: #6b4a00;
  --focus: #1d6fe8;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; }
h1 { font-size: 1.9rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #dbe5f2; padding: 1.25rem .75rem; }
.brand { padding: 0 .5rem 1.25rem; display: flex; flex-direction: column; }
.brand-name { font-weight: 800; font-size: 1.45rem; letter-spacing: .02em; color: #fff; }
.brand-sub { font-size: .9rem; color: #aebdd1; }
.brand.dark .brand-name { color: var(--navy); }
.brand.dark .brand-sub { color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: 8px; color: #dbe5f2; text-decoration: none; margin-bottom: .15rem; }
.nav-item:hover:not(.disabled) { background: var(--navy-2); }
.nav-item.active { background: var(--teal); color: #fff; font-weight: 600; }
.nav-item.disabled { color: #7d8fa8; cursor: default; }
.nav-icon { width: 1.25rem; text-align: center; }

.content { display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: .6rem 1.25rem; display: flex; justify-content: space-between; align-items: center; }
.company-form { display: flex; align-items: center; gap: .6rem; }
.company { padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; font: inherit; min-width: 240px; }
.user { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-2); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; }
.page { padding: 1.5rem 1.5rem 3rem; max-width: 1400px; width: 100%; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem; margin-top: 1.25rem; }
.btn { display: inline-block; padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid var(--teal); color: var(--teal); background: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.notice { background: var(--amber-bg); color: var(--amber-text); padding: .6rem .8rem; border-radius: 8px; }

.bare { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 2rem; width: min(440px, 100%); box-shadow: 0 6px 24px rgba(11, 31, 58, .08); }
.auth-card .brand { padding-bottom: 1rem; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: .5rem; }
  .sidebar nav { display: flex; overflow-x: auto; gap: .25rem; }
  .brand { display: none; }
  .nav-item { white-space: nowrap; }
  .company { min-width: 0; width: 100%; max-width: 220px; }
}
@media print { .sidebar, .topbar { display: none; } .shell { display: block; } }

/* Customers */
.search label { display: block; font-weight: 600; margin-bottom: .35rem; }
.search-row { display: flex; gap: .6rem; }
.search-row input { flex: 1; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.field-error { color: #a4161a; font-weight: 600; margin: .5rem 0 0; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; background: #e8eef5; padding: .55rem .75rem; font-size: .9rem; }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.small { font-size: .85rem; }
.code { font-family: Consolas, monospace; font-weight: 600; }
.crumbs { margin: 0 0 .5rem; color: var(--muted); }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge.ok { background: #d9f2e4; color: #0b5b31; }
.badge.warn { background: var(--amber-bg); color: var(--amber-text); }
.badge.invoice { background: #dbeafe; color: #0b3a8a; }
.badge.cash { background: #e7e3fb; color: #3b2a8a; }
.accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.account-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.balance-label { color: var(--muted); font-size: .9rem; }
.balance { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance.credit { color: var(--teal); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 1rem 0 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details.summary { border-top: 1px solid var(--border); padding-top: .75rem; }
.details.summary .num { text-align: left; }
.overdue { color: #a4161a; font-weight: 700; }
.table tfoot th { background: #f3f6fa; border-top: 2px solid var(--border); }
.table-scroll { overflow-x: auto; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }

/* Statement transaction types: colour plus a text label, never colour alone */
.badge.t-invoice { background: #dbeafe; color: #0b3a8a; }
.badge.t-credit { background: #d9f2e4; color: #0b5b31; }
.badge.t-payment { background: #e7e3fb; color: #3b2a8a; }
.badge.t-adjust { background: var(--amber-bg); color: var(--amber-text); }
.badge.t-other { background: #e2e8f0; color: #334155; }
.filter-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.filter-row label { display: block; font-weight: 600; margin-bottom: .25rem; }
.statement .open-row td { background: #f1f5f9; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.inline { display: inline; margin: 0; }
@media print {
    .no-print, nav, .sidebar, .topbar, .company-form { display: none !important; }
    .card { box-shadow: none; border: 0; padding: 0; break-inside: avoid; }
    tr { break-inside: avoid; }
    thead { display: table-header-group; }
}
.stack > * + * { margin-top: .9rem; }
.stack input[type=text], .stack input[type=email], .stack input:not([type]) { width: 100%; max-width: 32rem; padding: .5rem; border: 1px solid var(--rule, #cbd5e1); border-radius: 6px; font: inherit; }
.stack label { display: block; font-weight: 600; margin-bottom: .25rem; }
.roles { border: 1px solid #cbd5e1; border-radius: 8px; padding: .75rem 1rem; }
.roles legend { font-weight: 600; padding: 0 .4rem; }
label.check { display: block; font-weight: 400; margin: .35rem 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.recon { position: sticky; top: 1rem; }
.recon .issues { margin: .5rem 0 0 1rem; padding: 0; }
.recon .issues li { margin: .25rem 0; }
.recon .issues.warn { color: var(--amber-text); }
.badge.bad { background: #fde2e2; color: #8a1111; }
.table.compact th, .table.compact td { padding: .25rem .4rem; font-size: .9rem; }
.table input:not([type=checkbox]), .table select { width: 100%; min-width: 5.5rem; padding: .35rem; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.table input.num { text-align: right; }
