/* Scaffbook Board — dark theme, tuned for a 75–85" wall screen AND phone browsers. */
:root {
  --bg: #111318;
  --panel: #191c23;
  --panel-2: #20242d;
  --line: #2b303b;
  --text: #eef1f6;
  --muted: #8b93a3;
  --blue: #3f6fb5;
  --red: #d8544a;
  --amber: #e0a22e;
  --green: #3fa66a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ── Auth ─────────────────────────────────────────────── */
.auth-view { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; width: min(420px, 100%);
}
.auth-brand { margin-bottom: 1.25rem; }
.auth-error { color: var(--red); margin: 0.5rem 0; }
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.65rem 0.75rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-size: 1rem;
}
.auth-submit { width: 100%; margin-top: 0.5rem; }

/* ── Brand / topbar ───────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand-mark { display: grid; place-items: center; }
.brand-title { font-weight: 700; font-size: 1.15rem; }
.wm-scaff { color: var(--text); } .wm-book { color: var(--blue); }
.brand-sub { font-size: 0.8rem; color: var(--muted); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.clock { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.top-center { display: flex; align-items: center; gap: 1.1rem; }
.weather { display: flex; align-items: baseline; gap: 0.45rem; }
.wx-emoji { font-size: 1.5rem; line-height: 1; }
.wx-temp { font-size: 1.35rem; font-weight: 700; }
.wx-range { color: var(--muted); font-size: 0.95rem; }
.topbar-actions { display: flex; gap: 0.6rem; align-items: center; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 0.55rem 0.95rem; border-radius: 10px; font-size: 0.95rem; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn.primary { background: var(--blue); border-color: var(--blue); }
.btn.ghost { background: transparent; }
.btn:hover { filter: brightness(1.12); }
.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 0.9rem; }

/* ── Board layout ─────────────────────────────────────── */
.board {
  display: grid; grid-template-columns: minmax(300px, 22%) 1fr;
  gap: 1rem; padding: 1rem 1.2rem; align-items: start;
}
.rail {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; position: sticky; top: 4.6rem; max-height: calc(100vh - 6rem);
  display: flex; flex-direction: column;
}
.rail-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; }
.rail-head h2 { margin: 0; font-size: 1.1rem; }
.rail .card-list { overflow-y: auto; flex: 1; }
.rail-foot { margin-top: 0.6rem; font-size: 0.85rem; }
#review-list { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.review-head { font-weight: 700; margin-bottom: 0.45rem; }
.review-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  background: var(--panel-2); border: 1px solid var(--amber); border-radius: 10px;
  padding: 0.5rem 0.6rem; margin-bottom: 0.45rem;
}
.review-info { min-width: 0; }
.review-title { font-weight: 600; overflow-wrap: anywhere; }
.review-actions { display: flex; gap: 0.35rem; flex: none; }
.approve-btn { background: var(--green); border-color: var(--green); font-weight: 700; }
.sendback-btn { font-weight: 700; }
.done-head { color: var(--muted); margin-bottom: 0.35rem; }
.done-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.2rem 0; }
.done-title { color: var(--muted); text-decoration: line-through; overflow-wrap: anywhere; }
.undo-btn { padding: 0.25rem 0.6rem; font-size: 0.85rem; flex: none; }

.columns {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem;
}
.col {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem; min-height: 200px; border-top: 4px solid var(--blue);
}
.col-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; cursor: pointer; }
.col-head:hover h3 { text-decoration: underline; }
.col-head h3 { margin: 0; font-size: 1rem; }
.col-count { font-size: 0.85rem; color: var(--muted); }

/* ── Task cards ───────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 0.55rem; }
.todo-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.6rem 0.7rem; display: flex; gap: 0.6rem; align-items: flex-start; cursor: grab;
}
.todo-card.dragging { opacity: 0.4; cursor: grabbing; }
.card-list[data-seg] { min-height: 3rem; border-radius: 8px; }
.card-list.drop-over { outline: 2px dashed var(--blue); outline-offset: 4px; }
.todo-card.overdue { border-color: var(--red); }
.todo-card .tick {
  flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 2px solid var(--muted); background: none; cursor: pointer; margin-top: 0.1rem;
}
.todo-card .tick:hover { border-color: var(--green); background: rgba(63,166,106,0.15); }
.todo-body { min-width: 0; flex: 1; }
.todo-title { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; font-size: 0.78rem; }
.chip {
  padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.chip.due { color: var(--text); }
.chip.due.overdue { color: #fff; background: var(--red); border-color: var(--red); }
.chip.due.today { color: #111; background: var(--amber); border-color: var(--amber); }
.chip.pri-High { color: var(--amber); border-color: var(--amber); }
.chip.pri-Urgent { color: #fff; background: var(--red); border-color: var(--red); }
.chip.recur { color: var(--blue); border-color: var(--blue); }
.empty-col { color: var(--muted); font-size: 0.9rem; padding: 0.4rem 0.2rem; }

/* ── Modal ────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem; width: min(560px, calc(100vw - 2rem));
  max-height: 90vh; overflow-y: auto;
}
.modal-card h2 { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.modal-actions { display: flex; justify-content: space-between; gap: 0.6rem; margin-top: 1rem; }
.modal-actions .spacer { flex: 1; }
.btn.danger { color: var(--red); border-color: var(--red); background: transparent; }

/* ── Toast ────────────────────────────────────────────── */
/* Focus mode: one segment, whole screen */
.focus-view { padding: 1.2rem; }
.focus-head {
  display: flex; align-items: center; gap: 1rem;
  max-width: 1100px; margin: 0 auto 1.1rem;
  border-bottom: 3px solid var(--blue); padding-bottom: 0.7rem;
}
.focus-head h2 { margin: 0; font-size: 2rem; }
.focus-head .spacer { flex: 1; }
.focus-list { max-width: 1100px; margin: 0 auto; gap: 0.8rem; }
.focus-view .todo-card { padding: 0.9rem 1rem; }
.focus-view .todo-title { font-size: 1.45rem; }
.focus-view .todo-meta { font-size: 1rem; }
.focus-view .tick { width: 2rem; height: 2rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.7rem 1.1rem; z-index: 30;
}

/* ── TV mode: bump everything up on very wide screens ─── */
@media (min-width: 1900px) {
  body { font-size: 1.25rem; }
  .brand-title { font-size: 1.6rem; }
  .clock { font-size: 2.6rem; }
  .wx-emoji { font-size: 2.4rem; }
  .wx-temp { font-size: 2.1rem; }
  .wx-range { font-size: 1.4rem; }
  .rail-head h2 { font-size: 1.5rem; }
  .col-head h3 { font-size: 1.35rem; }
  .todo-title { font-size: 1.25rem; }
  .todo-meta { font-size: 1rem; }
  .btn { font-size: 1.15rem; padding: 0.7rem 1.2rem; }
  .focus-head h2 { font-size: 3rem; }
  .focus-head { max-width: 1500px; }
  .focus-list { max-width: 1500px; }
  .focus-view .todo-title { font-size: 2rem; }
  .focus-view .todo-meta { font-size: 1.3rem; }
  .focus-view .tick { width: 2.6rem; height: 2.6rem; }
}

/* ── Phone: stack the rail above scrollable columns ───── */
@media (max-width: 820px) {
  .board { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; }
  .clock { display: none; }
  .top-center { margin-left: auto; }
  .columns { grid-auto-columns: 85vw; }
}
