/* Inequality Bot — "Paper & Ink" theme: near-white paper panels, ink text, one
   brick-red accent, no blue. Variable NAMES kept from the earlier navy/blue/
   orange theme (--navy/--blue/--orange/...) to avoid touching every rule, but
   their VALUES point at the new palette. */

:root {
  --navy: #FAF9F5;
  --blue: #20211D;
  --orange: #B4472F;
  --orange-dark: #8C371F;
  --cream-page: #F4F1EC;
  --cream-content: #FFFFFF;
  --highlight: #F3DED4;
  --border: rgba(32, 33, 29, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: 'Archivo', system-ui, sans-serif; color: var(--blue); background: var(--cream-page); }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

.ib-shell { display: flex; height: 100vh; }

/* ---- Sidebar ---- */
.ib-sidebar {
  width: 248px; flex: none; background: var(--navy); color: var(--blue);
  display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border);
}
.ib-sidebar-top {
  display: flex; align-items: center; gap: 9px; padding: 18px 18px 14px;
  background: none; border: none; text-align: left; width: 100%; border-radius: 6px;
}
.ib-sidebar-top:hover { background: rgba(32,33,29,.05); }
.ib-logo { width: 30px; height: 30px; border-radius: 7px; }
.ib-wordmark { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.ib-new-question {
  margin: 0 14px 16px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--blue);
  background: transparent; color: var(--blue); font: 600 12.5px/1 'Space Grotesk', sans-serif;
}
.ib-new-question:hover { background: rgba(32,33,29,.06); }
.ib-history { flex: 1; overflow-y: auto; padding: 0 8px; }
.ib-group-label {
  font: 500 9.5px/1 'IBM Plex Mono', monospace; letter-spacing: .1em; color: rgba(32,33,29,.4);
  padding: 10px 10px 6px;
}
.ib-history-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 10px; border-radius: 5px; font-size: 12.5px; line-height: 1.35;
  color: rgba(32,33,29,.72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ib-history-item:hover { background: rgba(32,33,29,.06); color: var(--blue); }
.ib-history-item.active { background: rgba(180,71,47,.09); color: var(--orange); font-weight: 600; }
.ib-sidebar-status { padding: 14px 18px; border-top: 1px solid var(--border); font: 400 10.5px/1.5 'IBM Plex Mono', monospace; color: rgba(32,33,29,.55); }
.ib-source-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.ib-source-row { display: flex; align-items: center; gap: 7px; }
.ib-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4B8A5E; flex: none; }
.ib-model-toggle-wrap { padding-top: 10px; border-top: 1px solid var(--border); margin-top: 4px; }
.ib-model-toggle { display: flex; gap: 6px; margin-top: 5px; }
.ib-model-opt {
  flex: 1; background: #fff; border: 1px solid rgba(32,33,29,.18); border-radius: 20px;
  padding: 6px 4px; font: 600 10.5px/1 'Space Grotesk', sans-serif; color: rgba(32,33,29,.5);
}
.ib-model-opt.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.ib-sidebar-tagline { margin-top: 2px; color: rgba(32,33,29,.4); padding-top: 10px; border-top: 1px solid var(--border); }
.ib-clear-all-btn {
  display: block; width: 100%; margin-top: 12px; background: #fff; cursor: pointer;
  border: 1px solid rgba(32,33,29,.18); border-radius: 6px; padding: 8px 10px;
  font: 500 11px/1 'IBM Plex Mono', monospace; color: rgba(32,33,29,.5); text-align: center;
}
.ib-clear-all-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ---- Main column ---- */
.ib-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--cream-content); }
.ib-topbar {
  background: var(--navy); color: var(--orange-dark); padding: 9px 30px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px 14px; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  border-bottom: 1px solid var(--border);
}
.ib-topbar a, .ib-topbar span { white-space: nowrap; }
.ib-topbar a { color: var(--orange); }
.ib-topbar-spacer { margin-left: auto; }
.ib-topbar-cost { font-weight: 500; color: var(--orange-dark); }
.ib-menu-btn {
  display: none; background: none; border: none; color: var(--orange-dark); font-size: 16px;
  padding: 0; margin-right: 2px; line-height: 1;
}
.ib-sidebar-backdrop { display: none; }
.ib-headerbar { padding: 18px 30px 6px; background: var(--cream-content); }
.ib-title-card {
  display: inline-flex; align-items: center; gap: 12px; max-width: 100%; background: #fff;
  border-radius: 11px; padding: 11px 20px 11px 16px;
  box-shadow: 0 3px 12px rgba(32,33,29,.09), 0 0 0 1px rgba(32,33,29,.05);
}
.ib-accent { width: 4px; align-self: stretch; background: var(--orange); border-radius: 2px; flex: none; }
.ib-title {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; letter-spacing: -.02em;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ib-thread { flex: 1; overflow-y: auto; padding: 24px 30px; display: flex; flex-direction: column; gap: 22px; }

/* ---- Empty-conversation landing state ---- */
.ib-landing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; text-align: center; }
.ib-landing-logo { width: 56px; height: 56px; border-radius: 14px; }
.ib-landing-title { font: 700 26px/1.2 'Space Grotesk', sans-serif; letter-spacing: -.02em; }
.ib-landing-tagline { font-size: 14px; color: rgba(32,33,29,.55); max-width: 420px; line-height: 1.5; }
.ib-landing-examples { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 560px; margin-top: 6px; }

