/* Answerlore app styles, ported from the design canvas "Answerlore App Design System".
   Light is the default; dark is defined explicitly, not derived by inversion. */

:root {
  --al-bg: #F4F1E8; --al-bg-sunken: #EBE7DB; --al-surface: #FBF9F3; --al-surface-2: #F0ECE1;
  --al-border: #D9D4C4; --al-border-strong: #BFB8A4;
  --al-text: #12261E; --al-text-2: #3B382F; --al-text-3: #6B665A;
  --al-accent: #1E4535; --al-accent-hover: #12261E; --al-accent-subtle: #E3EBE5;
  --al-accent-border: #B3C9BB; --al-on-accent: #F4F1E8;
  --al-escalate: #9A3412; --al-escalate-surface: #FAEDE5; --al-escalate-border: #C97A52;
  --al-on-escalate: #F4F1E8;
  --al-shadow: 0 1px 2px rgba(18,38,30,.06), 0 1px 1px rgba(18,38,30,.04);
  --al-focus: 0 0 0 3px rgba(30,69,53,.30);
  --al-font-ui: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --al-font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --al-font-display: "Bricolage Grotesque", "Helvetica Neue", Helvetica, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --al-bg: #12261E; --al-bg-sunken: #0D1B15; --al-surface: #1A3227; --al-surface-2: #1E3A2D;
    --al-border: #2C4A3B; --al-border-strong: #3E6151;
    --al-text: #F4F1E8; --al-text-2: #C6C2B4; --al-text-3: #96907F;
    --al-accent: #7DB79A; --al-accent-hover: #95C7AD; --al-accent-subtle: #1B3A2C;
    --al-accent-border: #355947; --al-on-accent: #12261E;
    --al-escalate: #E07A4B; --al-escalate-surface: #3A1D0F; --al-escalate-border: #A0492A;
    --al-on-escalate: #2B1006;
    --al-shadow: none;
    --al-focus: 0 0 0 3px rgba(125,183,154,.32);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--al-bg); color: var(--al-text);
  font-family: var(--al-font-ui); font-size: 16px; line-height: 26px;
  -webkit-font-smoothing: antialiased; text-wrap: pretty;
}
a { color: var(--al-accent); text-decoration: none; }
a:hover { color: var(--al-accent-hover); text-decoration: underline; }
svg { display: block; flex: none; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--al-focus); }

/* ---- type scale ---- */
.wordmark { font-family: var(--al-font-display); font-weight: 700; text-transform: uppercase;
  line-height: 1; white-space: nowrap; color: var(--al-accent); }
.t-title { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.018em; margin: 0; }
.t-head { font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: -.008em; margin: 0; }
.t-body { font-size: 16px; line-height: 26px; font-weight: 400; margin: 0; }
.t-strong { font-size: 16px; line-height: 26px; font-weight: 600; margin: 0; }
.t-cap { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--al-text-3); margin: 0; }
.t-label { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; margin: 0; }
.mono, code { font-family: var(--al-font-mono); font-size: .92em; letter-spacing: -.01em; }
.dim { color: var(--al-text-2); }
.dim3 { color: var(--al-text-3); }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 248px minmax(0,1fr); min-height: 100vh; }
.side { background: var(--al-bg-sunken); border-right: 1px solid var(--al-border);
  display: flex; flex-direction: column; gap: 24px; padding: 20px 12px;
  position: sticky; top: 0; height: 100vh; }
.brandrow { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; }
.brandrow a { display: flex; align-items: center; gap: 6px; color: var(--al-accent); }
.brandrow a:hover { text-decoration: none; color: var(--al-accent-hover); }
.navgroup { display: flex; flex-direction: column; gap: 2px; }
.navitem { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px;
  border-radius: 12px; color: var(--al-text-2); font-size: 15px; font-weight: 500;
  border: 1px solid transparent; }
a.navitem:hover { text-decoration: none; background: var(--al-surface-2); color: var(--al-text); }
.navitem.is-active { background: var(--al-surface); color: var(--al-text); font-weight: 600;
  box-shadow: var(--al-shadow); border: 1px solid var(--al-border); }
.side-spacer { flex: 1; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 0 12px; min-height: 44px; }
.avatar { width: 26px; height: 26px; border-radius: 999px; background: var(--al-accent-subtle);
  border: 1px solid var(--al-accent-border); color: var(--al-accent); display: flex; flex: none;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase; }
