@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;700;800&family=IBM+Plex+Sans+KR:wght@400;500;600;700&display=swap");

:root {
  --bg: #f4ecdf;
  --paper: rgba(255, 250, 243, 0.8);
  --panel: rgba(255, 252, 247, 0.9);
  --text: #201716;
  --muted: #6b5a58;
  --line: rgba(70, 48, 41, 0.12);
  --line-strong: rgba(70, 48, 41, 0.28);
  --accent: #d84e2c;
  --accent-deep: #a92f14;
  --accent-soft: rgba(216, 78, 44, 0.14);
  --accent-wash: rgba(216, 78, 44, 0.08);
  --ink-blue: #24566b;
  --gold: #b57b17;
  --ok: #257d53;
  --warn: #9a6f10;
  --err: #ad2d23;
  --shadow: 0 24px 60px rgba(62, 38, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 161, 109, 0.24) 0, transparent 26%),
    radial-gradient(circle at 85% 12%, rgba(36, 86, 107, 0.16) 0, transparent 24%),
    linear-gradient(180deg, #f8f1e8 0%, #f2e6d6 45%, #efe4d8 100%);
}

a {
  color: inherit;
}

.scene,
.halftone {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.scene-a {
  background:
    radial-gradient(circle at 20% 20%, rgba(216, 78, 44, 0.18) 0, transparent 35%),
    radial-gradient(circle at 78% 18%, rgba(36, 86, 107, 0.12) 0, transparent 30%);
}

.scene-b {
  background:
    radial-gradient(circle at 50% 100%, rgba(181, 123, 23, 0.12) 0, transparent 36%);
  mix-blend-mode: multiply;
}

.halftone {
  opacity: 0.26;
  background-image: radial-gradient(rgba(32, 23, 22, 0.08) 0.7px, transparent 0.7px);
  background-size: 12px 12px;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  position: relative;
  z-index: 1;
}

.hero {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 28px;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-end;
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.92), rgba(252, 240, 226, 0.88)),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(216, 78, 44, 0.16), transparent 65%);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.panel-eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0;
  font: 800 clamp(2.4rem, 7vw, 4.8rem) / 0.95 "Bricolage Grotesque", sans-serif;
  letter-spacing: -0.04em;
}

.hero-lead {
  margin: 14px 0 0;
  max-width: 720px;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input,
select,
button {
  border-radius: 16px;
  border: 1px solid var(--line);
  font: 600 0.95rem/1.2 "IBM Plex Sans KR", sans-serif;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

select {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 4px rgba(216, 78, 44, 0.12);
}

select:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 4px rgba(216, 78, 44, 0.12);
}

button {
  padding: 14px 18px;
  cursor: pointer;
  background: var(--accent);
  color: #fff8f3;
  border-color: transparent;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-deep);
}

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.7);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.hero-button {
  min-width: 144px;
}

.hero-button.secondary {
  background: rgba(255, 255, 255, 0.56);
}

.flash {
  min-height: 28px;
  margin: 14px 2px 0;
  padding: 8px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  color: var(--muted);
}

.flash:empty {
  display: none;
}

.flash[data-tone="error"] {
  color: var(--err);
  border-color: rgba(173, 45, 35, 0.22);
  background: rgba(255, 239, 236, 0.9);
}

.stats-strip {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px 18px 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.stat-label {
  margin: 0;
  font-size: 0.77rem;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: 1.55rem;
  line-height: 1.1;
}

.stat-sub {
  margin: 8px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
}

.panel {
  padding: 22px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-head h2 {
  margin: 0;
  font: 700 1.5rem/1.1 "Bricolage Grotesque", sans-serif;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  color: var(--text);
}

.status-badge[data-status="completed"] {
  color: var(--ok);
  background: rgba(37, 125, 83, 0.08);
}

.status-badge[data-status="running"] {
  color: var(--accent-deep);
  background: rgba(216, 78, 44, 0.08);
}

.status-badge[data-status="failed"] {
  color: var(--err);
  background: rgba(173, 45, 35, 0.08);
}

.settings-form,
.detail-block {
  margin-top: 18px;
}

.settings-form label {
  display: block;
  margin-bottom: 14px;
}

.settings-form span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

.config-preview {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px dashed var(--line-strong);
}

.config-preview p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.inline-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.run-hero {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(216, 78, 44, 0.1), rgba(255, 255, 255, 0.6)),
    rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(216, 78, 44, 0.14);
}

.run-title {
  margin: 0;
  font: 700 1.28rem/1.2 "Bricolage Grotesque", sans-serif;
}

.run-sub,
.subtle,
.table-sub,
.history-bottom,
.history-mid,
.progress-meta,
.empty-state,
.detail-summary p,
.error-row td {
  color: var(--muted);
}

.run-sub {
  margin: 6px 0 0;
}

.progress-bar {
  margin-top: 16px;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(32, 23, 22, 0.08);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff9d72);
}