.ib-bubble-user { align-self: flex-end; max-width: 74%; }
.ib-bubble-user-label { font: 500 9.5px/1 'IBM Plex Mono', monospace; letter-spacing: .14em; color: rgba(32,33,29,.5); margin-bottom: 6px; text-align: right; }
.ib-bubble-user-text {
  background: #F1EDE6; border: 1px solid rgba(32,33,29,.16); color: var(--blue);
  padding: 13px 17px; border-radius: 14px 14px 4px 14px; font: 500 15px/1.45 'Space Grotesk', sans-serif;
  box-shadow: 0 1px 3px rgba(32,33,29,.05);
}

.ib-answer { display: flex; gap: 14px; }
.ib-bot-icon { width: 32px; height: 32px; flex: none; border-radius: 8px; }
.ib-answer-body { flex: 1; min-width: 0; }
.ib-meta { font: 400 10px/1 'IBM Plex Mono', monospace; letter-spacing: .1em; color: var(--orange-dark); margin-bottom: 10px; }
.ib-headline { font: 700 15.5px/1.5 'Space Grotesk', sans-serif; letter-spacing: -.01em; margin-bottom: 10px; }
.ib-body { font-family: 'Source Serif 4', Georgia, serif; font-size: 15.5px; line-height: 1.62; color: rgba(32,33,29,.82); }
.ib-body a, .ib-headline a {
  color: var(--blue); text-decoration: underline; text-decoration-color: var(--orange);
  text-decoration-thickness: 1px; text-underline-offset: 2px;
}
.ib-headline p, .ib-body p { margin: 0 0 12px; }
.ib-headline p:last-child, .ib-body p:last-child { margin-bottom: 0; }
.ib-body ul, .ib-body ol { margin: 0 0 12px; padding-left: 22px; }
.ib-body li { margin-bottom: 4px; }
.ib-body table { border-collapse: collapse; font-size: 14px; margin: 0 0 12px; }
.ib-body th, .ib-body td { border: 1px solid rgba(32,33,29,.16); padding: 6px 10px; text-align: left; }
.ib-body th { font-family: 'IBM Plex Mono', monospace; font-size: 11px; background: rgba(32,33,29,.05); }

/* ---- Chart + table shown inline in the answer (not buried in Underlying data) ---- */
.ib-inline-data { margin: 4px 0 16px; }
.ib-inline-data-title { font: 600 11px/1 'IBM Plex Mono', monospace; letter-spacing: .06em; color: rgba(32,33,29,.5); margin-bottom: 8px; }

.ib-usage-strip {
  display: inline-flex; align-items: center; gap: 14px; padding: 9px 13px; margin-top: 14px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--cream-page);
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: rgba(32,33,29,.62);
}
.ib-usage-label { color: rgba(32,33,29,.45); }
.ib-usage-sep { width: 1px; height: 11px; background: rgba(32,33,29,.18); }
.ib-usage-cost { font-weight: 500; color: var(--orange-dark); }

.ib-followup-label { font: 400 10px/1 'IBM Plex Mono', monospace; letter-spacing: .1em; color: rgba(32,33,29,.5); margin: 18px 0 8px; }
.ib-followups { display: flex; flex-wrap: wrap; gap: 8px; }
.ib-chip {
  padding: 9px 13px; border: 1px solid rgba(32,33,29,.22); border-radius: 20px; background: #fff;
  font: 500 12.5px/1 'Space Grotesk', sans-serif; color: var(--blue); box-shadow: 0 1px 2px rgba(32,33,29,.05);
  transition: border-color .12s ease, color .12s ease;
}
.ib-chip:hover { border-color: var(--orange); color: var(--orange); }

