/* Valeo Lab : shared demo application shell
   Layout: left rail / top bar / center workspace / right chat sidebar */

/* Neutral UI typeface: Arial system stack */

:root {
  --fm-indigo: #171c8f;
  --fm-true-blue: #0072ce;
  --fm-dark-space: #25282a;
  --fm-outer-space: #464b4b;
  --fm-deep-smoke: #727578;
  --fm-smoke: #b1b3b3;
  --fm-white-smoke: #f4f4f4;
  --fm-indigo-tint: #eef0fb;
  --ok: #1a7a64;
  --warn: #9a6700;
  --bad: #b3261e;
  --rail-w: 56px;
  --top-h: 32px;
  --chat-w: 400px;
  --border: #e6e8ec;
  --border-soft: #eef0f2;
  --muted: #8a8f98;
  --radius: 0;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #f7f8f9;
  color: var(--fm-dark-space);
  overflow: hidden;
}

/* ── App shell ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.65rem 0;
  z-index: 70;
}

.rail-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 0.75rem;
  
  text-decoration: none;
}
.rail-logo:hover { background: #f3f4f6; }
.rail-logo img {
  width: 23px;
  height: 23px;
  object-fit: contain;
  border-radius: 0;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
}

.rail-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  width: 100%;
}

.rail-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.rail-item:hover { background: #f3f4f6; color: var(--fm-dark-space); }
.rail-item.active {
  background: var(--fm-indigo-tint);
  color: var(--fm-indigo);
}
.rail-item i,
.rail-item svg { width: 17px; height: 17px; stroke-width: 1.75; }

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-right: var(--chat-w);
}

/* ── Deck menubar (TPO office suite style) ───────────────── */
.app-top {
  flex-shrink: 0;
  height: var(--top-h);
  z-index: 60;
}

.deck-menubar {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0 8px;
  gap: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  color: #2d2d2d;
  background: #f3f3f3;
  border-bottom: 1px solid #d0d0d0;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.deck-menubar-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.deck-menubar-dropdown {
  position: relative;
  flex: 0 0 auto;
}

.deck-dropdown-menu {
  left: 0;
  right: auto;
  min-width: 180px;
}

.deck-dropdown-separator {
  height: 1px;
  background: #e0e0e0;
  margin: 3px 0;
}

.deck-menubar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  border: none;
  background: transparent;
  color: #2d2d2d;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  flex-shrink: 0;
  line-height: 1;
  box-sizing: border-box;
}

.deck-menubar-item:hover {
  background: #e5e5e5;
  color: #1a1a1a;
}

.deck-menubar-item:focus-visible {
  outline: 2px solid var(--fm-indigo);
  outline-offset: -2px;
}

.deck-menubar-separator {
  width: 1px;
  height: 18px;
  background: #d0d0d0;
  margin: 0 4px;
  flex-shrink: 0;
}

.deck-menubar-chevron {
  font-size: 10px;
  color: var(--fm-outer-space);
}

.deck-menubar-context {
  display: inline-block;
  max-width: min(42vw, 520px);
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fm-outer-space);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.deck-menubar-action {
  color: var(--fm-indigo);
  font-weight: 600;
}

.deck-menubar-action:hover {
  background: var(--fm-indigo-tint);
  color: var(--fm-indigo);
}

.deck-export-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #b1b3b3;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 85;
}

.deck-export-menu.is-open {
  display: block;
}

.deck-export-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: #2d2d2d;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.deck-export-menu-item:hover:not(:disabled) {
  background: var(--fm-indigo-tint);
  color: var(--fm-indigo);
}

@media (max-width: 720px) {
  .deck-menubar-context {
    max-width: 28vw;
  }

  .deck-menubar-action {
    padding: 0 8px;
    font-size: 11px;
  }

  .deck-menubar-item {
    padding: 0 8px;
  }
}

.demo-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  padding: 0.55rem 1rem;
  background: var(--fm-dark-space);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: min(92vw, 28rem);
  text-align: center;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.demo-toast.show {
  opacity: 1;
}

/* ── Workspace (center) ──────────────────────────────────── */
.workspace {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.6rem 3rem;
}

.ws-head { margin-bottom: 1.25rem; }
.ws-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--fm-dark-space);
  letter-spacing: -0.01em;
}
.ws-head p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 62rem;
  line-height: 1.6;
}
.ws-head p strong { color: var(--fm-outer-space); font-weight: 600; }

