/* ============================================================
   타이디 블로그모니터 — 디자인 시스템 v3 (2026-08-28 재설계)

   왜 다시 짰나
   ─────────────
   1) 상단 가로 메뉴에 항목이 6개로 늘자 브랜드와 메뉴가 통째로 잘려 나갔다.
      → 좌측 고정 사이드바 256px. 항목이 늘어도 세로로 쌓인다.
      (Linear·Stripe·Grafana·Vercel이 쓰는 폭)
   2) 표 머리를 sticky로 두고 표를 overflow 상자에 넣자 머리가 첫 줄을 덮었다.
      → sticky 제거. 스크롤 상자와 sticky는 같이 쓰지 않는다.
   3) 순위 배지에 금·은·동 색을 덮어씌워 "파랑=내 블로그 / 빨강=경쟁사"라는
      이 앱의 가장 중요한 약속이 깨졌다. 경쟁사 3위가 갈색으로 보였다.
      → 금속색 폐기. 1~3위는 같은 색 계열의 링으로만 표시한다.

   원칙
   ─────
   · 첫 화면에는 판단에 필요한 것만. 숫자 타일은 4~5개까지.
   · 요약 먼저, 상세는 한 번 눌러서. (progressive disclosure)
   · 파랑 = 내 블로그 / 빨강 = 경쟁사. 이 약속을 덮는 색은 만들지 않는다.
   · 모션은 transform·opacity 만 (GPU 전용).
   ============================================================ */

/* ── 토큰 ─────────────────────────────────────────────── */
:root {
  /* 중립 (warm neutral · stone) */
  --bg: #f7f6f4;
  --card: #ffffff;
  --line: #e7e5e4;
  --line-soft: #efedeb;
  --head-bg: #faf9f8;
  --txt: #1c1917;
  --txt-2: #57534e;
  --txt-3: #8a8480;
  --placeholder: #b3aca7;

  /* 의미 색 — 파랑=우리, 빨강=경쟁사 */
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-line: #bfdbfe;
  --comp: #b91c1c;
  --comp-line: #dc2626;
  --comp-soft: #fef2f2;

  --ok-text: #047857;  --ok-bg: #d1fae5;  --ok-line: #a7f3d0;
  --warn-text: #92400e; --warn-bg: #fef3c7; --warn-line: #fde68a;
  --bad-text: #991b1b;  --bad-bg: #fee2e2;  --bad-line: #fecaca;

  /* 사이드바 */
  --side-w: 256px;
  --side-bg: #ffffff;
  --side-line: #e7e5e4;

  --ring: #2563eb;
  --focus-input: #93b8f5;

  --shadow-xs: 0 1px 2px rgba(28,25,23,.05);
  --shadow-sm: 0 1px 2px rgba(28,25,23,.04), 0 1px 3px rgba(28,25,23,.06);
  --shadow-md: 0 1px 2px rgba(28,25,23,.04), 0 4px 12px rgba(28,25,23,.06);
  --shadow-lg: 0 4px 12px rgba(28,25,23,.08), 0 24px 64px rgba(28,25,23,.10);

  --r-card: 12px;
  --r-ctl: 8px;

  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          'Apple SD Gothic Neo', 'Malgun Gothic', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;
}

/* ── 베이스 ───────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #dbeafe; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: #d6d3d1 transparent; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

h1, h2, h3 { letter-spacing: -.012em; }
h1 { font-size: 21px; line-height: 1.3; font-weight: 700; margin: 0; }
h2 { font-size: 15px; font-weight: 650; margin: 30px 0 10px; }
h3 { font-size: 13.5px; font-weight: 650; color: var(--txt-2); margin: 18px 0 0; }
p { margin: 8px 0; }
a { color: var(--accent-strong); text-decoration: none; }
main a:hover { text-decoration: underline; text-underline-offset: 3px; }

small.dim, .dim { color: var(--txt-3); font-weight: 400; }
.dim2 { color: var(--txt-3); }
.hint { color: var(--txt-3); font-size: 12.5px; line-height: 1.6; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.center { text-align: center; }
.jobline { color: var(--txt-2); }
.spacer { flex: 1; }

/* ============================================================
   1. 껍데기 — 좌측 사이드바 + 본문
   ============================================================ */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 60;
  display: flex; flex-direction: column;
  background: var(--side-bg); border-right: 1px solid var(--side-line);
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px; font-weight: 700; font-size: 15px;
  letter-spacing: -.015em; color: var(--txt);
}
.side-brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; box-shadow: 0 1px 3px rgba(29,78,216,.35);
}
.brand-mark svg { width: 17px; height: 17px; }