.whoami-name { font-size: 13px; font-weight: 600; color: var(--al-text); line-height: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami-sub { font-size: 12px; color: var(--al-text-3); line-height: 16px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.col { width: 100%; max-width: 772px; margin: 0 auto; padding: 0 40px;
  display: flex; flex-direction: column; }

/* ---- topbar + pagehead ---- */
.topbar { height: 64px; flex: none; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 0 40px;
  border-bottom: 1px solid var(--al-border); }
.pagehead { display: flex; flex-direction: column; gap: 18px; padding: 30px 40px 22px; }

/* ---- chips + buttons ---- */
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 999px; background: var(--al-bg-sunken); border: 1px solid var(--al-border);
  color: var(--al-text-2); font-size: 14px; font-weight: 500; }
.chip-cite { display: inline-flex; align-items: center; gap: 9px; padding: 7px 13px;
  border-radius: 999px; background: transparent; border: 1px solid var(--al-border);
  color: var(--al-text-3); font-size: 13px; line-height: 18px; font-weight: 500; max-width: 100%; }
.chip-cite .mono { color: var(--al-text-2); overflow-wrap: anywhere; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px;
  padding: 0 20px; border-radius: 999px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; }
.btn-primary { background: var(--al-accent); color: var(--al-on-accent); }
.btn-primary:hover { background: var(--al-accent-hover); }
.btn-quiet { background: transparent; color: var(--al-text-2); border-color: var(--al-border-strong); }
.btn-quiet:hover { background: var(--al-surface-2); }
.btn-escalate { background: var(--al-escalate); color: var(--al-on-escalate); }
.iconbtn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border-radius: 10px; color: var(--al-text-3); font-size: 13px; font-weight: 500;
  border: 1px solid transparent; background: transparent; }
.iconbtn:hover { color: var(--al-text); background: var(--al-surface-2); text-decoration: none; }
.iconbtn.is-bordered { border-color: var(--al-border); }

/* ---- surfaces ---- */
.card { background: var(--al-surface); border: 1px solid var(--al-border); border-radius: 16px;
  box-shadow: var(--al-shadow); }
.hr { height: 1px; background: var(--al-border); border: 0; margin: 0; }

/* ---- the escalate block: the loudest thing on any screen ---- */
.escalate { background: var(--al-escalate-surface); border: 2px solid var(--al-escalate-border);
  border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.escalate-title { display: flex; align-items: center; gap: 10px; color: var(--al-escalate); }
.team { display: inline-block; font-weight: 700; color: var(--al-text); }

/* ---- input bar ---- */
.inputbar { background: var(--al-surface); border: 1px solid var(--al-border-strong);
  border-radius: 22px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--al-shadow); }
.inputbar:focus-within { box-shadow: var(--al-focus); }
.inputbar textarea { border: 0; background: transparent; resize: none; padding: 0; margin: 0;
  font: inherit; color: var(--al-text); width: 100%; min-height: 26px; max-height: 200px; }
.inputbar textarea:focus { outline: none; box-shadow: none; }
.inputbar textarea::placeholder { color: var(--al-text-3); }
.inputrow { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.send { width: 44px; height: 44px; border-radius: 999px; background: var(--al-accent);
  color: var(--al-on-accent); border: 0; display: flex; align-items: center; justify-content: center; }
.send:hover { background: var(--al-accent-hover); }

/* ---- rows + tables ---- */
.row { display: grid; align-items: center; gap: 16px; padding: 16px 20px;
  border-bottom: 1px solid var(--al-border); }
.row:last-child { border-bottom: 0; }
.thead { display: grid; align-items: center; gap: 16px; padding: 0 20px 10px; }
.thead span { font-size: 11.5px; font-weight: 700; letter-spacing: .085em;
  text-transform: uppercase; color: var(--al-text-3); line-height: 16px; }
.pill-status { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--al-border);
  color: var(--al-text-3); background: transparent; white-space: nowrap; }
.pill-status.is-loud { background: var(--al-border); border-color: var(--al-border-strong);
  color: var(--al-text); }
.pill-status.is-escalate { background: var(--al-escalate-surface);
  border-color: var(--al-escalate-border); color: var(--al-escalate); }
.track { height: 4px; border-radius: 999px; background: var(--al-border); overflow: hidden; }
.track > i { display: block; height: 100%; background: var(--al-text-3); border-radius: 999px; }
.track.is-indeterminate > i { width: 40%; animation: al-slide 1.4s ease-in-out infinite; }
@keyframes al-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.spin { animation: al-spin 1s linear infinite; }
@keyframes al-spin { to { transform: rotate(360deg); } }

/* ---- steps + lists ---- */
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex;
  flex-direction: column; gap: 12px; }
