/* ==========================================================================
   CCF Deadlines — Flat Editorial Academic Stylesheet
   Zero nested cards · Crisp hairlines · True horizontal & vertical timelines
   ========================================================================== */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, monospace;

  /* Light: Crisp Paper & Ink */
  --bg: #ffffff;
  --bg-subtle: #f8f9fb;
  --bg-muted: #f2f4f7;
  --bg-hover: #f9fafb;

  --border: #e5e7eb;
  --border-subtle: #eff1f5;
  --border-strong: #d1d5db;

  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  --accent: #1d4ed8;
  --accent-soft: #eff6ff;
  --ink-active: #111827;
  --ink-active-fg: #ffffff;

  --rank-a: #be123c;
  --rank-a-bg: #fff1f2;
  --rank-b: #b45309;
  --rank-b-bg: #fffbeb;
  --rank-c: #047857;
  --rank-c-bg: #ecfdf5;
  --rank-n: #4b5563;
  --rank-n-bg: #f3f4f6;

  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;

  --radius: 6px;
  --topbar-bg: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] {
  --bg: #0c0f14;
  --bg-subtle: #11161f;
  --bg-muted: #171d28;
  --bg-hover: #141a24;

  --border: #232b38;
  --border-subtle: #1b222d;
  --border-strong: #323d4f;

  --text: #eef2f6;
  --text-secondary: #b4becb;
  --text-muted: #8492a6;
  --text-faint: #5c697b;

  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --ink-active: #eef2f6;
  --ink-active-fg: #0c0f14;

  --rank-a: #fb7185;
  --rank-a-bg: rgba(251, 113, 133, 0.14);
  --rank-b: #fbbf24;
  --rank-b-bg: rgba(251, 191, 36, 0.14);
  --rank-c: #34d399;
  --rank-c-bg: rgba(52, 211, 153, 0.14);
  --rank-n: #94a3b8;
  --rank-n-bg: rgba(148, 163, 184, 0.14);

  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;

  --topbar-bg: rgba(12, 15, 20, 0.9);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden { display: none !important; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

.v-sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
}

/* ---------- Top Navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--ink-active);
  color: var(--ink-active-fg);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 48px 0 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  outline: none;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}

.search-box input:focus {
  background: var(--bg);
  border-color: var(--text-muted);
}

.search-box input::placeholder {
  color: var(--text-faint);
}

.search-clear {
  position: absolute;
  right: 26px;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.search-clear:hover { color: var(--text); }

.kbd-hint {
  position: absolute;
  right: 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 5px;
  line-height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-faint);
  background: var(--bg);
  pointer-events: none;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tz-wrapper {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.tz-wrapper select {
  border: none;
  background: transparent;
  outline: none;
  max-width: 155px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}
.tz-wrapper select option,
.tz-wrapper select optgroup {
  background: var(--bg);
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--ink-active);
  border-color: var(--ink-active);
  color: var(--ink-active-fg);
}
.btn-primary:hover {
  opacity: 0.9;
  background: var(--ink-active);
}

.btn-subtle {
  background: var(--bg-subtle);
}

.btn-icon {
  width: 32px;
  padding: 0;
  color: var(--text-secondary);
}

.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.text-btn {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
}
.text-btn:hover {
  color: var(--text);
  background: var(--bg-muted);
}

.count-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Flat Subbar: Inline Metrics & Presets ---------- */
.subbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.subbar-inner {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.metrics-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-item {
  border: none;
  background: none;
  padding: 3px 6px;
  margin: -3px -6px;
  border-radius: 5px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  cursor: pointer;
  transition: background 0.12s;
}
.metric-item:hover {
  background: var(--bg-muted);
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.metric-num.is-urgent { color: var(--danger); }

.metric-lbl {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.metric-note {
  font-size: 11.5px;
  color: var(--text-faint);
}

.presets-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.tab-link {
  border: none;
  background: none;
  height: 28px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.tab-link:hover {
  color: var(--text);
  background: var(--bg-muted);
}
.tab-link.active {
  color: var(--text);
  background: var(--bg-muted);
  font-weight: 600;
}

/* ---------- Flat Filter Ribbon ---------- */
.filter-ribbon {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.filter-ribbon-inner {
  padding-top: 10px;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.filter-cluster {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.filter-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.inline-group {
  display: inline-flex;
  gap: 4px;
}

.chip-rank {
  height: 26px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}
.chip-rank .chip-c {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
}
.chip-rank:hover { border-color: var(--border-strong); }

.chip-rank[data-rank="A"].active { background: var(--rank-a-bg); border-color: var(--rank-a); color: var(--rank-a); }
.chip-rank[data-rank="B"].active { background: var(--rank-b-bg); border-color: var(--rank-b); color: var(--rank-b); }
.chip-rank[data-rank="C"].active { background: var(--rank-c-bg); border-color: var(--rank-c); color: var(--rank-c); }
.chip-rank[data-rank="N"].active { background: var(--rank-n-bg); border-color: var(--text-muted); color: var(--text); }
.chip-rank.active .chip-c { color: inherit; opacity: 0.78; }

.segmented {
  display: inline-flex;
  background: var(--bg-muted);
  border-radius: 5px;
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.flat-select {
  height: 26px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.flat-select:focus { border-color: var(--text-muted); }
.flat-select option { background: var(--bg); color: var(--text); }

.filter-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view-switcher {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  overflow: hidden;
}

.view-btn {
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.view-btn:last-child { border-right: none; }
.view-btn:hover { color: var(--text); background: var(--bg-subtle); }
.view-btn.active {
  background: var(--ink-active);
  color: var(--ink-active-fg);
  font-weight: 600;
}

.domain-line {
  align-items: center;
}

.domain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.domain-chip {
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s;
}
.domain-chip:hover {
  background: var(--bg-muted);
  color: var(--text);
}
.domain-chip .d-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.domain-chip .d-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.domain-chip.active {
  background: var(--bg);
  border-color: var(--text-muted);
  color: var(--text);
  font-weight: 600;
}
.domain-chip.active .d-code,
.domain-chip.active .d-count {
  color: var(--text-secondary);
}

/* ---------- Main Content & Results Bar ---------- */
.main-content {
  flex: 1;
  padding-top: 14px;
  padding-bottom: 48px;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 2px;
}

.results-left, .results-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.result-count {
  font-size: 12.5px;
  color: var(--text-muted);
}
.result-count strong {
  font-family: var(--font-mono);
  color: var(--text);
}

.sync-meta {
  font-size: 12px;
  color: var(--text-faint);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.active-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
}
.active-pill button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.active-pill button:hover { color: var(--text); }

/* ---------- Minimalist Inline Tags ---------- */
.rank-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.rank-A { background: var(--rank-a-bg); color: var(--rank-a); }
.rank-B { background: var(--rank-b-bg); color: var(--rank-b); }
.rank-C { background: var(--rank-c-bg); color: var(--rank-c); }
.rank-N { background: var(--rank-n-bg); color: var(--rank-n); }

.meta-tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.status-dot-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
}
.status-dot-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.st-watching { color: var(--accent); }
.st-preparing { color: var(--warn); }
.st-submitted { color: #7c3aed; }
.st-accepted { color: var(--ok); }

/* Countdown colors */
.cd-imminent { color: var(--danger); }
.cd-soon { color: var(--warn); }
.cd-open { color: var(--text); }
.cd-expired { color: var(--text-faint); }

/* ==========================================================================
   VIEW 1: Editorial List View (Default — Flat, Crisp, Zero Nested Boxes)
   ========================================================================== */
.conf-list {
  border-top: 1px solid var(--border);
}

.conf-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(175px, 1.1fr) 128px 186px;
  align-items: center;
  gap: 16px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.conf-row:hover {
  background: var(--bg-hover);
}

.conf-row.is-expired {
  opacity: 0.56;
}
.conf-row.is-expired:hover {
  opacity: 0.9;
}

.row-main {
  min-width: 0;
}

.row-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 3px;
}

.row-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.row-core {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.row-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.row-submeta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.row-note-inline {
  color: var(--warn);
  font-size: 12px;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-deadlines {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dl-primary {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dl-tz {
  font-size: 11px;
  color: var(--text-faint);
}

.dl-abstract {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--warn);
}
.dl-abstract.abs-urgent { color: var(--danger); font-weight: 600; }
.dl-abstract.abs-passed { color: var(--text-faint); text-decoration: line-through; }

.row-accept {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.accept-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.accept-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.thin-bar {
  width: 72px;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-muted);
  overflow: hidden;
}
.thin-bar > span {
  display: block;
  height: 100%;
  background: var(--text-muted);
}
.thin-bar > span.rate-low { background: var(--rank-a); }
.thin-bar > span.rate-mid { background: var(--rank-b); }
.thin-bar > span.rate-high { background: var(--rank-c); }

.row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.row-countdown {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-act {
  height: 26px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none !important;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-act:hover {
  background: var(--bg-muted);
  color: var(--text);
}
.icon-act.is-tracked {
  color: var(--accent);
  background: var(--accent-soft);
}
.icon-act.is-preparing {
  color: var(--warn);
  background: var(--rank-b-bg);
}
.icon-act.is-accepted {
  color: var(--ok);
  background: var(--rank-c-bg);
}

/* ==========================================================================
   VIEW 2: TRUE TIMELINE VIEW (Horizontal Proportional Gantt + Vertical Spine)
   ========================================================================== */
.tl-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.tl-controls-left, .tl-controls-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tl-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.tl-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-diamond {
  width: 8px;
  height: 8px;
  border: 2px solid var(--warn);
  background: var(--bg);
  transform: rotate(45deg);
  display: inline-block;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.legend-today-line {
  width: 2px;
  height: 12px;
  background: var(--danger);
  display: inline-block;
}

/* --- 2A. Horizontal Proportional Gantt Timeline --- */
.gantt-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow-x: auto;
  position: relative;
}

.gantt-canvas {
  min-width: 880px;
  position: relative;
}

.gantt-header {
  display: grid;
  grid-template-columns: 224px 1fr;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 6;
}

.gantt-corner {
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: var(--bg-subtle);
  z-index: 8;
}

.gantt-axis {
  position: relative;
  height: 36px;
}

.gantt-month-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
  padding: 9px 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
}

.gantt-today-flag {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  z-index: 9;
  white-space: nowrap;
}

.gantt-group-bar {
  display: grid;
  grid-template-columns: 224px 1fr;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.gantt-group-label {
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  background: var(--bg-subtle);
  z-index: 5;
}

.gantt-row {
  display: grid;
  grid-template-columns: 224px 1fr;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover { background: var(--bg-hover); }

.gantt-row-label {
  padding: 8px 12px 8px 14px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 4;
}
.gantt-row:hover .gantt-row-label {
  background: var(--bg-hover);
}

.gantt-row-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-track {
  position: relative;
  height: 38px;
}

.gantt-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed var(--border-subtle);
  pointer-events: none;
}

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--danger);
  opacity: 0.75;
  pointer-events: none;
  z-index: 2;
}

/* Milestone elements on the Gantt track */
.gantt-span {
  position: absolute;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 2px;
  opacity: 0.85;
  z-index: 2;
}
.gantt-span.rank-A { background: var(--rank-a); }
.gantt-span.rank-B { background: var(--rank-b); }
.gantt-span.rank-C { background: var(--rank-c); }
.gantt-span.rank-N { background: var(--text-muted); }

.gantt-conf-tail {
  position: absolute;
  top: 50%;
  height: 0;
  border-top: 1.5px dashed var(--border-strong);
  z-index: 1;
  pointer-events: none;
}

.gantt-abs-node {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 2px solid var(--warn);
  background: var(--bg);
  z-index: 3;
}

.gantt-dl-node {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--bg);
  z-index: 4;
  transition: transform 0.12s;
}
.gantt-row:hover .gantt-dl-node {
  transform: translate(-50%, -50%) scale(1.22);
}
.gantt-dl-node.rank-A { background: var(--rank-a); }
.gantt-dl-node.rank-B { background: var(--rank-b); }
.gantt-dl-node.rank-C { background: var(--rank-c); }
.gantt-dl-node.rank-N { background: var(--text-muted); }

.gantt-date-tag {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}
.gantt-date-tag.is-left {
  transform: translate(-100%, -50%);
}

/* Floating Gantt Tooltip */
.gantt-tooltip {
  position: fixed;
  z-index: 90;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

/* --- 2B. Classic Vertical Spine Timeline --- */
.spine-timeline {
  position: relative;
  padding-left: 112px;
}

.spine-timeline::before {
  content: "";
  position: absolute;
  left: 96px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border);
}

.spine-month-node {
  position: relative;
  padding: 18px 0 8px;
}
.spine-month-node:first-child { padding-top: 4px; }

.spine-month-node::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 23px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2.5px solid var(--text);
}
.spine-month-node:first-child::before { top: 9px; }

.spine-month-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spine-event {
  position: relative;
  padding: 11px 8px 11px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: background 0.1s;
}
.spine-event:hover { background: var(--bg-hover); }

.spine-date-left {
  position: absolute;
  left: -112px;
  width: 84px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.spine-dot {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.spine-dot.rank-A { background: var(--rank-a); }
.spine-dot.rank-B { background: var(--rank-b); }
.spine-dot.rank-C { background: var(--rank-c); }
.spine-dot.rank-N { background: var(--text-muted); }

.spine-dot.is-abstract {
  border-radius: 0;
  transform: translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--bg);
  border: 2px solid var(--warn);
}

.spine-today-marker {
  position: relative;
  margin: 8px 0;
  height: 1px;
  background: var(--danger);
}
.spine-today-marker span {
  position: absolute;
  left: -112px;
  top: -9px;
  width: 84px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--danger);
}

/* ==========================================================================
   VIEW 3: Compact Table View
   ========================================================================== */
.table-wrap {
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

.conf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.conf-table th {
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.conf-table th.sortable { cursor: pointer; }
.conf-table th.sortable:hover { color: var(--text); }

.conf-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.conf-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.conf-table tbody tr:hover { background: var(--bg-hover); }
.conf-table tbody tr.is-expired { opacity: 0.55; }

/* ==========================================================================
   VIEW 4: Clean Flat Grid (Zero inner nested boxes!)
   ========================================================================== */
.flat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.grid-cell {
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.grid-cell:hover { background: var(--bg-hover); }
.grid-cell.is-expired { opacity: 0.58; }

.grid-cell-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.grid-cell-countdown {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.grid-cell-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.grid-cell-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==========================================================================
   Slide-over Drawer (Flat Editorial Sections — Zero Nested Cards)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.14s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  width: 100%;
  max-width: 560px;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.18s ease-out;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0.85; } to { transform: translateX(0); opacity: 1; } }

.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.drawer-title {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.drawer-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.drawer-close {
  font-size: 18px;
  flex-shrink: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 32px;
}

.d-block {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.d-block:last-child { border-bottom: none; }

.d-block-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.d-countdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.d-countdown-num {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.status-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.status-btn:hover { border-color: var(--border-strong); color: var(--text); }
.status-btn.active {
  background: var(--ink-active);
  border-color: var(--ink-active);
  color: var(--ink-active-fg);
  font-weight: 600;
}

.note-input {
  width: 100%;
  min-height: 66px;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  resize: vertical;
  outline: none;
  font-size: 13px;
  line-height: 1.5;
}
.note-input:focus {
  background: var(--bg);
  border-color: var(--text-muted);
}

/* Clean Timeline Table inside Drawer */
.tz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.tz-table th {
  text-align: left;
  padding: 6px 8px 6px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.tz-table td {
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.tz-table tr:last-child td { border-bottom: none; }

/* Clean Key-Value List inside Drawer */
.kv-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.kv-k { color: var(--text-muted); }
.kv-v { color: var(--text); font-weight: 500; word-break: break-word; }

.qr-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.qr-box img {
  max-width: 190px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  margin-top: 6px;
}

/* Flat Backup / Planner Rows */
.flat-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.flat-subrow:last-child { border-bottom: none; }
.flat-subrow:hover { background: var(--bg-hover); }

.gap-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  white-space: nowrap;
}

/* States, Footer, Toast */
.loading-state, .empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0 0 16px; }

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.7s linear infinite;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 14px 0;
  margin-top: auto;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hide-md { display: none; }
  .conf-row {
    grid-template-columns: minmax(0, 1.8fr) minmax(150px, 1fr) 156px;
  }
  .row-accept { display: none; }
}

@media (max-width: 720px) {
  .container { padding: 0 14px; }
  .hide-sm { display: none; }
  .topbar-inner {
    height: auto;
    padding: 8px 0;
    flex-wrap: wrap;
  }
  .search-box {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }
  .conf-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .row-right {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .filter-right { margin-left: 0; }
  .spine-timeline { padding-left: 84px; }
  .spine-timeline::before { left: 72px; }
  .spine-date-left { left: -84px; width: 62px; font-size: 11px; }
  .spine-dot { left: -16px; }
  .spine-month-node::before { left: -17px; }
  .spine-today-marker span { left: -84px; width: 62px; }
}
