/* ==========================================================================
   Research Hub · 研究成果中心 — Zero-CDN Institutional Workstation Styles
   ========================================================================== */

:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #f2f4f7;
  --bg-subtle: #e9edf2;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-elevated: rgba(255, 255, 255, 0.94);
  --border: #dfe4ec;
  --border-strong: #c8d1de;
  --ink: #111827;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;

  /* A-Share Conventions: Red = Up, Green = Down */
  --up: #c83228;
  --up-soft: #fef2f2;
  --down: #127858;
  --down-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --star: #d97706;
  --live: #10b981;

  /* Kind Badge Palette */
  --kind-html: #1d4ed8;
  --kind-html-bg: #dbeafe;
  --kind-md: #6d28d9;
  --kind-md-bg: #ede9fe;
  --kind-csv: #047857;
  --kind-csv-bg: #d1fae5;
  --kind-pdf: #be123c;
  --kind-pdf-bg: #ffe4e6;
  --kind-json: #b45309;
  --kind-json-bg: #fef3c7;
  --kind-img: #0369a1;
  --kind-img-bg: #e0f2fe;
  --kind-code: #374151;
  --kind-code-bg: #e5e7eb;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.14);

  --topbar-h: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --font-sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #0b0f17;
  --bg-subtle: #111723;
  --surface: #151c28;
  --surface-2: #1b2434;
  --surface-3: #232e42;
  --surface-elevated: rgba(21, 28, 40, 0.94);
  --border: #263246;
  --border-strong: #364763;
  --ink: #e5ecf6;
  --ink-2: #b8c4d6;
  --muted: #8494ab;
  --muted-2: #5d6d85;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --accent-border: rgba(96, 165, 250, 0.35);

  --up: #f2645a;
  --up-soft: rgba(242, 100, 90, 0.14);
  --down: #34d399;
  --down-soft: rgba(52, 211, 153, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --star: #fbbf24;
  --live: #34d399;

  --kind-html: #60a5fa;
  --kind-html-bg: rgba(59, 130, 246, 0.18);
  --kind-md: #a78bfa;
  --kind-md-bg: rgba(139, 92, 246, 0.18);
  --kind-csv: #34d399;
  --kind-csv-bg: rgba(16, 185, 129, 0.18);
  --kind-pdf: #fb7185;
  --kind-pdf-bg: rgba(244, 63, 94, 0.18);
  --kind-json: #fbbf24;
  --kind-json-bg: rgba(245, 158, 11, 0.18);
  --kind-img: #38bdf8;
  --kind-img-bg: rgba(14, 165, 233, 0.18);
  --kind-code: #cbd5e1;
  --kind-code-bg: rgba(148, 163, 184, 0.18);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 46px rgba(0, 0, 0, 0.6);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
  color: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Theme Icon Visibility */
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }

/* App Shell Layout States */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* When workspace is open, lock shell to viewport height for seamless iframe/reader scrolling */
.app-shell[data-layout="workbench"],
.app-shell[data-has-project="true"] {
  height: 100vh;
  overflow: hidden;
}

.app-shell[data-fullscreen="true"] .topbar,
.app-shell[data-fullscreen="true"] .workbench-sidebar {
  display: none !important;
}

/* ==========================================================================
   Top Bar
   ========================================================================== */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.brand-btn:hover {
  background: var(--surface-3);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
}

.brand-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live SSE Pill */
.sse-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-2);
}

