:root {
  /* Emendis look & feel: charcoal-navy tekst, koel-grijze basis, rood accent. */
  --bg: #f5f6f8;
  --bg-warm: #eef0f3;
  --surface: #ffffff;
  --ink: #2b3139;         /* charcoal-navy (wordmark) */
  --muted: #6b7280;
  --line: #E8E9EC;
  --accent: #d61f4e;      /* Emendis-rood */
  --accent-soft: #fde7e8;
  --accent2: #f28f8f;     /* lichte rood-dash (logo-accent) */
  --xp: #f5a300;          /* XP-goud */
  --xp-soft: #fdf1cf;
  --streak: #ff6b35;      /* streak-vlam */
  --green: #1f9d63;
  --green-soft: #e2f4ea;
  --shadow: 0 10px 30px rgba(43, 49, 57, 0.10);
  --radius: 16px;
  --field-bg: #f7f8fa;
  --glow-1: #fde3e4;
  --glow-2: #eef0f3;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14171c;
  --bg-warm: #1a1e24;
  --surface: #1c2027;
  --ink: #eceef2;
  --muted: #9aa1ac;
  --line: #E8E9EC;
  --accent: #ff4d4d;
  --accent-soft: #3a1b1e;
  --accent2: #c96a6a;
  --xp: #f7c53d;
  --xp-soft: #3a2f10;
  --streak: #ff835a;
  --green: #43c489;
  --green-soft: #143325;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --field-bg: #14181e;
  --glow-1: #2a1416;
  --glow-2: #1a1e24;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #14171c; --bg-warm: #1a1e24; --surface: #1c2027; --ink: #eceef2;
    --muted: #9aa1ac; --line: #2c323b; --accent: #ff4d4d; --accent-soft: #3a1b1e; --accent2: #c96a6a;
    --xp: #f7c53d; --xp-soft: #3a2f10; --streak: #ff835a; --green: #43c489; --green-soft: #143325;
    --shadow: 0 10px 30px rgba(0,0,0,0.5); --field-bg: #14181e; --glow-1: #2a1416; --glow-2: #1a1e24;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* Toegangsslot (zonder geldige ?app=-sleutel) */
.gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.gate__box { max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 30px; }
.gate__icon { font-size: 40px; margin-bottom: 12px; }
.gate__title { font-family: 'Poppins', system-ui, sans-serif; font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.gate__text { color: var(--muted); font-size: 15px; margin: 0; }

body {
  background:
    radial-gradient(900px 340px at 85% -80px, var(--glow-1) 0%, transparent 60%),
    radial-gradient(700px 300px at 0% 0%, var(--glow-2) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* toolbar */
.toolbar { position: fixed; top: 16px; right: 16px; z-index: 40; display: flex; align-items: center; gap: 8px; }
.lang-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); padding: 3px; gap: 2px; }
.lang-btn { border: none; background: transparent; color: var(--muted); padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer; transition: background .15s, color .15s; }
.lang-btn.is-active { background: var(--accent); color: #fff; }
.theme-toggle { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-size: 18px; display: grid; place-items: center; transition: transform .12s, border-color .15s; }
.theme-toggle:hover { transform: scale(1.08); border-color: var(--accent); }
.theme-toggle:active { transform: scale(.94); }

.app { max-width: 1040px; margin: 0 auto; padding: 32px 24px 90px; }

/* Desktop 2-koloms rijen */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 18px; }
.row-2 > * { margin: 0; }
.row-2--work { align-items: start; }
.row-2--stats { align-items: stretch; }
.row-2--stats .ring-panel, .row-2--stats .board { max-width: none; margin: 0; }
.col { display: flex; flex-direction: column; min-width: 0; }
.col > .section-head { margin-top: 0; min-height: 30px; }
.col > .section-head--gap { margin-top: 22px; }
@media (max-width: 820px) {
  .row-2 { grid-template-columns: 1fr; }
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 12px 0 20px; }
/* TempAI-wordmerk (Emendis-stijl) */
.logo { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 5px; margin-bottom: 16px; }
.logo__word { font-family: 'Poppins', system-ui, sans-serif; font-weight: 700; font-size: 28px; line-height: 1; letter-spacing: -.01em; color: var(--ink); }
.logo .brand-dashes--start { margin-top: 0; }
.hero__title { font-family: 'Poppins', system-ui, sans-serif; font-weight: 600; font-size: clamp(26px, 4.6vw, 38px); line-height: 1.12; margin: 0 0 12px; }
.hero__sub { color: var(--muted); font-size: 15.5px; max-width: 520px; margin: 0 auto; }

/* Emendis twin-dash accent (logo-motief) */
.brand-dashes { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.brand-dashes span { width: 22px; height: 4px; border-radius: 2px; }
.brand-dashes span:first-child { background: var(--accent); }
.brand-dashes span:last-child { background: var(--accent2); }
.brand-dashes--start { justify-content: flex-start; margin-top: 8px; }

/* Emendis brandmerk (footer) */
.brandmark { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.brandmark__word { font-family: 'Poppins', system-ui, sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .14em; color: var(--ink); }

/* ---------- Stat bar (level / xp / streak) ---------- */
.statbar { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); padding: 10px 16px; margin: 0 auto 16px; max-width: 460px; }
.stat-chip { font-weight: 700; font-size: 13px; white-space: nowrap; }
.stat-chip--level { color: var(--accent); }
.stat-chip--streak { color: var(--streak); }
.xp { flex: 1; min-width: 0; }
.xp__track { height: 10px; background: var(--field-bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.xp__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--xp), #ffd766); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.xp__text { display: block; text-align: center; font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- Ring panel ---------- */
.ring-panel { display: flex; align-items: center; justify-content: center; gap: 32px; background: linear-gradient(160deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 32px; margin: 0 auto 18px; max-width: 620px; }
.ring__col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); width: 132px; height: 132px; }
.ring__bg { fill: none; stroke: var(--line); stroke-width: 12; }
.ring__fill { fill: none; stroke: url(#ringgrad); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1); }
.ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__hours { font-family: 'Poppins', system-ui, sans-serif; font-size: 26px; font-weight: 600; line-height: 1; }
.ring__goal { font-size: 11.5px; color: var(--muted); }
.ring__meta { min-width: 0; flex: 1; }
.ring__day { font-family: 'Poppins', system-ui, sans-serif; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ring__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ring__date { font-size: 13px; color: var(--ink); font-weight: 600; }
/* datum-navigatie */
.datenav { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.datenav__label { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; line-height: 1.25; }
.datenav__btn { border: 1px solid var(--line); background: var(--field-bg); color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; white-space: nowrap; transition: color .15s, border-color .15s; }
.datenav__btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.datenav__btn:disabled { opacity: .4; cursor: default; }
.nudge { margin-top: 10px; font-size: 13.5px; color: var(--ink); background: var(--field-bg); border: 1px dashed var(--line); border-radius: 12px; padding: 8px 12px; }

/* Ring-panel laadstatus */
.ring__spinner { display: none; position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.ring__skeleton { display: none; flex-direction: column; gap: 9px; }
.ring__skeleton span { display: block; border-radius: 6px; background: var(--muted); animation: skpulse 1.3s ease-in-out infinite; }
.ring__skeleton span:nth-child(1) { width: 38%; height: 11px; }
.ring__skeleton span:nth-child(2) { width: 66%; height: 18px; animation-delay: .12s; }
.ring__skeleton span:nth-child(3) { width: 92%; height: 34px; border-radius: 10px; animation-delay: .24s; }
@keyframes skpulse { 0%, 100% { opacity: .22; } 50% { opacity: .45; } }
.ring-panel.is-loading .ring__fill { opacity: 0; }
.ring-panel.is-loading .ring__center { visibility: hidden; }
.ring-panel.is-loading .ring__spinner { display: block; }
.ring-panel.is-loading .datenav,
.ring-panel.is-loading .ring__day,
.ring-panel.is-loading .nudge { display: none; }
.ring-panel.is-loading .ring__skeleton { display: flex; }

/* ---------- Top-collega's (try-out) ---------- */
.board { max-width: 460px; margin: 0 auto 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.board__title { display: block; text-align: center; font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.board__sub { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.board__list { display: flex; flex-direction: column; gap: 12px; }
.board__row { display: flex; align-items: center; gap: 12px; }
.board__rank { font-size: 18px; width: 22px; text-align: center; flex: none; }
.board__avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.board__avatar--0 { background: var(--accent); }
.board__avatar--1 { background: var(--sun, var(--xp)); }
.board__avatar--2 { background: var(--green); }
.board__main { flex: 1; min-width: 0; }
.board__name { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board__bar { height: 6px; background: var(--field-bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.board__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--xp)); border-radius: 999px; }
.board__hours { font-family: 'Poppins', system-ui, sans-serif; font-weight: 600; font-size: 14px; flex: none; }

/* ---------- Section head ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 12px; }
.section-head__label { font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.section-head__label svg { color: var(--accent); flex: none; }
.qbtn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer; transition: color .15s, border-color .15s; }
.qbtn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- PR rows ---------- */
.pr-list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 16px; transition: opacity .3s, transform .15s; }
.row.is-logged { opacity: .62; }
.row__head { display: flex; align-items: center; gap: 14px; }
.row__main { flex: 1; min-width: 0; }
.row__top { display: flex; align-items: center; gap: 8px; }
.row__key { font-weight: 700; font-size: 13.5px; color: var(--accent); text-decoration: none; }
a.row__key:hover { text-decoration: underline; }
.row__pr { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); background: var(--field-bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.row__summary { display: block; font-size: 14.5px; margin-top: 2px; }
.row__desc { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.row__time { font-family: 'Poppins', system-ui, sans-serif; font-weight: 600; font-size: 17px; min-width: 48px; text-align: center; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper__btn { width: 26px; height: 26px; border: 1px solid var(--line); background: var(--field-bg); color: var(--ink); border-radius: 8px; font-size: 16px; line-height: 1; font-family: inherit; cursor: pointer; display: grid; place-items: center; transition: border-color .15s, color .15s; }
.stepper__btn:hover { border-color: var(--accent); color: var(--accent); }
.row__done { font-size: 12px; color: var(--green); font-weight: 600; }

/* Uitklapbare PR-omschrijving */
.row__desc-toggle { border: 1px solid var(--line); background: var(--field-bg); color: var(--muted); font-family: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 2px 8px; border-radius: 999px; }
.row__desc-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Modal (PR-omschrijving) ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 18, 24, 0.55); backdrop-filter: blur(2px); }
.modal__card { position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4); width: clamp(320px, 60vw, 1000px); max-height: 82vh; overflow-y: auto; padding: 26px 28px; }
.modal__close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--field-bg); color: var(--ink); cursor: pointer; font-size: 14px; }
.modal__close:hover { border-color: var(--accent); color: var(--accent); }
.modal__title { font-family: 'Poppins', system-ui, sans-serif; font-size: 20px; font-weight: 700; color: var(--accent); margin: 0; }
.modal__sub { font-size: 15px; font-weight: 600; margin: 2px 0 16px; }
.modal__desc { font-size: 13.5px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.modal__desc strong { display: inline-block; margin-top: 8px; }
.modal__desc a { color: var(--accent); }
.modal__desc code { background: var(--field-bg); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; font-size: 12px; }
.modal__link { display: inline-block; margin-top: 16px; color: var(--accent); font-weight: 600; text-decoration: none; }
.modal__link:hover { text-decoration: underline; }
.book { border: none; background: linear-gradient(135deg, var(--accent), #b3001b); color: #fff; border-radius: 500px; padding: 8px 14px; font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer; transition: transform .1s, box-shadow .15s; }
.book:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.book:disabled { opacity: .55; cursor: default; }

.log-all { width: 100%; margin-top: 14px; border: none; background: var(--accent); color: #fff; border-radius: 12px; padding: 13px; font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer; transition: transform .1s, box-shadow .15s; }
.log-all:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* Handmatig een ander ticket boeken — zelfde kaartlayout als een PR-rij (.row) */
.manual__input { width: 100%; border: 1px solid var(--line); background: var(--field-bg); color: var(--ink); border-radius: 10px; padding: 10px 13px; font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.manual__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.empty { text-align: center; color: var(--muted); padding: 26px; }
.status { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 26px; }
.status__spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges ---------- */
.badges { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 22px auto; }
.badges__label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--field-bg); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--muted); filter: grayscale(1); opacity: .5; transition: all .2s; }
.badge.is-on { filter: none; opacity: 1; color: var(--ink); border-color: var(--xp); background: var(--xp-soft); }
.badge__name { font-weight: 600; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow); padding: 11px 16px; font-size: 13.5px; font-weight: 600; opacity: 0; transform: translateY(12px); transition: opacity .3s, transform .3s; }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast--xp { border-left-color: var(--xp); }
.toast--level { border-left-color: var(--accent); background: var(--accent-soft); }
.toast--badge { border-left-color: var(--xp); background: var(--xp-soft); }
.toast--day { border-left-color: var(--green); background: var(--green-soft); }
.toast--error { border-left-color: var(--streak); }

/* ---------- Reward banner ---------- */
.reward {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent-soft), var(--xp-soft));
  border: 1px solid var(--xp); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin: 22px 0 4px;
}
.reward__text { display: flex; flex-direction: column; gap: 2px; }
.reward__text strong { font-family: 'Poppins', system-ui, sans-serif; font-size: 18px; }
.reward__text span { font-size: 13px; color: var(--muted); }
.reward__play {
  border: none; background: linear-gradient(135deg, var(--accent), #b3001b); color: #fff;
  border-radius: 12px; padding: 12px 18px; font-size: 14.5px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: transform .1s, box-shadow .15s;
}
.reward__play:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------- Mini-game overlay ---------- */
.game-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px;
  background: rgba(10, 8, 20, 0.62); backdrop-filter: blur(3px); }
.game-card { width: min(440px, 94vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 24px 70px rgba(0,0,0,.4); overflow: hidden; }
.game-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--line); font-size: 15px; }
.game-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--field-bg); color: var(--ink); cursor: pointer; font-size: 13px; }
.game-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; font-size: 13px; color: var(--muted); }
.game-hud b { color: var(--ink); font-variant-numeric: tabular-nums; }
.game-high { color: var(--xp); font-weight: 700; }
.game-stage { position: relative; height: 430px;
  background: radial-gradient(120% 80% at 50% 0%, var(--accent-soft), var(--field-bg)); }
.game-canvas { position: absolute; inset: 0; touch-action: none; }
.game-screen { position: absolute; inset: 0; display: grid; place-content: center; gap: 16px;
  text-align: center; padding: 26px; background: rgba(0,0,0,.28); backdrop-filter: blur(2px); }
.game-help { color: #fff; font-size: 14px; max-width: 300px; margin: 0 auto; line-height: 1.5; }
.game-final { color: #fff; font-family: 'Poppins', system-ui, sans-serif; font-size: 22px; margin: 0; }
.game-record { font-family: 'Inter'; font-size: 14px; color: var(--xp); font-weight: 700; }
.game-btn { justify-self: center; border: none; background: linear-gradient(135deg, var(--accent), #b3001b);
  color: #fff; border-radius: 12px; padding: 13px 26px; font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: transform .1s, box-shadow .15s; }
.game-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
@media (max-width: 480px) { .game-stage { height: 380px; } }
