:root {
  --ink: #14213d;
  --ink-2: #4a5671;
  --ink-3: #6b7690;
  --paper: #eef1f6;
  --panel: #ffffff;
  --line: #d5dbe6;
  --signal: #ffc53d;
  --action: #2346d6;
  --action-dark: #1a35a6;
  --danger: #b42318;
  --ok: #157f54;
  --radius: 6px;
  --font: 'IBM Plex Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--font); word-break: keep-all; overflow-wrap: anywhere; }
a { color: var(--action); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.3; font-weight: 700; }
h2 { font-size: 1.125rem; line-height: 1.4; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; box-shadow: 0 0 0 2px var(--ink); }
.boot { padding: 48px 16px; text-align: center; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }

/* 틀 */
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--ink); color: #fff; padding: 20px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 700; font-size: 1.25rem; color: #fff; text-decoration: none; }
.brand-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px rgba(255, 197, 61, .25); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .14); }
.nav a { display: block; padding: 10px 12px; border-radius: var(--radius); color: #cfd6e6; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.rail-foot { margin-top: auto; padding: 0 8px; font-size: .875rem; color: #cfd6e6; }
.rail-foot button { background: none; border: 0; padding: 4px 0; color: #fff; text-decoration: underline; font: inherit; cursor: pointer; }
.main { padding: 32px 32px 64px; max-width: 1180px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head p { color: var(--ink-2); max-width: 62ch; }
.back { display: inline-block; margin-bottom: 8px; font-size: .875rem; color: var(--ink-2); }
.block { margin-top: 32px; }
.block > h2 { margin-bottom: 10px; }
.block-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--ink); background: var(--panel); color: var(--ink); border-radius: var(--radius); font: 600 .9375rem/1.3 var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { background: #e4e8f0; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fdecea; }
.btn[disabled] { opacity: .55; cursor: default; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 현황판 */
.block-title { margin-bottom: 10px; }
.board { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.board-row { display: grid; grid-template-columns: 120px repeat(4, minmax(0, 1fr)) 96px; border-top: 1px solid var(--line); }
.board-row:first-child { border-top: 0; }
.board-top { color: var(--ink-2); font-size: .8125rem; font-weight: 500; }
.board-top > div { padding: 8px 12px; }
.row-head { padding: 12px; border-left: 4px solid var(--hub, var(--line)); }
.row-head a { color: inherit; text-decoration: none; font-weight: 600; }
.row-head a:hover { text-decoration: underline; }
.cell { padding: 12px; min-width: 0; }
.cell-plugs { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.plug { color: var(--ink); font-size: .9375rem; line-height: 1.4; text-decoration: none; }
.plug:hover { text-decoration: underline; }
.plug.planned, .plug.paused { color: var(--ink-3); }
.plug-state { margin-left: 6px; font-size: .8125rem; }
.count-link { font-size: .9375rem; color: var(--ink); text-decoration: none; }
.count-link:hover { text-decoration: underline; }
.board-row.off { background: #f6f7fa; }

/* 허브 색 */
.hub-0 { --hub: #0b7a75; } .hub-1 { --hub: #b83280; } .hub-2 { --hub: #c2500c; }
.hub-3 { --hub: #6d28d9; } .hub-4 { --hub: #1d6fd1; } .hub-5 { --hub: #4d7c0f; }

/* 목록 */
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.item { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-link { color: inherit; text-decoration: none; }
.item-link:hover { background: #f6f7fa; }
.item-link:hover .item-title { text-decoration: underline; }
.item-main { min-width: 0; flex: 1 1 240px; }
.item-title { font-weight: 600; color: var(--ink); text-decoration: none; }
a.item-title:hover { text-decoration: underline; }
.item-sub { font-size: .875rem; color: var(--ink-2); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: #e4e8f0; color: var(--ink); font-size: .8125rem; font-weight: 500; }
.tag.active { background: #dcf3e8; color: #0d5c3c; }
.tag.planned { background: #fff1cc; color: #6b4e00; }
.tag.paused { background: #e4e8f0; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.empty { padding: 20px 16px; color: var(--ink-2); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.hub-title { display: flex; gap: 12px; align-items: stretch; }
.hub-title::before { content: ''; width: 6px; border-radius: 3px; background: var(--hub, var(--ink)); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fact { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.fact h3 { font-size: .875rem; color: var(--ink-2); font-weight: 500; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--ink); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; border-radius: var(--radius) var(--radius) 0 0; }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }

/* 폼 */
label.field, .field { display: block; }
.field > span { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 4px; }
.field small { display: block; color: var(--ink-2); font-size: .8125rem; margin-top: 4px; line-height: 1.45; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #8791a8; border-radius: var(--radius); background: #fff; color: var(--ink); font: 400 16px/1.45 var(--font); }
textarea { min-height: 88px; resize: vertical; }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.form-error { color: var(--danger); font-size: .9375rem; font-weight: 500; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); border: 1px solid var(--ink); border-radius: var(--radius); padding: 20px; color: var(--ink); }
dialog::backdrop { background: rgba(20, 33, 61, .55); }
dialog h2 { margin-bottom: 14px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius); font-weight: 500; max-width: calc(100vw - 32px); }
#toast.error { background: var(--danger); }

details { border-top: 1px solid var(--line); padding-top: 12px; }
summary { font-weight: 600; cursor: pointer; min-height: 32px; }
.details-body { margin-top: 10px; }

/* 로그인 */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.gate-box { width: min(420px, 100%); background: var(--panel); padding: 28px 24px; border-radius: var(--radius); border-top: 6px solid var(--signal); }
.gate-box h1 { margin-bottom: 4px; }
.gate-box > p { color: var(--ink-2); margin-bottom: 18px; }
.gate-box .btn { width: 100%; }

/* 기록 */
.log-time { color: var(--ink-2); font-size: .8125rem; white-space: nowrap; }
.log-warn { color: #8a5a00; font-weight: 600; }
.log-error { color: var(--danger); font-weight: 600; }

/* 휴대폰 */
.tabbar { display: none; }
@media (max-width: 860px) {
  .shell { display: block; }
  .rail { display: none; }
  .main { padding: 20px 16px calc(88px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.5rem; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--ink); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { padding: 12px 2px; min-height: 52px; text-align: center; color: #cfd6e6; font-size: .8125rem; font-weight: 500; text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: #fff; font-weight: 700; }
  .board { border: 0; background: none; display: grid; gap: 10px; overflow: visible; }
  .board-row.board-top { display: none; }
  .board-row { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); border-left: 4px solid var(--hub, var(--line)); }
  .row-head { border-left: 0; padding: 12px 14px 4px; }
  .cell { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; padding: 6px 14px; }
  .cell.none { display: none; }
  .cell::before { content: attr(data-label); font-size: .8125rem; color: var(--ink-2); line-height: 1.7; }
  .board-row .cell:last-child { padding-bottom: 12px; }
  .facts, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: minmax(0, 1fr); }
  .quick .btn { width: 100%; }
  #toast { bottom: calc(68px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
