:root {
  --ink: #17181b;
  --muted: #71747a;
  --line: #e1e2e4;
  --gold: #b78a42;
  --white: #fff;
  --glass: rgba(255, 255, 255, 0.78);
  --side: #111319;
  --shadow: 0 10px 35px #1318200a;
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #f2f2f3;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
}

button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

svg.ui-icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  padding: 12px;
  gap: 12px;
  background: radial-gradient(ellipse at 85% 0, #fff 0, transparent 45%), linear-gradient(145deg, #e2e3e5, #f8f8f8 54%, #d8dadd);
}

/* OBSIDIAN SIDEBAR */
.sidebar {
  background: linear-gradient(150deg, #090d1b 0, #17181c 48%, #202124);
  border: 1px solid #41434a;
  color: #e5e5e7;
  border-radius: 23px;
  display: flex;
  flex-direction: column;
  padding: 15px 13px;
  min-height: 0;
  box-shadow: 0 14px 32px #0002;
  overflow: hidden;
}

.brand {
  padding: 5px 0 15px;
  display: block;
}

.brand img {
  display: block;
  width: 100%;
  border-radius: 12px;
}

.new {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  background: #fafafa;
  color: #15161a;
  font-weight: 650;
  box-shadow: 0 3px 16px #fff1;
  transition: transform 0.14s ease, background 0.14s ease;
}

.new:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.navtitle {
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #9b9da5;
  margin: 22px 10px 9px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  width: 100%;
  padding: 10px 11px;
  border-radius: 10px;
  color: #c9cbd0;
  transition: 0.15s;
}

.nav:hover, .nav.active {
  background: #ffffff15;
  color: white;
}

.nav.active {
  box-shadow: inset 0 0 0 1px #ffffff17;
}

.nav.active:after {
  content: '';
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: #d3ad65;
  margin-left: auto;
}

.history {
  overflow: auto;
  min-height: 30px;
  flex: 1;
}

.history .nav {
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
}

.history .nav.current {
  background: #ffffff17;
  color: white;
}

.sidefoot {
  margin-top: 12px;
  border-top: 1px solid #ffffff20;
  padding-top: 9px;
}

.sidefoot small {
  display: block;
  color: #9699a1;
  font-size: 11px;
  padding: 4px 11px;
}

/* MAIN LIGHT GLASS PANEL */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #ffffffb0;
  border-radius: 23px;
  overflow: hidden;
  background: linear-gradient(130deg, #ffffffaa, #ffffff55);
  box-shadow: var(--shadow);
  position: relative;
}

.main.dragover::after {
  content: 'Drop CSV, TSV, Excel or Word (.docx) files to attach to KaiRO';
  position: absolute;
  inset: 14px;
  border: 2px dashed var(--gold);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  color: var(--ink);
  z-index: 20;
  pointer-events: none;
}

.top {
  height: 65px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  border-bottom: 1px solid #e2e3e6;
  background: #ffffff80;
  backdrop-filter: blur(20px);
}

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

.top strong {
  font-size: 15px;
}

.top small {
  font-size: 11px;
  color: var(--muted);
}

.mode-select {
  border: 1px solid var(--line);
  background: #fff9;
  border-radius: 10px;
  padding: 7px 10px;
  color: #333;
  max-width: 155px;
}

.api-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #ffffffc8;
  border-radius: 99px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.api-pill:hover {
  background: #ffffff;
}

.api-pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.api-pill.ready .pill-dot {
  background: #16a34a;
}

.api-pill.missing {
  border-color: rgba(183, 138, 66, 0.45);
  background: rgba(183, 138, 66, 0.08);
  color: #7c5c26;
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #ffffffb0;
  border-radius: 11px;
}

.iconbtn:hover {
  background: white;
}

.avatar {
  background: #17191e;
  color: white;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 11px;
  letter-spacing: 0.7px;
  flex-shrink: 0;
}

.content {
  display: flex;
  flex: 1;
  min-height: 0;
}

.center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  position: relative;
}

.scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  scroll-behavior: smooth;
}

/* WELCOME HERO */
.welcome {
  max-width: 900px;
  margin: auto;
  padding: clamp(28px, 6vh, 66px) 34px 22px;
  text-align: center;
}

.heroicon {
  width: 83px;
  height: 83px;
  display: block;
  margin: 0 auto 19px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 8px 20px #080b2024;
  border: 1px solid #c0a16a55;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #8f713f;
  font-weight: 650;
}

.welcome h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(36px, 4vw, 59px);
  letter-spacing: -2.7px;
  margin: 12px 0 10px;
  line-height: 1.1;
}