.sse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.sse-pill[data-state="live"] .sse-dot {
  background: var(--live);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.sse-pill[data-state="reconnecting"] .sse-dot {
  background: var(--amber);
  animation: pulse-dot 1.4s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.sse-state-label {
  font-weight: 600;
}

.pill-sep {
  color: var(--border-strong);
}

.sse-time {
  color: var(--muted);
}

/* Search Box */
.topbar-center {
  flex: 1 1 320px;
  max-width: 460px;
  min-width: 180px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 35px;
  padding: 0 34px 0 33px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-clear-btn {
  position: absolute;
  right: 7px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.search-clear-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.kbd-badge {
  position: absolute;
  right: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
}

.search-input:focus ~ .kbd-badge {
  display: none;
}

/* Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-select {
  height: 34px;
  padding: 0 28px 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5L6 7.5l3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  appearance: none;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.sort-select:hover {
  border-color: var(--border-strong);
}

.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

.segmented-group {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.action-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--ink);
}

.action-btn-subtle {
  color: var(--muted);
  font-weight: 500;
}

.action-btn.is-loading .rescan-icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.14s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* ==========================================================================
   Overview Gallery Section
   ========================================================================== */
.overview-section {
  max-width: 1620px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 22px 44px;
}

.overview-controls-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

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

.category-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.cat-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  color: var(--ink);
}

.cat-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.cat-pill-count {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.14);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.cat-pill.is-active .cat-pill-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.subfilter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.format-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.fmt-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.fmt-chip:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.fmt-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.overview-result-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Project Cards Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  position: relative;
  min-width: 0;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.card-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.cat-badge[data-tone="chain"] {
  background: var(--kind-html-bg);
  color: var(--kind-html);
  border-color: transparent;
}
.cat-badge[data-tone="quant"] {
  background: var(--kind-md-bg);
  color: var(--kind-md);
  border-color: transparent;
}
.cat-badge[data-tone="market"] {
  background: var(--up-soft);
  color: var(--up);
  border-color: transparent;
}
.cat-badge[data-tone="company"] {
  background: var(--kind-csv-bg);
  color: var(--kind-csv);
  border-color: transparent;
}
.cat-badge[data-tone="topic"] {
  background: var(--kind-json-bg);
  color: var(--kind-json);
  border-color: transparent;
}

.card-date {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.star-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-2);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.14s ease, background-color 0.14s ease;
}

.star-btn:hover {
  background: var(--surface-3);
  color: var(--star);
}

.star-btn.is-pinned {
  color: var(--star);
}

.card-title {
  margin: 0 0 4px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-subtitle {
  margin: 0 0 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-path {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-summary {
  margin: 0 0 11px;
  font-size: 13px;
  line-height: 1.58;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 11px;
}

.hl-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.hl-label {
  color: var(--muted);
}

.hl-val {
  font-weight: 600;
  color: var(--ink);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
}

.card-match-hint {
  margin-bottom: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-artifacts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  margin-bottom: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.artifact-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kind-badge[data-kind="html"] { background: var(--kind-html-bg); color: var(--kind-html); }
.kind-badge[data-kind="markdown"] { background: var(--kind-md-bg); color: var(--kind-md); }
.kind-badge[data-kind="csv"] { background: var(--kind-csv-bg); color: var(--kind-csv); }
.kind-badge[data-kind="pdf"] { background: var(--kind-pdf-bg); color: var(--kind-pdf); }
.kind-badge[data-kind="json"] { background: var(--kind-json-bg); color: var(--kind-json); }
.kind-badge[data-kind="image"] { background: var(--kind-img-bg); color: var(--kind-img); }
.kind-badge[data-kind="code"],
.kind-badge[data-kind="text"],
.kind-badge[data-kind="other"] { background: var(--kind-code-bg); color: var(--kind-code); }

.card-size-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary-card {
  flex: 1;
  height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.btn-primary-card:hover {
  background: var(--accent-hover);
}

.btn-secondary-card {
  height: 33px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.btn-secondary-card:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* Skeleton & Empty States */
.skeleton-card {
  height: 248px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-gallery {
  grid-column: 1 / -1;
  padding: 56px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-gallery h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.empty-gallery p {
  margin: 0 0 16px;
  color: var(--muted);
}

/* ==========================================================================
   Split-Pane Workbench & Seamless Reader Workspace
   ========================================================================== */
.workspace-section {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  overflow: hidden;
}

/* Workbench Left Sidebar */
.workbench-sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.app-shell[data-layout="gallery"] .workbench-sidebar,
.app-shell[data-sidebar-collapsed="true"] .workbench-sidebar {
  display: none;
}

.sidebar-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-cat-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.mini-cat-pill {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.mini-cat-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.sidebar-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mini-icon-btn {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.mini-icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.sidebar-project-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-item {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.sidebar-item:hover {
  background: var(--surface-2);
}

.sidebar-item.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.sidebar-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-item.is-active .sidebar-item-title {
  color: var(--accent);
}

.sidebar-item-sub {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* Reader Pane */
.reader-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  position: relative;
}

.reader-empty-state {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px;
}

.empty-state-box {
  max-width: 420px;
  text-align: center;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-state-box h3 {
  margin: 0 0 8px;
}

.empty-state-box p {
  margin: 0;
  color: var(--muted);
}

.reader-active-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Reader Top Toolbar */
.reader-toolbar {
  min-height: 48px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.reader-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.reader-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.toolbar-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.toolbar-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--ink);
}

.toolbar-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.toolbar-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.toolbar-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

.app-shell[data-fullscreen="false"] .fs-exit-icon { display: none; }
.app-shell[data-fullscreen="true"] .fs-enter-icon { display: none; }

.nav-prev-next {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.mini-nav-btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.mini-nav-btn + .mini-nav-btn {
  border-left: 1px solid var(--border);
}

.mini-nav-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.mini-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.reader-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.reader-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-submeta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Artifact Tabs Bar */
.artifact-tabs-bar {
  height: 39px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.artifact-tabs-list {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  height: 100%;
  scrollbar-width: none;
}

.artifact-tabs-list::-webkit-scrollbar {
  display: none;
}

.artifact-tab {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 240px;
  transition: all 0.12s ease;
}

.artifact-tab:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.artifact-tab.is-active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.tab-kind-dot {
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.tab-kind-dot[data-kind="html"] { background: var(--kind-html-bg); color: var(--kind-html); }
.tab-kind-dot[data-kind="markdown"] { background: var(--kind-md-bg); color: var(--kind-md); }
.tab-kind-dot[data-kind="csv"] { background: var(--kind-csv-bg); color: var(--kind-csv); }
.tab-kind-dot[data-kind="pdf"] { background: var(--kind-pdf-bg); color: var(--kind-pdf); }
.tab-kind-dot[data-kind="json"] { background: var(--kind-json-bg); color: var(--kind-json); }
.tab-kind-dot[data-kind="image"] { background: var(--kind-img-bg); color: var(--kind-img); }
.tab-kind-dot[data-kind="code"],
.tab-kind-dot[data-kind="text"],
.tab-kind-dot[data-kind="other"] { background: var(--kind-code-bg); color: var(--kind-code); }

.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-artifact-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Searchable Project File Explorer Drawer */
.file-explorer-drawer {
  position: absolute;
  top: 87px;
  right: 14px;
  width: min(560px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 150px));
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.drawer-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.drawer-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 32px 0 10px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.drawer-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
}

#closeFileDrawerBtn {
  position: absolute;
  top: 13px;
  right: 14px;
}

.drawer-kind-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.drawer-file-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.drawer-file-item {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.drawer-file-item:hover {
  background: var(--surface-2);
}

.drawer-file-item.is-active {
  background: var(--accent-soft);
}

.drawer-file-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.drawer-file-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-file-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-file-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-file-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ==========================================================================
   Reader Viewport & Rich Viewers
   ========================================================================== */
.reader-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 1. HTML & PDF Iframe Viewer */
.viewer-frame-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.viewer-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.iframe-skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.spinner-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

/* 2. Built-in Markdown Reader + Right TOC Outline */
.viewer-md-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--surface);
  overflow: hidden;
}

.md-article-scroll {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 36px 64px;
  scroll-behavior: smooth;
}

.md-doc-container {
  max-width: 920px;
  margin: 0 auto;
}

.viewer-meta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 22px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.meta-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.enc-badge {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
}

.trunc-banner {
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 6px;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--amber);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Markdown Typography */
.md-body {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
  word-break: break-word;
}

.md-body h1,
.md-body h2,
.md-body h3,
.md-body h4,
.md-body h5,
.md-body h6 {
  color: var(--ink);
  line-height: 1.35;
  margin-top: 1.6em;
  margin-bottom: 0.65em;
  scroll-margin-top: 18px;
}

.md-body h1 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.md-body h2 {
  font-size: 19.5px;
  font-weight: 700;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.md-body h3 {
  font-size: 16.5px;
  font-weight: 700;
}

.md-body h4 {
  font-size: 15px;
  font-weight: 700;
}

.md-body p {
  margin: 0 0 1em;
}

.md-body ul,
.md-body ol {
  margin: 0 0 1.1em;
  padding-left: 1.55em;
}

.md-body li {
  margin-bottom: 0.38em;
}

.md-body strong {
  font-weight: 700;
  color: var(--ink);
}

.md-body blockquote {
  margin: 1.1em 0;
  padding: 10px 16px;
  border-left: 3.5px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: var(--ink-2);
}

.md-body blockquote p:last-child {
  margin-bottom: 0;
}

.md-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.md-body code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.md-code-block {
  margin: 1.1em 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.md-code-head {
  padding: 5px 12px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.md-code-block pre {
  margin: 0;
  padding: 13px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

.md-code-block pre code {
  padding: 0;
  background: transparent;
  font-size: inherit;
}

.md-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 10px 0;
}

/* GFM Tables inside Markdown */
.md-table-wrap {
  margin: 1.15em 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.md-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.md-body th,
.md-body td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.md-body th:last-child,
.md-body td:last-child {
  border-right: 0;
}

.md-body tr:last-child td {
  border-bottom: 0;
}

.md-body th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.md-body tbody tr:hover {
  background: var(--surface-2);
}

/* Right-Side TOC Outline */
.md-toc-pane {
  width: 256px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  padding: 16px 14px;
  overflow-y: auto;
}

.toc-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 5px 5px 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.12s ease;
}

.toc-item[data-level="2"] { padding-left: 10px; font-weight: 600; }
.toc-item[data-level="3"] { padding-left: 22px; font-size: 12px; color: var(--muted); }

.toc-item:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.toc-item.is-active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* 3. Interactive CSV Data Table Viewer */
.viewer-csv-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.csv-toolbar {
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.csv-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.csv-filter-input {
  width: 260px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
}

.csv-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

.csv-stats {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.csv-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.csv-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.8px;
  font-variant-numeric: tabular-nums;
}

.csv-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border);
  padding: 7px 11px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.csv-table thead th:hover {
  background: var(--border);
}

.csv-table thead th.col-num {
  text-align: right;
}

.csv-table thead th.col-idx {
  width: 48px;
  text-align: right;
  color: var(--muted);
  cursor: default;
}

.sort-ind {
  margin-left: 4px;
  font-size: 10px;
  color: var(--accent);
}

.csv-table tbody td {
  padding: 6px 11px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--ink-2);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-table tbody tr:hover td {
  background: var(--surface-2);
  color: var(--ink);
}

.csv-table td.col-idx {
  text-align: right;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface-2);
}

.csv-table td.col-num {
  text-align: right;
  font-family: var(--font-mono);
}

.csv-table td.val-up {
  color: var(--up);
  font-weight: 600;
}

.csv-table td.val-down {
  color: var(--down);
  font-weight: 600;
}

.csv-table td.col-code {
  font-family: var(--font-mono);
  color: var(--ink);
}

/* 4. JSON / Code / Text Viewer */
.viewer-code-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.code-toolbar {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.code-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px;
}

.code-pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--ink);
  tab-size: 2;
  white-space: pre;
}

.code-pre.is-wrapped {
  white-space: pre-wrap;
  word-break: break-word;
}

.tok-key { color: var(--accent); font-weight: 600; }
.tok-str { color: var(--down); }
.tok-num { color: var(--up); }
.tok-bool { color: var(--kind-md); font-weight: 600; }
.tok-null { color: var(--muted); font-style: italic; }
.tok-cmt { color: var(--muted); font-style: italic; }
.tok-kw { color: var(--kind-md); font-weight: 600; }

/* 5. Zoomable Image Viewer */
.viewer-image-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
}

.image-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-stage.is-checker {
  background-image:
    linear-gradient(45deg, var(--surface-3) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-3) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-3) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.zoomable-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease;
  transform-origin: center center;
  cursor: zoom-in;
}

/* 6. Other / Binary File Card (.xlsx, etc.) */
.viewer-other-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--bg-canvas);
}

.other-file-card {
  max-width: 480px;
  width: 100%;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.other-ext-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.other-file-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  word-break: break-all;
}

.other-file-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}

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

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .hide-md { display: none !important; }
  .md-toc-pane { width: 210px; }
  .workbench-sidebar { width: 270px; }
}

@media (max-width: 920px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
  }
  .topbar-center {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }
  .hide-sm { display: none !important; }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .md-toc-pane {
    display: none;
  }
  .md-article-scroll {
    padding: 18px 18px 48px;
  }
  .workbench-sidebar {
    width: 240px;
  }
}
