/* Dispatch. Ad-operations console voor Frankie & Belle. */

@font-face {
  font-family: 'Archivo'; src: url('/fonts/archivo.woff2') format('woff2');
  font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400 700; font-display: swap;
}

:root {
  color-scheme: dark;

  --void:   #0A0C0D;
  --panel:  #12161A;
  --raise:  #1A2027;
  --line:   #252D36;
  --line-2: #313B46;
  --ink:    #DDE5EC;
  --ink-2:  #7E8B98;
  --signal: #FFB020;
  --live:   #3DDC97;
  --alert:  #FF5C5C;
  --mat:    #E8EAED;

  /* Gewichtsladder: hoeveelheden in vijf dekkingsstappen van dezelfde amber. */
  --w1: rgba(255,176,32,.16);
  --w2: rgba(255,176,32,.32);
  --w3: rgba(255,176,32,.50);
  --w4: rgba(255,176,32,.72);
  --w5: rgba(255,176,32,1);

  --ui: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 22px; --s6: 30px; --s7: 44px; --s8: 68px;

  --rail: 216px;
  --ease: cubic-bezier(.2,.7,.3,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; min-height: 100vh;
  background: var(--void);
  color: var(--ink);
  font: 400 16px/1.5 var(--ui);
  letter-spacing: -.005em;
}

::selection { background: rgba(255,176,32,.28); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; border-radius: 2px; }
/* De inhoud krijgt na elke navigatie focus zodat schermlezers meelopen. Dat is een
   container, geen bedieningselement, dus hij tekent geen ring. */
#view:focus, #view:focus-visible { outline: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--void); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }

h1, h2, h3 { margin: 0; font-family: var(--ui); font-weight: 650; letter-spacing: -.022em; text-wrap: balance; }
h1 { font-size: clamp(22px, 2.6vw, 28px); }
h2 { font-size: 18px; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 var(--s3); max-width: 68ch; }
a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: .94em; }

/* ============ raamwerk ============ */

.table { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--s5);
  padding: var(--s5) var(--s3);
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand { padding: 0 var(--s2); font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.25; }
.brand small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--signal); margin-top: 3px; font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: var(--s3);
  padding: 9px var(--s2); border-radius: 4px;
  color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: color .12s var(--ease), background .12s var(--ease);
}
.nav a:hover { background: var(--raise); color: var(--ink); }
.nav a[aria-current='page'] { background: var(--raise); color: var(--ink); font-weight: 600; }
.nav a[aria-current='page'] svg { color: var(--signal); }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .tally { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.rail-foot { margin-top: auto; padding: 0 var(--s2); font-family: var(--mono); font-size: 11px; color: var(--ink-2); display: grid; gap: 5px; }

.content { padding: var(--s5) var(--s6) var(--s8); max-width: 1440px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.head .sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; }

/* ============ vlakken ============ */

.piece { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: var(--s4); }
.piece--uncut { border-color: var(--line-2); border-style: dashed; }
.piece--cut { border-color: var(--signal); }
.piece__name { font-weight: 600; font-size: 15px; line-height: 1.3; }

/* Koppelmarkering tussen een concurrent-ad en ons product. */
.notch { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--signal); letter-spacing: .04em; text-transform: uppercase; }
.notch::before { content: ''; width: 6px; height: 6px; background: var(--signal); transform: rotate(45deg); }

/* Vlag: hier moet jij iets beslissen. */
.tack { display: flex; align-items: center; gap: var(--s2); font-size: 15px; color: var(--ink); }
.tack svg { width: 14px; height: 14px; color: var(--alert); flex: none; }

/* ============ trendtik: elk getal draagt zijn richting ============ */

.figure__value { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; color: var(--signal); }
.figure__label { font-family: var(--mono); font-size: 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .14em; }
.figure__unknown { font-family: var(--mono); font-size: 17px; color: var(--ink-2); }
.figure { display: flex; align-items: center; gap: var(--s2); }

.grain { display: inline-flex; align-items: center; height: 20px; }
.grain svg { width: 9px; height: 18px; }
.grain--up svg { color: var(--live); }
.grain--down svg { color: var(--alert); }
.grain--unknown svg { color: var(--line-2); }

/* ============ budgetrail met harde stop ============ */

.seam { display: grid; gap: 6px; }
.seam__track { position: relative; height: 8px; border-radius: 2px; background: var(--raise); overflow: hidden; border: 1px solid var(--line); }
.seam__fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); background: var(--signal); transition: transform .3s var(--ease); will-change: transform; }
.seam__fill.over { background: var(--alert); }
.seam__legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--ink-2); letter-spacing: .04em; }

/* ============ gewicht in plaats van kleurcodes ============ */

