/* ==========================================================================
   Nomi Admin — Apple-style Redesign
   System font, clean blues, generous whitespace, pill tabs, glass header.
   Zero AI icons.
   ========================================================================== */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --text: #1d1d1f;
  --muted: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0,113,227,0.06);
  --accent-ring: rgba(0,113,227,0.2);
  --pending: #bf5a00;
  --success: #248a3d;
  --warn: #d97706;
  --err: #e53935;
  --code-bg: #f5f5f7;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --transition: 200ms ease;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ==========================================================================
   Landing Page — Apple-style with ambient animated orbs
   ========================================================================== */
#landingPage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
.landing-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.landing-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.6;
  animation: orbFloat 20s ease-in-out infinite;
}
.landing-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,113,227,0.5) 0%, transparent 65%);
  top: -15%; left: -10%;
  animation-duration: 22s;
}
.landing-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(94,92,230,0.45) 0%, transparent 65%);
  bottom: -20%; right: -10%;
  animation-duration: 18s;
  animation-delay: -8s;
}
.landing-orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,199,190,0.4) 0%, transparent 65%);
  top: 35%; left: 50%;
  animation-duration: 25s;
  animation-delay: -14s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -20px) scale(1.05); }
  50% { transform: translate(-20px, 30px) scale(0.95); }
  75% { transform: translate(20px, 20px) scale(1.02); }
}
.landing-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  animation: landingFadeUp 1s ease-out;
}
.landing-title {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text);
}
.landing-word {
  display: block;
}
.landing-word:nth-child(1) { animation: wordSlide 0.8s ease-out both; }
.landing-word:nth-child(2) { animation: wordSlide 0.8s ease-out 0.15s both; }
.landing-sub {
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  margin-bottom: 44px;
  animation: landingFadeUp 1s ease-out 0.3s both;
}
#landingPage button {
  padding: 16px 40px;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 4px 14px rgba(0,113,227,0.3);
  animation: landingFadeUp 1s ease-out 0.5s both;
}
#landingPage button:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(0,113,227,0.4);
  transform: translateY(-1px);
}
#landingPage button:active { transform: translateY(0) scale(0.97); }

@keyframes landingFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes wordSlide {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   App Header — glassmorphism
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.app-header .brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
}
.app-header .brand .logo svg {
  width: 22px; height: 22px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app-header .sub { color: var(--muted); font-size: 12px; font-weight: 400; }

/* User menu */
.user-menu { margin-left: auto; position: relative; }
.user-menu__trigger {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--border-light);
  border-radius: 999px; padding: 5px 12px 5px 5px;
  cursor: pointer; font-size: 13px; color: var(--text);
  transition: border-color var(--transition);
}
.user-menu__trigger:hover { border-color: var(--accent); }
.user-menu__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.user-menu__caret { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; }
.user-menu__pop {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--panel); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  min-width: 180px; overflow: hidden; z-index: 200;
}
.user-menu__pop[hidden] { display: none; }
.user-menu__header { padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
.user-menu__name { font-weight: 600; font-size: 13px; }
.user-menu__meta { font-size: 11px; color: var(--muted); }
.user-menu__item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px; border: none; background: none;
  font-size: 13px; color: var(--text); cursor: pointer; text-align: left;
}
.user-menu__item:hover { background: var(--accent-soft); }
.user-menu__item svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; }

/* ==========================================================================
   Container & Panels
   ========================================================================== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 28px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}
.panel:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.04);
}
.panel h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2 .count { font-weight: 400; color: var(--muted); font-size: 13px; }

/* ==========================================================================
   Login Screen — same ambient orb background as landing
   ========================================================================== */