.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.side-sect {
  font-size: 11px; font-weight: 650; letter-spacing: .04em;
  color: var(--txt-3); text-transform: uppercase;
  padding: 14px 8px 6px;
}
.side-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 1px; border-radius: var(--r-ctl);
  color: var(--txt-2); font-weight: 500; font-size: 14px;
}
.side-link svg { width: 17px; height: 17px; flex: none; opacity: .7; }
.side-link:hover { background: var(--line-soft); color: var(--txt); text-decoration: none; }
.side-link.on {
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 650;
}
.side-link.on svg { opacity: 1; }
.side-link.on::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.side-link .cnt {
  margin-left: auto; font-size: 11.5px; font-weight: 700;
  background: var(--bad-bg); color: var(--bad-text);
  padding: 0 7px; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.side-foot {
  border-top: 1px solid var(--line-soft); padding: 10px 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.side-foot .side-link { font-size: 13.5px; }
.side-note { padding: 6px 10px 0; font-size: 11.5px; color: var(--txt-3); line-height: 1.5; }

.shell { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px 56px; }
footer { text-align: center; color: var(--txt-3); padding: 8px 20px 30px; font-size: 12px; }

/* ★main에는 위 여백이 없다 — 위 여백은 .pagehead가 낸다.
   .pagehead를 안 쓰고 <h1>을 바로 놓은 화면은 제목이 화면 맨 위에 붙어
   잘려 보였다(키워드관리·동기화기록·도움말·추이, 2026-08-28 실측).
   화면마다 머리를 다시 만들지 않도록 여기서 한 번에 막는다. */
main > h1 { margin: 26px 0 2px; }
main > h1 + p, main > h1 + .hint { margin-top: 6px; }
main > h1 + .filterbar, main > h1 + table, main > h1 + .tablescroll,
main > h1 + section, main > h1 + div { margin-top: 16px; }

/* ── 페이지 머리 ───────────────────────────────────────── */
.pagehead {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 26px 0 18px;
}
.pagehead .ph-t { min-width: 0; }
.pagehead .ph-sub { color: var(--txt-3); font-size: 13px; margin: 3px 0 0; }
.pagehead .ph-act { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   2. 배너
   ============================================================ */
.flash, .alertbox, .jobbar {
  border-radius: 10px; padding: 10px 15px; margin: 0 0 14px;
  font-size: 13.5px; line-height: 1.55;
}
.flash    { background: var(--accent-soft); border: 1px solid var(--accent-line); color: #1e40af; margin-top: 14px; }
.alertbox { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); }
.alertbox a { color: var(--warn-text); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.jobbar   { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; }
.jobbar.running { box-shadow: inset 3px 0 0 #6366f1; }
.ok-box   { background: #f2fdf7; border-color: var(--ok-line); color: var(--ok-text); }

/* ============================================================
   3. 폼 · 버튼
   ============================================================ */
input, select, button { font-family: inherit; font-size: 14px; color: var(--txt); }
input, select {
  padding: 6px 11px; min-height: 34px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-ctl);
}
input::placeholder { color: var(--placeholder); }
input:focus-visible, select:focus-visible {
  outline: none; border-color: var(--focus-input);
  box-shadow: 0 0 0 3px rgba(37,99,235,.13);
}
input.ro, .ro { background: var(--bg); color: var(--txt-2); }
input[type="color"] {
  min-height: 0; width: 30px; height: 28px; padding: 2px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card); cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357534e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}

button, .btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border: 1px solid transparent; border-radius: var(--r-ctl);
  background: var(--accent); color: #fff; font-weight: 650; font-size: 13.5px;
  cursor: pointer; text-decoration: none; box-shadow: var(--shadow-xs);
  white-space: nowrap;
}
button::after, .btn::after {
  content: ""; position: absolute; inset: 0; background: #000;
  opacity: 0; transition: opacity 120ms ease-out; pointer-events: none;
}
button:hover::after, .btn:hover::after { opacity: .07; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button:disabled::after { opacity: 0; }

/* 보조 버튼 — 표 안에서는 이게 기본이다. 파랑 버튼이 줄마다 있으면
   어느 것이 중요한지 사라진다. */
button.ghost, .btn.ghost, .mini-btn.ghost {
  background: var(--card); color: var(--txt-2);
  border-color: var(--line); box-shadow: none;
}
button.ghost:hover, .btn.ghost:hover { color: var(--txt); }

/* 파괴적 동작은 평소엔 조용하게, 누르려 할 때만 빨갛게.
   빨간 버튼이 줄마다 있으면 화면이 소리를 지른다. */
button.danger {
  background: var(--card); color: var(--txt-3);
  border-color: var(--line); box-shadow: none;
}
button.danger:hover {
  background: var(--comp-soft); color: var(--comp); border-color: var(--bad-line);
}
button.danger:hover::after { opacity: 0; }

.mini-btn { padding: 3px 9px; font-size: 12.5px; border-radius: 7px; }
.btn { padding: 7px 13px; }
form.inline, form.inline-form { display: inline-flex; gap: 6px; align-items: center; }

/* ── 필터 바 ───────────────────────────────────────────── */
.filterbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-xs); padding: 9px 12px; margin-bottom: 16px;
}
.filterbar input:not([type]), .filterbar input[name="q"] { flex: 1 1 180px; max-width: 340px; }
.filterbar .hint { flex: 1 1 auto; min-width: 0; }

.pager { margin: 14px 2px; display: flex; gap: 4px; flex-wrap: wrap; }
.pg {
  min-width: 30px; height: 30px; padding: 0 6px; border-radius: var(--r-ctl);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line);
  color: var(--txt-2); font-size: 13px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pg:hover { background: var(--line-soft); text-decoration: none; }
.pg.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; }

/* ============================================================
   4. 표
   ★sticky 머리를 쓰지 않는다 — 스크롤 상자 안에서 첫 줄을 덮는다.
   ============================================================ */
table {
  width: 100%; margin: 12px 0 20px;
  border-collapse: separate; border-spacing: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-xs);
  font-variant-numeric: tabular-nums;
}
th, td { padding: 9px 13px; text-align: left; vertical-align: middle; }
th {
  font-size: 12.5px; font-weight: 650; color: var(--txt-3);
  letter-spacing: -.005em; white-space: nowrap;
}
thead th { background: var(--head-bg); border-bottom: 1px solid var(--line); }
tbody td { border-bottom: 1px solid var(--line-soft); height: 42px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fcfbfa; }
tbody th { background: var(--head-bg); border-bottom: 1px solid var(--line); }
tfoot th { background: var(--head-bg); border-top: 1px solid var(--line); font-weight: 700; color: var(--txt); }