.progress-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.error-line {
  margin: 12px 0 0;
  color: var(--err);
  font-size: 0.9rem;
}

.batch-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.batch-pill {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  display: grid;
  gap: 4px;
}

.batch-pill span,
.batch-pill em {
  font-size: 0.77rem;
  color: var(--muted);
}

.batch-pill strong {
  font-size: 1rem;
}

.batch-pill[data-status="completed"] {
  border-color: rgba(37, 125, 83, 0.24);
}

.batch-pill[data-status="running"] {
  border-color: rgba(216, 78, 44, 0.22);
}

.batch-pill[data-status="failed"] {
  border-color: rgba(173, 45, 35, 0.22);
}

.run-summary-strip,
.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.run-summary-strip {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.genre-summary {
  margin: 16px 0 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.genre-chip,
.genre-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.genre-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(36, 86, 107, 0.08);
  color: var(--ink-blue);
  font-size: 0.8rem;
  font-weight: 700;
}

.genre-chip[data-tone="밈"] {
  background: rgba(181, 123, 23, 0.12);
  color: var(--gold);
}

.genre-chip[data-tone="잡담"] {
  background: rgba(36, 86, 107, 0.1);
  color: var(--ink-blue);
}

.genre-chip[data-tone="장르불명"] {
  background: rgba(32, 23, 22, 0.08);
  color: var(--muted);
}

.history-list {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.history-item {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
}

.history-item.selected {
  border-color: rgba(216, 78, 44, 0.3);
  background: rgba(255, 245, 240, 0.92);
}

.history-top,
.history-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-mid {
  display: block;
  margin: 10px 0 8px;
}

.detail-summary {
  margin-top: 18px;
}

.detail-summary > div {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.detail-summary strong {
  display: block;
  font-size: 1.16rem;
}

.detail-summary p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.detail-block h3 {
  margin: 0 0 12px;
  font: 700 1.18rem/1.1 "Bricolage Grotesque", sans-serif;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(32, 23, 22, 0.03);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.42);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table.compact {
  min-width: 680px;
}

.title-cell a {
  font-weight: 600;
  text-decoration: none;
}

.title-cell a:hover {
  color: var(--accent-deep);
}

.table-sub {
  display: block;
  margin-top: 6px;
  font-size: 0.76rem;
}

.error-row td {
  padding-top: 0;
  font-size: 0.84rem;
}

.empty-state,
.panel-loading {
  margin-top: 18px;
  padding: 22px;
  border-radius: 20px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.38);
  line-height: 1.7;
}

@media (max-width: 980px) {
  .stats-strip,
  .dashboard,
  .run-summary-strip,
  .detail-summary {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 100%);
    padding-top: 16px;
  }

  .hero,
  .panel,
  .stat-card {
    border-radius: 24px;
    padding: 18px;
  }

  .hero-actions,
  .inline-actions {
    width: 100%;
  }

  .hero-button,
  .inline-actions button {
    flex: 1 1 100%;
  }
}

.badge.done {
  color: var(--ok);
  border-color: var(--badge-done-border);
  background: var(--badge-done-bg);
}

.badge.crawling {
  color: var(--warn);
  border-color: var(--badge-crawl-border);
  background: var(--badge-crawl-bg);
  animation: pulse 1.5s ease-in-out infinite;
}

.badge.error {
  color: var(--err);
  border-color: var(--badge-err-border);
  background: var(--badge-err-bg);
}

.badge.stale {
  color: var(--err);
  border-color: var(--badge-err-border);
  background: var(--badge-err-bg);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== Post Actions ===== */
.post-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}

.post-actions button {
  padding: 4px 10px;
  font-size: 0.82rem;
}

.crawl-btn {
  border-color: var(--sky);
  background: var(--crawl-btn-bg);
}

.crawl-btn:hover {
  background: var(--crawl-btn-hover);
}

.delete-btn {
  border-color: var(--delete-btn-border);
  background: var(--delete-btn-bg);
}

.delete-btn:hover {
  background: var(--delete-btn-hover);
}

.reset-btn {
  border-color: var(--muted);
  background: var(--bg-surface);
  color: var(--muted);
  font-size: 0.8rem;
}

.reset-btn:hover {
  background: var(--line);
  color: var(--text);
}

/* ===== Summary ===== */
.summary {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
  animation: fadeIn 300ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.summary-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
}

.summary-mood {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.summary h4 {
  margin: 0 0 6px;
  font-size: 0.92rem;
}

.summary ul {
  margin: 0;
  padding-left: 18px;
}

.summary p {
  margin: 0;
}

.mention-count {
  font-size: 0.73rem;
  color: var(--muted);
  margin-left: 2px;
}

/* ===== Top Table ===== */
.top-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.top-table th {
  background: var(--table-th-bg);
  font-weight: 600;
}

.top-table th,
.top-table td {
  border-bottom: 1px solid var(--table-line);
  text-align: left;
  padding: 6px 8px;
}

.top-table tr:hover td {
  background: var(--table-hover);
}

.top-table a {
  color: var(--accent-dark);
}

[data-theme="dark"] .top-table a,
[data-theme="dark"] .onboarding-step em {
  color: var(--accent);
}

.post-error {
  margin-top: 8px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Onboarding Overlay ===== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 300ms ease-out;
}

.onboarding-overlay.onboarding-fade-out {
  animation: fadeOut 250ms ease-in forwards;
}

@keyframes fadeOut {
  to { opacity: 0; }
}

.onboarding-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 30px;
  width: min(440px, 90vw);
  box-shadow: var(--overlay-shadow);
  animation: rise 350ms ease-out;
}

.onboarding-card h2 {
  margin: 0 0 18px;
  font: 700 1.2rem/1.3 "Space Grotesk", sans-serif;
  text-align: center;
  color: var(--accent-dark);
}

.onboarding-steps {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.onboarding-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.onboarding-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: 700 0.8rem/26px "Space Grotesk", sans-serif;
  text-align: center;
}

.onboarding-step strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.onboarding-step p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.onboarding-step em {
  font-style: normal;
  color: var(--accent-dark);
  font-weight: 600;
}

.onboarding-close {
  display: block;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: 600 0.95rem/1 "IBM Plex Sans KR", sans-serif;
  cursor: pointer;
  transition: background 150ms;
}

.onboarding-close:hover {
  background: var(--accent-dark);
}

/* ===== Crawl All Progress ===== */
.crawl-all-progress {
  text-align: center;
}

.crawl-all-progress h2 {
  margin-bottom: 16px;
}

.progress-bar-wrap {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 300ms ease;
}

.progress-text {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.progress-current {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 10px;
  min-height: 1.2em;
}

.progress-stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.summary-model {
  text-align: center;
  color: var(--muted);
  font-size: 0.73rem;
}

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .app-shell {
    width: 96vw;
    margin: 6px auto;
  }

  .topbar {
    border-radius: 10px;
    padding: 8px 10px;
    gap: 6px;
  }

  .topbar-title {
    font-size: 0.88rem;
  }

  .topbar-form {
    flex-basis: 100%;
    order: 2;
  }

  .theme-switcher {
    order: 1;
    margin-left: auto;
  }

  .topbar-form input {
    padding: 9px 12px;
    font-size: 0.9rem;
  }

  .topbar-form button {
    padding: 9px 14px;
  }

  .posts-section {
    padding: 12px;
    border-radius: 14px;
    margin-top: 8px;
  }

  .posts-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .posts-header h2 {
    font-size: 1.1rem;
  }

  .posts-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .posts-header-actions button {
    flex: 1;
  }

  .split-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 8px;
    min-height: auto;
  }

  .post-sidebar {
    max-height: 35vh;
    border-radius: 10px;
  }

  .sidebar-item {
    padding: 14px 12px;
  }

  .sidebar-item-name {
    font-size: 0.92rem;
  }

  .post-detail {
    max-height: none;
    padding: 14px;
    border-radius: 10px;
  }

  .detail-empty {
    min-height: 120px;
    font-size: 0.9rem;
  }

  .post-top {
    gap: 6px;
  }

  .post-title {
    font-size: 1rem;
    white-space: normal;
    word-break: keep-all;
  }

  .post-actions {
    width: 100%;
    margin-top: 8px;
  }

  .post-actions button,
  .post-actions .gallery-link-btn {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  .badge {
    font-size: 0.8rem;
    padding: 3px 10px;
  }

  .gallery-code {
    font-size: 0.78rem;
  }

  .summary {
    margin-top: 10px;
    padding-top: 10px;
    gap: 8px;
  }

  .summary-section {
    padding: 12px;
    border-radius: 10px;
  }

  .summary h4 {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }

  .summary ul {
    padding-left: 16px;
    font-size: 0.88rem;
    line-height: 1.6;
  }

  .summary p {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .top-table,
  .top-table thead,
  .top-table tbody,
  .top-table tr,
  .top-table th,
  .top-table td {
    display: block;
  }

  .top-table thead {
    display: none;
  }

  .top-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg-surface);
  }

  .top-table tr:hover td {
    background: transparent;
  }

  .top-table td {
    border: none;
    padding: 1px 0;
    font-size: 0.88rem;
  }

  .top-table td:first-child {
    float: left;
    margin-right: 6px;
    font-size: 1rem;
  }

  .top-table td:nth-child(2) {
    font-weight: 600;
    margin-bottom: 4px;
  }

  .top-table td:nth-child(n+3) {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-right: 8px;
  }
}

