:root {
  --bg: #f6f7f9; --panel: #fff; --line: #dde1e6; --text: #1d232a; --muted: #6b7280;
  --accent: #2563eb; --accent-dark: #1d4ed8; --danger: #dc2626; --ok: #16a34a; --warn: #d97706;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: #9aa3af; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); }
button.danger { color: var(--danger); }
button.link { border: none; background: none; color: var(--accent); padding: 2px 4px; }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; color: var(--text); }
textarea { width: 100%; min-height: 240px; font-family: Consolas, "D2Coding", monospace; font-size: 13px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; width: min(420px, 92vw); }
.login-card form { display: grid; gap: 8px; margin-top: 16px; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.badge { background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.layout { display: grid; grid-template-columns: 220px 1fr auto; min-height: calc(100vh - 45px); }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); padding: 12px; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.board-list { list-style: none; margin: 0; padding: 0; }
.board-list li { padding: 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.board-list li:hover { background: #f1f5f9; }
.board-list li.active { background: #e0e7ff; }
.board-list .count { color: var(--muted); font-size: 12px; }
.main { padding: 16px; min-width: 0; }
.empty { display: grid; place-items: center; height: 60vh; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.title-input { font-size: 16px; font-weight: 600; min-width: 260px; }
.drop-zone { border: 2px dashed #94a3b8; border-radius: 12px; padding: 20px; text-align: center; background: var(--panel); outline: none; }
.drop-zone.over, .drop-zone:focus { border-color: var(--accent); background: #eff6ff; }
.drop-zone p { margin: 4px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 80px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #bfdbfe; }
.card.skipped { opacity: .5; }
.card img { width: 100%; height: 140px; object-fit: contain; background: #fafafa; cursor: pointer; }
.card-body { padding: 8px 10px; display: grid; gap: 6px; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head .num { font-weight: 700; }
.order-badge { background: var(--accent); color: #fff; border-radius: 999px; min-width: 22px; text-align: center; font-size: 12px; padding: 1px 6px; }
.chip { font-size: 12px; border-radius: 999px; padding: 2px 8px; background: #e5e7eb; }
.chip.transcribing { background: #fef3c7; color: #92400e; }
.chip.transcribed { background: #dcfce7; color: #166534; }
.chip.error { background: #fee2e2; color: #991b1b; }
.chip.skipped { background: #e5e7eb; color: #374151; }
.card-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.card-actions button { padding: 2px 8px; font-size: 12px; }
.card .err { color: var(--danger); font-size: 12px; white-space: pre-wrap; }
.footbar { position: fixed; bottom: 0; left: 220px; right: 0; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.editor { width: 460px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; max-height: calc(100vh - 45px); }
.editor-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.editor-body { padding: 12px; overflow: auto; display: grid; gap: 10px; }
.editor-body img { max-width: 100%; border: 1px solid var(--line); cursor: zoom-in; }
.editor-body img.zoomed { max-width: none; width: 200%; cursor: zoom-out; }
.tabs { display: flex; gap: 4px; }
.tab { border-radius: 6px 6px 0 0; }
.tab.active { background: #e0e7ff; border-color: #c7d2fe; }
.preview { background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; padding: 10px; white-space: pre-wrap; font-size: 13px; max-height: 320px; overflow: auto; }
.errors { margin: 0; padding-left: 18px; color: var(--danger); font-size: 13px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 10; }
.modal-card { background: var(--panel); border-radius: 12px; padding: 20px; width: min(720px, 92vw); max-height: 85vh; overflow: auto; }
.page-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.page-list label { display: grid; gap: 4px; text-align: center; cursor: pointer; }
.page-list img { width: 100%; border: 1px solid var(--line); }
.help-body { max-width: 860px; margin: 0 auto; padding: 24px; background: var(--panel); line-height: 1.6; }
.help-body img { max-width: 100%; }
.help-body code { background: #f1f5f9; padding: 1px 4px; border-radius: 4px; }
.help-body pre { background: #f1f5f9; padding: 10px; border-radius: 6px; overflow: auto; }
.help-body table { border-collapse: collapse; }
.help-body td, .help-body th { border: 1px solid var(--line); padding: 4px 8px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .footbar { left: 0; }
  .editor { width: 100%; }
}

.startbar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.startbar .muted { font-size: 13px; }