.login-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 40px 24px;
  overflow: hidden;
}
.login-screen::before,
.login-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  pointer-events: none;
  animation: orbFloat 20s ease-in-out infinite;
}
.login-screen::before {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(0,113,227,0.4) 0%, transparent 65%);
  top: -10%; right: -5%;
  animation-duration: 20s;
}
.login-screen::after {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(94,92,230,0.35) 0%, transparent 65%);
  bottom: -10%; left: -5%;
  animation-duration: 24s;
  animation-delay: -6s;
}
.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  text-align: center;
  background: rgba(255,255,255,0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  animation: landingFadeUp 0.8s ease-out;
}
.login-box__brand {
  display: none;
}
.login-box__logo {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
}
.login-box__logo svg {
  width: 18px; height: 18px;
  stroke: var(--accent); fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.login-box__title { font-size: 15px; font-weight: 600; }
.login-box__title span { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.login-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-box__sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-box__msg { font-size: 12px; color: var(--muted); margin-top: 12px; min-height: 18px; }
.login-box__msg.is-error { color: var(--err); }
.login-field { text-align: left; margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 5px; color: var(--muted); text-align: left; }
.login-field input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none;
  transition: border-color var(--transition);
}
.login-field input:focus { border-color: var(--accent); }
.login-box__submit {
  width: 100%; padding: 11px;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background var(--transition);
  margin-top: 4px;
}
.login-box__submit:hover { background: var(--accent-hover); }

/* ==========================================================================
   Tabs — pill style
   ========================================================================== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  background: rgba(0,0,0,0.04);
  border-radius: 999px;
  margin-bottom: 28px;
  width: fit-content;
}
.tab {
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==========================================================================
   Tables
   ========================================================================== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th {
  text-align: left; font-weight: 600; padding: 10px 12px;
  border-bottom: 2px solid var(--border-light);
  color: var(--text); font-size: 12px;
  letter-spacing: 0.01em;
}
table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
table tr:hover td { background: rgba(0,113,227,0.03); }
table tr:last-child td { border-bottom: none; }
/* PDF list: percentage column widths + fixed layout, so column widths stay
   stable across pages (no jumping when a page has a longer name) yet still
   scale with the window. Long unbroken filenames wrap inside the PDF cell. */
#pdfList table { table-layout: fixed; }
#pdfList td.slug { word-break: break-word; overflow-wrap: anywhere; }
#pdfList td.size, #pdfList td.ts { white-space: nowrap; }
#pdfList td.action { white-space: nowrap; }

/* ==========================================================================
   Status badges
   ========================================================================== */
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.status.completed { background: #d1fae5; color: #065f46; }
.status.failed { background: #fee2e2; color: #991b1b; }
.status.processing { background: #dbeafe; color: #1e40af; }

/* Task badge colors (used by JS TASK_STATUS_META) */
.badge-review { display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:500; font-family:inherit; background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.badge-enabled { display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:500; font-family:inherit; background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.badge-failed { display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:500; font-family:inherit; background:#fef2f2; color:#b91c1c; border:1px solid #fecaca; }
.badge-processing { display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:500; font-family:inherit; background:#dbeafe; color:#1e40af; border:1px solid #93c5fd; }
.badge-enabling { display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:500; font-family:inherit; background:#e0e7ff; color:#3730a3; border:1px solid #a5b4fc; }
.badge-uploading { display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:500; font-family:inherit; background:#f3f4f6; color:#6b7280; border:1px solid #d1d5db; }

/* ==========================================================================
   Wiki layout
   ========================================================================== */
.wiki-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; min-height: 500px; }
.wiki-tree { overflow-y: auto; max-height: 70vh; padding-right: 12px; border-right: 1px solid var(--border-light); }
.wiki-view { overflow-y: auto; max-height: 70vh; }
.wiki-view .empty { color: var(--muted); font-size: 13px; text-align: center; padding: 60px 0; }

/* Wiki tree buckets (collapsible sections) */
.bucket {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  margin-top: 4px;
  transition: background var(--transition);
  user-select: none;
}
.bucket:hover { background: var(--accent-soft); }
.bucket .arrow {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.2s ease;
  display: inline-block;
}
.bucket.expanded .arrow { transform: rotate(90deg); }
.bucket .count-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  background: var(--bg);
  padding: 1px 7px;
  border-radius: 99px;
}
.bucket-body { padding: 4px 0 8px 18px; }
.bucket-body.collapsed { display: none; }

/* Individual wiki page items */
.page-item {
  padding: 7px 10px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}
.page-item:hover { background: var(--accent-soft); color: var(--text); }
.page-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.page-item.planned { opacity: 0.5; font-style: italic; }
.page-item.deprecated { opacity: 0.4; text-decoration: line-through; }

/* ==========================================================================
   Inputs & Buttons
   ========================================================================== */
.filter {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; outline: none; margin-bottom: 12px;
  transition: border-color var(--transition);
  font-family: inherit;
}
.filter:focus { border-color: var(--accent); }
button.refresh-btn, .btn-sm {
  background: var(--panel); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
  font-weight: 500;
}
button.refresh-btn:hover, .btn-sm:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Ensure all buttons/inputs/selects use system font */
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* Status/action buttons in tables — uniform style */
table button, table select {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  border: none;
  transition: opacity var(--transition);
}
table button:hover { opacity: 0.85; }
table select {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 3px 8px;
  border-radius: 5px;
}
table select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--bg);
}

/* ==========================================================================
   Messages & misc
   ========================================================================== */
.msg { font-size: 13px; color: var(--muted); padding: 16px 0; text-align: center; }
.msg.err { color: var(--err); text-align: left; }
.hint { font-size: 12px; color: var(--muted); }
.uploads { margin-top: 12px; }
.count { font-weight: 400; color: var(--muted); font-size: 13px; }

/* ==========================================================================
   Markdown body
   ========================================================================== */
.md-body { font-size: 13px; line-height: 1.7; }
.md-body h1, .md-body h2, .md-body h3 { margin: 14px 0 6px; }
.md-body h1 { font-size: 17px; } .md-body h2 { font-size: 15px; } .md-body h3 { font-size: 13px; }
.md-body p { margin-bottom: 8px; }
.md-body ul, .md-body ol { padding-left: 18px; margin-bottom: 8px; }
.md-body code { background: var(--code-bg); padding: 2px 5px; border-radius: 4px; font-size: 12px; }
.md-body pre { background: var(--code-bg); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; margin: 8px 0; tab-size: 2; }
.md-body table { border-collapse: collapse; margin: 10px 0; font-size: 12px; }
.md-body table th, .md-body table td { border: 1px solid var(--border); padding: 5px 8px; }
.md-body table th { background: var(--bg); font-weight: 600; }

/* ==========================================================================
   Editor & Wiki View
   ========================================================================== */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.page-header .path { flex: 1; min-width: 0; }
.page-header .path code { font-size: 12px; color: var(--muted); background: var(--bg); padding: 4px 8px; border-radius: 5px; word-break: break-all; }
.page-header .actions { display: flex; gap: 6px; flex-shrink: 0; }
.page-header .actions button {
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.page-header .actions button:hover { border-color: var(--accent); color: var(--accent); }
.page-header .actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-header .actions button.primary:hover { background: var(--accent-hover); }

/* Wiki view meta line */
.meta { font-size: 12px; color: var(--muted); margin-bottom: 16px; padding: 10px 12px; background: var(--bg); border-radius: 8px; line-height: 1.7; }
.meta code { font-size: 11px; background: var(--panel); padding: 1px 5px; border-radius: 3px; }

.editor-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-family: inherit; }
.editor-status.saved { background: #d1fae5; color: #065f46; }
.editor-status.dirty { background: #fef3c7; color: #92400e; }
.editor-status.error { background: #fee2e2; color: #991b1b; }

/* Inline markdown editor (enterEdit) — these were referenced but never styled,
   so the textarea rendered as a tiny unusable box. */
.editor-bar { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; line-height: 1.6; }
.editor-bar code { font-size: 11px; background: var(--panel); padding: 1px 5px; border-radius: 3px; }
.editor-textarea {
  width: 100%;
  min-height: 60vh;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
}
.editor-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ==========================================================================
   Modals (shared)
   ========================================================================== */
.versions-modal-bg, .draft-review-modal {
  display: none; position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.versions-modal-bg.open, .draft-review-modal.open { display: flex; }
.versions-modal {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  width: 90vw; max-width: 640px; max-height: 80vh;
  overflow-y: auto; padding: 24px; position: relative;
}
.versions-modal h3 { margin: 0 0 12px; font-size: 15px; }
.versions-modal .version-row {
  padding: 10px 12px; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 12px;
}
.versions-modal .version-row.latest { background: var(--accent-soft); border-color: var(--accent); }
.versions-modal .version-row button { margin-top: 6px; font-size: 11px; padding: 3px 10px; background: none; border: 1px solid var(--border); border-radius: 5px; cursor: pointer; }
.versions-modal .close { position: absolute; top: 16px; right: 16px; background: none; border: 1px solid var(--border); padding: 4px 12px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }

/* Draft review modal */
.drm-box {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  width: 95vw; max-width: 1200px; height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.drm-header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); }
.drm-body { display: flex; flex: 1; overflow: hidden; }
.drm-pane { flex: 1; overflow-y: auto; padding: 16px 20px; }
.drm-pane + .drm-pane { border-left: 1px solid var(--border-light); }
.drm-pane h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
#drmPdf { width: 100%; height: 100%; border: none; display: block; }
/* DRM header/status bits used by openDraftReview() */
.drm-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.drm-badge.create { background: #e6f4ea; color: var(--success); }
.drm-badge.update { background: #fef1dd; color: var(--warn); }
.drm-close { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.drm-close:hover { border-color: var(--accent); color: var(--accent); }
.drm-loading { padding: 24px; color: var(--muted); font-size: 13px; }
/* Line diff (UPDATE preview) — GitHub-style unified diff */
.diff-body { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--border-light); border-radius: 6px; overflow: hidden; }
.diff-line { display: flex; border-bottom: 1px solid var(--border-light); }
.diff-line:last-child { border-bottom: none; }
.diff-line .diff-ln { width: 40px; min-width: 40px; text-align: right; padding: 1px 6px; color: var(--muted); font-size: 11px; border-right: 1px solid var(--border-light); user-select: none; }
.diff-line .diff-prefix { width: 16px; min-width: 16px; text-align: center; user-select: none; font-weight: 600; }
.diff-line .diff-text { flex: 1; padding: 1px 8px; }
.diff-line.dl-same { background: var(--panel); color: var(--text); }
.diff-line.dl-same .diff-prefix { color: var(--muted); }
.diff-line.dl-add { background: #e6ffec; color: #1a7f37; }
.diff-line.dl-add .diff-ln { background: #ccffd8; }
.diff-line.dl-add .diff-prefix { color: #1a7f37; }
/* human-edit provenance marks (purple = author/blame convention) */
.diff-line.dl-human { box-shadow: inset 3px 0 0 #8250df; background: #8250df0d; }
.diff-line.dl-human-del { box-shadow: inset 3px 0 0 #8250df; }
.dl-human-mark { color: #8250df; font-weight: 700; margin-right: 6px; user-select: none; }
.dl-human-badge {
  margin-left: 10px; padding: 0 7px;
  font-size: 10px; font-weight: 700;
  color: #fff; background: #8250df;
  border-radius: 999px; white-space: nowrap;
}
.dl-human-note { color: #8250df; margin-left: 10px; }
.dl-human-note b { font-weight: 700; }
/* provenance source locator (wiki view, blame-style) */
.prov-source {
  max-height: 420px; overflow-y: auto;
  border: 1px solid var(--border-light); border-radius: 8px;
  margin-bottom: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.55;
}
.prov-line { display: flex; }
.prov-line .prov-ln {
  width: 40px; min-width: 40px; text-align: right; padding: 0 8px;
  color: var(--muted); border-right: 1px solid var(--border-light);
  user-select: none;
}
.prov-line .prov-text { flex: 1; padding: 0 10px; white-space: pre-wrap; word-break: break-word; }
.prov-line-human { background: #8250df14; box-shadow: inset 3px 0 0 #8250df; }
.diff-line.dl-del { background: #ffebe9; color: #82071e; }
.diff-line.dl-del .diff-ln { background: #ffd7d5; }
.diff-line.dl-del .diff-prefix { color: #82071e; }
.dl-summary { padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border-light); font-size: 12px; }
.dl-fold { padding: 4px 12px; background: #f8f9fb; border-bottom: 1px solid var(--border-light); color: var(--accent); font-size: 11px; cursor: pointer; text-align: center; user-select: none; }
.dl-fold:hover { background: var(--accent-soft); }
.dl-fold:hover { border-color: var(--accent); }
.dl-summary { position: sticky; top: 0; z-index: 1; margin-bottom: 10px; padding: 6px 10px; background: var(--panel); border: 1px solid var(--border-light); border-radius: 6px; font-size: 12px; font-family: -apple-system, sans-serif; }

/* ==========================================================================
   Push panel & Label edit
   ========================================================================== */
.push-panel { margin-top: 16px; padding: 14px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: transparent; }
.push-panel__toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.push-panel__toggle input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.push-panel__body { margin-top: 12px; display: none; }
.push-panel__body.is-open { display: block; }

/* Tag summary chip strip */
.push-tags {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

/* Field groups */
.push-field { margin-bottom: 16px; }
.push-field:last-child { margin-bottom: 0; }
.push-field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

/* Audience radios */
.push-radios { display: flex; flex-direction: column; gap: 8px; }
.push-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.push-radio input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* Search input */
.push-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.push-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* Typeahead suggestions */
.push-suggest {
  margin-top: 4px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
}
.push-suggest__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}
.push-suggest__item:last-child { border-bottom: none; }
.push-suggest__item:hover { background: var(--accent-soft); }
.push-suggest__id { font-size: 11px; color: var(--muted); }
.push-suggest__empty { padding: 8px 12px; font-size: 12px; color: var(--muted); }

/* Selected recipient chips */
.push-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.push-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-ring);
  border-radius: 999px;
}
.push-chip__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  color: var(--accent);
}
.push-chip__x:hover { background: var(--accent); color: #fff; }

/* Buttons */
.push-btn {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}
.push-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Recipient preview result */
.push-recipients { margin-top: 10px; font-size: 13px; }
.push-recipients ul { margin-top: 4px; }
.push-recipients li { color: var(--text); }

/* Message textarea */
.push-textarea {
  width: 100%;
  margin-top: 8px;
  min-height: 96px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.push-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
#labelEditPanel { margin-top: 16px; padding: 14px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); background: var(--bg); }

/* ==========================================================================
   Upload area
   ========================================================================== */
#drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
#drop:hover, #drop.hover { border-color: var(--accent); background: var(--accent-soft); }

/* Pager — right-aligned, consistent font */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; font-size: 12px; font-family: inherit; color: var(--muted); }
.pager__info { display: flex; gap: 8px; align-items: center; }
.pager__controls { display: flex; gap: 6px; align-items: center; }
.pager__controls button { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: none; font-size: 12px; font-family: inherit; cursor: pointer; transition: all var(--transition); color: var(--text); }
.pager__controls button:hover { border-color: var(--accent); color: var(--accent); }
.pager__size { font-size: 12px; font-family: inherit; }
.pager__size select { font-size: 12px; font-family: inherit; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); }

/* Role-based visibility (UX only; backend enforcement is a separate task).
   .edit-only  — any create/modify control; hidden for the read-only viewer role.
   .admin-only — admin-exclusive surfaces (e.g. Upload PDF). */
body.role-viewer .edit-only { display: none !important; }
body.role-viewer .admin-only { display: none !important; }
/* .admin-strict — visible ONLY to admin-level roles (hidden for viewer).
   Used for admin-exclusive tools like the PDF preview magnifier. */
.admin-strict { display: none !important; }
body.role-admin .admin-strict,
body.role-superadmin .admin-strict { display: inline-block !important; }
/* .view-only — read-only substitute shown ONLY to the viewer role. */
.view-only { display: none; }
body.role-viewer .view-only { display: inline; }

/* ==========================================================================
   Users tab (account management, superadmin only)
   ========================================================================== */
.new-user-form { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.new-user-form .login-field { margin: 0; min-width: 200px; flex: 1; max-width: 280px; }
.new-user-form .login-field label { display: block; margin-bottom: 6px; }
.new-user-form input, .new-user-form select {
  font-family: inherit; font-size: 13px; padding: 0 10px; height: 38px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); width: 100%; box-sizing: border-box;
}
/* The Create button has no label above it — push it down to input level. */
.new-user-form .btn-sm { padding: 0 20px; height: 38px; margin-top: 24px; }
.new-user-form .btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }
/* Login typeahead dropdown, anchored under the username input. */
.nu-suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  background: var(--panel);
}
.push-suggest__item.is-taken { opacity: 0.5; cursor: default; }
.push-suggest__item.is-taken:hover { background: none; }
tr.user-disabled td { opacity: 0.5; }
.user-off { color: #c0392b; font-weight: 600; }
.user-me {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  background: var(--accent-soft, rgba(0,113,227,0.1)); color: var(--accent, #0071e3);
  border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: middle;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 768px) {
  .container { padding: 0 12px; }
  .app-header { padding: 10px 14px; gap: 8px; }
  .app-header .brand { font-size: 14px; }
  .app-header .sub { display: none; }
  .user-menu__trigger #userInfo { display: none; }
  .panel { padding: 16px 14px; margin-bottom: 14px; border-radius: 12px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; width: auto; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; }
  .wiki-layout { grid-template-columns: 1fr; gap: 12px; }
  .wiki-tree { max-height: 220px; border-right: none; border-bottom: 1px solid var(--border-light); padding-right: 0; padding-bottom: 12px; }
  .wiki-view { max-height: none; }
  #pdfList, #auditList, #gapList { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .drm-box { width: 100vw; height: 100vh; border-radius: 0; }
  .pager { flex-direction: column; align-items: stretch; }
  .pager__controls { justify-content: space-between; }
  .pager__controls button { flex: 1; text-align: center; padding: 9px; }
  .login-screen { padding: 24px 16px; }
}
@media (max-width: 480px) {
  .panel { padding: 14px 12px; }
  .tab { padding: 7px 12px; font-size: 12px; }
  .push-panel { padding: 12px; }
}

/* ==========================================================================
   Usage hero metrics (Dashboard) — odometer cards
   ========================================================================== */
.usage-hero {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 10px;
}
@media (max-width: 1100px) { .usage-hero { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .usage-hero { grid-template-columns: 1fr; } }
.usage-card {
  position: relative;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 26px 28px 22px;
  background:
    radial-gradient(130% 100% at 50% -25%, var(--accent-soft), transparent 62%),
    var(--panel);
  overflow: hidden;
  transition: transform .3s cubic-bezier(.23,1,.32,1), box-shadow .3s ease, border-color .3s ease;
  animation: usage-enter .65s cubic-bezier(.23,1,.32,1) both;
}
.usage-card::before {           /* hairline top highlight */
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-ring), transparent);
}
.usage-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-ring);
  box-shadow: 0 18px 44px rgba(0,0,0,.08);
}
/* staggered entrance, left to right */
.usage-hero .usage-card:nth-child(1) { animation-delay: 0ms; }
.usage-hero .usage-card:nth-child(2) { animation-delay: 70ms; }
.usage-hero .usage-card:nth-child(3) { animation-delay: 140ms; }
.usage-hero .usage-card:nth-child(4) { animation-delay: 210ms; }
.usage-hero .usage-card:nth-child(5) { animation-delay: 280ms; }
@keyframes usage-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.usage-label {
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  margin-top: 10px;
}
.usage-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* Odometer: each digit is a masked column; the inner strip rolls vertically */
.odo {
  display: flex; align-items: baseline;
  font-size: 48px; font-weight: 700; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  height: 1.06em; overflow: hidden;
}
.odo-digit { position: relative; height: 1.06em; overflow: hidden; }
.odo-strip {
  display: flex; flex-direction: column; line-height: 1.06em;
  transform: translateY(0);
  transition: transform 1.4s cubic-bezier(.23, 1, .32, 1);   /* long glide, soft landing */
  will-change: transform;
}
.odo-sep { line-height: 1.06em; }
.usage-bump {                    /* "+N" chip that floats up on live increments */
  position: absolute; top: 18px; right: 20px;
  font-size: 12px; font-weight: 600; color: var(--success);
  opacity: 0; pointer-events: none;
  animation: usage-bump-float 1.4s ease-out forwards;
}
@keyframes usage-bump-float {
  0%   { opacity: 0; transform: translateY(6px); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}
.usage-live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase;
}
.usage-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: usage-pulse 2.4s ease-in-out infinite;
}
@keyframes usage-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(36,138,61,.35); }
  50%      { box-shadow: 0 0 0 5px rgba(36,138,61,0); }
}
/* ---- weekly pulse strip ---- */
.week-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}
.week-title {
  font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text);
}
.week-vs {
  margin-left: auto;
  font-size: 11px; color: var(--muted);
}
.week-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
@media (max-width: 1100px) { .week-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px)  { .week-strip { grid-template-columns: repeat(2, 1fr); } }
.week-card {
  position: relative;
  border: none;
  border-radius: 14px;
  padding: 18px 18px 16px;
  background: var(--bg);            /* recessed gray tile on the white panel */
  overflow: hidden;
  transition: transform .3s cubic-bezier(.23,1,.32,1), box-shadow .3s ease, background .3s ease;
  animation: usage-enter .65s cubic-bezier(.23,1,.32,1) both;
}
.week-card:hover {
  transform: translateY(-2px);
  background: #f0f0f3;
  box-shadow: 0 10px 26px rgba(0,0,0,.06);
}
.week-strip .week-card:nth-child(1) { animation-delay: 260ms; }
.week-strip .week-card:nth-child(2) { animation-delay: 310ms; }
.week-strip .week-card:nth-child(3) { animation-delay: 360ms; }
.week-strip .week-card:nth-child(4) { animation-delay: 410ms; }
.week-strip .week-card:nth-child(5) { animation-delay: 460ms; }
.week-strip .week-card:nth-child(6) { animation-delay: 510ms; }
.week-num { display: flex; align-items: baseline; gap: 1px; }
.week-plus {
  font-size: 17px; font-weight: 700; line-height: 1;
  color: var(--success);
  transform: translateY(-6px);      /* superscript the sign, price-tag style */
}
.week-card.warm .week-plus { color: var(--err); }
.week-card.zero .week-plus { color: var(--muted); }
.odo-sm { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; }
.week-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 7px; letter-spacing: .01em; }

/* ---- trending (hot topics, headline-chart style) ---- */
.trend-updated { font-size: 11px; color: var(--muted); }
.trend-list { display: grid; gap: 6px; }
.trend-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  transition: background .2s ease, transform .25s cubic-bezier(.23,1,.32,1);
  animation: usage-enter .55s cubic-bezier(.23,1,.32,1) both;
}
.trend-row:hover { background: var(--bg); transform: translateX(2px); }
.trend-list .trend-row:nth-child(1) { animation-delay: 0ms; }
.trend-list .trend-row:nth-child(2) { animation-delay: 60ms; }
.trend-list .trend-row:nth-child(3) { animation-delay: 120ms; }
.trend-list .trend-row:nth-child(4) { animation-delay: 180ms; }
.trend-list .trend-row:nth-child(5) { animation-delay: 240ms; }
.trend-rank {
  flex: 0 0 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 13px; font-weight: 750; font-style: italic;
  color: #fff; background: var(--muted);
}
.trend-rank.r1 { background: linear-gradient(135deg, #ff3b30, #ff6259); box-shadow: 0 3px 10px rgba(255,59,48,.3); }
.trend-rank.r2 { background: linear-gradient(135deg, #ff9500, #ffb340); box-shadow: 0 3px 10px rgba(255,149,0,.28); }
.trend-rank.r3 { background: linear-gradient(135deg, #ffcc00, #ffdb4d); box-shadow: 0 3px 10px rgba(255,204,0,.28); }
.trend-rank.r4, .trend-rank.r5 { background: #c7c7cc; }
.trend-body { flex: 1; min-width: 0; }
.trend-title-row { display: flex; align-items: baseline; gap: 8px; }
.trend-title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.trend-new {
  font-size: 9px; font-weight: 750; letter-spacing: .06em;
  color: var(--accent); border: 1px solid var(--accent-ring);
  background: var(--accent-soft);
  padding: 1px 5px; border-radius: 5px;
  transform: translateY(-1px);
}
.trend-summary {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trend-count {
  flex: 0 0 auto;
  font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.trend-count small { font-size: 10px; font-weight: 500; color: var(--muted); margin-left: 2px; }
/* skeleton shimmer while the LLM chews */
.trend-skel {
  height: 54px; border-radius: 12px;
  background: linear-gradient(90deg, var(--bg) 25%, #ececf0 45%, var(--bg) 65%);
  background-size: 300% 100%;
  animation: trend-shimmer 1.4s ease-in-out infinite;
}
@keyframes trend-shimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }
.trend-empty { font-size: 12px; color: var(--muted); padding: 14px 2px; }
/* ---- domains (live demand bars) ---- */
.domain-list { display: flex; flex-direction: column; gap: 4px; }
.domain-row {
  display: grid; grid-template-columns: 150px 1fr 64px;
  align-items: center; gap: 14px;
  padding: 8px 14px;
  border-radius: 10px;
  transition: background .2s ease;
  animation: usage-enter .55s cubic-bezier(.23,1,.32,1) both;
}
.domain-row:hover { background: var(--bg); }
.domain-name {
  font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.domain-row.untagged .domain-name { color: var(--muted); font-weight: 500; }
.domain-track {
  height: 8px; border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}
.domain-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #59a8ff);
  width: 0;
  transition: width 1.2s cubic-bezier(.23,1,.32,1);   /* bars glide on live updates */
}
.domain-row.untagged .domain-fill { background: #c7c7cc; }
.domain-count {
  display: flex; justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}
.odo-xs { font-size: 14px; font-weight: 650; letter-spacing: 0; }
/* ---- feedback log ---- */
.fblog-chips { display: flex; gap: 6px; }
.fblog-chip {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  font-size: 11px; font-weight: 600; font-family: inherit;
  color: var(--muted); cursor: pointer;
  transition: all .2s ease;
}
.fblog-chip:hover { border-color: var(--text); color: var(--text); }
.fblog-chip.active { background: var(--text); border-color: var(--text); color: #fff; }

/* Apple-style segmented capsule (iOS UISegmentedControl): grey track,
   white sliding thumb. Used by the Wiki tab's Full/Seller KB switcher. */
.seg-capsule {
  position: relative;
  display: inline-flex;
  background: #eceef1;
  border-radius: 999px;
  padding: 2px;
  user-select: none;
}
.seg-capsule__thumb {
  position: absolute;
  top: 2px; bottom: 2px; left: 2px;
  width: calc(50% - 2px);
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04);
  transition: transform .22s cubic-bezier(.3,.7,.4,1);
  pointer-events: none;
}
.seg-capsule[data-active="1"] .seg-capsule__thumb { transform: translateX(100%); }
.seg-capsule__opt {
  position: relative; z-index: 1;
  border: none; background: none; cursor: pointer;
  padding: 4px 16px;
  font-size: 11px; font-weight: 600; font-family: inherit;
  border-radius: 999px;
  color: var(--muted);
  transition: color .22s ease;
  min-width: 64px;
}
.seg-capsule__opt.active { color: var(--text); }
.fblog-badge {
  display: inline-block; padding: 2px 9px;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .01em;
  white-space: nowrap;
}
/* desaturated, low-key tones — no traffic-light brightness */
.fblog-badge.not_resolved { color: #9a4238; background: rgba(154,66,56,.07); border: 1px solid rgba(154,66,56,.18); }
.fblog-badge.info_gap     { color: #8a6a1f; background: rgba(138,106,31,.08); border: 1px solid rgba(138,106,31,.18); }
.fblog-q, .fblog-fb {
  max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fblog-fb-empty { color: var(--border); }
.fblog-empty { font-size: 12px; color: var(--muted); padding: 14px 2px; }
/* ---- wiki keyword search results ---- */
.wiki-search-hit {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}
.wiki-search-hit:hover { background: var(--bg); }
.wiki-search-int {
  flex: 0 0 auto;
  font-size: 9px; font-weight: 700; letter-spacing: .05em;
  color: #8a6a1f; background: rgba(138,106,31,.09);
  border: 1px solid rgba(138,106,31,.2);
  padding: 1px 5px; border-radius: 4px;
}
.wiki-search-bar {
  height: 3px; border-radius: 999px;
  background: var(--bg); overflow: hidden; margin-top: 5px;
}
.wiki-search-bar > div {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #59a8ff);
}

@media (prefers-reduced-motion: reduce) {
  .odo-strip { transition: none; }
  .usage-card, .week-card, .trend-row { transition: none; animation: none; }
  .trend-skel { animation: none; }
}