/* KPI cards : label on top (small caps), value below */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0 1.4rem;
}
.kpi {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.45rem;
  background: #fff;
  border: 1px solid var(--border);
  
  padding: 0.95rem 1.05rem;
  box-shadow: var(--card-shadow);
}
.kpi .v {
  font-size: clamp(1.05rem, 1.35vw, 1.4rem);
  font-weight: 600;
  color: var(--fm-dark-space);
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.kpi .l {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.35;
}
.kpi.green .v { color: var(--fm-true-blue); }
.kpi.warn .v { color: var(--warn); }
.kpi.bad .v { color: var(--bad); }

/* Cards & panels */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  
  box-shadow: var(--card-shadow);
  margin-bottom: 1.2rem;
  overflow: hidden;
}
.panel > .panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--border-soft);
}
.panel > .panel-head h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fm-dark-space);
}
.panel > .panel-head .hint { font-size: 0.73rem; color: var(--muted); margin-left: auto; text-align: right; }
.panel > .panel-head i { color: var(--fm-indigo) !important; }
.panel > .panel-body { padding: 1.1rem; }
.panel > .panel-body.tight { padding: 0; }

/* Tabs : pill style, active = solid FM indigo */
.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
  overflow-x: auto;
}
.tab {
  padding: 0.34rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fm-outer-space);
  background: none;
  border: none;
  
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: var(--fm-indigo); color: #fff; font-weight: 600; }

