@font-face { font-family: Pretendard; font-weight: 400; font-style: normal; font-display: swap; src: url('/static/fonts/pretendard-400.woff2?v=1') format('woff2'); }
@font-face { font-family: Pretendard; font-weight: 700; font-style: normal; font-display: swap; src: url('/static/fonts/pretendard-700.woff2?v=1') format('woff2'); }

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --ink: #1b1b1a;
  --ink-2: #55554f;
  --muted: #6b6b64;
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --accent: #2a5bd7;
  --accent-soft: #e8eefc;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: #e7f5e7;
  --warning: #fab219;
  --warning-soft: #fff4dc;
  --critical: #d03b3b;
  --critical-soft: #fbe9e9;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Pretendard, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: -0.2px; margin-right: 8px; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
}
.tab.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.top .grow { flex: 1; }
.search {
  width: 220px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.me { color: var(--muted); font-size: 13px; white-space: nowrap; }
.me button { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0 0 0 6px; }

.btn {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: default; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 64px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(200px, 1.3fr) minmax(220px, 2fr) 96px;
  gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); cursor: pointer;
}
.row:hover { background: #fbfbf9; }
.row.head { cursor: default; background: var(--bg); border-top: 0; color: var(--muted); font-size: 12px; padding-top: 8px; padding-bottom: 8px; }
.row.head:hover { background: var(--bg); }
.row.head > div:last-child { text-align: right; }
.row .title { font-weight: 700; }
.meta { color: var(--muted); font-size: 12px; }
.c-stage { font-size: 13px; }
.c-stage .sno { color: var(--accent); }
.c-next { font-size: 13px; }
.c-due { text-align: right; font-variant-numeric: tabular-nums; }
.c-due.late b { color: var(--critical); }
.alert-line { font-size: 12px; color: #8a5a00; margin-top: 3px; }
.alert-line::before { content: "⚠ "; }
.alert-line.critical { color: var(--critical); }
.alert-line.critical::before { content: "⛔ "; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty b { color: var(--ink); display: block; font-size: 15px; margin-bottom: 4px; }

.dots { display: inline-flex; gap: 4px; margin-top: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.done { background: var(--good); }
.dots i.cur { background: var(--accent); }
.dots i.past { background: #b9dcb9; }

.sno {
  display: inline-block; min-width: 20px; height: 18px; padding: 0 5px; border: 1.5px solid currentColor; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums; vertical-align: 1px;
}

.badge { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 11px; white-space: nowrap; vertical-align: 1px; }
.badge.secret { background: var(--critical-soft); color: var(--critical); }

.alert {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  background: var(--warning-soft); color: #6b4a00;
}
.alert.critical { background: var(--critical-soft); color: var(--critical); }
.alert::before { content: "⚠"; }
.alert.critical::before { content: "⛔"; }

.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 12px; white-space: nowrap; }
.link:hover { text-decoration: underline; }

.back { border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 0; font-size: 13px; }
.dhead { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.dhead h1 { font-size: 22px; margin: 0; letter-spacing: -0.3px; }
.dhead .sub { color: var(--muted); }
.dhead .grow { flex: 1; }
.alerts-line { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.customs { padding: 10px 16px; font-size: 13px; }
.customs details.fold { margin-top: 6px; }
.customs .events li { grid-template-columns: 90px 110px 1fr; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }

.stabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.stab {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px; cursor: pointer;
  color: var(--muted); display: inline-flex; align-items: center; gap: 4px;
}
.stab.done { color: var(--good-text); }
.stab.cur { color: var(--accent); }
.stab.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stab .ok { font-size: 12px; }
.stab .nm { font-size: 13px; }
.stab .miss { font-size: 11px; color: var(--muted); }
.stab.past { color: var(--ink-2); }

.stage-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.stage-head h2 { margin: 0; font-size: 18px; }
.stage-head .sno { font-size: 13px; height: 22px; line-height: 19px; min-width: 26px; border-radius: 11px; vertical-align: 2px; }
.stage-goal { margin: 4px 0 10px; color: var(--ink-2); font-size: 13px; }
.col-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 16px 0 4px; }

.check { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--good); cursor: pointer; }
.check .lb { cursor: pointer; }
.check .hint { color: var(--muted); font-size: 12px; margin-top: 1px; }
.check.done .lb { color: var(--muted); }
.check.na .lb { color: var(--muted); text-decoration: line-through; }
.check .link { color: var(--muted); margin-top: 3px; }

.doc { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); align-items: center; }
.doc:first-child { border-top: 0; }
.doc .dn { font-size: 14px; }
.doc .st { color: var(--muted); font-size: 12px; margin-left: 6px; }
.doc .st.ok { color: var(--good-text); }
.doc .files { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.doc .file { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.doc .file a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .da { grid-column: 2; grid-row: 1; display: flex; gap: 10px; }
.doc .da input[type=file] { display: none; }
.xbtn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 14px; }
.xbtn:hover { color: var(--critical); }

details.fold > summary { cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 700; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸ "; color: var(--muted); }
details.fold[open] > summary::before { content: "▾ "; }
details.fold[open] > summary { margin-bottom: 10px; }
section.card details.fold { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; }
.field .k { color: var(--muted); font-size: 12px; }
.field .v { min-height: 21px; overflow-wrap: anywhere; }
.field input, .field select, .field textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); }
.field.wide { grid-column: span 2; }
.form-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }

.note { background: var(--warning-soft); border-radius: 8px; padding: 8px 12px; margin: 6px 0; font-size: 13px; }
.extra { background: var(--critical-soft); border-radius: 8px; padding: 10px 14px; margin: 6px 0; font-size: 13px; }
.extra b { color: var(--critical); }
.extra ol { margin: 6px 0 0; padding-left: 20px; }
.phrase { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0; }
.phrase .ph { display: flex; gap: 8px; align-items: center; }
.phrase .pt { font-weight: 700; font-size: 13px; }
.phrase .ph .btn { margin-left: auto; }
.phrase pre { white-space: pre-wrap; font-family: inherit; margin: 6px 0 0; font-size: 13px; }
.phrase .ko { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stuck { background: var(--bg); border-radius: 8px; padding: 10px 14px; margin: 6px 0; font-size: 13px; }
.stuck b::before { content: "❓ "; }
.stuck b.plain::before { content: none; }
ul.rules { margin: 0; padding-left: 18px; font-size: 13px; }
ul.rules li { margin: 4px 0; }

.events { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 320px; overflow: auto; }
.events li { display: grid; grid-template-columns: 100px 80px 1fr; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.events li:first-child { border-top: 0; }
.events .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.events .a { color: var(--ink-2); }

.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 340px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login p { margin: 0 0 18px; color: var(--muted); }
.login label { display: block; font-size: 13px; color: var(--ink-2); margin: 10px 0 4px; }
.login input { width: 100%; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 8px; }
.login .btn { width: 100%; margin-top: 18px; padding: 10px; }
.err { color: var(--critical); font-size: 13px; margin-top: 10px; min-height: 18px; }

.modal-bg { position: fixed; inset: 0; background: rgba(20, 20, 18, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 14px; padding: 22px; }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60;
}
#toast.show { opacity: 1; }

@media (max-width: 1000px) {
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 840px) {
  .row { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 14px; }
  .row.head { display: none; }
  .row .c-stage, .row .c-next { grid-column: 1 / -1; }
  .row .c-due { grid-column: 2; grid-row: 1; }
}
@media (max-width: 640px) {
  .top { position: static; padding: 10px 14px; }
  .search { width: 100%; order: 10; }
  main { padding: 14px 12px 48px; }
  .events li { grid-template-columns: 1fr; gap: 0; }
  .modal .fields { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
}