/* ===== Tabs ===== */
.detail-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--line);
  margin-top: 12px;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-content { margin-top: 12px; }
.tab-loading, .tab-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}

/* ===== Deep Analysis ===== */
.deep-tab-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.deep-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deep-request-btn {
  padding: 10px 22px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.deep-request-btn:hover:not([disabled]) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.deep-request-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.deep-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.deep-history-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}

.deep-history-entry {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.deep-history-entry:hover {
  border-color: var(--accent);
}

.deep-history-entry.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.deep-history-entry.selected .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.deep-content {
  min-height: 100px;
}

.deep-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.deep-analysis-result {
  display: grid;
  gap: 18px;
}

.deep-block {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
}

.deep-block h4 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: var(--text);
}

.deep-section {
  margin-bottom: 12px;
}

.deep-section:last-child {
  margin-bottom: 0;
}

.deep-section h5 {
  margin: 0 0 6px 0;
  font-size: 0.88rem;
  color: var(--accent-dark);
}

.deep-section ul {
  margin: 0;
  padding-left: 20px;
}

.deep-section li {
  margin-bottom: 6px;
  line-height: 1.6;
  font-size: 0.88rem;
}

.deep-thought {
  border-color: var(--accent);
  border-style: dashed;
}

.deep-thought li {
  font-style: italic;
}

