/* MUनीम paper design system. Tokens and component rules follow MUnimDesignSystem.html.
   Text-safe colour steps (--muted, --cyan-text, --good-text, --bad-text, --orange-text) are the
   accessible values from that guide's Accessibility section (4.5:1 on paper and card). */
:root {
  --paper: #efebdf;
  --paper-2: #eae5d7;
  --card: #f5f2ea;
  --card-hi: #fbf9f3;
  --line: #ded7c5;
  --line-soft: #e7e1d2;
  --ink: #161512;
  --ink-2: #3a372f;
  --muted: #6f6a5e;
  --muted-2: #aba593; /* lines and disabled states only */
  --cyan: #39b6d8;
  --cyan-deep: #2a93b0;
  --yellow: #f7d344;
  --orange: #e38330;
  --good: #3f9d6a;
  --bad: #c9533b;
  --cyan-text: #217289;
  --good-text: #307750;
  --bad-text: #b44832;
  --orange-text: #a15716;
  --on-cyan: #08323d;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Montserrat", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow-panel: 0 1px 0 rgba(0, 0, 0, 0.02), 0 22px 50px -34px rgba(60, 45, 15, 0.45);
  --shadow-hover: 0 26px 52px -30px rgba(60, 45, 15, 0.5);
  --shadow-popover: 0 24px 60px -18px rgba(40, 30, 10, 0.45);
  --sidebar: 262px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background:
    radial-gradient(260px 160px at 85% 0%, rgba(57, 182, 216, 0.22), transparent 70%),
    radial-gradient(240px 160px at 0% 100%, rgba(247, 211, 68, 0.24), transparent 70%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  text-align: left;
}

a {
  color: var(--cyan-text);
}

* {
  scrollbar-width: thin;
  scrollbar-color: #d8d0bd transparent;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

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

/* Layout */
.shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding-bottom: 24px;
}

.main {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 15px 40px;
  background: rgba(239, 235, 223, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding: 36px 40px 0;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.library {
  display: block;
  padding-bottom: 90px;
}

.quora-view {
  flex: 1;
  min-height: calc(100vh - 51px);
  padding-bottom: 0;
}

.content:has(#quoraView:not([hidden])),
.content:has(#redditView:not([hidden])),
.content:has(#linkedinView:not([hidden])),
.content:has(#newsletterView:not([hidden])) {
  max-width: none;
  padding: 0;
}

.quora-frame-wrap {
  height: calc(100vh - 51px);
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f6f1e7;
  box-shadow: none;
}

.quora-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* Sidebar identity + nav */
.identity {
  padding: 26px 22px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.tagline,
.crumbs,
.nav-group-label,
.lbl,
.h-sub,
.panel-sub,
.panel-tag,
th,
.note,
.tag-mini,
.pill-st,
.sample-badge,
.sg-tag,
.meta,
.section-label {
  font-family: var(--sans);
  text-transform: uppercase;
}

.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: var(--muted);
}

.logo {
  display: flex;
  align-items: baseline;
  margin: 6px 0 2px;
  font-size: 34px;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.logo .mu {
  font-weight: 800;
}

.logo .neem {
  margin-left: 1px;
  font-family: "Tiro Devanagari Hindi", serif;
  font-size: 33px;
  font-weight: 400;
  color: var(--cyan-text);
}

.tagline {
  margin-top: 7px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.nav-group {
  padding: 13px 12px 2px;
}

.nav-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.nav-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--paper-2);
}

.nav-item.active {
  background: var(--card-hi);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  color: var(--ink);
  font-weight: 600;
}

.nav-item.home {
  margin-bottom: 2px;
}

.nav-item .tick {
  width: 3px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 3px;
  background: transparent;
  transition: 0.15s;
}

.nav-item.active .tick {
  background: var(--cyan);
}

.nav-item .meta {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav-item.new-chat {
  margin: 2px 0 6px;
  color: var(--cyan-text);
  font-weight: 700;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  transition: background 0.14s;
}

.nav-row:hover {
  background: var(--paper-2);
}

.nav-row .label {
  flex: 1;
}

.nav-row .meta {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav-row .chev {
  width: 13px;
  height: 13px;
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}

.nav-row.open .chev {
  transform: rotate(90deg);
}

.nav-children {
  max-height: 0;
  overflow: hidden;
  visibility: hidden;
  transition: max-height 0.28s var(--ease), visibility 0s 0.28s;
}

.nav-children.open {
  max-height: 1800px;
  visibility: visible;
  transition: max-height 0.28s var(--ease), visibility 0s;
}

.nav-subrow {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
}

.nav-subrow:hover {
  background: var(--paper-2);
}

.nav-subrow.active {
  background: var(--card-hi);
  border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav-sub {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 6px 8px 24px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.nav-subrow.active .nav-sub,
.nav-sub:hover {
  color: var(--ink);
}

.nav-subrow.has-data .nav-sub {
  color: var(--ink-2);
}

.nav-sub .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-sub .meta {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav-ext {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.nav-ext:hover {
  color: var(--cyan-text);
}

.hist-row {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
}

.hist-row:hover {
  background: var(--paper-2);
}

.hist-row.active {
  background: var(--card-hi);
  border-color: var(--line);
}

.hist-title {
  flex: 1;
  min-width: 0;
  padding: 8px 11px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-row.active .hist-title {
  color: var(--ink);
  font-weight: 600;
}

.hist-delete {
  padding: 6px 10px;
  color: var(--muted);
  opacity: 0;
}

.hist-row:hover .hist-delete,
.hist-delete:focus-visible {
  opacity: 1;
}

.empty-line {
  padding: 4px 11px 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Top bar */
.crumbs {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.crumbs b {
  color: var(--ink);
}

.topbar-spacer {
  flex: 1;
}

.topbar-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: border-color 0.15s, color 0.15s;
}

.scope-pill:hover {
  border-color: var(--cyan);
  color: var(--ink);
}

.scope-pill .x {
  color: var(--muted);
}

.sample-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--orange-text);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--orange-text);
}

.sample-badge .blink {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  animation: blink 1.7s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* Pills, tags */
.pill-st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.pill-st::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-st.conn {
  background: rgba(63, 157, 106, 0.14);
  color: var(--good-text);
}

.pill-st.pend {
  background: rgba(227, 131, 48, 0.15);
  color: var(--orange-text);
}

.pill-st.plan {
  background: var(--paper-2);
  color: var(--muted);
}

.panel-tag,
.tag-mini {
  padding: 5px 10px;
  border-radius: 100px;
  background: var(--paper-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}

.tag-mini {
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.sg-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--yellow);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
  vertical-align: middle;
}

/* Hero + stats */
.hero {
  margin-bottom: 30px;
}

.hero h1 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 144;
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.hero .h-sub {
  margin-top: 14px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.hero .h-sub b {
  color: var(--cyan-text);
}

.hl {
  background-image: linear-gradient(transparent 58%, rgba(247, 211, 68, 0.9) 58%, rgba(247, 211, 68, 0.9) 92%, transparent 92%);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

.stat {
  padding: 24px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.stat:hover {
  border-color: var(--muted-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.stat .lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.stat .val {
  margin: 20px 0 16px;
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat .ul {
  width: 64px;
  height: 3px;
  border-radius: 3px;
  background: var(--line);
}

.stat .delta {
  margin-top: 13px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat.g-cyan {
  background: linear-gradient(155deg, rgba(57, 182, 216, 0.16), rgba(57, 182, 216, 0.02) 60%, transparent), var(--card);
}

.stat.g-cyan .ul {
  background: var(--cyan);
}

.stat.g-cyan .val {
  color: var(--cyan-text);
}

.stat.g-yellow {
  background: linear-gradient(155deg, rgba(247, 211, 68, 0.22), rgba(247, 211, 68, 0.03) 60%, transparent), var(--card);
}

.stat.g-yellow .ul {
  background: var(--yellow);
}

.stat.g-orange {
  background: linear-gradient(155deg, rgba(227, 131, 48, 0.16), rgba(227, 131, 48, 0.02) 60%, transparent), var(--card);
}

.stat.g-orange .ul {
  background: var(--orange);
}

.stat.g-ink {
  background: linear-gradient(155deg, rgba(20, 18, 12, 0.07), transparent 60%), var(--card);
}

.stat.g-ink .ul {
  background: var(--ink);
}

.section-label {
  margin: 4px 0 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.suggestion {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.suggestion:hover {
  border-color: var(--cyan);
  background: var(--card-hi);
  color: var(--ink);
}

.suggestion .spark {
  margin-right: 8px;
  color: var(--cyan-text);
}

/* Empty state */
.empty {
  margin-bottom: 26px;
  padding: 54px 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--card);
  text-align: center;
}

.empty h3 {
  margin-bottom: 9px;
  font-family: var(--serif);
  font-variation-settings: "opsz" 40;
  font-size: 24px;
  font-weight: 400;
}

.empty p {
  max-width: 48ch;
  margin: 0 auto 20px;
  font-size: 13px;
  color: var(--muted);
}

/* Messages */
.messages {
  flex: 1;
  width: 100%;
  max-width: 900px;
}

.msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
}

.msg.user {
  align-items: flex-end;
}

.bubble.user {
  max-width: min(80%, 640px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  background: var(--card-hi);
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* The MUनीम says block: the only ink surface in the product. */
.ai {
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--paper);
}

.ai::after {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57, 182, 216, 0.28), transparent 70%);
  pointer-events: none;
}

.ai-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 13px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.ai-head .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: blink 1.6s infinite;
}

.ai-body {
  position: relative;
  z-index: 1;
  max-width: 92ch;
  font-size: 14px;
  line-height: 1.65;
  color: #e6e1d4;
  overflow-wrap: anywhere;
}

.ai-body p,
.ai-body ul,
.ai-body ol,
.ai-body blockquote,
.ai-body h3 {
  margin-bottom: 10px;
}

.ai-body > :last-child {
  margin-bottom: 0;
}

.ai-body b,
.ai-body strong {
  color: #fff;
  font-weight: 700;
}

.ai-body h3 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 40;
  font-size: 19px;
  font-weight: 400;
  color: #fff;
}

.ai-body ul,
.ai-body ol {
  padding-left: 22px;
}

.ai-body li {
  margin-bottom: 4px;
}

.ai-body blockquote {
  padding-left: 12px;
  border-left: 3px solid rgba(57, 182, 216, 0.6);
  color: #cfc9ba;
}

.ai-body code {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.cite {
  margin-left: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(57, 182, 216, 0.22);
  color: #9adcee;
  font-size: 10px;
  font-weight: 700;
  vertical-align: super;
  cursor: pointer;
}

.cite:hover {
  background: rgba(57, 182, 216, 0.4);
}

.typing {
  display: inline-flex;
  gap: 5px;
  padding: 6px 0 2px;
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e6e1d4;
  animation: pulse 1.2s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

/* Flags: alert rows with a left border and a dot + word rather than colour alone */
.flag {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--muted-2);
  border-radius: 12px;
  background: var(--card);
}

.flag-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.flag-t {
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.flag-t p {
  margin-bottom: 6px;
}

.flag-t > :last-child {
  margin-bottom: 0;
}

.flag-warn {
  border-left-color: var(--orange);
}

.flag-warn .flag-dot {
  background: var(--orange);
}

.flag-bad {
  border-left-color: var(--bad);
}

.flag-bad .flag-dot {
  background: var(--bad);
}

/* Sources */
.sources {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.section-label.small {
  margin: 0;
}

.source {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--cyan);
  border-radius: 12px;
  background: var(--card);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.source.flash {
  border-color: var(--cyan-deep);
  box-shadow: var(--shadow-hover);
}

.source summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  list-style: none;
  cursor: pointer;
}

.source summary::-webkit-details-marker {
  display: none;
}

.source-n {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--cyan-text);
}

.source-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-body {
  padding: 0 14px 12px;
  font-size: 13px;
  color: var(--ink-2);
}

.source-body blockquote {
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 3px solid var(--line);
}

.go {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.go:hover {
  color: var(--cyan-text);
}

/* Composer */
.composer-wrap {
  position: sticky;
  bottom: 0;
  z-index: 10;
  width: 100%;
  max-width: 900px;
  padding: 16px 0 22px;
  background: linear-gradient(180deg, rgba(239, 235, 223, 0), var(--paper) 28%);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-note {
  margin-top: 8px;
}

.note {
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--muted);
}

.composer textarea,
.field input,
.field select,
.field textarea,
.filterbar input,
.filterbar select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 13.5px;
  color: var(--ink);
}

.composer textarea {
  flex: 1;
  max-height: 200px;
  overflow-y: hidden;
  resize: none;
}

.composer textarea:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.filterbar input:focus,
.filterbar select:focus {
  border-color: var(--cyan-deep);
  box-shadow: 0 0 0 1px var(--cyan-deep);
  outline: none;
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Buttons */
.btn-primary {
  padding: 12px 24px;
  border-radius: 100px;
  background: var(--cyan);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--on-cyan);
  text-align: center;
  transition: background 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--cyan-deep);
}

.btn-ghost {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card-hi);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  transition: border-color 0.15s;
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--cyan);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Panels + library */
.panel {
  margin-bottom: 26px;
  padding: 24px 26px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-panel);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.reels-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 40;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.15;
}

.panel-sub {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.add-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field .lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.field textarea {
  resize: vertical;
}

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

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.form-note {
  font-size: 12.5px;
  color: var(--muted);
}

.form-note.good {
  color: var(--good-text);
}

.form-note.bad {
  color: var(--bad-text);
}

.filterbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.filterbar select {
  width: auto;
  max-width: 240px;
  padding: 9px 14px;
  border-radius: 100px;
  font-weight: 600;
}

.filterbar input {
  flex: 1;
  min-width: 160px;
  padding: 9px 14px;
}

.filterbar .reels-clear {
  padding: 9px 14px;
  border-radius: 100px;
  white-space: nowrap;
}

.filterbar .reels-date {
  flex: 0 0 146px;
  min-width: 146px;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card-hi);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.seg button:hover {
  border-color: var(--cyan);
}

.seg button.on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.tbl-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: middle;
}

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

td.name {
  max-width: 360px;
  font-weight: 600;
}

td.name a {
  color: var(--ink);
  text-decoration: none;
}

td.name a:hover {
  color: var(--cyan-text);
}

td.name .clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.name .sub {
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

th.num,
td.num {
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
}

td.act {
  text-align: right;
}

.row-delete {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.row-delete:hover {
  border-color: var(--bad);
  color: var(--bad-text);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Creator dashboard */
.creator-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(19, 117, 139, 0.12), transparent 42%), var(--card-hi);
  box-shadow: 0 18px 42px rgba(27, 24, 18, 0.07);
}

.creator-top h1 {
  margin-top: 8px;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: 0;
}

.creator-top p {
  max-width: 620px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.5;
}

.creator-eyebrow {
  color: var(--cyan-text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.creator-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.76);
}

.creator-controls select {
  min-width: min(320px, 100%);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-hi);
  font-weight: 700;
}

.creator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.creator-card {
  position: relative;
  min-height: 146px;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-hi);
  overflow: hidden;
}

.creator-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--cyan-text);
}

.creator-card:nth-child(2)::before {
  background: var(--yellow);
}

.creator-card:nth-child(3)::before {
  background: #c36f33;
}

.creator-card:nth-child(4)::before {
  background: #1b1812;
}

.creator-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.creator-value {
  margin-top: 8px;
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.creator-card.wide .creator-value {
  font-size: clamp(34px, 4vw, 52px);
}

.creator-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11.5px;
}

.sparkline {
  display: block;
  width: 100%;
  height: 56px;
  margin-top: 16px;
}

.sparkline polyline {
  fill: none;
  stroke: #c7c2b4;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.sparkline circle {
  fill: var(--cyan-text);
}

.creator-latest {
  padding-bottom: 20px;
}

.creator-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(168px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.creator-reel-card {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.68);
  color: var(--ink);
  text-decoration: none;
}

.creator-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-2);
}

.creator-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creator-thumb.empty img {
  display: none;
}

.creator-age {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 4px 8px;
  border-radius: 100px;
  background: rgba(22, 21, 18, 0.78);
  color: var(--paper);
  font-size: 10px;
  font-weight: 800;
}

.creator-reel-title {
  display: -webkit-box;
  margin-top: 10px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.creator-reel-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.creator-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.9fr);
  gap: 16px;
}

.creator-analytics-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seg.mini button {
  padding: 5px 10px;
  font-size: 11px;
}

.creator-chart {
  min-height: 220px;
}

.creator-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.creator-bar {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.bar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-2);
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan-text);
}

.bar-num {
  text-align: right;
  font-weight: 800;
}

.creator-top-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.creator-top-row {
  display: grid;
  grid-template-columns: 22px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border-radius: 8px;
}

.creator-top-row:hover {
  background: var(--paper-2);
}

.creator-top-row .thumb {
  width: 34px;
  height: 48px;
}

.rank {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.top-title {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-views {
  font-size: 12px;
  font-weight: 800;
}

.creator-labels h3 {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 12px;
}

.creator-labels .creator-bars + h3 {
  margin-top: 18px;
}

.creator-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.creator-insight {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--cyan);
  border-radius: 10px;
  background: var(--card-hi);
}

.creator-insight strong {
  display: block;
  margin: 8px 0 4px;
}

.creator-insight p {
  color: var(--muted);
  font-size: 12.5px;
}

.creator-post-table tbody tr {
  cursor: pointer;
}

.creator-post-table {
  table-layout: fixed;
  min-width: 920px;
}

.creator-post-table th:first-child,
.creator-post-table td:first-child {
  width: 48%;
}

.creator-post-table th:nth-child(2),
.creator-post-table th:nth-child(3),
.creator-post-table td:nth-child(2),
.creator-post-table td:nth-child(3) {
  width: 13%;
}

.creator-post-table td {
  height: 78px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.creator-post-table td:nth-child(2),
.creator-post-table td:nth-child(3) {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creator-post-table .reel {
  min-height: 58px;
}

.creator-post-table .thumb {
  width: 40px;
  height: 58px;
}

.creator-post-table tbody tr:hover td {
  background: var(--paper-2);
}

.creator-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.creator-drawer-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(22, 21, 18, 0.45);
}

.creator-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(620px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 30px;
  background: var(--card-hi);
  box-shadow: var(--shadow-popover);
}

.creator-drawer.transcript-modal {
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 46px);
}

.creator-drawer.transcript-modal .creator-drawer-scrim {
  background: rgba(22, 21, 18, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.creator-drawer.transcript-modal .creator-drawer-panel {
  position: relative;
  top: auto;
  right: auto;
  width: min(960px, 94vw);
  height: auto;
  max-height: 88vh;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card-hi);
}

.creator-drawer.transcript-modal .drawer-detail h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

.creator-drawer.transcript-modal .scene-list {
  max-height: min(48vh, 460px);
}

.drawer-x {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 28px;
  color: var(--muted);
}

.drawer-detail h2 {
  padding-right: 34px;
  font-size: 22px;
  line-height: 1.25;
}

.drawer-detail h3 {
  margin: 22px 0 8px;
  font-size: 13px;
}

.drawer-actions {
  margin-top: 12px;
}

.scene-detail {
  min-width: min(100%, 880px);
}

.creator-drawer-panel:has(.scene-detail) {
  width: min(960px, calc(100% - 72px));
  max-width: 960px;
  border-radius: 22px 0 0 22px;
}

.scene-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.scene-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--paper-2);
  color: #8c5b18;
  font-weight: 800;
}

.scene-kicker {
  margin-bottom: 6px;
  color: #8c5b18;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.scene-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 276px;
  gap: 16px;
  align-items: start;
}

.scene-grid.has-visual {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 250px;
}

.taxonomy-panel {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 242, 232, 0.72));
}

.taxonomy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.taxonomy-head h3 {
  margin: 0;
  font-size: 18px;
}

.taxonomy-status {
  flex: none;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.taxonomy-status.ok {
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good-text);
}

.taxonomy-status.review {
  background: #fff3d7;
  color: #8c5b18;
}

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.taxonomy-card {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--card-hi);
}

.taxonomy-card span,
.taxonomy-block h4 {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.taxonomy-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.taxonomy-card p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.taxonomy-blocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.taxonomy-block {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.taxonomy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.taxonomy-chip {
  padding: 7px 9px;
  border: 1px solid #d9d0bd;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 800;
}

.taxonomy-review-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.scene-panel,
.scene-side-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--card-hi);
}

.scene-panel {
  padding: 18px 16px;
}

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

.scene-panel-head h3,
.scene-side-card h3 {
  margin: 0;
  color: #8c5b18;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.scene-note,
.scene-muted {
  color: var(--muted);
  font-size: 12px;
}

.scene-list {
  max-height: min(58vh, 560px);
  overflow-y: auto;
  padding-right: 10px;
}

.scene-item {
  display: grid;
  grid-template-columns: 14px minmax(86px, auto) minmax(0, 1fr);
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.scene-item:last-child {
  border-bottom: 0;
}

.scene-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: #8d6bd1;
  box-shadow: 0 0 0 3px rgba(141, 107, 209, 0.14);
}

.visual-panel .scene-dot {
  background: #2b91a8;
  box-shadow: 0 0 0 3px rgba(43, 145, 168, 0.14);
}

.visual-panel .scene-time {
  color: var(--cyan-text);
}

.scene-time {
  color: #7d5bb8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.scene-item p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.scene-empty,
.scene-caption {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
}

.scene-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scene-side-card {
  padding: 16px;
}

.scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.scene-tag {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 800;
}

.scene-tag.hook {
  background: #eef4ff;
  border-color: #cad9f5;
  color: #43618f;
}

.scene-tag.topic,
.scene-tag.series {
  background: #edf8f2;
  border-color: #c9e9d8;
  color: #367c58;
}

.scene-metric {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.scene-metric:last-child {
  border-bottom: 0;
}

.scene-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.scene-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

/* Channel header on the reels page */
.channel-head {
  margin-bottom: 26px;
}

.channel-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.channel-id h2 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 144;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.channel-head .h-sub {
  margin: 10px 0 20px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.channel-head .h-sub b {
  color: var(--cyan-text);
}

.channel-head .stat-row {
  margin-bottom: 0;
}

/* Reels table */
.search-box {
  width: min(260px, 100%);
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card-hi);
  font-size: 13px;
}

.search-box:focus {
  border-color: var(--cyan-deep);
  box-shadow: 0 0 0 1px var(--cyan-deep);
  outline: none;
}

.reel-table td {
  padding: 10px 12px;
}

.sort-btn {
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.sort-btn:hover,
.sort-btn.on {
  color: var(--ink);
}

.sort-btn:disabled {
  cursor: default;
  color: var(--muted);
}

th.num .sort-btn {
  text-align: right;
}

.taxonomy-col {
  width: 132px;
}

.tax-mini {
  display: inline-flex;
  max-width: 126px;
  padding: 6px 8px;
  border: 1px solid #d9d0bd;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.15;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.tax-mini.review {
  border-color: #efdca4;
  background: #fff3d7;
  color: #8c5b18;
}

.tax-mini.muted {
  color: var(--muted);
}

td.reel-cell {
  max-width: 560px;
}

.reel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.thumb {
  flex: none;
  width: 40px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--paper-2);
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-text {
  min-width: 0;
}

.reel-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

a.reel-title:hover {
  color: var(--cyan-text);
}

.reel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.pill-toggle {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card-hi);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.pill-toggle:hover {
  border-color: var(--cyan);
}

.pill-toggle.on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.read-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan-text);
}

/* A transcript made on this computer's GPU rather than in Colab. */
.local-tag {
  margin-left: 8px;
  vertical-align: 1px;
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good-text);
}

.ollama-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border: 1px solid rgba(127, 96, 205, 0.22);
  background: rgba(127, 96, 205, 0.13);
  color: #6c4fc2;
  font-weight: 800;
}

.analysed-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border: 1px solid color-mix(in srgb, var(--good) 30%, transparent);
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good-text);
  font-weight: 800;
  cursor: pointer;
}

.analysed-tag:hover {
  background: color-mix(in srgb, var(--good) 24%, transparent);
}

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

.reel-table tr:has(+ .transcript-row) td {
  border-bottom-color: transparent;
}

.transcript-row td {
  padding: 0 12px 14px 66px;
}

.transcript-box {
  max-height: 340px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--cyan);
  border-radius: 12px;
  background: var(--card-hi);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.transcript-box.scene-inline {
  max-height: 430px;
  padding: 14px 18px;
}

.transcript-box.scene-inline .scene-list {
  max-height: 350px;
  padding-right: 8px;
}

.transcript-box.scene-inline .scene-item {
  grid-template-columns: 14px 104px minmax(0, 1fr);
  padding: 10px 0;
}

.transcript-box.scene-inline .scene-time {
  font-size: 12px;
}

.transcript-box.scene-inline .scene-item p {
  margin: 0;
  font-size: 13px;
}

.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.transcript-head .read-btn {
  margin-top: 0;
}

.seg {
  display: flex;
  gap: 12px;
  padding: 3px 0;
}

.seg .time {
  flex: none;
  width: 42px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cyan-text);
}

