:root {
  --bg: #0b1220;
  --bg-2: #0f1a2e;
  --panel: #111c33;
  --panel-2: #16233f;
  --line: #22314f;
  --text: #e8eefc;
  --muted: #93a4c4;
  --accent: #3b82f6;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: radial-gradient(1200px 800px at 70% -10%, #16264a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  overflow: hidden;
  cursor: none;
}

.board {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6vh 2.4vw;
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 1.4vw; }
.logo {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  padding: .6vh 1vh; border-radius: 10px;
}
.logo img {
  height: 4.6vh; max-height: 52px; width: auto; display: block;
}
.topbar h1 { font-size: 3vh; letter-spacing: .06em; line-height: 1.1; }
.sub { color: var(--muted); font-size: 1.7vh; letter-spacing: .28em; }

.meta { text-align: right; display: flex; align-items: center; gap: 2vw; }
.live {
  display: flex; align-items: center; gap: .6vw;
  color: var(--green); font-weight: 700; letter-spacing: .18em; font-size: 1.9vh;
}
.dot {
  width: 1.3vh; height: 1.3vh; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(34,197,94,.7); animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
  70% { box-shadow: 0 0 0 1.6vh rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.clock { font-size: 3.4vh; font-weight: 700; font-variant-numeric: tabular-nums; }
.date { color: var(--muted); font-size: 1.6vh; }

/* ---------- Stage / card ---------- */
.stage { position: relative; padding: 3vh 4vw; display: flex; align-items: center; }
.loading, .errorbox {
  width: 100%; text-align: center; color: var(--muted); font-size: 3vh;
}
.errorbox { color: var(--amber); }

.card {
  width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-left: 10px solid var(--status, var(--accent));
  border-radius: 22px;
  padding: 4vh 4vw;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  animation: slidein .5s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 2vw; }
.ch-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1.6vh; }
.qr { display: flex; flex-direction: column; align-items: center; gap: .8vh; }
.qr-box {
  background: #fff; padding: 1vh; border-radius: 10px;
  width: 18vh; height: 18vh; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-cap {
  font-size: 1.4vh; letter-spacing: .16em; color: var(--text);
  font-weight: 700; text-align: center;
}
.job-code { font-size: 5.5vh; font-weight: 800; letter-spacing: .04em; }
.client { color: var(--muted); font-size: 2.6vh; margin-top: .4vh; letter-spacing: .04em; }
.project { color: var(--text); font-size: 2.6vh; margin-top: .3vh; letter-spacing: .04em; font-weight: 600; }

.badge {
  padding: 1vh 2.2vh; border-radius: 999px; font-weight: 800; font-size: 2.2vh;
  letter-spacing: .12em; white-space: nowrap;
  background: color-mix(in srgb, var(--status) 18%, transparent);
  color: var(--status); border: 1px solid color-mix(in srgb, var(--status) 45%, transparent);
}

.desc-cap, .tasks-cap {
  margin-top: 2.4vh; font-size: 1.6vh; letter-spacing: .18em;
  color: var(--muted); text-transform: uppercase;
}
.desc {
  margin-top: .6vh; font-size: 4vh; font-weight: 600; line-height: 1.2;
}

/* Tasks list */
.tasks {
  margin-top: 1vh; display: flex; flex-direction: column; gap: 1.2vh;
  max-height: 34vh; overflow: auto;
}
.task-row {
  display: flex; justify-content: space-between; align-items: center; gap: 2vw;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.4vh 1.8vh;
}
.task-name {
  font-size: 2.8vh; font-weight: 600; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis;
}
.task-meta { display: flex; align-items: center; gap: 1.4vw; flex: none; }
.task-prog { font-size: 2.2vh; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.task-chip {
  padding: .6vh 1.6vh; border-radius: 999px; font-size: 1.7vh; font-weight: 800;
  letter-spacing: .1em; white-space: nowrap;
  background: color-mix(in srgb, var(--status) 18%, transparent);
  color: var(--status); border: 1px solid color-mix(in srgb, var(--status) 45%, transparent);
}

.grid {
  margin-top: 3.4vh;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2vw;
}
.tile {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 2.2vh 2vh;
}
.tile .k { color: var(--muted); font-size: 1.7vh; letter-spacing: .14em; text-transform: uppercase; }
.tile .v { font-size: 3.4vh; font-weight: 800; margin-top: .8vh; }
.prio-normal { color: var(--green); }
.prio-low { color: var(--muted); }
.prio-high { color: var(--amber); }
.prio-urgent { color: var(--red); }

.progress-wrap { margin-top: 3.4vh; }
.progress-wrap .row { display: flex; justify-content: space-between; font-size: 2vh; color: var(--muted); }
.bar-track { margin-top: 1.2vh; height: 2.6vh; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, var(--status), color-mix(in srgb, var(--status) 55%, #ffffff));
  transition: width .8s ease;
}

/* ---------- Bottom bar ---------- */
.bottombar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4vh 2.4vw; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 1.8vh;
}
.counter { font-weight: 700; letter-spacing: .1em; }
.status-note { text-align: center; flex: 1; }
.updated { font-variant-numeric: tabular-nums; }

.progress-track { height: .8vh; background: rgba(255,255,255,.05); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }

.stale-warn { color: var(--amber); }