/* Data tables */
.tbl-wrap { overflow-x: auto; }
table.data {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.78rem;
}
table.data th {
  background: #fafbfb;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td {
  padding: 0.48rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  color: var(--fm-dark-space);
}
table.data tr:hover td { background: #fafbfb; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.subtotal td { background: #f6f7f8; font-weight: 600; }
table.data tr.section td {
  background: var(--fm-indigo-tint);
  color: var(--fm-indigo);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.data tr.muted td { color: var(--fm-smoke); }

/* Workbook sheets (rappro / fable5) : label column keeps a readable width */
table#sheet td:first-child { min-width: 230px; }

.xref {
  color: var(--fm-true-blue);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.xref:hover { color: var(--fm-dark-space); }

.pill {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  
  white-space: nowrap;
}
.pill.ok   { background: var(--fm-indigo-tint); color: var(--fm-indigo); }
.pill.warn { background: #fdf5e6; color: var(--warn); }
.pill.bad  { background: #fdeceb; color: var(--bad); }
.pill.info { background: #eef1f7; color: var(--fm-outer-space); }
.pill.mut  { background: #f2f3f4; color: var(--muted); }

/* Heat bars */
.heat {
  position: relative;
  background: #eef0f2;
  height: 8px;
  min-width: 70px;
  
  overflow: hidden;
}
.heat > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--fm-true-blue), var(--fm-indigo));
  
}
.heat.red > span { background: linear-gradient(90deg, #e7a33e, var(--bad)); }

/* Evidence viewer (modal) */
.evidence-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 90;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.evidence-overlay.open { display: flex; }
.evidence-box {
  background: #fff;
  
  max-width: min(880px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.3);
}
.evidence-box .ev-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.evidence-box .ev-head h3 { margin: 0; font-size: 0.9rem; color: var(--fm-dark-space); flex: 1; }
.evidence-box .ev-head button {
  background: none; border: none; cursor: pointer;
  color: var(--fm-deep-smoke); font-size: 1.1rem; line-height: 1;
}
.evidence-box .ev-body { overflow: auto; padding: 1rem; text-align: center; }
.evidence-box .ev-body img { max-width: 100%; border: 1px solid var(--border); }
.evidence-box .ev-cap { padding: 0 1rem 0.9rem; font-size: 0.78rem; color: var(--fm-deep-smoke); }

/* Timeline (Fable 5 replay) */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: #dce0f0;
}
.tl-item { position: relative; padding: 0 0 1.05rem 0.6rem; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -1.6rem; top: 4px;
  width: 12px; height: 12px;
  
  background: #fff;
  border: 3px solid var(--fm-indigo);
}
.tl-item.done::before { background: var(--fm-indigo); }
.tl-item .tl-time {
  font-size: 0.68rem;
  color: var(--fm-deep-smoke);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tl-item h4 { margin: 0.1rem 0 0.25rem; font-size: 0.88rem; color: var(--fm-dark-space); }
.tl-item p { margin: 0; font-size: 0.8rem; color: var(--fm-deep-smoke); line-height: 1.55; max-width: 46rem; }
.tl-item code {
  font-size: 0.72rem;
  background: #f0f2f8;
  padding: 0.06rem 0.3rem;
  
}

/* Upload row (rappro-flash) */
.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}
.upload-panel { margin-bottom: 0; }
.upload-panel .dropzone { border: none; border-bottom: 1px solid var(--border-soft); }
.upload-progress { padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border-soft); }
.upload-progress-label { font-size: 0.76rem; color: var(--fm-deep-smoke); margin-top: 0.35rem; }
.upload-files {
  list-style: none;
  margin: 0;
  padding: 0;
}
.upload-files li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
  color: var(--fm-dark-space);
  border-bottom: 1px solid var(--border-soft);
  line-height: 1.35;
}
.upload-files li:last-child { border-bottom: none; }
.upload-files li i { width: 15px; height: 15px; color: var(--fm-true-blue); flex-shrink: 0; }
.upload-files li span:first-of-type { flex: 1; min-width: 0; }
.upload-files li .pill { flex-shrink: 0; }

.rappro-workspace { margin-bottom: 0; }
.rappro-tbl-wrap { max-height: 64vh; overflow: auto; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed #cfd4da;
  
  background: #fafbfb;
  padding: 1.6rem 1.2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--fm-indigo);
  background: var(--fm-indigo-tint);
}
.dropzone i { width: 26px; height: 26px; color: var(--fm-indigo); }
.dropzone strong { color: var(--fm-dark-space); }

/* Doc browser (askMAF) */
.doc-layout { display: grid; grid-template-columns: 300px 1fr; min-height: 480px; }
.doc-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 72vh; }
.doc-list .doc-group {
  padding: 0.55rem 0.9rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fm-deep-smoke);
}
.doc-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-family: inherit;
}
.doc-item:hover { background: #f6f7f8; }
.doc-item.active { background: var(--fm-indigo-tint); border-left-color: var(--fm-indigo); }
.doc-item .c { font-size: 0.72rem; font-weight: 700; color: var(--fm-indigo); }
.doc-item .t { font-size: 0.78rem; color: var(--fm-dark-space); line-height: 1.3; }
.doc-item .s { font-size: 0.68rem; color: var(--fm-smoke); }
.doc-view {
  padding: 1.2rem 1.6rem;
  overflow-y: auto;
  max-height: 72vh;
  font-size: 0.85rem;
  line-height: 1.65;
}
.doc-view h1, .doc-view h2, .doc-view h3 { color: var(--fm-dark-space); }
.doc-view h1 { font-size: 1.15rem; }
.doc-view h2 { font-size: 1rem; }
.doc-view h3 { font-size: 0.9rem; }
.doc-view table { border-collapse: collapse; font-size: 0.78rem; margin: 0.6rem 0; }
.doc-view th, .doc-view td { border: 1px solid var(--border); padding: 0.3rem 0.5rem; }
.doc-view th { background: #f6f7f8; }
.doc-view code { background: #f0f2f8; padding: 0.05rem 0.3rem; font-size: 0.78rem; }
.doc-view blockquote { border-left: 3px solid #d4d8f5; margin: 0.6rem 0; padding: 0.1rem 0.9rem; color: var(--fm-deep-smoke); }
.doc-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: var(--fm-smoke); gap: 0.6rem;
}
.doc-empty i { width: 34px; height: 34px; }

/* ── Chat sidebar (right) ────────────────────────────────── */
.chat-side {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--chat-w);
  background: #fff;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.25s ease;
}
.chat-side.closed { transform: translateX(100%); }

.app-content { transition: margin-right 0.25s ease; }
body.chat-closed .app-content { margin-right: 0; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
  color: var(--fm-dark-space);
}
.chat-head .dot {
  width: 8px; height: 8px;
  
  background: var(--fm-indigo);
  box-shadow: 0 0 0 3px rgba(23, 28, 143, 0.18);
}
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who .n { font-size: 0.88rem; font-weight: 600; }
.chat-head .who .m { font-size: 0.68rem; color: var(--muted); }

.chat-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}
.chat-close:hover { background: #f3f4f6; color: var(--fm-dark-space); }
.chat-close i { width: 17px; height: 17px; }

/* Same design as the landing page assistant toggle (#bob-chat-toggle) */
.chat-reopen {
  display: none;
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  align-items: center;
  justify-content: center;
  background: var(--fm-indigo);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(23, 28, 143, 0.4);
  z-index: 55;
  transition: background 0.2s, transform 0.2s;
}
.chat-reopen:hover { background: var(--fm-true-blue); transform: scale(1.07); }
.chat-reopen i { width: 24px; height: 24px; }
body.chat-closed .chat-reopen { display: flex; }

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.msg { max-width: 92%; }
.msg .bubble {
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.55;
  
}
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--fm-dark-space); color: #fff; }
.msg.bot { align-self: flex-start; max-width: 96%; }
.msg.bot .bubble { background: #f4f5f6; color: var(--fm-dark-space); }
.msg.bot .bubble > :first-child { margin-top: 0; }
.msg.bot .bubble > :last-child { margin-bottom: 0; }
.msg.bot .bubble h1, .msg.bot .bubble h2, .msg.bot .bubble h3 { color: var(--fm-dark-space); }
.msg.bot .bubble strong { color: var(--fm-indigo); }
.msg.bot .bubble h1 { font-size: 0.95rem; }
.msg.bot .bubble h2 { font-size: 0.88rem; }
.msg.bot .bubble h3 { font-size: 0.84rem; }
.msg.bot .bubble table { border-collapse: collapse; font-size: 0.72rem; margin: 0.4rem 0; max-width: 100%; display: block; overflow-x: auto; }
.msg.bot .bubble th, .msg.bot .bubble td { border: 1px solid #dfe2e6; padding: 0.22rem 0.4rem; }
.msg.bot .bubble th { background: #eceeef; }
.msg.bot .bubble code { background: #e9ebec; padding: 0.03rem 0.25rem;  font-size: 0.76rem; }
.msg.bot .bubble blockquote { border-left: 3px solid #cfd4da; margin: 0.4rem 0; padding: 0.05rem 0.7rem; color: var(--fm-deep-smoke); }
.msg .meta { font-size: 0.64rem; color: var(--fm-smoke); margin-top: 0.2rem; }

.typing { display: inline-flex; gap: 4px; padding: 0.25rem 0; }
.typing span {
  width: 6px; height: 6px;
  
  background: var(--fm-smoke);
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 70%, 100% { opacity: 0.25; } 35% { opacity: 1; } }

.chat-sugg {
  padding: 0.5rem 1rem 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-top: 1px solid var(--border-soft);
}
.chat-sugg button {
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--fm-outer-space);
  background: #fff;
  border: 1px solid var(--border);
  
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chat-sugg button:hover {
  background: var(--fm-indigo-tint);
  border-color: var(--fm-indigo);
  color: var(--fm-indigo);
}

.chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 1rem 0.9rem;
  border-top: 1px solid var(--border-soft);
}
.chat-input textarea {
  flex: 1;
  resize: none;
  font-family: inherit;
  font-size: 0.84rem;
  border: 1px solid var(--border);
  
  padding: 0.6rem 0.8rem;
  min-height: 42px;
  max-height: 130px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input textarea:focus {
  border-color: var(--fm-indigo);
  box-shadow: 0 0 0 3px rgba(23, 28, 143, 0.12);
}
.chat-input button {
  background: var(--fm-indigo);
  color: #fff;
  border: none;
  
  width: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.chat-input button:hover { background: var(--fm-true-blue); }
.chat-input button:disabled { background: var(--fm-smoke); cursor: default; }
.chat-input button i { width: 17px; height: 17px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1080px) {
  :root { --chat-w: 340px; }
  .doc-layout { grid-template-columns: 240px 1fr; }
}
@media (max-width: 860px) {
  html, body { overflow: auto; }
  .app-shell { height: auto; min-height: 100dvh; flex-direction: column; }
  .app-rail {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .rail-logo { margin: 0; }
  .rail-nav { flex-direction: row; flex: 0; gap: 0.35rem; }
  .rail-foot { border-top: none; padding: 0; width: auto; }
  .app-content { margin-right: 0; }
  .workspace { min-height: 38vh; }
  .chat-side {
    position: fixed;
    top: auto;
    height: 62vh;
    width: 100%;
    border-top: 2px solid var(--fm-indigo);
    transform: translateY(calc(100% - 44px));
    transition: transform 0.3s ease;
  }
  .chat-side.open { transform: translateY(0); }
  .chat-head { cursor: pointer; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-list { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .upload-row { grid-template-columns: 1fr; }
}
