/* Ledgerline: plain CSS, no external fonts or CDNs */
:root {
  --ink: #0f172a; --ink2: #475569; --ink3: #94a3b8; --line: #e2e8f0; --bg: #f5f6fa; --card: #fff;
  --nav: #111936; --nav2: #1b2550; --navtext: #c7cdf0; --accent: #5146e5; --accent2: #eef0ff;
  --ok: #047857; --okbg: #e7f7ef; --info: #1d4ed8; --infobg: #e8efff; --warn: #a15c07; --warnbg: #fdf3e1;
  --err: #b42318; --errbg: #fdecea; --neutral: #475569; --neutralbg: #eef1f5;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--ink2); } .faint { color: var(--ink3); } .small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: 12px; white-space: nowrap; }
.inv-no { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* environment banner */
.env-banner { display: flex; align-items: center; justify-content: center; gap: 10px; height: 30px; font-size: 12px;
  font-weight: 700; letter-spacing: .08em; position: sticky; top: 0; z-index: 20; }
.env-banner .sub { font-weight: 500; letter-spacing: .01em; opacity: .9; }
.env-staging { background: repeating-linear-gradient(-45deg, #f59e0b, #f59e0b 14px, #f7a928 14px, #f7a928 28px); color: #3b2300; }
.env-production { background: #b42318; color: #fff; }
.env-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 30px); background: linear-gradient(to right, var(--nav) 236px, transparent 236px); }
.sidebar { background: var(--nav); color: var(--navtext); display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 30px; height: calc(100vh - 30px); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; padding: 4px 8px 18px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11px; color: var(--navtext); font-weight: 500; letter-spacing: 0; }
.tenant { background: var(--nav2); border-radius: 8px; padding: 9px 10px; margin: 0 0 16px; font-size: 12.5px; }
.tenant b { color: #fff; display: block; font-size: 13px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--navtext); padding: 8px 10px; border-radius: 7px; margin-bottom: 2px; font-weight: 500; }
.nav a:hover { background: var(--nav2); color: #fff; text-decoration: none; }
.nav a.active { background: #2a3570; color: #fff; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav .section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7d86b8; padding: 14px 10px 6px; }
.sidebar .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid #253064; margin-top: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #5146e5; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.me b { color: #fff; font-size: 13px; display: block; line-height: 1.2; }
.me a { color: var(--navtext); font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 26px 36px 18px; }
.crumbs { font-size: 12.5px; color: var(--ink2); margin-bottom: 6px; }
.crumbs a { color: var(--ink2); }
.content { padding: 0 36px 36px; flex: 1; }
.footer { padding: 14px 36px 22px; color: var(--ink3); font-size: 12px; display: flex; justify-content: space-between; }

/* components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g2 { grid-template-columns: 1fr 1fr; }
.g-side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 12.5px; color: var(--ink2); font-weight: 500; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .hint { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn svg { width: 15px; height: 15px; }
.actions { display: flex; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--okbg); } .badge.info { color: var(--info); background: var(--infobg); }
.badge.warn { color: var(--warn); background: var(--warnbg); } .badge.error { color: var(--err); background: var(--errbg); }
.badge.neutral { color: var(--neutral); background: var(--neutralbg); }
.chip { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; border-radius: 5px; background: var(--neutralbg); color: var(--ink2); }
.chip.EUR { background: #eef0ff; color: #3f37c9; } .chip.USD { background: #e7f7ef; color: #047857; } .chip.GBP { background: #fdf3e1; color: #a15c07; }
.plan { font-size: 12.5px; font-weight: 600; }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink2); background: #f8fafc; padding: 10px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbff; }
table.data th.num, table.data td.num { text-align: right; }
.cust-cell b { display: block; font-weight: 600; } .cust-cell span { color: var(--ink3); font-size: 12.5px; }

.filters { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; color: var(--ink); border: 1px solid #d0d5dd; border-radius: 8px; padding: 8px 11px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7c4fb; border-color: var(--accent); }
.filters input[type=text] { width: 260px; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 11px; border-radius: 7px; color: var(--ink2); font-weight: 600; font-size: 13px; }
.tabs a.on { background: var(--accent2); color: var(--accent); }
.tabs a:hover { text-decoration: none; background: #f1f3f9; }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: var(--okbg); color: var(--ok); } .flash.error { background: var(--errbg); color: var(--err); }

dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 9px 12px; margin: 0; }
dl.kv dt { color: var(--ink2); } dl.kv dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 8px 0; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c7cdf0; margin-top: 6px; }
.timeline .when { font-size: 12px; color: var(--ink3); }
.callout { border: 1px solid #f3d29b; background: #fffaf0; color: #7a4a03; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.bar { height: 6px; border-radius: 6px; background: #eef1f5; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); }

/* login */
.login-wrap { min-height: calc(100vh - 30px); display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(1200px 600px at 10% 10%, #2a3570, var(--nav)); color: #dfe3ff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h2 { font-size: 30px; line-height: 1.2; color: #fff; max-width: 440px; letter-spacing: -.02em; }
.login-art p { max-width: 420px; color: #b8bfeb; font-size: 15px; }
.login-form { display: grid; place-items: center; padding: 40px; }
.login-form form { width: 360px; }
.login-form label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.login-form input { width: 100%; padding: 10px 12px; }
.login-form .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 10px; }

/* invoice document */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(16,24,40,.08); padding: 48px 52px; color: #1e293b; position: relative; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 34px; }
.issuer-brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 20px; color: #0b3b5c; letter-spacing: -.01em; }
.inv-title { text-align: right; }
.inv-title .word { font-size: 28px; font-weight: 300; letter-spacing: .18em; color: #0b3b5c; }
.inv-title .no { font-size: 14px; font-weight: 650; margin-top: 2px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 24px; margin-bottom: 30px; font-size: 13px; }
.inv-parties h4, .inv-pay h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }
.inv-parties p { margin: 0; line-height: 1.55; }
.inv-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; margin: 0; }
.inv-meta dt { color: #64748b; white-space: nowrap; } .inv-meta dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }
table.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lines th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 650;
  padding: 9px 8px; border-bottom: 2px solid #0b3b5c; }
table.lines td { padding: 12px 8px; border-bottom: 1px solid #e8edf3; vertical-align: top; }
table.lines td .detail { color: #64748b; font-size: 12px; margin-top: 2px; }
table.lines .num { text-align: right; }
.inv-bottom { display: grid; grid-template-columns: 1fr 290px; gap: 36px; margin-top: 22px; align-items: start; }
.totals { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.totals td { padding: 7px 8px; } .totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.totals tr.grand td { border-top: 2px solid #0b3b5c; padding-top: 12px; font-size: 17px; font-weight: 750; color: #0b3b5c; }
.totals tr.grand td:first-child { font-size: 14px; }
.vat-note { font-size: 12px; color: #64748b; margin-top: 10px; }
.inv-pay { font-size: 12.5px; background: #f8fafc; border: 1px solid #e8edf3; border-radius: 6px; padding: 14px 16px; }
.inv-pay dl { display: grid; grid-template-columns: 76px 1fr; gap: 3px 10px; margin: 0; }
.inv-pay dt { color: #64748b; } .inv-pay dd { margin: 0; font-weight: 600; }
.inv-foot { margin-top: 36px; padding-top: 14px; border-top: 1px solid #e8edf3; font-size: 11.5px; color: #94a3b8; display: flex; justify-content: space-between; gap: 20px; }
.stamp { position: absolute; top: 120px; right: 52px; transform: rotate(-8deg); border: 3px solid currentColor; border-radius: 8px;
  padding: 4px 14px; font-weight: 800; letter-spacing: .14em; font-size: 18px; opacity: .55; }
.stamp.Paid { color: #047857; } .stamp.Overdue { color: #b42318; } .stamp.Draft { color: #64748b; }

/* print page */
.print-body { background: #e9ecf2; }
.print-toolbar { display: flex; justify-content: space-between; align-items: center; max-width: 210mm; margin: 18px auto 12px; }
.a4 { width: 210mm; min-height: 297mm; margin: 0 auto 40px; padding: 18mm 18mm 14mm; border-radius: 2px; }
@page { size: A4; margin: 0; }
@media print {
  .print-body { background: #fff; }
  .print-toolbar, .env-banner { display: none !important; }
  .a4 { margin: 0; box-shadow: none; border: 0; }
}
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-side { grid-template-columns: 1fr; } }
.inv-pay dd { white-space: nowrap; } .inv-pay .mono { font-size: 11.5px; letter-spacing: -.02em; }