.ib-underlying-head {
  display: flex; flex-wrap: wrap; align-items: center; row-gap: 8px; column-gap: 14px;
  margin: 22px 0 12px; border-top: 2px solid var(--blue); padding-top: 14px;
}
.ib-underlying-head .ib-title2 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 19px; letter-spacing: -.02em; white-space: nowrap; }
.ib-underlying-sub { font-size: 11px; color: rgba(32,33,29,.5); margin: -8px 0 12px; }
.ib-collapse-all, .ib-downloadall-btn {
  background: #fff; border: 1px solid rgba(32,33,29,.22); border-radius: 20px; padding: 5px 12px;
  font: 500 10.5px/1 'IBM Plex Mono', monospace; color: var(--blue); white-space: nowrap;
}
.ib-collapse-all:hover, .ib-downloadall-btn:hover { border-color: var(--orange); color: var(--orange); }
.ib-collapse-all { margin-left: auto; }

.ib-card {
  background: var(--navy); border: 1px solid rgba(32,33,29,.12); border-radius: 8px; margin-bottom: 10px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(32,33,29,.04);
}
.ib-card summary {
  padding: 14px 16px; cursor: pointer; font-size: 12.5px; line-height: 1.5; list-style: none;
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px;
}
.ib-card summary:hover { background: rgba(32,33,29,.03); }
.ib-card summary::-webkit-details-marker { display: none; }
.ib-card summary .ib-card-title { color: var(--blue); font-weight: 600; }
.ib-card summary .ib-card-meta { color: rgba(32,33,29,.55); }
.ib-card summary .ib-expand-label {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font: 600 11px/1 'IBM Plex Mono', monospace; letter-spacing: .02em; color: var(--orange);
  border: 1px solid rgba(180,71,47,.35); border-radius: 20px; padding: 5px 11px;
}
.ib-card summary:hover .ib-expand-label { background: rgba(180,71,47,.06); }
.ib-card summary .ib-chevron { font-size: 9px; transition: transform .15s ease; }
.ib-card:not([open]) .ib-chevron { transform: rotate(-90deg); }
.ib-card-body { padding: 2px 16px 16px; }
.ib-card-source { font: 400 11px/1 'IBM Plex Mono', monospace; color: rgba(32,33,29,.5); margin-bottom: 6px; }
.ib-card-source a { color: var(--blue); text-decoration: underline; }
.ib-card-definition { font: 400 12px/1.5 'Source Serif 4', Georgia, serif; color: rgba(32,33,29,.7); margin-bottom: 12px; }

.ib-toggle-row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; }
.ib-radio-opt { display: flex; align-items: center; gap: 6px; font: 500 11.5px/1 'Space Grotesk', sans-serif; cursor: pointer; }
.ib-radio-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(32,33,29,.3); box-sizing: border-box; }
.ib-radio-opt.active .ib-radio-dot { background: var(--orange); border: 3px solid var(--orange); }
.ib-radio-opt.active { color: var(--blue); }
.ib-radio-opt:not(.active) { color: rgba(32,33,29,.55); }
.ib-dl-group { margin-left: auto; display: flex; gap: 8px; }
.ib-csv-btn {
  font: 500 10.5px/1 'IBM Plex Mono', monospace; color: var(--blue); background: #fff;
  border: 1px solid rgba(32,33,29,.22); border-radius: 20px; padding: 5px 11px;
}
.ib-csv-btn:hover { border-color: var(--orange); color: var(--orange); }

.ib-chart { width: 100%; margin-bottom: 8px; overflow-x: auto; }
.ib-chart-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ib-chart-tool-btn {
  font: 500 10.5px/1 'IBM Plex Mono', monospace; color: rgba(32,33,29,.55); background: transparent;
  border: 1px solid rgba(32,33,29,.18); border-radius: 20px; padding: 5px 11px;
}
.ib-chart-tool-btn:hover { border-color: var(--orange); color: var(--orange); }