ol.steps > li { counter-increment: s; display: grid; grid-template-columns: 26px minmax(0,1fr);
  gap: 14px; align-items: start; }
ol.steps > li::before { content: counter(s); display: flex; align-items: center;
  justify-content: center; width: 26px; height: 26px; border-radius: 999px;
  background: var(--al-bg-sunken); border: 1px solid var(--al-border); font-size: 13px;
  line-height: 1; font-weight: 700; color: var(--al-text-2); margin-top: 2px; }
ul.bare { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
ul.bare > li { display: grid; grid-template-columns: 7px minmax(0,1fr); gap: 14px;
  align-items: start; }
ul.bare > li::before { content: ""; width: 7px; height: 7px; border-radius: 999px;
  background: var(--al-text-3); margin-top: 10px; }
.escalate ul.bare > li::before { background: var(--al-escalate); }

/* ---- callouts ---- */
.stale { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-radius: 12px; background: var(--al-bg-sunken); border: 1px solid var(--al-border);
  color: var(--al-text-2); font-size: 13px; line-height: 19px; }
.error-callout { background: var(--al-escalate-surface); border: 1px solid var(--al-escalate-border);
  border-radius: 12px; padding: 12px 16px; color: var(--al-text); font-size: 14.5px;
  line-height: 22px; }
.handoff { background: var(--al-bg-sunken); border: 1px solid var(--al-border);
  border-radius: 12px; padding: 16px 18px; font-size: 13.5px; line-height: 20px; margin: 0;
  white-space: pre-wrap; font-family: var(--al-font-mono); color: var(--al-text);
  overflow-x: auto; }

/* ---- answer card details toggle ---- */
.full-detail-toggle { display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; width: 100%; border-radius: 12px; border: 1px solid var(--al-border);
  background: var(--al-surface-2); color: var(--al-text-2); font-size: 14px; font-weight: 600; }
.full-detail-toggle:hover { border-color: var(--al-border-strong); color: var(--al-text); }
.full-detail-toggle .chev { transition: transform .15s ease; }
.full-detail-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.full-detail { display: flex; flex-direction: column; gap: 26px; }
.full-detail[hidden] { display: none; }
.answer-section { display: flex; flex-direction: column; gap: 10px; }
.answer-card { padding: 28px; display: flex; flex-direction: column; gap: 26px; }

/* ---- search + fields ---- */
.searchbar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 18px;
  border-radius: 999px; background: var(--al-surface); border: 1px solid var(--al-border-strong);
  box-shadow: var(--al-shadow); }
.searchbar:focus-within { box-shadow: var(--al-focus); }
.searchbar input { flex: 1; border: 0; background: transparent; font: inherit;
  color: var(--al-text); }
.searchbar input:focus { outline: none; box-shadow: none; }
.searchbar input::placeholder { color: var(--al-text-3); }
.field { width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--al-border-strong);
  background: var(--al-surface); padding: 0 16px; font: inherit; font-size: 16px;
  color: var(--al-text); }
.field::placeholder { color: var(--al-text-3); }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr) 520px;
  background: var(--al-bg); }
.login-brand { background: var(--al-bg-sunken); border-right: 1px solid var(--al-border);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; }
.login-brand h1 { font-size: 38px; line-height: 46px; font-weight: 600; letter-spacing: -.03em;
  margin: 0; }
.login-form { display: flex; flex-direction: column; justify-content: center;
  padding: 48px 56px; gap: 26px; }
.login-field { display: flex; flex-direction: column; gap: 10px; }

/* ---- uploads ---- */
.dropzone { display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  border-radius: 16px; border: 1px solid var(--al-border-strong); background: var(--al-bg-sunken); }
.suggestion { padding: 16px 18px; display: grid; grid-template-columns: 20px minmax(0,1fr) 20px;
  gap: 14px; align-items: center; color: var(--al-text); border-radius: 16px; text-align: left;
  width: 100%; background: var(--al-surface); border: 1px solid var(--al-border);
  box-shadow: var(--al-shadow); }
.suggestion:hover { border-color: var(--al-border-strong); text-decoration: none; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center;
    padding: 10px 12px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--al-border);
    overflow-x: auto; }
  .side .navgroup { flex-direction: row; }
  .side .navitem { height: 40px; }
  .side .navitem span:last-child { display: none; }
  .whoami-meta { display: none; }
  .main { min-height: 0; }
  .topbar, .pagehead { padding-left: 20px; padding-right: 20px; }
  .col { padding: 0 20px; }
  .row, .thead { grid-template-columns: minmax(0,1fr) !important; gap: 6px; }
  .thead span:not(:first-child) { display: none; }
}
