/* Digital Mountain Cockpit — follows the digitalmountain.nl identity (Inter, ink #0E1116, #56CCF2 → #7FA8FF). */
:root {
    --ink: #0E1116;
    --brand-1: #56CCF2;
    --brand-2: #7FA8FF;
    --brand-gradient: linear-gradient(90deg, var(--brand-1), var(--brand-2));

    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-2: #F2F4F7;
    --border: #DCE1E8;
    --border-strong: #C5CCD6;
    --text: var(--ink);
    --muted: #5B6576;
    --link: #1C6FA3;
    --link-hover: #155A86;
    --positive: #1D7A4C;
    --negative: #B42318;
    --warning: #8F5300;
    --warning-bg: #FFF8EB;
    --warning-border: #F1D8A8;
    --error-bg: #FEF3F2;
    --error-border: #F4C7C2;
    --success-bg: #F0F8F3;
    --success-border: #C3E2CF;
    --info-bg: #F3F8FC;
    --info-border: #CFE3F1;
    --bar-revenue: #3AAEE0;
    --bar-expense: #A9B3C2;

    --radius: 4px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 14px; font-weight: 600; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pos { color: var(--positive); }
.neg { color: var(--negative); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; }
.site-header::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-gradient); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 68px; padding-top: 3px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand img { display: block; }
.wordmark { font-weight: 800; font-size: 17px; letter-spacing: -0.03em; line-height: 1.1; }
.wordmark .mountain { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.wordmark .product { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.nav { display: flex; align-items: stretch; gap: 2px; align-self: stretch; flex-wrap: wrap; }
.nav a { display: flex; align-items: center; padding: 0 11px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); border-bottom-color: var(--ink); }
.user-menu { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Page */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 28px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.content { display: flex; flex-direction: column; gap: 20px; padding-bottom: 48px; }

/* Panels */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-header a { font-size: 13px; }
.card-body { padding: 16px; }
.card-body > :first-child { margin-top: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* Key figures strip */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.figure { padding: 14px 18px; border-left: 1px solid var(--border); }
.figure:first-child { border-left: 0; }
.figure .label { color: var(--muted); font-size: 12.5px; }
.figure .value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.figure .sub { color: var(--muted); font-size: 12.5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom-color: var(--border-strong); }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); border-bottom: 0; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }

/* Status labels */
.badge { display: inline-block; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 3px; font-size: 12px; line-height: 18px; color: var(--muted); white-space: nowrap; background: var(--surface); }
.badge-needs_review, .badge-warning { color: var(--warning); border-color: var(--warning-border); background: var(--warning-bg); }
.badge-approved, .badge-success { color: var(--positive); border-color: var(--success-border); background: var(--success-bg); }
.badge-ignored { text-decoration: line-through; }
.badge-accent { color: var(--link); border-color: var(--info-border); background: var(--info-bg); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #232A35; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-danger { color: var(--negative); }
.btn-sm { padding: 3px 10px; font-size: 13px; }
form.inline { display: inline; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand-1); }

/* Invoice lines */
.invoice-lines { width: 100%; margin: 6px 0 8px; }
.invoice-lines th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 6px 4px 0; }
.invoice-lines td { padding: 0 6px 6px 0; border: 0; vertical-align: top; }
.invoice-lines tr:hover { background: none; }

/* Forms */
input, select, textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(86, 204, 242, .45); outline-offset: 0; border-color: #3AAEE0; }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0 8px 0 0; accent-color: var(--ink); }
.choice-list .choice { display: flex; align-items: center; font-weight: 400; margin-bottom: 6px; }
input[type="file"] { padding: 6px; }
label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field-check label { display: flex; align-items: center; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.form-errors { color: var(--negative); font-size: 12.5px; list-style: none; padding: 0; margin: 4px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.section-title { font-size: 13px; font-weight: 600; margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.section-title:first-child { margin-top: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters > div { min-width: 150px; }
.filters label { font-size: 12px; color: var(--muted); font-weight: 400; }

/* Messages */
.flash, .note { padding: 9px 14px; border-radius: var(--radius); border: 1px solid; }
.flash-success { background: var(--success-bg); border-color: var(--success-border); color: var(--positive); }
.flash-error { background: var(--error-bg); border-color: var(--error-border); color: var(--negative); }
.flash-info { background: var(--info-bg); border-color: var(--info-border); color: var(--link); }
.flash-warning, .note-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.note { background: var(--info-bg); border-color: var(--info-border); }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

/* VAT form */
.vat-form td.box { font-weight: 700; width: 52px; font-variant-numeric: tabular-nums; }
.vat-form tr.section td { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--muted); }
.vat-form tr.total td { font-size: 15px; font-weight: 700; border-top: 2px solid var(--ink); }
.vat-form tr.zero td:not(.box) { color: var(--muted); }
details summary { cursor: pointer; color: var(--link); font-size: 12.5px; }
details table { margin-top: 6px; font-size: 12.5px; }
details td { padding: 4px 8px; }

/* Chart */
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; align-items: end; height: 180px; padding-top: 10px; border-bottom: 1px solid var(--border-strong); }
.bar-group { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.bar { flex: 1; min-height: 1px; }
.bar.revenue { background: var(--bar-revenue); }
.bar.expense { background: var(--bar-expense); }
.bar-labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }

/* Calculation */
.breakdown { width: 100%; }
.breakdown td { border: 0; padding: 4px 0; }
.breakdown tr:hover { background: none; }
.breakdown tr.subtotal td { border-top: 1px solid var(--border); padding-top: 8px; font-weight: 600; }
.breakdown tr.grand td { border-top: 2px solid var(--ink); padding-top: 10px; font-size: 15px; font-weight: 700; }

.document-frame { width: 100%; height: 78vh; border: 0; display: block; background: #fff; }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; max-height: 340px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: var(--radius); margin: 0; }
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; background: var(--surface-2); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; position: relative; overflow: hidden; }
.login .card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-gradient); }
.login .brand { margin-bottom: 22px; }
.login .btn { width: 100%; justify-content: center; }

@media (max-width: 1100px) {
    .header-inner { flex-wrap: wrap; gap: 8px 20px; padding-bottom: 0; }
    .nav { order: 3; width: 100%; min-height: 40px; }
    .nav a { padding: 0 10px 0 0; margin-right: 6px; }
    .split { grid-template-columns: 1fr; }
    .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .figure:nth-child(3) { border-left: 0; }
    .figure:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 640px) {
    .wrap { padding: 0 16px; }
    .nav { overflow-x: auto; flex-wrap: nowrap; }
    .nav a { white-space: nowrap; }
    .grid-2, .grid-3, .form-grid, .figures { grid-template-columns: 1fr; }
    .figure { border-left: 0; border-top: 1px solid var(--border); }
    .figure:first-child { border-top: 0; }
    .bars, .bar-labels { gap: 3px; }
}
