:root {
  --ink: #241b3a;        /* dusk plum-indigo */
  --ink-soft: #5d5375;
  --bg: #f3f1f8;         /* evening haze */
  --surface: #ffffff;
  --line: #dcd7e8;
  --sun: #f2a93b;        /* golden hour */
  --coral: #e8684a;      /* horizon — tax */
  --sea: #1f7a8c;        /* water — net */
  --radius-lg: 18px;
  --radius-sm: 8px;
  font-family: 'Schibsted Grotesk', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
h2 { font-size: 1.15rem; font-weight: 700; }
.muted { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
button, .btn, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

button, .btn {
  border: 0; border-radius: var(--radius-sm); padding: .55rem 1rem; cursor: pointer;
  background: var(--ink); color: #fff; font-weight: 600; text-decoration: none; display: inline-block; white-space: nowrap;
}
.btn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.primary { background: var(--sun); border-color: var(--sun); color: var(--ink); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: transparent; color: #b8402a; border: 1px solid #f0c4b8; padding: .3rem .6rem; font-size: .85rem; }
button:disabled { opacity: .45; cursor: default; }
input, select { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .7rem; background: #fff; color: var(--ink); min-width: 0; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(180deg, #2d2350 0%, #7a3e6a 45%, #e8684a 75%, #f2a93b 100%); }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: var(--radius-lg); padding: 2rem 1.6rem; display: grid; gap: 1rem; }
.login-card h1 { font-size: 1.6rem; line-height: 1.15; font-weight: 800; }
.login-card h1 span { font-size: 1rem; font-weight: 500; color: var(--ink-soft); }
.login-card label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.err { color: #b8402a; margin: 0; min-height: 1.2em; font-size: .92rem; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 24px; background: var(--ink); color: #fff; }
.topbar strong { font-weight: 800; }
.topbar strong span { font-weight: 500; opacity: .7; margin-left: .4rem; }
.who { display: flex; align-items: center; gap: .8rem; font-size: .92rem; }
.who button { color: #fff; border-color: rgba(255,255,255,.3); padding: .35rem .8rem; }

main { max-width: 1240px; margin: 0 auto; padding: 24px; display: grid; gap: 20px; }

/* the one bold element: dusk band with the equation */
.dusk {
  border-radius: var(--radius-lg); color: #fff; padding: 28px 28px 22px;
  background: linear-gradient(100deg, #2d2350 0%, #5b3264 38%, #b44f5a 68%, #e8875a 86%, #f2a93b 100%);
  display: grid; gap: 22px;
}
.dusk-label { margin: 0 0 .6rem; opacity: .85; font-weight: 500; }
.equation { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem 1.1rem; }
.equation > div { display: grid; }
.eq-val { font-size: clamp(1.5rem, 3.4vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.eq-cap { font-size: .9rem; opacity: .85; }
.equation .net { flex-basis: 100%; margin-top: .4rem; }
.equation .net .eq-val { font-size: clamp(1.9rem, 4.6vw, 3.6rem); }
.op { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 300; opacity: .7; padding-bottom: 1.3rem; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.25); }
.facts dt { font-size: .85rem; opacity: .8; }
.facts dd { margin: 0; font-size: 1.15rem; font-weight: 700; }
.note { margin: -8px 0 0; color: var(--ink-soft); font-size: .9rem; }

.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--line); min-width: 0; }
.panel h2.spaced { margin-top: 1.6rem; }

/* chart */
.chart { margin-top: 1rem; overflow-x: auto; }
.chart svg { display: block; min-width: 100%; }
.chart .bar { fill: var(--sun); }
.chart .bar.today { fill: var(--coral); }
.chart text { fill: var(--ink); font-family: inherit; }
.chart .lbl { fill: var(--ink-soft); font-size: 12px; }
.chart .val { font-size: 12px; font-weight: 700; }
.chart .rp { fill: var(--ink-soft); font-size: 11px; }

/* table */
.table-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions input[type=search] { width: 260px; max-width: 100%; }
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
#table th, #table td { padding: .5rem .7rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
#table thead th { position: sticky; top: 0; background: #ebe7f3; font-weight: 700; z-index: 1; }
#table td.num { text-align: right; font-feature-settings: 'tnum' 1; }
#table tr.uji td { color: var(--ink-soft); background: #fbf7ef; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .45rem; border-radius: 99px; background: #fde7c4; color: #7a4a05; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; font-size: .92rem; }
.msg { margin: 0 0 12px; padding: .6rem .8rem; border-radius: var(--radius-sm); background: #e6f3f5; color: #154f5b; }
.msg.bad { background: #fbe6e1; color: #8a2f1e; }

.mini { margin-top: .8rem; }
.mini th, .mini td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
.mini th { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1 1 180px; }

@media (max-width: 640px) {
  main { padding: 16px; gap: 16px; }
  .topbar { padding: .8rem 16px; }
  .topbar strong span { display: none; }
  .dusk { padding: 22px 18px 18px; }
  .op { padding-bottom: 1.2rem; }
  .actions { width: 100%; }
  .actions input[type=search] { flex: 1 1 100%; width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.spaced-top { margin-top: 1.6rem; margin-bottom: .2rem; }
.small { font-size: .85rem; margin: 0 0 .6rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; cursor: pointer; }
.table-wrap.short { max-height: 420px; }
.table-wrap .mini { margin-top: 0; }
.log td { white-space: nowrap; font-size: .86rem; }
.log td.ua { white-space: normal; min-width: 220px; color: var(--ink-soft); font-size: .8rem; }
.res { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; }
.res.ok { background: #dcefe9; color: #155447; }
.res.out { background: #ebe7f3; color: var(--ink-soft); }
.res.bad { background: #fbe0d8; color: #8a2f1e; }
.res.block { background: #8a2f1e; color: #fff; }
