@font-face { font-family: "Depot Display"; src: url("fonts/UI_Font_Display-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Arena Body"; src: url("fonts/UI_Font_Body-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Arena Body"; src: url("fonts/UI_Font_Body-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --bg: #08090a;
  --panel: #111417;
  --panel-2: #171b1f;
  --line: #2a2f35;
  --text: #e9e7e2;
  --muted: #9aa0a6;
  --accent: #f2b51c;
  --accent-ink: #141006;
  --later: #8a9099;
  --planned: #7fb0e0;
  --dev: #f2b51c;
  --done: #6cc487;
  --danger: #ef6b5e;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 "Arena Body", system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, h3 { font-family: "Depot Display", "Arena Body", sans-serif; font-weight: 700; margin: 0; letter-spacing: .02em; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; }
h3 { font-size: 18px; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
.btn {
  font: inherit; font-weight: 600; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #444b53; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, .card:focus-visible, .row:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 96px; }

/* ---------- login ---------- */
#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(380px, 100%); display: grid; gap: 16px; padding: 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { font: 700 22px "Depot Display", sans-serif; letter-spacing: .12em; color: var(--accent); }
.brand-sub { font: 700 14px "Depot Display", sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px; background: rgba(8, 9, 10, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a {
  text-decoration: none; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
main { max-width: 1320px; margin: 0 auto; padding: 24px 24px 80px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head p { margin-top: 4px; max-width: 70ch; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; white-space: nowrap;
}
button.chip { cursor: pointer; padding: 7px 12px; font-size: 13px; }
button.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chip.ms { border-style: dashed; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.s-later { color: var(--later); } .pill.s-planned { color: var(--planned); } .pill.s-in_dev { color: var(--dev); } .pill.s-done { color: var(--done); }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 180px; }
.col.over { border-color: var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; }
.col-head h2 { flex: 1; }
.col-head .count { color: var(--muted); font-size: 13px; font-weight: 600; }
.col-head.s-planned h2 { color: var(--planned); } .col-head.s-in_dev h2 { color: var(--dev); } .col-head.s-done h2 { color: var(--done); }
.cards { display: grid; gap: 8px; min-height: 40px; }
.empty { color: var(--muted); font-size: 14px; padding: 16px 8px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.card {
  display: grid; gap: 8px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; border-left: 3px solid var(--line);
}
.card:hover { border-color: #444b53; }
.card.s-planned { border-left-color: var(--planned); } .card.s-in_dev { border-left-color: var(--dev); } .card.s-done { border-left-color: var(--done); }
.card.dragging { opacity: .4; }
.card.drop-before { box-shadow: 0 -3px 0 -1px var(--accent); }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.card.s-done .card-title { color: #c9c7c2; }
.card-desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-meta { color: var(--muted); font-size: 12px; }
.col-more { display: block; text-align: center; margin-top: 10px; color: var(--muted); font-size: 13px; }

/* ---------- long-term plan ---------- */
.mstone { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.ms-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ms-title { flex: 1; min-width: 200px; }
.ms-title .target { color: var(--accent); font-weight: 600; font-size: 13px; margin-left: 10px; white-space: nowrap; }
.ms-title p { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 80ch; }
.ms-actions { display: flex; gap: 6px; }
.progress { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; color: var(--muted); font-size: 13px; }
.bar { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .b-done { background: var(--done); } .bar .b-dev { background: var(--dev); }
.rows { display: grid; }
.row {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 8px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 6px;
}
.row:hover { background: var(--panel-2); }
.row-title { overflow-wrap: anywhere; }
.row-title .chip { margin-left: 8px; }
.row.s-done .row-title { color: var(--muted); }
.row-side { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1; }

/* ---------- history ---------- */
.two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.panel > h2 { margin-bottom: 12px; }
.month { margin: 18px 0 4px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.month:first-of-type { margin-top: 0; }
.feed { display: grid; }
.feed-item { padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.feed-item:first-child { border-top: 0; }
.feed-item time { display: block; color: var(--muted); font-size: 12px; }
.feed-item b { font-weight: 600; }
.feed-item .link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.feed-item .gone { color: var(--muted); text-decoration: line-through; }
.feed-item blockquote { margin: 6px 0 0; padding: 6px 10px; border-left: 2px solid var(--line); color: var(--muted); white-space: pre-wrap; }

/* ---------- dialog ---------- */
dialog {
  width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
dialog.narrow { width: min(480px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.dlg-body { display: grid; gap: 14px; padding: 22px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  flex: 1; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 6px; color: var(--muted);
  background: var(--bg); border: 0; border-left: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.seg button:first-child { border-left: 0; }
.seg button.on.s-later { background: var(--later); color: #0b0c0d; }
.seg button.on.s-planned { background: var(--planned); color: #0b0c0d; }
.seg button.on.s-in_dev { background: var(--dev); color: var(--accent-ink); }
.seg button.on.s-done { background: var(--done); color: #0b0c0d; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.dlg-actions .spacer { flex: 1; }
.dlg-section { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.note-row { display: flex; gap: 8px; align-items: flex-start; }
.note-row textarea { min-height: 44px; height: 44px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.toast.ok { border-left-color: var(--done); }

@media (max-width: 900px) {
  .board, .two { grid-template-columns: 1fr; }
  .top { padding: 10px 16px; gap: 10px; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .who { margin-left: auto; }
  main { padding: 16px 16px 64px; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row > .pill { grid-column: 1 / -1; }
  .grid2 { grid-template-columns: 1fr; }
  .seg { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .btn, .tabs a { transition: border-color .12s, background-color .12s; }
}
