:root {
  color-scheme: dark;
  --bg: #0a0e14; --panel: #111823; --panel2: #161f2c; --line: #223044; --line2: #2b3b52;
  --text: #e8eef6; --muted: #8696ab; --blue: #3aa0ff; --blue-d: #1d6fc0; --red: #f0545f; --red-d: #b8333d;
  --amber: #f0b45a; --radius: 12px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
body { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
h1, h2, h3 { margin: 0; font-weight: 600; }
a { color: inherit; text-decoration: none; }
.num, .pos, .neg, td.r, th.r { font-variant-numeric: tabular-nums; }
.pos { color: var(--blue); } .neg { color: var(--red); } .muted { color: var(--muted); }

/* sidebar */
.side { background: #0d131c; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: .2px; padding: 0 6px; }
.brand b { color: var(--blue); font-weight: 700; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--blue), var(--blue-d)); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: skewY(-28deg) scaleX(.8); opacity: .9; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
nav a:hover { background: var(--panel); color: var(--text); }
nav a.on { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--blue); }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 6px; }

/* top bar */
.main { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(10,14,20,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.journal-switch, .top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.journal-switch label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.view { padding: 24px 28px 60px; max-width: 1500px; }

/* controls */
select, input, textarea { background: #0c121b; color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
select { width: auto; min-width: 190px; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, nav a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn { border: 1px solid var(--line2); background: var(--panel2); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #04121f; font-weight: 600; }
.btn.primary:hover { background: #5ab4ff; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--red-d); color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 12px; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.panel > h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.section-title { text-align: center; letter-spacing: 6px; text-transform: uppercase; font-size: 12px; color: var(--muted); margin: 26px 0 14px; display: flex; align-items: center; gap: 14px; }
.section-title::before, .section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.page-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.page-title h1 { font-size: 22px; }

/* hero strip (zoals het voorbeeld: kapitaal / netto / opnames / eindsaldo) */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.strip .panel { text-align: center; padding: 18px 12px; }
.strip .v { font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.strip .l { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.strip .panel.hl { background: linear-gradient(160deg, #132338, var(--panel)); border-color: var(--line2); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .9px; }
.kpi .v { font-size: 22px; font-weight: 650; margin-top: 4px; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* tables */
.tbl-wrap { overflow-x: auto; padding-bottom: 16px; scrollbar-width: thin; scrollbar-color: #34465f transparent; }
.tbl-wrap::-webkit-scrollbar { height: 10px; }
.tbl-wrap::-webkit-scrollbar-track { background: transparent; }
.tbl-wrap::-webkit-scrollbar-thumb { background: #34465f; border-radius: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb:hover { background: #4a6285; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover td { background: rgba(58,160,255,.05); }
th.r, td.r { text-align: right; }
td.note { white-space: normal; min-width: 240px; max-width: 320px; color: var(--muted); font-size: 12.5px; display: table-cell; }
td.note > div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line2); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); margin-right: 4px; }
.tag.long { color: var(--blue); border-color: var(--blue-d); } .tag.short { color: var(--red); border-color: var(--red-d); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 170px; }
.bar-cell .track { flex: 1; height: 8px; background: #0c121b; border-radius: 4px; position: relative; }
.bar-cell .fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.filters input, .filters select { min-width: 130px; width: auto; }

/* coach */
.coach { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.coach li { padding: 10px 12px; border-radius: 9px; background: var(--panel2); border-left: 3px solid var(--line2); font-size: 13px; }
.coach li.good { border-left-color: var(--blue); } .coach li.warn { border-left-color: var(--amber); } .coach li.info { border-left-color: var(--muted); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { min-width: 190px; text-align: center; text-transform: capitalize; font-size: 17px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 120px; gap: 6px; }
.cal .dow { text-align: center; font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; padding: 4px; }
.cell { min-height: 82px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; text-align: left; color: inherit; font: inherit; }
.cell:hover { border-color: var(--blue); }
.cell.out { opacity: .25; cursor: default; }
.cell.sel { outline: 2px solid var(--blue); }
.cell .d { font-size: 12px; color: var(--muted); }
.cell .p { font-weight: 650; font-size: 14px; }
.cell .c { font-size: 11px; color: var(--muted); }
.cell.win { background: linear-gradient(160deg, rgba(58,160,255,.22), var(--panel)); border-color: rgba(58,160,255,.45); }
.cell.loss { background: linear-gradient(160deg, rgba(240,84,95,.22), var(--panel)); border-color: rgba(240,84,95,.45); }
.cell.week { cursor: default; background: var(--panel2); justify-content: center; align-items: center; text-align: center; }

/* modal & form */
.modal { position: fixed; inset: 0; background: rgba(3,6,10,.72); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; z-index: 20; }
.modal[hidden], .toast[hidden] { display: none; }
.dialog { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: min(760px, 100%); padding: 22px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.dialog.narrow { width: min(480px, 100%); }
.dialog h2 { font-size: 18px; margin-bottom: 16px; }
.form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.f { display: flex; flex-direction: column; gap: 4px; grid-column: span 2; }
.f.w3 { grid-column: span 3; } .f.w6 { grid-column: span 6; } .f.w4 { grid-column: span 4; }
.f select, .f input, .f textarea { min-width: 0; width: 100%; }
.f > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.f small { color: var(--muted); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span { display: inline-block; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line2); background: #0c121b; font-size: 12.5px; color: var(--muted); }
.chip input:checked + span { background: rgba(58,160,255,.18); border-color: var(--blue); color: var(--text); }
.chip.bad input:checked + span { background: rgba(240,84,95,.18); border-color: var(--red); }
.chip input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }
.net-preview { grid-column: span 6; padding: 12px 14px; border-radius: 10px; background: var(--panel2); display: flex; justify-content: space-between; align-items: center; }
.net-preview b { font-size: 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.err { color: var(--red); font-size: 12.5px; grid-column: span 6; min-height: 16px; }

.toast { position: fixed; bottom: 22px; right: 22px; background: var(--panel2); border: 1px solid var(--blue); padding: 11px 16px; border-radius: 10px; z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.empty { text-align: center; padding: 70px 20px; }
.empty h2 { font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 520px; margin: 0 auto 20px; }
.empty .btn { margin: 0 4px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.inline-form > * { width: auto; }
.help { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }

/* banners, screenshots, lightbox */
.banner { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--muted); font-size: 13px; }
.banner.warn { border-left-color: var(--amber); background: rgba(240,180,90,.1); }
.banner.info { border-left-color: var(--blue); }
#limitWarn:empty { display: none; }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.shot { position: relative; width: 104px; height: 70px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line2); background: #0c121b; }
.shot img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.shot-ph { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12px; }
.shot .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; line-height: 1; font-size: 15px; }
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.tag.pos { color: var(--blue); border-color: var(--blue-d); } .tag.neg { color: var(--red); border-color: var(--red-d); }
.net-preview { gap: 12px; }
.net-preview .muted { margin-left: auto; font-size: 12.5px; }
.cal-head .btn { min-width: 36px; }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3, .g-21, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px; gap: 8px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  .top, .view { padding-left: 14px; padding-right: 14px; }
  .form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f, .f.w3, .f.w4 { grid-column: span 1; } .f.w6, .net-preview, .err { grid-column: span 2; }
  .cal { grid-template-columns: repeat(7, minmax(0, 1fr)); } .cell.week, .dow.wk { display: none; }
  .cal-head h2 { min-width: 0; flex: 1; }
  .cal-head .muted { margin-left: 0 !important; width: 100%; } .cell { min-height: 60px; padding: 4px; }
  .strip .v { font-size: 20px; }
}