@media (max-width: 760px) {
  .transcript-row td {
    padding-left: 12px;
  }
}

.reels-foot {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.reels-foot:empty {
  display: none;
}

/* Load bar */
.loadbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #39b6d8, #f7d344, #e38330);
  transform-origin: left;
  animation: sweep 0.7s var(--ease) infinite;
}

@keyframes sweep {
  from {
    transform: scaleX(0);
    opacity: 1;
  }
  to {
    transform: scaleX(1);
    opacity: 0.2;
  }
}

/* Rise-in */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rise {
  animation: rise 0.62s var(--ease) both;
}

.stat-row .stat:nth-child(2) {
  animation-delay: 60ms;
}

.stat-row .stat:nth-child(3) {
  animation-delay: 120ms;
}

.stat-row .stat:nth-child(4) {
  animation-delay: 180ms;
}

/* Mobile: glass tab bar + bottom sheet */
.mobnav,
.drawer {
  display: none;
}

@media (max-width: 1080px) {
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .creator-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .creator-card.wide {
    grid-column: 1 / -1;
  }

  .creator-analytics-grid,
  .creator-analytics-grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .mobnav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 80;
    display: flex;
    gap: 2px;
    height: 66px;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(245, 242, 234, 0.32));
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    box-shadow: 0 18px 50px -12px rgba(40, 30, 10, 0.36), 0 2px 8px -2px rgba(40, 30, 10, 0.16), inset 0 1.5px 1px rgba(255, 255, 255, 0.95);
  }

  .mtab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 21px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
    color: var(--ink-2);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
  }

  .mtab svg {
    width: 20px;
    height: 20px;
  }

  .mtab.active {
    background: #fff;
    box-shadow: 0 4px 12px -4px rgba(40, 30, 10, 0.3);
    color: var(--ink);
  }

  .drawer {
    position: fixed;
    inset: 0;
    z-index: 90;
  }

  .drawer:not([hidden]) {
    display: block;
  }

  .drawer-scrim {
    position: absolute;
    inset: 0;
    background: rgba(22, 21, 18, 0.35);
  }

  .drawer-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86vh;
    overflow-y: auto;
    padding: 10px 10px calc(28px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    background: var(--card-hi);
    box-shadow: var(--shadow-popover);
    animation: sheet 0.34s var(--ease);
  }

  .grab {
    width: 40px;
    height: 4px;
    margin: 2px auto 6px;
    border-radius: 4px;
    background: var(--line);
  }

  .composer-wrap {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .library {
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
  }
}