.welcome h1 em {
  font-style: normal;
  color: #a47b38;
}

.welcome p {
  color: #696c73;
  font-size: 15px;
  line-height: 1.65;
  margin: 0 auto;
  max-width: 530px;
}

.capgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-top: 32px;
  text-align: left;
}

.cap {
  background: linear-gradient(145deg, #fff, #f4f4f5aa);
  border: 1px solid #ffffff;
  border-radius: 17px;
  box-shadow: 0 3px 13px #00000009, inset 0 0 0 1px #e0e1e580;
  padding: 17px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  text-align: left;
  transition: 0.18s;
  min-width: 0;
}

.cap:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px #00000012;
}

.cap.dark {
  background: linear-gradient(140deg, #1f2025, #34363a);
  color: #fff;
  border-color: #3b3e43;
  box-shadow: 0 8px 17px #0002;
}

.cap.dark small {
  color: #c7c8cc;
}

.capicon {
  display: grid;
  place-items: center;
  background: #eaeaec;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.dark .capicon {
  background: #ffffff18;
  color: #e1be7b;
}

.cap strong {
  display: block;
  font-weight: 650;
  margin: 2px 0 5px;
}

.cap small {
  display: block;
  color: #73767c;
  font-size: 12px;
  line-height: 1.45;
}

.cap .arr {
  margin-left: auto;
  width: 15px;
  opacity: 0.6;
}

.try {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.chip {
  font-size: 11px;
  background: #ffffff8c;
  border: 1px solid #dedfe1;
  border-radius: 99px;
  padding: 8px 12px;
  color: #555960;
}

.chip:hover {
  background: #fff;
  color: #111;
}

/* COMPOSER */
.composer-wrap {
  padding: 10px 26px 13px;
  flex-shrink: 0;
  background: linear-gradient(transparent, #f5f5f6 38%);
}

.composer {
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid #d7d8db;
  background: #fff;
  border-radius: 21px;
  box-shadow: 0 10px 30px #14181d0b;
  padding: 12px 13px 10px;
}

.composer:focus-within {
  border-color: #c5b393;
  box-shadow: 0 10px 30px rgba(183, 138, 66, 0.12);
}

.composer textarea {
  border: none;
  resize: none;
  width: 100%;
  min-height: 52px;
  max-height: 135px;
  outline: none !important;
  padding: 5px 7px;
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  color: #18191b;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}

.composer-tools .tool {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  color: #666a70;
  font-size: 12px;
  border-radius: 9px;
}

.tool:hover {
  background: #eee;
  color: var(--ink);
}

.style-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #ececef;
  border: 1px solid #dcdcde;
  border-radius: 12px;
  padding: 3px;
}

.style-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 550;
  color: #5b5f66;
  transition: all 0.16s ease;
}

.style-opt svg {
  width: 13px;
  height: 13px;
}

.style-opt:hover {
  color: var(--ink);
}

.style-opt[data-style="boardroom"].active {
  background: #17181d;
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(15, 16, 20, 0.2);
}

.style-opt[data-style="fable"].active {
  background: linear-gradient(135deg, #b58d46, #8f6b2f);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(164, 123, 56, 0.35);
}

.send {
  background: #15161a;
  color: white;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.send:hover:not(:disabled) {
  background: #2b2d34;
}

.send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint {
  text-align: center;
  color: #83868c;
  font-size: 10px;
  margin-top: 9px;
}

.attached-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 4px 8px;
}

.attach {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  padding: 6px 9px;
  background: #f1f1f2;
  border: 1px solid #e4e5e7;
  max-width: 100%;
  font-size: 12px;
  cursor: pointer;
}

.attach:hover {
  background: #e9eaec;
}

.attach span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.attach button {
  padding: 2px;
  display: inline-flex;
  border-radius: 5px;
}

.attach button:hover {
  background: rgba(0, 0, 0, 0.08);
}

.attach button svg {
  width: 14px;
  height: 14px;
}

/* MESSAGES STREAM */
.messages {
  max-width: 900px;
  margin: auto;
  padding: 28px 34px 8px;
}

.message {
  margin: 0 0 25px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 85%;
  padding: 12px 16px;
  background: #e8e9eb;
  border-radius: 17px 17px 4px 17px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.assistant-avatar {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #c0a16a44;
}

.answer {
  flex: 1;
  min-width: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.answer .kairo-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-weight: 650;
}

.kairo-tag {
  color: #9a7b43;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kairo-tag.boardroom {
  background: #17181d;
  color: #f3f4f6;
  padding: 2px 7px;
  border-radius: 999px;
}

.kairo-tag.fable {
  background: #f5ebd8;
  color: #8f6b2f;
  border: 1px solid #d8be8a;
  padding: 2px 7px;
  border-radius: 999px;
}

.answer .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #6a6d73;
  font-size: 11px;
  margin-top: 12px;
}

.answer .actions button {
  font-size: 11px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 7px;
  padding: 5px 9px;
}

.answer .actions button:hover {
  background: #f5f5f5;
}

/* MARKDOWN INSIDE ANSWERS */
.markdown-body p {
  margin: 0 0 11px;
}

.markdown-body ul, .markdown-body ol {
  margin: 6px 0 12px 20px;
}

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

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  margin: 16px 0 8px;
}

.markdown-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: #f0f0f2;
  padding: 2px 5px;
  border-radius: 5px;
}

.markdown-body pre code {
  display: block;
  padding: 12px;
  overflow-x: auto;
  background: #17181b;
  color: #e5e7eb;
  border-radius: 10px;
}

/* TOOL TRACE ACCORDION */
.trace-box {
  background: #ffffffd4;
  border: 1px solid var(--line);
  border-radius: 13px;
  margin: 0 0 12px;
  overflow: hidden;
}

.trace-box summary {
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 500;
  color: #5c5f66;
  cursor: pointer;
  user-select: none;
  background: #f7f7f8;
}

.trace-box summary:hover {
  color: var(--ink);
}

.trace-steps {
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trace-step-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #8f713f;
  margin-bottom: 4px;
}

.trace-code {
  margin: 0;
  background: #f4f4f6;
  border: 1px solid #e4e5e8;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #17181b;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ANALYSIS CARD, STATGRID, TABLES & CHARTS */
.analysis-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 16px;
  margin: 12px 0;
  overflow: auto;
  box-shadow: var(--shadow);
}

.chart-plot {
  width: 100%;
  height: 380px;
}

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

.stat {
  background: #f5f5f5;
  border-radius: 10px;
  padding: 10px;
}

.stat b {
  display: block;
  font-size: 20px;
}

.stat small {
  color: #666;
  font-size: 11px;
}

/* FABLE STAGE (INTERACTIVE & STATIC STORY ANIMATION) */
.fable-stage {
  background: linear-gradient(155deg, #121319 0%, #1c1e26 100%);
  color: #f3f4f6;
  border: 1px solid #2c2f3a;
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0 6px;
  box-shadow: 0 12px 30px rgba(10, 12, 20, 0.22);
}

.fable-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.fable-kicker {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d6b26f;
  margin-bottom: 4px;
}

.fable-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 19px;
  font-weight: 400;
  margin: 0 0 2px;
  color: #ffffff;
}

.fable-sub {
  font-size: 12px;
  color: #9ca3af;
}

.fable-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.fable-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 500;
  background: #232631;
  color: #e5e7eb;
  border: 1px solid #343847;
  transition: background 0.15s, border-color 0.15s;
}