td.num, th.num { text-align: right; white-space: nowrap; }
td[colspan] { text-align: center; color: var(--txt-3); padding: 24px 14px; }

/* 모서리 라운딩 (overflow:hidden 없이) */
thead tr:first-child th:first-child { border-top-left-radius: calc(var(--r-card) - 1px); }
thead tr:first-child th:last-child { border-top-right-radius: calc(var(--r-card) - 1px); }
tbody tr:first-child th:first-child { border-top-left-radius: calc(var(--r-card) - 1px); }
tbody tr:last-child td:first-child, tfoot tr:last-child th:first-child { border-bottom-left-radius: calc(var(--r-card) - 1px); }
tbody tr:last-child td:last-child, tfoot tr:last-child th:last-child { border-bottom-right-radius: calc(var(--r-card) - 1px); }

/* 촘촘한 표 — 줄이 많은 표에만 붙인다 */
table.tight th, table.tight td { padding: 6px 11px; }
table.tight tbody td { height: 38px; }

/* 옆으로 긴 표는 제 상자 안에서만 흐른다 */
.tablescroll { overflow-x: auto; margin: 12px 0 20px; }
.tablescroll > table { margin: 0; }

.matrix th.comp-h { background: #fdf7f6; color: var(--comp); text-align: center; border-left: 1px solid var(--line-soft); }
.matrix th.comp { font-weight: 500; font-size: 11.5px; color: var(--txt-3); }
.matrix .rankcell { text-align: center; }
.my-h { text-align: center; }
.sub { font-size: 11px; color: var(--txt-3); font-weight: 500; }

/* 계정·업체를 세로로 합친 칸 */
td.acct-cell {
  background: var(--head-bg); vertical-align: top; white-space: nowrap;
  border-right: 1px solid var(--line);
}
td.acct-cell b { font-size: 14px; }

td.actions { white-space: nowrap; }
td.actions > *, td.actions form { margin-right: 3px; }
td.actions > *:last-child { margin-right: 0; }

.newrow td { background: #fcfbfa; border-top: 1px dashed var(--line); }
.newrow:hover td { background: var(--head-bg); }
.offrow td input, .offrow td .badge, .offrow td .bid { opacity: .5; }
.threat-row td { background: #fdf6f5; }
.threat-row td:first-child { box-shadow: inset 3px 0 0 var(--comp-line); }
.threat-row:hover td { background: #fbecea; }

.formhost { display: none; }

/* ============================================================
   5. 순위 배지 — 이 앱의 핵심 약속
      파랑 채움 = 내 블로그 / 빨간 외곽선 = 경쟁사.
      1~3위는 **같은 색 계열의 링**으로만 표시한다.
      금·은·동 색으로 덮으면 내 것과 남의 것을 구별할 수 없게 된다.
   ============================================================ */
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 23px; padding: 0 7px;
  border-radius: 7px; font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.rank.g { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.rank.c { background: var(--card); color: var(--comp); border: 1.5px solid var(--comp-line); }

.rank.g.top1 { box-shadow: 0 0 0 3px rgba(37,99,235,.22); }
.rank.g.top2 { box-shadow: 0 0 0 2px rgba(37,99,235,.16); }
.rank.g.top3 { box-shadow: 0 0 0 2px rgba(37,99,235,.10); }
.rank.c.top1 { box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.rank.c.top2 { box-shadow: 0 0 0 2px rgba(220,38,38,.13); }
.rank.c.top3 { box-shadow: 0 0 0 2px rgba(220,38,38,.09); }

/* ── 직전 대비 변화 ────────────────────────────────────── */
.mvline { margin-top: 2px; line-height: 1; min-height: 12px; }
.mv { font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mv.up   { color: var(--ok-text); }
.mv.down { color: var(--bad-text); }
.mv.out  { color: var(--warn-text); }
/* NEW·동일은 알림이 아니다 — 첫 체크에는 전부 NEW라 화면이 NEW로 뒤덮인다 */
.mv.new, .mv.same { color: var(--placeholder); font-weight: 500; }

/* ── 측정 출처 ─────────────────────────────────────────── */
.srcmark {
  display: inline-block; padding: 0 5px; border-radius: 5px;
  font-size: 10.5px; font-weight: 650; vertical-align: 1px;
}
.srcmark.html { background: var(--ok-bg);   color: var(--ok-text); }
.srcmark.api  { background: var(--warn-bg); color: var(--warn-text); }

/* ── 배지 · 알약 · 칩 ──────────────────────────────────── */
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
}
.badge.ok  { background: var(--ok-bg); color: var(--ok-text); }
.badge.bad { background: var(--bad-bg); color: var(--bad-text); }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--txt-2);
  font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.pill.ok  { background: var(--ok-bg);  color: var(--ok-text); }
.pill.bad { background: var(--bad-bg); color: var(--bad-text); }
.chip {
  display: inline-block; padding: 1px 8px; margin: 0 2px 3px 0;
  background: var(--line-soft); border-radius: 999px;
  font-size: 12px; color: var(--txt-2);
}
.tag { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 650; }
.tag.boss { background: var(--accent-soft); color: var(--accent-strong); }
.tag.mach { background: var(--line-soft); color: var(--txt-2); }
/* 범례 — 문단으로 쓰면 벽이 된다. 한 줄에 한 가지만, 회색 상자 안에.
   (모니터 하단의 설명 문단이 실제로 읽히지 않는 벽이었다 — 2026-08-28) */
.legend {
  margin: 18px 0 6px; padding: 12px 15px;
  background: var(--head-bg); border: 1px solid var(--line-soft);
  border-radius: 10px;
  display: grid; gap: 5px;
}
.legend span { display: block; color: var(--txt-2); font-size: 12.5px; line-height: 1.6; }
.legend b.rank { vertical-align: 1px; }

/* ============================================================
   6. 숫자 타일 — 한 화면에 4~5개까지. 그 이상은 아무것도 안 보인다.
   ============================================================ */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tot {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-xs); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 1px;
}
.tot-n { font-size: 23px; font-weight: 700; line-height: 1.15; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.tot-l { font-size: 12px; color: var(--txt-3); white-space: nowrap; }
.tot-n small { font-size: 15px; color: var(--txt-3); font-weight: 650; }
.tot.ok  { background: #f2fdf7; border-color: var(--ok-line); }
.tot.ok  .tot-n { color: var(--ok-text); }
.tot.bad { background: var(--comp-soft); border-color: var(--bad-line); }
.tot.bad .tot-n { color: var(--bad-text); }
/* 지금 손봐야 할 하나 — 다른 타일보다 확실히 앞에 나온다 */
.tot.lead { box-shadow: 0 0 0 1px var(--bad-line), var(--shadow-md); }
/* ★0은 성과가 아니다. 값이 0이면 초록·빨강을 칠하지 않는다 —
   첫 화면이 "10위 안 0"을 초록으로 축하하고 있었다 (2026-08-28 실측). */
.tot.zero { background: var(--card); border-color: var(--line); box-shadow: var(--shadow-xs); }
.tot.zero .tot-n { color: var(--placeholder); }

/* ============================================================
   6-1. 첫 실행 안내 — 데이터가 하나도 없을 때
   표를 "—"로 채워 보여주는 건 안내가 아니다. 무엇부터 하면 되는지를 준다.
   ============================================================ */
.emptyhero {
  background: var(--card); border: 1px solid var(--accent-line);
  border-radius: var(--r-card); box-shadow: var(--shadow-sm);
  padding: 20px 22px; margin: 0 0 20px;
}
.emptyhero h2 { margin: 0 0 3px; font-size: 16px; }
.emptyhero > p { margin: 0 0 15px; color: var(--txt-2); font-size: 13.5px; }
.steprow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.stepcard {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--head-bg); padding: 12px 14px;
}
.stepcard .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; margin-bottom: 7px;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700;
}
.stepcard > b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.stepcard p { margin: 0; color: var(--txt-3); font-size: 12.5px; line-height: 1.55; }
.stepcard .btn, .stepcard button { margin-top: 9px; }

/* 행이 0인 표는 머리만 남겨 두지 않는다 — 아무 열과도 안 맞는
   헤더가 홀로 떠 있게 된다. 표 대신 이 상자를 그린다. */
.emptystate {
  border: 1px dashed var(--line); border-radius: var(--r-card);
  background: var(--card); padding: 30px 24px; text-align: center;
  color: var(--txt-2); margin: 12px 0 20px;
}
.emptystate > b { display: block; font-size: 14.5px; color: var(--txt); margin-bottom: 5px; }
.emptystate p { margin: 0 0 12px; font-size: 13px; color: var(--txt-3); }

/* 접히는 도움말 — 산문이 표 사이에 끼면 표 경계가 흐려진다 */
.hintfold { margin: 6px 0 16px; }
.hintfold > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--txt-2);
  list-style: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
}
.hintfold > summary::-webkit-details-marker { display: none; }
.hintfold > summary::before { content: "?"; font-weight: 700; color: var(--txt-3); }
.hintfold > summary:hover { background: var(--head-bg); color: var(--txt); }
.hintfold > .hint { margin-top: 8px; }
.fieldbox.helpfold { margin: 14px 0; }
.fieldbox.helpfold > summary { border-left-color: var(--accent-line); font-size: 14px; }
.fieldbox.helpfold .fieldbody > table { margin-top: 10px; }

/* ============================================================
   6-2. 사용법 패널 — 화면마다 접혀 있다가 눌러야 열린다
   ★내용은 app/help.py 한 곳에서 온다. 여기는 모양만 맡는다.
   ============================================================ */
.guide { margin: 0 0 18px; }
.guide > summary {
  display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap;
  cursor: pointer; list-style: none;
  padding: 6px 13px 6px 8px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: var(--accent-strong); font-size: 13px;
}
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary:hover { background: #e4efff; }
.guide > summary .dim { color: var(--txt-3); font-weight: 400; }
.guide .gq {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700;
}
.guide[open] > summary { border-radius: var(--r-card) var(--r-card) 0 0; border-bottom-color: transparent; }

.guidebody {
  border: 1px solid var(--accent-line); border-radius: 0 var(--r-card) var(--r-card);
  background: var(--card); padding: 4px 18px 16px;
}
.guidebody h4 {
  font-size: 12px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
  color: var(--txt-3); margin: 18px 0 6px;
}
.guide-what { color: var(--txt); font-size: 13.5px; line-height: 1.7; margin: 14px 0 0; }
.gsteps { margin: 0; padding-left: 20px; }
.gsteps li { font-size: 13.5px; line-height: 1.7; color: var(--txt-2); margin-bottom: 4px; }
.gnotes { margin: 0; padding-left: 18px; }
.gnotes li { font-size: 13px; line-height: 1.7; color: var(--warn-text); margin-bottom: 3px; }

/* 항목 설명 — 이름과 뜻을 두 칸으로. 산문으로 늘어놓으면 못 찾는다 */
.gitems { display: grid; grid-template-columns: 190px 1fr; gap: 6px 16px; margin: 0; }
.gitems dt { font-size: 13px; font-weight: 650; color: var(--txt); }
.gitems dd { margin: 0; font-size: 13px; line-height: 1.65; color: var(--txt-2); }

.guide-foot { margin: 18px 0 0; font-size: 12px; color: var(--txt-3); }
.guide-missing, .guide-stale {
  margin: 14px 0 0; padding: 9px 13px; border-radius: 9px;
  background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-text);
  font-size: 13px; line-height: 1.6;
}
.guide-stale { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }

/* 전체 사용법 화면 */
.guidenav { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 18px; }
.guidenav .chip { background: var(--card); border: 1px solid var(--line); font-size: 12.5px; padding: 3px 11px; }
.guidenav .chip:hover { background: var(--head-bg); text-decoration: none; }
.guidesec {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-xs); padding: 2px 18px 16px; margin-bottom: 14px;
  scroll-margin-top: 20px;
}
.guidesec-t { font-size: 15px; font-weight: 700; color: var(--txt); margin: 16px 0 0; }
.guidesec .guidebody { border: none; padding: 0; }

@media (max-width: 720px) {
  .gitems { grid-template-columns: 1fr; gap: 2px; }
  .gitems dd { margin-bottom: 8px; }
}

/* 방향 칩 (동기화기록) — 두 글자에서 줄바꿈되면 표가 흔들린다 */
.dirchip {
  display: inline-block; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
  background: var(--line-soft); color: var(--txt-2);
}
.dirchip.in  { background: var(--accent-soft); color: var(--accent-strong); }
.dirchip.out { background: var(--ok-bg); color: var(--ok-text); }
.logtable td.when, .logtable td.dir { white-space: nowrap; }
.logtable td.detail { color: var(--txt-2); }
.logtable td.detail summary { cursor: pointer; font-size: 12.5px; }
.logtable td.detail .mono { overflow-wrap: anywhere; }

/* ── 블로그 신원 ───────────────────────────────────────── */
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2.5px; margin-right: 6px; vertical-align: 1px; }
.bid { font-family: var(--mono); font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.openlink { margin-left: 3px; color: var(--txt-3); font-weight: 700; }
.openlink:hover { color: var(--accent-strong); }
.bline { padding: 1px 0; white-space: nowrap; }
.bline + .bline { margin-top: 2px; }

.fieldlink { display: inline-flex; align-items: baseline; gap: 3px; color: var(--txt); }
.fieldlink b { font-size: 14px; }
.fieldlink:hover { text-decoration: none; }
.fieldlink:hover b { color: var(--accent-strong); }

/* ── 승패 막대 ─────────────────────────────────────────── */
.wl { display: flex; align-items: center; gap: 8px; }
.wlbar { flex: 1; display: flex; height: 7px; min-width: 56px; border-radius: 999px; overflow: hidden; background: var(--line-soft); }
.wlbar span { display: block; height: 100%; }
.wlbar .w { background: var(--accent); }
.wlbar .t { background: #d6d3d1; }
.wlbar .l { background: var(--comp-line); }
.wlnum { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wlnum .w { color: var(--accent-strong); }
.wlnum .l { color: var(--comp); }

/* ── 키워드 칩 ─────────────────────────────────────────── */
.kwchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px 2px 3px; margin: 2px 3px 2px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; color: var(--txt-2); max-width: 230px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kwchip:hover { background: var(--head-bg); text-decoration: none; }
.kwchip .rank { min-width: 20px; height: 19px; font-size: 11px; padding: 0 5px; }

/* ============================================================
   7. 분야 상자 (접이식) — 요약은 접힌 채로도 읽힌다
   ============================================================ */
.fieldbox {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-xs); margin: 8px 0;
}
.fieldbox[open] { box-shadow: var(--shadow-md); }
.fieldbox > summary {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 15px 11px 13px; cursor: pointer; list-style: none;
  border-radius: var(--r-card); border-left: 3px solid var(--fc, var(--line));
}
.fieldbox > summary::-webkit-details-marker { display: none; }
.fieldbox > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: 4px;
  border-right: 2px solid var(--txt-3); border-bottom: 2px solid var(--txt-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 140ms ease-out;
}
.fieldbox[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.fieldbox > summary:hover { background: var(--head-bg); }
.fieldbox[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r-card) var(--r-card) 0 0; }
.fdot { width: 9px; height: 9px; border-radius: 2.5px; flex: none; }
.fcode { font-size: 14.5px; }
.flabel { font-weight: 650; color: var(--txt-2); }
.fmeta { font-size: 12px; color: var(--txt-3); }
.fpills { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.fieldbody { padding: 0 15px 10px; }
.fieldbody table { margin-top: 8px; box-shadow: none; }

/* ============================================================
   8. 키워드모니터 — 즉시 조회
   ============================================================ */
.askbox {
  background: linear-gradient(180deg, #f5f9ff, var(--card));
  border: 1px solid var(--accent-line); border-radius: var(--r-card);
  box-shadow: var(--shadow-sm); padding: 15px 16px 13px; margin-bottom: 18px;
}
.askbox h2 { margin: 0 0 11px; }
.askform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.askform input[name="keyword"] { flex: 1 1 260px; min-width: 180px; min-height: 38px; font-size: 14.5px; }
.askform button { min-height: 38px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--txt-2); white-space: nowrap; }
.chk input { min-height: 0; width: 15px; height: 15px; padding: 0; accent-color: var(--accent); }

.resultbox {
  border: 1px solid var(--accent-line); border-radius: var(--r-card);
  background: var(--card); box-shadow: var(--shadow-sm);
  padding: 13px 16px 2px; margin-bottom: 20px;
}
.resultbox h2 { margin: 0 0 5px; }
.resultbox table { margin-top: 9px; box-shadow: none; }
.kwname { color: var(--accent-strong); }
.resmeta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--txt-3); font-size: 12.5px; }

/* 셀 인라인 편집 (키워드관리) */
.kwtable td.edit { cursor: text; }
.kwtable tr:hover td.edit:empty::after { content: "＋"; color: var(--placeholder); font-size: 11px; }
.kwtable td.edit:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.kwtable td.edit b { font-weight: 650; }
.cellin { width: 100%; min-height: 26px; padding: 2px 6px; font-size: 13.5px; }
.saved   { background: #dcfce7 !important; box-shadow: inset 0 0 0 1px #86efac; }
.saveerr { background: var(--bad-bg) !important; box-shadow: inset 0 0 0 1px #fca5a5; }
.st { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.st-active            { background: transparent; color: var(--txt-3); font-weight: 500; }
.st-lockedhead        { background: var(--warn-bg); color: var(--warn-text); }
.st-frozenwave2       { background: var(--accent-soft); color: var(--accent-strong); }
.st-blockednoevidence { background: var(--bad-bg); color: var(--bad-text); }
.st-none              { background: transparent; color: var(--placeholder); }

/* ── 2단 ──────────────────────────────────────────────── */
/* 한쪽이 짧고 한쪽이 길면 그냥 빈 자리로 보인다. 각각 상자로 세워
   길이가 달라도 두 덩이로 읽히게 한다. */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 24px; }
.cols > section {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-xs);
  padding: 4px 16px 14px;
}
.cols > section > h2 { margin-top: 14px; }
ul.plain { list-style: none; padding: 0; margin: 8px 0; }
ul.plain li { padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; color: var(--txt-2); font-variant-numeric: tabular-nums; }
ul.plain li:last-child { border-bottom: none; }

/* ============================================================
   9. 도움말
   ============================================================ */
.statusbox {
  border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-text);
  border-radius: var(--r-card); padding: 12px 15px; margin-bottom: 6px; line-height: 1.6;
}
.statusbox.ok { border-color: var(--ok-line); background: #f2fdf7; color: var(--ok-text); }
.warn-text { color: var(--warn-text); }
table.kv th { width: 180px; background: var(--head-bg); vertical-align: top; white-space: normal; color: var(--txt-2); }
table.kv td { line-height: 1.6; }
ol.steps { counter-reset: step; list-style: none; padding: 0; margin: 12px 0 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 0 0 15px 40px; margin: 0 0 0 13px; border-left: 2px solid var(--line); }
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 2px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: -14px; top: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 0 0 3px var(--bg);
}
.stepbody { margin-top: 3px; color: var(--txt-2); font-size: 13px; line-height: 1.65; }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 6px; background: var(--line-soft); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--txt); }
pre.code { background: #1c1917; color: #e7e5e4; border-radius: var(--r-ctl); padding: 13px 15px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--line-soft); padding: 1px 5px; border-radius: 5px; }

/* ============================================================
   10. 로그인 (사이드바 없음)
   ============================================================ */
body.loginbody {
  display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background:
    radial-gradient(520px 320px at 18% 8%, rgba(37,99,235,.07), transparent 68%),
    radial-gradient(620px 420px at 85% 92%, rgba(220,38,38,.05), transparent 70%),
    var(--bg);
}
.loginbox {
  width: min(360px, 100%);
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 34px 30px 26px; margin: 0;
  display: flex; flex-direction: column;
}
.login-logo {
  width: 48px; height: 48px; border-radius: 13px; margin-bottom: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; box-shadow: 0 2px 6px rgba(29,78,216,.35), 0 8px 24px rgba(29,78,216,.18);
}
.login-logo svg { width: 25px; height: 25px; }
.loginbox h1 { font-size: 18px; margin: 0 0 2px; }
.loginbox .sub { color: var(--txt-3); font-size: 13.5px; margin: 0 0 20px; }
.loginbox .alert { background: var(--comp-soft); border: 1px solid var(--bad-line); color: var(--bad-text); border-radius: var(--r-ctl); padding: 9px 12px; font-size: 13.5px; font-weight: 500; margin: 0 0 14px; }
.loginbox input { width: 100%; min-height: 44px; font-size: 15px; margin: 0 0 12px; }
.loginbox button { width: 100%; min-height: 44px; font-size: 15px; }
.loginbox button svg { width: 17px; height: 17px; }
.login-foot { text-align: center; color: var(--placeholder); font-size: 11.5px; margin: 18px 0 0; }

/* ============================================================
   11. 반응형
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }

/* 표가 좁아지면 한글이 한 글자씩 세로로 쪼개진다("소파천갈/이").
   폭을 붙잡아 두고 제 상자 안에서 옆으로 흐르게 한다 —
   찌그러진 표보다 스크롤되는 표가 낫다. */
@media (max-width: 1080px) {
  .tablescroll > table { min-width: 840px; }
}
td .fieldlink, td .fieldlink .dim, td.acct-cell b { white-space: nowrap; }

/* 좁은 화면에서는 사이드바를 위로 눕힌다 — 세로 공간을 뺏지 않는다.
   ★가로 스크롤로 두지 않는다. 6항목 중 뒤쪽 4개가 화면 밖에 숨어
     "메뉴가 사라졌다"는 v2의 실패가 그대로 재현됐다(2026-08-28 실측).
     줄바꿈이면 다 보인다 — 두 줄이 되는 대신 아무것도 숨지 않는다. */
@media (max-width: 980px) {
  .side {
    position: sticky; top: 0; width: auto;
    flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 4px 6px; padding: 8px 12px;
    border-right: none; border-bottom: 1px solid var(--side-line);
  }
  .side-brand { padding: 0 8px 0 0; font-size: 14px; }
  .side-brand span:not(.brand-mark) { display: none; }
  .side-nav {
    display: flex; flex-wrap: wrap; gap: 2px; padding: 0; overflow: visible;
    flex: 1 1 auto; min-width: 0;
  }
  .side-sect { display: none; }
  .side-link { padding: 6px 9px; margin: 0; white-space: nowrap; font-size: 13px; }
  .side-link svg { width: 15px; height: 15px; }
  .side-link.on::before { left: 0; right: 0; top: auto; bottom: -1px; width: auto; height: 2px; border-radius: 0; }
  .side-foot { border-top: none; flex-direction: row; padding: 0; margin-left: auto; }
  .side-note { display: none; }
  .shell { margin-left: 0; }
  main { padding: 0 16px 40px; }
  .pagehead { padding: 18px 0 14px; }
}
@media (max-width: 720px) {
  h1 { font-size: 19px; }
  /* 액션 버튼이 오른쪽으로 밀리다 잘리지 않게 — 아래 줄로 내려 왼쪽부터 */
  .pagehead .ph-act { margin-left: 0; width: 100%; }
  .filterbar .spacer { display: none; }
  th, td { padding: 7px 9px; }
  .fpills { margin-left: 0; flex-basis: 100%; }
  .fmeta { flex-basis: 100%; }
  .totals { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  .tot-n { font-size: 19px; }
  table.kv th { width: auto; }
}
