/* HQ — operator's daylight. Ink navy + cyan on cool paper. */
:root {
  --paper: #f4f7f9;
  --card: #ffffff;
  --ink: #22384c;
  --muted: #64798c;
  --faint: #93a5b5;
  --line: #dbe4eb;
  --accent: #128fb4;
  --accent-soft: #e2f4fa;
  --warn: #b97a17;
  --warn-soft: #fdf2df;
  --danger: #c0392b;
  --danger-soft: #fbe9e7;
  --good: #2e8b62;
  --good-soft: #e3f3ec;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Mulish", -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, textarea, select { font: inherit; color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 36px; width: min(360px, 100%); text-align: center;
  box-shadow: 0 20px 50px rgba(34, 56, 76, .08);
}
.login-mark {
  font-family: var(--display); font-weight: 900; font-size: 44px; letter-spacing: -.03em;
  color: var(--ink);
}
.login-mark::after { content: "."; color: var(--accent); }
.login-sub { color: var(--muted); margin: 4px 0 24px; }
.login-who { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.who-chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 20px; font-weight: 600;
}
.who-chip.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
.login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 12px; background: var(--paper);
}
.login-error { color: var(--danger); min-height: 1.2em; margin-top: 10px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn { border-radius: 8px; padding: 8px 14px; font-weight: 700; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { color: var(--danger); border: 1px solid var(--danger-soft); background: var(--danger-soft); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- masthead ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 20px 20px 80px; }
.masthead { padding: 8px 4px 14px; }
.masthead-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.masthead-title { display: flex; align-items: baseline; gap: 14px; }
.mark { font-family: var(--display); font-weight: 900; font-size: 34px; letter-spacing: -.03em; }
.mark::after { content: "."; color: var(--accent); }
.date { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.masthead-actions { display: flex; align-items: center; gap: 8px; }
.me { font-weight: 800; color: var(--accent); cursor: pointer; padding: 4px 8px; }
.briefing {
  margin-top: 8px; font-family: var(--mono); font-size: 13px; color: var(--muted);
  border-left: 3px solid var(--accent); padding-left: 10px;
}
.briefing b { color: var(--ink); font-weight: 600; }
.briefing .warnval { color: var(--danger); font-weight: 600; }

/* ---------- daily rhythm ---------- */
.rhythm { display: flex; gap: 10px; flex-wrap: wrap; padding: 6px 0 18px; }
.rhythm-chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px 8px 10px; font-weight: 700; transition: border-color .15s, background .15s;
}
.rhythm-chip:hover { border-color: var(--accent); }
.rhythm-chip.done { background: var(--good-soft); border-color: rgba(46, 139, 98, .35); color: var(--good); }
.rhythm-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 12px; color: transparent; flex: none;
}
.rhythm-chip.done .rhythm-check { background: var(--good); border-color: var(--good); color: #fff; }
.rhythm-streak { font-family: var(--mono); font-size: 12px; color: var(--warn); font-weight: 600; }
.rhythm-period { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.lane { background: transparent; min-width: 0; }
.lane-head {
  font-family: var(--display); font-weight: 900; font-size: 13px; letter-spacing: .14em;
  text-transform: uppercase; padding: 6px 2px 10px; display: flex; align-items: center; gap: 8px;
}
.lane-head .lane-count { font-family: var(--mono); font-weight: 400; color: var(--faint); letter-spacing: 0; }
.lane-head::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.lane[data-lane="involved"] .lane-head::before { background: var(--warn); }
.lane[data-lane="others"] .lane-head::before { background: var(--faint); }
.section-block { margin-bottom: 14px; }
.section-label {
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); padding: 2px 2px 6px; display: flex; justify-content: space-between;
}
.section-label .add-here { color: var(--faint); font-weight: 800; visibility: hidden; }
.section-block:hover .add-here { visibility: visible; }
.section-label .add-here:hover { color: var(--accent); }
.task-list { display: flex; flex-direction: column; gap: 8px; min-height: 6px; border-radius: 8px; }
.task-list.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; }

.task {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start;
  cursor: grab; position: relative; transition: box-shadow .15s, border-color .15s;
}
.task:hover { border-color: #bcd0dc; box-shadow: 0 4px 14px rgba(34, 56, 76, .07); }
.task.done-task { opacity: .55; }
.task.done-task .task-title { text-decoration: line-through; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { cursor: grabbing; }
.task-check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); flex: none;
  margin-top: 1px; display: grid; place-items: center; font-size: 11px; color: transparent;
  transition: background .12s, border-color .12s;
}
.task-check:hover { border-color: var(--good); }
.task.done-task .task-check { background: var(--good); border-color: var(--good); color: #fff; }
.task-main { min-width: 0; flex: 1; }
.task-title { font-weight: 700; overflow-wrap: break-word; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.chip {
  font-size: 11px; font-weight: 700; border-radius: 5px; padding: 2px 7px;
  background: var(--paper); color: var(--muted); border: 1px solid var(--line);
}
.chip.owner { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.due { font-family: var(--mono); font-weight: 600; }
.chip.due-soon { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.due-over { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.target { background: transparent; border-style: dashed; }
.chip.comments { background: transparent; border-color: transparent; color: var(--faint); font-family: var(--mono); }

/* ---------- tabs + panel ---------- */
.tabs { display: flex; gap: 4px; margin-top: 30px; border-bottom: 2px solid var(--line); }
.tab {
  padding: 10px 16px; font-weight: 800; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; letter-spacing: .01em;
}
.tab:hover { color: var(--ink); }
.tab.selected { color: var(--ink); border-bottom-color: var(--accent); }
.panel { padding: 18px 0; }
.panel-meta { font-family: var(--mono); font-size: 12px; color: var(--faint); margin-bottom: 12px; }
.panel-meta .err { color: var(--danger); }
.panel-empty { color: var(--muted); padding: 30px 0; text-align: center; }

table.data { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-wrap { overflow-x: auto; border-radius: 10px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfdfe;
  white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
td.num, .money { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.money.big { font-weight: 600; }
.status-dot { font-size: 12px; white-space: nowrap; font-weight: 700; }
.notes-toggle { color: var(--accent); font-weight: 700; font-size: 12px; white-space: nowrap; }
.notes-row td { background: #fbfdfe; }
.note-item { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.note-item:last-child { border-bottom: none; }
.note-author { font-weight: 800; font-size: 12px; }
.note-ts { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-left: 6px; }
.note-form { display: flex; gap: 8px; margin-top: 8px; }
.note-form input { flex: 1; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: var(--card); }

/* brain */
.brain { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr; gap: 16px; align-items: start; }
.brain-col { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.brain-col h3 { font-family: var(--display); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
.brain-item { display: flex; gap: 9px; padding: 6px 0; align-items: flex-start; border-bottom: 1px dashed var(--line); }
.brain-item:last-of-type { border-bottom: none; }
.brain-item.done { color: var(--faint); text-decoration: line-through; }
.pp-cat { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); flex: none; margin-top: 2px; }
.brain-form { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.brain-form input, .brain-form select { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: var(--paper); flex: 1; min-width: 90px; }

/* activity */
.activity-item { display: flex; gap: 10px; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.activity-ts { font-family: var(--mono); font-size: 11px; color: var(--faint); flex: none; width: 110px; }
.activity-who { font-weight: 800; flex: none; }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(34, 56, 76, .35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 94vw); z-index: 50;
  background: var(--card); border-left: 1px solid var(--line); padding: 22px;
  overflow-y: auto; box-shadow: -18px 0 50px rgba(34, 56, 76, .15);
}
.drawer h2 { font-family: var(--display); font-size: 19px; margin-bottom: 14px; padding-right: 30px; }
.drawer-close { position: absolute; top: 14px; right: 14px; font-size: 20px; color: var(--faint); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--paper);
}
.field textarea { min-height: 84px; resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.drawer-actions { display: flex; gap: 8px; margin: 14px 0 22px; }
.drawer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 8px; }
.drawer-stamp { font-size: 11px; color: var(--faint); font-family: var(--mono); margin-top: 18px; }

/* confetti */
.confetti { position: fixed; width: 7px; height: 7px; border-radius: 1px; pointer-events: none; z-index: 100; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}

/* responsive */
@media (max-width: 940px) {
  .board { grid-template-columns: 1fr; }
  .brain { grid-template-columns: 1fr; }
}