.ib-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ib-table th {
  font: 500 9.5px/1 'IBM Plex Mono', monospace; letter-spacing: .06em; color: rgba(32,33,29,.45);
  text-align: left; white-space: nowrap; padding: 0 20px 8px 0; border-bottom: 1px solid rgba(32,33,29,.16);
}
.ib-table td { padding: 8px 20px 8px 0; white-space: nowrap; border-bottom: 1px solid rgba(32,33,29,.07); }
.ib-table td.num { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.ib-table tr.ib-highlight td { background: var(--highlight); }
.ib-table-wrap { max-height: 420px; overflow: auto; margin-bottom: 10px; }
.ib-table-caption { font-size: 11.5px; color: rgba(32,33,29,.55); margin-bottom: 8px; }

.ib-inputbar {
  display: flex; align-items: center; gap: 12px; margin: 16px 30px 20px; background: #fff;
  border: 1px solid rgba(32,33,29,.16); border-radius: 10px; padding: 10px 10px 10px 15px;
  box-shadow: 0 2px 8px rgba(32,33,29,.06);
}
.ib-inputbar:focus-within { border-color: rgba(180,71,47,.4); }
.ib-inputbar input { flex: 1; border: none; outline: none; font-size: 13.5px; font-family: 'Archivo', sans-serif; color: var(--blue); background: transparent; }
.ib-inputbar input::placeholder { color: rgba(32,33,29,.4); }
.ib-send { width: 32px; height: 32px; border-radius: 7px; background: var(--orange); border: none; color: #fff; font-size: 14px; transition: background .12s ease; }
.ib-send:hover { background: var(--orange-dark); }

/* ---- "Thinking" status row — same icon+body slot the finished answer will occupy ---- */
.ib-status-row { display: flex; gap: 14px; align-items: flex-start; }
.ib-status-text {
  font: 600 15px/1.4 'Space Grotesk', sans-serif; color: rgba(32,33,29,.6);
  animation: ib-pulse 1.4s ease-in-out infinite;
}
@keyframes ib-pulse { 0%, 100% { opacity: .4; } 50% { opacity: .9; } }

/* ---- Mobile: the sidebar has nowhere to live at phone/small-tablet widths
   alongside real content, so below this breakpoint it becomes a slide-in
   drawer (hidden off-canvas by default, toggled by the topbar's ☰ button)
   instead of a permanent 248px column eating most of the screen. ---- */
@media (max-width: 860px) {
  .ib-menu-btn { display: inline-block; }
  .ib-sidebar {
    position: fixed; top: 0; left: 0; height: 100%; z-index: 100; width: 260px;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(32,33,29,.18);
  }
  .ib-sidebar.ib-sidebar-open { transform: translateX(0); }
  .ib-sidebar-backdrop.ib-backdrop-open {
    display: block; position: fixed; inset: 0; background: rgba(32,33,29,.4); z-index: 99;
  }
  .ib-topbar, .ib-headerbar, .ib-thread { padding-left: 16px; padding-right: 16px; }
  .ib-inputbar { margin-left: 16px; margin-right: 16px; }
  .ib-bubble-user { max-width: 88%; }
  .ib-title { font-size: 16px; }
}

/* ---- Beta: badge, budget meter, feedback, modal ---- */
.ib-beta-badge {
  display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 1px 6px; border-radius: 999px;
  background: var(--orange); color: #fff; font-family: 'IBM Plex Mono', monospace; font-size: 9px;
  font-weight: 500; letter-spacing: .08em;
}
.ib-budget { display: flex; align-items: center; gap: 10px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.ib-budget[hidden] { display: none; }
.ib-budget-bar { width: 90px; height: 6px; border-radius: 999px; background: rgba(32,33,29,.12); overflow: hidden; }
.ib-budget-fill { display: block; height: 100%; background: #3B6B8C; border-radius: 999px; transition: width .4s; }
.ib-budget-warn .ib-budget-fill { background: #D9A441; }
.ib-budget-full .ib-budget-fill { background: var(--orange); }
.ib-budget-full .ib-budget-text { color: var(--orange-dark); font-weight: 500; }
.ib-account-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.ib-link-btn { background: none; border: 0; padding: 0; font-size: 11.5px; color: rgba(32,33,29,.6); text-decoration: underline; }
.ib-link-btn:hover { color: var(--orange); }
.ib-link-btn[hidden] { display: none; }
.ib-account-email { margin-top: 6px; font-size: 10.5px; color: rgba(32,33,29,.4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-feedback-bar { display: flex; gap: 8px; margin-top: 10px; }
.ib-fb-btn {
  background: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px;
  font-size: 11.5px; color: rgba(32,33,29,.65);
}
.ib-fb-btn:hover:not(:disabled) { border-color: var(--orange); color: var(--orange); }
.ib-fb-btn:disabled { opacity: .6; cursor: default; }
.ib-modal-backdrop { position: fixed; inset: 0; background: rgba(32,33,29,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.ib-modal-backdrop[hidden] { display: none; }
.ib-modal { background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.ib-modal-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; }
.ib-modal-sub { font-size: 13px; color: rgba(32,33,29,.6); margin: 4px 0 14px; }
.ib-fb-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ib-fb-kinds button { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12px; }
.ib-fb-kinds button.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.ib-modal textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font: inherit; font-size: 13.5px; resize: vertical; }
.ib-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.ib-modal-cancel { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; }
.ib-modal-send { background: var(--orange); color: #fff; border: 0; border-radius: 8px; padding: 8px 18px; font-weight: 600; }
.ib-modal-send:disabled { opacity: .6; }
.ib-modal-status { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: rgba(32,33,29,.7); }
@media (max-width: 860px) { .ib-budget-bar { width: 56px; } .ib-budget { font-size: 10px; gap: 6px; } }