@keyframes sheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@media (max-width: 760px) {
  .sidebar {
    display: none;
  }

  .topbar {
    padding: 12px 18px;
  }

  .content {
    padding: 22px 16px 0;
  }

  .hero {
    margin-bottom: 22px;
  }

  .stat-row {
    gap: 12px;
  }

  .stat {
    padding: 18px 16px;
  }

  .stat .val {
    margin: 14px 0 12px;
    font-size: 32px;
  }

  .ai {
    padding: 20px 18px;
  }

  .panel {
    padding: 20px 18px 22px;
  }

  .creator-top {
    flex-direction: column;
  }

  .creator-grid {
    grid-template-columns: 1fr;
  }

  .creator-strip {
    grid-auto-columns: minmax(132px, 46vw);
  }

  .creator-bar {
    grid-template-columns: 72px minmax(0, 1fr) 48px;
  }

  .creator-drawer-panel {
    padding: 24px 18px;
  }

  .creator-drawer-panel:has(.scene-detail) {
    width: 100%;
    border-radius: 0;
  }

  .scene-head,
  .scene-grid {
    grid-template-columns: 1fr;
  }

  .taxonomy-grid,
  .taxonomy-blocks {
    grid-template-columns: 1fr;
  }

  .scene-avatar {
    display: none;
  }

  .scene-item {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .scene-time {
    grid-column: 2;
  }

  .scene-item p {
    grid-column: 2;
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .col-sm {
    display: none;
  }

  .taxonomy-col {
    display: none;
  }

  .bubble.user {
    max-width: 92%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- windsor (testing page) ---------- */
.windsor-view .wrap { padding: 28px 32px 48px; max-width: 1200px; }
.windsor-bar { display: flex; gap: 10px; margin: 16px 0 20px; }
.windsor-bar select, .windsor-bar .btn { font: inherit; font-size: 12.5px; padding: 7px 12px; border: 1px solid var(--line, #ded7c5); border-radius: 8px; background: var(--card-hi, #fbf9f3); color: inherit; cursor: pointer; }
.windsor-card { background: var(--card, #f5f2ea); border: 1px solid var(--line, #ded7c5); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.windsor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.windsor-head h3 { margin: 0; font-size: 14px; }
.windsor-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.windsor-table th { text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #8e887a); padding: 6px 10px; border-bottom: 1px solid var(--line, #ded7c5); white-space: nowrap; }
.windsor-table td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft, #e7e1d2); white-space: nowrap; }
.windsor-error { color: #c9533b; font-size: 12.5px; margin: 4px 0; }
.windsor-note { color: var(--muted, #8e887a); font-size: 11.5px; margin: 4px 0 8px; }
.windsor-bar { flex-wrap: wrap; }
.windsor-more { margin: 4px 0 16px; }
.windsor-more .btn { font: inherit; font-size: 12.5px; padding: 7px 12px; border: 1px solid var(--line, #ded7c5); border-radius: 8px; background: var(--card-hi, #fbf9f3); cursor: pointer; }
.windsor-totals { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.windsor-stat { background: var(--card, #f5f2ea); border: 1px solid var(--line, #ded7c5); border-radius: 10px; padding: 10px 16px; min-width: 96px; }
.windsor-stat b { display: block; font-size: 18px; }
.windsor-stat span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #8e887a); }
.windsor-table td.windsor-caption { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.windsor-table td, .windsor-table th { text-align: right; }
.windsor-table td:nth-child(-n+3), .windsor-table th:nth-child(-n+3) { text-align: left; }

/* Chat chart */
.chat-chart {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--card-hi);
}

.chat-chart-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(90px, 170px) 1fr 52px 46px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}

.chart-label {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  height: 12px;
  background: var(--paper-2);
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  background: var(--cyan-deep);
  border-radius: 6px;
}

.chart-value {
  font-weight: 600;
  text-align: right;
}

.chart-n,
.chart-note {
  color: var(--muted);
  font-size: 11px;
}

.chart-note {
  margin-top: 8px;
}

.cpv-overview { margin: 0 0 18px; padding: 18px 26px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(135deg, rgba(57, 182, 216, 0.12), rgba(247, 211, 68, 0.12) 46%, rgba(255, 250, 242, 0.92)); box-shadow: var(--shadow-panel); }
.period-filter { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 14px; padding: 14px 26px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 250, 242, 0.86); box-shadow: 0 16px 40px -34px rgba(42, 35, 20, 0.62); }
.period-sub { margin-top: 5px; color: var(--muted); font-size: 13px; font-weight: 650; }
.period-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.period-controls select,
.period-controls input { height: 42px; min-width: 150px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-hi); color: var(--ink); padding: 0 14px; font: inherit; font-weight: 700; }
.period-controls input { min-width: 142px; }
.cpv-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.cpv-tiles { display: grid; grid-template-columns: repeat(4, minmax(108px, 1fr)); gap: 12px; flex: 1; max-width: 760px; }
.cpv-tile { display: flex; flex-direction: column; justify-content: center; min-height: 78px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-hi); box-shadow: 0 14px 34px -28px rgba(60, 45, 15, 0.55); }
.cpv-tile b { margin-top: 5px; color: var(--ink); font-size: clamp(20px, 2vw, 30px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cpv-label { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cpv-months { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.cpv-chip { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line, #ded7c5); background: rgba(255, 250, 242, 0.8); font-variant-numeric: tabular-nums; }
.cpv-chip em { font-style: normal; opacity: 0.6; margin-right: 6px; }
.cpv-chip.empty { opacity: 0.5; }
@media (max-width: 980px) { .cpv-overview-head { align-items: stretch; flex-direction: column; } .cpv-tiles { max-width: none; } }
@media (max-width: 640px) { .cpv-overview { padding: 18px 16px; } .cpv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cpv-tile b { font-size: 20px; } }

@media (max-width: 560px) {
  .chart-row {
    grid-template-columns: minmax(70px, 110px) 1fr 46px;
  }

  .chart-n {
    display: none;
  }
}


.month-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.month-tile {
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--card-hi);
}

.month-tile-label {
  color: var(--muted);
  font-size: 12px;
}

.month-tile-value {
  margin: 4px 0 2px;
  font-size: 22px;
  font-weight: 600;
}

.month-tile-delta {
  font-size: 12.5px;
  font-weight: 600;
}

.month-tile-delta.down {
  color: #e5675d;
}

.month-tile-delta.up {
  color: #3fb27f;
}

.month-tile-delta.flat {
  color: var(--muted);
}

.month-tile-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}

.creator-insight.warn {
  border-left-color: #e5675d;
}

.creator-insight.good {
  border-left-color: #3fb27f;
}

.month-note {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.range-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.range-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.range-dash {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

.range-confidence {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card-hi);
  border: 1px solid var(--line-soft);
  font-size: 12px;
}

.range-confidence.low {
  color: #e5675d;
}

.range-confidence.medium {
  color: #c98a1c;
}

.range-confidence.good {
  color: #3fb27f;
}