.deep-meta {
  background: var(--bg-surface);
}

.deep-meta p {
  margin: 0;
  line-height: 1.7;
  font-size: 0.9rem;
}

/* ===== History (Time Machine) ===== */
.history-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-timeline {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
}
.history-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
}
.history-entry:last-child { border-bottom: none; }
.history-entry:hover { background: var(--sidebar-hover, rgba(0,0,0,0.04)); }
.history-entry.selected {
  background: var(--sidebar-selected, rgba(74,124,89,0.1));
  border-left: 3px solid var(--accent);
}
.history-date { font-weight: 600; min-width: 140px; }
.history-meta { color: var(--muted); flex: 1; }
.history-current { font-size: 0.7rem; }
.history-snapshot-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-weight: 600;
  font-size: 0.9rem;
}
.history-snapshot-empty {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

/* ===== Charts (Trends) ===== */
.chart-section {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.chart-section h4 { margin: 0 0 10px; font-size: 0.9rem; }
.chart-container {
  position: relative;
  height: 220px;
}
.mood-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mood-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
}
.mood-date { font-weight: 600; font-size: 0.72rem; color: var(--muted); }
.mood-label { margin-top: 2px; }

/* ===== Comparison Card (Changes) ===== */
.comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.comparison-card h4 { margin: 0 0 12px; }
.change-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.change-row:last-of-type { border-bottom: none; }
.change-label {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 120px;
  flex-shrink: 0;
}
.change-value {
  font-size: 0.85rem;
  text-align: right;
  word-break: keep-all;
}
.delta-positive { color: var(--ok); font-weight: 700; }
.delta-negative { color: var(--err); font-weight: 700; }
.change-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.change-section h5 { margin: 0 0 6px; font-size: 0.85rem; }
.change-section ul { margin: 0; padding-left: 18px; }
.change-section li { font-size: 0.85rem; margin-bottom: 4px; }
.change-section p { font-size: 0.85rem; margin: 0; }

/* ===== Mobile adjustments for new features ===== */
@media (max-width: 760px) {
  .detail-tabs { gap: 0; }
  .tab-btn { padding: 8px 10px; font-size: 0.78rem; }
  .history-date { min-width: auto; font-size: 0.78rem; }
  .history-entry { padding: 8px 10px; font-size: 0.8rem; }
  .chart-container { height: 180px; }
  .change-row { flex-direction: column; gap: 4px; }
  .change-value { text-align: left; }
}