.fable-btn svg {
  width: 12px;
  height: 12px;
}

.fable-btn:hover {
  background: #2e3240;
  border-color: #4b5063;
}

.fable-btn.primary {
  background: linear-gradient(135deg, #c0964c, #997232);
  color: #ffffff;
  border-color: transparent;
}

.fable-btn.active-mode {
  background: #d6b26f22;
  color: #e8cb92;
  border-color: #c0964c88;
}

.fable-rail {
  height: 4px;
  background: #262934;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.fable-rail-fill {
  height: 100%;
  background: linear-gradient(90deg, #a47b38, #e6c47e);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.fable-spotlight {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(214, 178, 111, 0.25);
  border-radius: 14px;
  padding: 13px 15px;
  margin-bottom: 14px;
  animation: fableFadeUp 0.42s ease;
}

.fable-stage.is-static .fable-spotlight,
.fable-stage.is-static .fable-bar-fill,
.fable-stage.is-static .fable-flow-card,
.fable-stage.is-static .fable-svg-path {
  animation: none !important;
  transition: none !important;
}

.fable-act-pill {
  font-size: 10.5px;
  font-weight: 600;
  color: #e6c47e;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.fable-act-headline {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  color: #ffffff;
  margin-bottom: 3px;
}

.fable-act-text {
  font-size: 12.5px;
  color: #c7ccd6;
  line-height: 1.5;
  max-width: 560px;
}

.fable-metric-badge {
  text-align: right;
  background: rgba(164, 123, 56, 0.14);
  border: 1px solid rgba(214, 178, 111, 0.35);
  border-radius: 12px;
  padding: 9px 13px;
  min-width: 118px;
}

.fable-metric-badge small {
  display: block;
  font-size: 10px;
  color: #d6b26f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fable-metric-badge strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  color: #ffffff;
}

/* Race Bars Visual */
.fable-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fable-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 90px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  opacity: 0.56;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fable-bar-row.lit {
  opacity: 1;
}

.fable-bar-label {
  color: #e5e7eb;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fable-bar-track {
  height: 12px;
  background: #232632;
  border-radius: 999px;
  overflow: hidden;
}

.fable-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4b5563, #6b7280);
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s ease;
}

.fable-bar-row.lit .fable-bar-fill {
  background: linear-gradient(90deg, #a47b38, #e6c47e);
  box-shadow: 0 0 12px rgba(214, 178, 111, 0.35);
}

.fable-bar-val {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #e5e7eb;
}

.fable-bar-detail {
  grid-column: 2 / -1;
  font-size: 11px;
  color: #9ca3af;
  margin-top: -4px;
}

/* Journey Line SVG Visual */
.fable-journey-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Spotlight Flow Grid */
.fable-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.fable-flow-card {
  background: #1b1e28;
  border: 1px solid #2d3140;
  border-radius: 12px;
  padding: 11px 12px;
  opacity: 0.62;
  transition: transform 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

.fable-flow-card.lit {
  opacity: 1;
  border-color: #d6b26f;
  background: linear-gradient(160deg, #222532, #1c1f2a);
  transform: translateY(-2px);
}

.fable-flow-card small {
  display: block;
  color: #9ca3af;
  font-size: 11px;
  margin-bottom: 4px;
}

.fable-flow-card strong {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  color: #fff;
  margin-bottom: 4px;
}

.fable-flow-card span {
  display: block;
  font-size: 11px;
  color: #cbd5e1;
}

/* Act Pills Navigation */
.fable-acts-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #282b36;
}

.fable-act-btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: #9ca3af;
  background: #1d2029;
  border: 1px solid #2d3140;
  transition: all 0.15s ease;
}

.fable-act-btn:hover {
  color: #ffffff;
  border-color: #4b5063;
}

.fable-act-btn.active {
  background: rgba(214, 178, 111, 0.18);
  color: #f3d79b;
  border-color: #c0964c;
}

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

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
  margin: 8px 0;
}

th, td {
  border-bottom: 1px solid #e7e7e7;
  padding: 7px 8px;
  white-space: nowrap;
}

th {
  color: #777;
  font-weight: 500;
}

td {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* RIGHT INSPECTOR */
.inspector {
  width: 290px;
  background: #ffffff85;
  border-left: 1px solid var(--line);
  padding: 20px 15px;
  overflow: auto;
  flex-shrink: 0;
}

.inspector h3 {
  font-size: 13px;
  margin: 0 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inspector h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #82848a;
  margin: 21px 0 10px;
}

.panelcard {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 13px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.panelcard.clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.panelcard.clickable:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.panelcard p {
  font-size: 12px;
  color: #73767b;
  margin: 4px 0 0;
}

.panel-badge {
  float: right;
  font-size: 10px;
  font-weight: 600;
  color: #8f713f;
  background: rgba(183, 138, 66, 0.12);
  padding: 2px 7px;
  border-radius: 99px;
}

.panel-action-btn {
  margin-top: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9px;
  background: #15161a;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.panel-action-btn:hover {
  background: #2b2d34;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #555;
}

.dot {
  width: 7px;
  height: 7px;
  background: #b78a42;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.ready {
  background: #16a34a;
}

/* THINKING ANIMATION */
.thinking-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #5c5f66;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 14px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(183, 138, 66, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* MODALS */
.modalback {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #10121866;
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}

.modal {
  width: min(490px, 100%);
  background: #fff;
  border-radius: 23px;
  padding: 25px;
  box-shadow: 0 20px 70px #0003;
}

.modal-wide {
  width: min(820px, 100%);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
}

.preview-scroll {
  overflow-y: auto;
  margin-top: 8px;
}

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

.modal h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 26px;
}

.modal p {
  color: #62666d;
  line-height: 1.6;
  margin: 0 0 14px;
}

.modal a {
  color: #8f713f;
  font-weight: 600;
}

.modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #62666d;
  margin-top: 10px;
}

.modal input, .modal-select {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 11px;
  margin: 6px 0 8px;
  background: #fafafa;
}

.modal-error {
  color: #b91c1c !important;
  font-size: 12px;
  margin: 4px 0 8px !important;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.modal-footer-right {
  display: flex;
  gap: 8px;
}

.modal-btn {
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 550;
}

.modal-btn.primary {
  background: #17191c;
  color: #fff;
}

.modal-btn.primary:hover {
  background: #2b2d34;
}

.modal-btn.secondary {
  background: #eee;
  color: #333;
}

.modal-btn.secondary:hover {
  background: #e2e2e4;
}

.toast {
  position: fixed;
  top: 74px;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  pointer-events: none;
  background: #17191c;
  color: white;
  border-radius: 10px;
  padding: 10px 16px;
  z-index: 60;
  box-shadow: 0 8px 30px #0003;
  font-size: 13px;
}

.mobilemenu {
  display: none;
}

@media (max-width: 1150px) {
  .inspector {
    width: 245px;
  }
  .welcome {
    padding-left: 22px;
    padding-right: 22px;
  }
  .shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .inspector {
    position: absolute;
    right: 0;
    top: 65px;
    bottom: 0;
    z-index: 3;
    box-shadow: -10px 0 30px #0001;
    background: #fafafa;
    width: min(300px, 90%);
  }
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
    padding: 7px;
    gap: 7px;
  }
  .top {
    padding: 0 14px;
  }
  .top small {
    display: none;
  }
  .capgrid {
    gap: 8px;
  }
  .cap {
    padding: 12px;
  }
  .capicon {
    width: 32px;
    height: 32px;
  }
  .composer-wrap {
    padding: 10px 15px;
  }
}

@media (max-width: 650px) {
  .shell {
    display: block;
    padding: 0;
  }
  .main {
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 254px;
    z-index: 40;
    border-radius: 0 20px 20px 0;
    display: none;
  }
  .sidebar.open {
    display: flex;
  }
  .mobilemenu {
    display: grid;
  }
  .top {
    height: 58px;
  }
  .mode-select {
    max-width: 110px;
  }
  .api-pill span:last-child {
    display: none;
  }
  .top-left, .top-right {
    gap: 6px;
  }
  .welcome {
    padding: 30px 16px 14px;
  }
  .welcome h1 {
    letter-spacing: -1.4px;
  }
  .capgrid {
    margin-top: 23px;
  }
  .cap {
    gap: 8px;
  }
  .cap .arr {
    display: none;
  }
  .cap small {
    font-size: 11px;
  }
  .heroicon {
    width: 65px;
    height: 65px;
  }
  .messages {
    padding: 20px 13px;
  }
  .composer-tools .tool span {
    display: none;
  }
  .style-opt {
    padding: 6px 8px;
    font-size: 11px;
  }
  .fable-bar-row {
    grid-template-columns: 96px 1fr 72px;
  }
  .inspector {
    top: 58px;
  }
  .statgrid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* LOGIN GATE */
body.auth-locked .shell {
  filter: blur(7px);
  pointer-events: none;
  user-select: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 30% 20%, rgba(164, 123, 56, 0.16), transparent 55%),
    rgba(11, 13, 21, 0.72);
  backdrop-filter: blur(8px);
}

.auth-card {
  width: min(410px, 100%);
  background: linear-gradient(160deg, #ffffff, #f6f6f8);
  border: 1px solid #d9dbe0;
  border-radius: 22px;
  padding: 30px 28px 26px;
  box-shadow: 0 24px 60px rgba(8, 10, 20, 0.35);
  text-align: left;
}

.auth-card img {
  width: 62px;
  height: 62px;
  border-radius: 17px;
  object-fit: cover;
  display: block;
  margin: 0 auto 12px;
  border: 1px solid #c0a16a66;
  box-shadow: 0 8px 20px rgba(10, 12, 24, 0.18);
}

.auth-eyebrow {
  text-align: center;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8f713f;
  margin-bottom: 4px;
}

.auth-card h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: 27px;
  text-align: center;
  margin: 0 0 4px;
  color: #14151a;
}

.auth-sub {
  text-align: center;
  color: #6b6e75;
  font-size: 13px;
  margin: 0 0 20px;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #2f3238;
  margin: 10px 0 5px;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d5d7dc;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #15161a;
}

.auth-input:focus {
  outline: 2px solid rgba(164, 123, 56, 0.35);
  border-color: #a47b38;
}

.auth-submit {
  width: 100%;
  margin-top: 16px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #17181d, #2d2f38);
  box-shadow: 0 6px 18px rgba(16, 18, 28, 0.24);
  transition: transform 0.12s ease, background 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #b58d46, #8f6b2f);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}
