/* IL Accounts — light, compact business-tool styling. No frameworks. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #1f2933;
  --muted: #6b7280;
  --accent: #1d5fd1;
  --accent-hover: #174cab;
  --danger: #c62828;
  --neg: #b42318;
  --pos: #067647;
  --zebra: #fafbfc;
  --hover: #eef3fb;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 16px; }
h2 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.h-sub { font-size: 14px; font-weight: 400; margin-left: 6px; }
.h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; }
.empty { padding: 32px 0; text-align: center; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--zebra); padding: 1px 4px; border-radius: 3px; }

/* Layout */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; height: 48px; }
.brand { font-weight: 700; color: var(--text); font-size: 15px; }
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a { color: var(--text); padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.topbar nav a:hover { background: var(--hover); text-decoration: none; }
.topbar nav a.active { background: var(--accent); color: #fff; }
.userbox { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .topbar-inner { height: auto; flex-wrap: wrap; padding: 8px 12px; } }

/* Flash */
.flashes { margin-bottom: 16px; }
.flash { padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; font-size: 13px; border: 1px solid; }
.flash-success { background: #ecfdf3; border-color: #a6f4c5; color: var(--pos); }
.flash-error { background: #fef3f2; border-color: #fecdca; color: var(--neg); }
.flash-info { background: #eff6ff; border-color: #bfdbfe; color: var(--accent); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.card-warn { border-color: #f5c26b; background: #fffaf0; }
.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card-value { font-size: 24px; font-weight: 600; margin: 4px 0 2px; }
.action-list { list-style: none; padding: 0; margin: 0 0 8px; }
.action-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
th, td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th { background: #f1f3f6; font-weight: 600; font-size: 12px; color: #374151; white-space: nowrap; }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:hover { background: var(--hover); }
tfoot th { background: #f1f3f6; }
table.compact th, table.compact td { padding: 5px 8px; }
table.kv th { width: 34%; font-weight: 500; color: var(--muted); text-align: left; }
table.kv tr:nth-child(even) { background: transparent; }
td.r, th.r { text-align: right; }
.num, td.r { font-variant-numeric: tabular-nums; }
.ccy { font-size: 11px; color: var(--muted); margin-left: 2px; }
.usd { font-size: 12px; white-space: nowrap; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
td.indent { padding-left: 24px; }
tr.group-row td { background: #f7f8fa; }
tr.sub-row { font-size: 12px; }
table.aging th, table.aging td { padding: 5px 6px; }

/* Status pills */
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: capitalize; background: #e5e7eb; color: #374151; white-space: nowrap; }
.pill-open { background: #dbeafe; color: #1e40af; }
.pill-partial { background: #fef3c7; color: #92400e; }
.pill-paid { background: #d1fae5; color: #065f46; }
.pill-cancelled { background: #e5e7eb; color: #6b7280; }
.pill-refunded { background: #ede9fe; color: #5b21b6; }
.pill-written_off { background: #fee2e2; color: #991b1b; }
.pill-draft { background: #f3f4f6; color: #6b7280; }
.pill-unmatched { background: #fee2e2; color: #991b1b; }
.pill-matched { background: #d1fae5; color: #065f46; }
.pill-categorised { background: #dbeafe; color: #1e40af; }
.pill-transfer { background: #e0e7ff; color: #3730a3; }
.pill-ignored { background: #f3f4f6; color: #6b7280; }

/* Forms */
label { display: block; font-size: 13px; color: #374151; }
label > input, label > select, label > textarea { display: block; margin-top: 3px; width: 100%; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29,95,209,.15); }
input[type=file] { font-size: 13px; }
label.check { display: flex; align-items: center; gap: 6px; }
label.check input { width: auto; margin: 0; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.form-card p { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; gap: 10px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; }
.filters label { font-size: 12px; }
.filters label > input, .filters label > select { width: auto; min-width: 120px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.inline-form input, .inline-form select { width: auto; }
.inline-edit select { max-width: 200px; font-size: 12px; padding: 3px 6px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions-row form { margin: 0; }

/* Buttons */
.btn { display: inline-block; font: inherit; font-size: 13px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: #f3b4b4; }
.btn-danger:hover { background: #fef3f2; }
.btn-small { padding: 3px 8px; font-size: 12px; }
.btn-link { border-color: transparent; background: transparent; color: var(--accent); }
.btn-block { width: 100%; margin-top: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* Reconcile panel */
.txn-row { cursor: pointer; }
.txn-row.is-open { background: var(--hover); }
.txn-panel > td { background: #fbfcfe; padding: 12px 16px 16px; border-bottom: 2px solid var(--border); }
.txn-panel:hover { background: transparent; }
.panel { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .panel { grid-template-columns: 1fr; } }
.panel-col form.inline-form { display: grid; grid-template-columns: 1fr; gap: 8px; }
.panel-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.suggestion { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); margin-bottom: 6px; }
.suggestion .s-main { flex: 1; min-width: 0; }
.suggestion .s-amount { white-space: nowrap; }
.suggestion .s-reason { font-size: 11px; color: var(--muted); }
.js-panel-msg { margin-top: 8px; min-height: 1em; }
.js-panel-msg.err { color: var(--neg); }
.js-panel-msg.ok { color: var(--pos); }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 32px; width: 340px; }
.login-card h1 { margin-bottom: 4px; }
.login-card p { margin: 0 0 20px; }
.login-card label { margin-bottom: 12px; }

/* Attachments (reconcile / transactions panels) */
.attachment { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); margin-bottom: 6px; }
.attachment .a-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
h3.mt { margin-top: 16px; }

/* Month-end / Inbox banners */
.banner { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; font-size: 13px; }
.banner-ok { background: #ecfdf3; border-color: #a6f4c5; color: var(--pos); }
.banner-err { background: #fef3f2; border-color: #fecdca; color: var(--neg); }
.banner-muted { background: var(--zebra); }
.banner table { background: var(--surface); color: var(--text); }
tr.row-stale td { color: var(--neg); }