.weight { display: inline-block; width: 30px; height: 6px; border-radius: 1px; background: var(--w1); }
.weight[data-w='1'] { background: var(--w1); }
.weight[data-w='2'] { background: var(--w2); }
.weight[data-w='3'] { background: var(--w3); }
.weight[data-w='4'] { background: var(--w4); }
.weight[data-w='5'] { background: var(--w5); }

/* ============ bediening ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 7px var(--s4);
  text-decoration: none; text-align: center; line-height: 1.2;
  font: 600 17px/1.2 var(--ui);
  border: 1px solid var(--signal); border-radius: 4px;
  background: var(--signal); color: #16120A; cursor: pointer;
  transition: background .12s var(--ease), transform .08s var(--ease);
}
.btn:hover { background: #ffc043; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--quiet:hover { background: var(--raise); border-color: var(--ink-2); }
.btn--small { min-height: 32px; font-size: 14px; padding: 5px var(--s3); }
.btn svg { width: 16px; height: 16px; }

label { display: block; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px var(--s3);
  font: 400 16px/1.45 var(--ui); color: var(--ink);
  background: var(--void); border: 1px solid var(--line); border-radius: 4px;
}
input[type='number'] { font-family: var(--mono); }
textarea { min-height: 104px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: .62; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); background: var(--panel); }
.field { margin-bottom: var(--s4); }
.field__hint { font-size: 13px; color: var(--ink-2); margin-top: 5px; text-transform: none; letter-spacing: 0; }

/* ============ roosters ============ */

.grid { display: grid; gap: var(--s3); }
.grid--figures { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.grid--pieces { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }

/* ============ dichte lijsten ============ */

.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.sheet__row { display: grid; align-items: center; gap: var(--s4); padding: 9px var(--s4); border-bottom: 1px solid var(--line); }
.sheet__row:last-child { border-bottom: 0; }
.sheet__row:hover { background: var(--raise); }
.sheet__head { background: var(--void); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.sheet__head:hover { background: var(--void); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Beeld staat op een neutrale mat, nooit op de zwarte grond: anders beoordeel je
   helderheid en kleur verkeerd, en beeld beoordelen is hier het werk. */
.thumb { width: 46px; height: 58px; object-fit: cover; border-radius: 3px; background: var(--mat); flex: none; }
.thumb--wide { width: 100%; height: auto; aspect-ratio: 4/5; display: block; }
.mat { background: var(--mat); }

/* ============ toestanden ============ */

.state { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; padding: 3px 7px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--ink-2); }
.state--live { border-color: rgba(61,220,151,.4); color: var(--live); }
.state--warn { border-color: rgba(255,92,92,.4); color: var(--alert); }
.state--dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.empty { border: 1px dashed var(--line-2); border-radius: 5px; padding: var(--s6); text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: var(--s2); font-size: 17px; }
.empty p { margin-left: auto; margin-right: auto; }

.note { position: relative; padding-left: var(--s4); font-size: 14px; color: var(--ink-2); }
.note::before { content: ''; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; background: var(--signal); transform: rotate(45deg); }

.log { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 60; display: grid; gap: var(--s2); max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--raise); border: 1px solid var(--signal); color: var(--ink); padding: var(--s3) var(--s4); border-radius: 4px; font-size: 14px; animation: rise .24s var(--ease); }
.toast--bad { border-color: var(--alert); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.skeleton { background: linear-gradient(90deg, var(--panel), var(--raise), var(--panel)); background-size: 200% 100%; animation: sweep 1.3s ease-in-out infinite; border-radius: 4px; }
@keyframes sweep { to { background-position: -200% 0; } }

dialog { border: 1px solid var(--line-2); border-radius: 5px; background: var(--panel); color: var(--ink); padding: 0; max-width: 600px; width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(10,12,13,.76); }
.dialog__head { padding: var(--s4); border-bottom: 1px solid var(--line); }
.dialog__body { padding: var(--s4); max-height: 58vh; overflow-y: auto; }
.dialog__foot { padding: var(--s4); border-top: 1px solid var(--line); display: flex; gap: var(--s3); justify-content: flex-end; flex-wrap: wrap; background: var(--void); }

.tabbar { display: none; }

/* ============ telefoon ============ */

@media (max-width: 899px) {
  body { padding-bottom: 74px; }
  .table { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; padding: var(--s3) var(--s4); }
  .rail .nav, .rail-foot { display: none; }
  .content { padding: var(--s4) var(--s4) var(--s6); }
  .grid--pieces { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .figure__value { font-size: 22px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(18,22,26,.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    display: grid; justify-items: center; gap: 3px; padding: 9px 2px 7px; min-height: 52px;
    color: var(--ink-2); text-decoration: none; font-size: 11px; font-weight: 500; letter-spacing: .01em;
  }
  .tabbar a[aria-current='page'] { color: var(--signal); }
  .tabbar svg { width: 20px; height: 20px; }
  .log { left: var(--s3); right: var(--s3); bottom: 82px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
