/* ============================================================
   AI Lawyer — Design System
   Classic legal: navy + brass, serif headings, clean sans UI
   ============================================================ */

:root {
  /* Navy scale */
  --navy-950: #0b1626;
  --navy-900: #0f1d33;
  --navy-850: #13243f;
  --navy-800: #182c4a;
  --navy-700: #213a5e;
  --navy-600: #2e4a73;
  --navy-500: #3d5d8a;

  /* Brass / gold accent (muted, restrained) */
  --brass-600: #9a7636;
  --brass-500: #b08a47;
  --brass-400: #c6a468;
  --brass-300: #d4bd92;
  --brass-200: #ecdcbd;

  /* Warm neutral paper */
  --paper:     #f6f4ef;
  --paper-2:   #efece4;
  --card:      #ffffff;
  --card-2:    #fbfaf7;

  /* Ink / text */
  --ink-900:   #16202e;
  --ink-700:   #364152;
  --ink-500:   #5a6473;
  --ink-400:   #828b98;

  /* Lines */
  --line:      #e4e0d6;
  --line-2:    #d8d3c6;
  --line-navy: rgba(255,255,255,0.10);

  /* Status hues (muted) */
  --c-claude:  #c08552;
  --c-gpt:     #2f8f7a;
  --c-gemini:  #4471c4;
  --c-grok:    #5b6470;
  --c-deepseek:#7a59b8;
  --c-mistral: #c2603e;

  --ok:        #2f7d5b;
  --warn:      #b07d2a;
  --danger:    #b1442f;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(15,29,51,.06), 0 1px 3px rgba(15,29,51,.05);
  --shadow-md: 0 4px 14px rgba(15,29,51,.08), 0 2px 6px rgba(15,29,51,.05);
  --shadow-lg: 0 18px 50px rgba(11,22,38,.18), 0 6px 18px rgba(11,22,38,.10);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brass-200); color: var(--ink-900); }

/* ---- Scrollbars ---- */
.scroll { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-400); background-clip: content-box; }
.scroll-navy { scrollbar-color: rgba(255,255,255,.18) transparent; }
.scroll-navy::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); }
.scroll-navy::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 296px 1fr;
  height: 100%;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(176,138,71,.10), transparent 60%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #e9edf4;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0,0,0,.25);
  min-height: 0;
}

.sb-brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line-navy);
  display: flex;
  align-items: center;
  gap: 13px;
}
.sb-brand .wordmark { display: flex; flex-direction: column; line-height: 1; }
.sb-brand .wordmark .name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: .2px;
  color: #fff;
}
.sb-brand .wordmark .name em { font-style: italic; color: var(--brass-400); }
.sb-brand .wordmark .sub {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(233,237,244,.55);
  margin-top: 6px;
  font-weight: 500;
}

.sb-new {
  margin: 16px 16px 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--navy-600), var(--navy-700));
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .12s ease, filter .15s ease;
}
.sb-new:hover { filter: brightness(1.1); transform: translateY(-1px); }
.sb-new:active { transform: translateY(0); }
.sb-new .plus { color: var(--brass-400); font-size: 17px; line-height: 1; }

.sb-list { flex: 1; overflow-y: auto; padding: 10px 10px 18px; min-height: 0; }
.sb-group-label {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(233,237,244,.42);
  font-weight: 600;
  padding: 12px 10px 7px;
}
.sb-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #d7deea;
  padding: 9px 11px;
  border-radius: 9px;
  margin-bottom: 2px;
  transition: background .12s ease, border-color .12s ease;
}
.sb-item:hover { background: rgba(255,255,255,.05); }
.sb-item.active {
  background: rgba(176,138,71,.13);
  border-color: rgba(176,138,71,.30);
}
.sb-item .t {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: #eef2f7;
}
.sb-item.active .t { color: #fff; }
.sb-item .meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(215,222,234,.5);
}
.sb-item .meta .pill {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--brass-400);
  letter-spacing: .03em;
}

.sb-foot {
  border-top: 1px solid var(--line-navy);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
  color: rgba(233,237,244,.6);
}
.sb-foot .ava {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(180deg, var(--brass-400), var(--brass-600));
  color: var(--navy-950); font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
  font-family: var(--serif);
}
.sb-foot .who { line-height: 1.2; }
.sb-foot .who b { color: #fff; font-weight: 600; display: block; font-size: 13px; }

/* ============================================================
   MAIN
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }

.topbar {
  height: 66px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  background: rgba(246,244,239,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tb-title { min-width: 0; }
.tb-title .h {
  font-family: var(--serif);
  font-size: 17px; font-weight: 600; color: var(--ink-900);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.tb-title .panel-dots { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.tb-title .panel-dots .lbl { font-size: 11px; color: var(--ink-400); margin-right: 2px; font-weight: 500; }
.tb-title .panel-dots .d { width: 8px; height: 8px; border-radius: 50%; }

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

/* language segmented control */
.lang {
  display: inline-flex;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.lang button {
  border: 0; background: transparent;
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  color: var(--ink-500);
  padding: 5px 11px; border-radius: 6px;
  transition: all .12s ease;
}
.lang button:hover { color: var(--ink-900); }
.lang button.on {
  background: var(--navy-800); color: #fff;
  box-shadow: var(--shadow-sm);
}

.ghost-btn {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-700);
  font-size: 13px; font-weight: 600;
  padding: 8px 15px; border-radius: 9px;
  transition: all .12s ease;
}
.ghost-btn:hover { border-color: var(--ink-400); color: var(--ink-900); }

/* ---- conversation scroll area ---- */
.thread {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 34px 26px 30px;
}
.thread-inner { max-width: 880px; margin: 0 auto; }

/* user message */
.msg-user { display: flex; justify-content: flex-end; margin-bottom: 28px; }
.msg-user .bubble {
  max-width: 76%;
  background: var(--navy-800);
  color: #f2f5fa;
  padding: 15px 19px;
  border-radius: 16px 16px 5px 16px;
  box-shadow: var(--shadow-md);
  font-size: 15px; line-height: 1.55;
  display: flex; flex-direction: column; align-items: flex-start;
}
.msg-user .bubble .doc {
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  padding: 8px 12px; border-radius: 9px;
  font-size: 12.5px; color: #e7ecf4;
}
.msg-user .bubble .doc .ic {
  width: 22px; height: 26px; border-radius: 3px;
  background: linear-gradient(180deg,#fff,#dfe6f0);
  position: relative; flex: 0 0 auto;
}
.msg-user .bubble .doc .ic:after {
  content:""; position:absolute; top:0; right:0; width:8px; height:8px;
  background: var(--navy-700); clip-path: polygon(0 0,100% 100%,0 100%);
}

/* ---- panel of models ---- */
.panel { margin-bottom: 26px; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 13px;
}
.panel-head .lab {
  font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-500);
}
.panel-head .rule { flex: 1; height: 1px; background: var(--line); }
.panel-head .count {
  font-family: var(--mono); font-size: 11.5px; color: var(--brass-600);
  background: rgba(176,138,71,.10); border: 1px solid rgba(176,138,71,.22);
  padding: 2px 8px; border-radius: 20px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}
.mcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px 12px;
  box-shadow: var(--shadow-sm);
  text-align: left; width: 100%;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  position: relative;
}
.mcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.mcard.open { border-color: var(--navy-600); box-shadow: var(--shadow-md); }
.mcard .top { display: flex; align-items: center; gap: 8px; }
.mcard .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(0,0,0,.025); }
.mcard .nm { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink-900); letter-spacing: -.01em; }
.mcard .chev { margin-left: auto; color: var(--ink-400); transition: transform .18s ease; font-size: 11px; }
.mcard.open .chev { transform: rotate(180deg); }

.mcard .verdict {
  display: inline-flex; align-items: center;
  margin-top: 11px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 9px; border-radius: 7px;
  letter-spacing: .01em;
  white-space: nowrap;
}
.v-ok   { background: rgba(47,125,91,.10); color: var(--ok); }
.v-warn { background: rgba(176,125,42,.12); color: var(--warn); }
.v-info { background: rgba(46,74,115,.10); color: var(--navy-600); }

.mcard .conf { margin-top: 11px; }
.mcard .conf .barwrap { height: 4px; background: var(--paper-2); border-radius: 20px; overflow: hidden; }
.mcard .conf .bar { height: 100%; border-radius: 20px; }
.mcard .conf .ct { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--ink-400); }
.mcard .conf .ct b { color: var(--ink-700); font-weight: 600; font-family: var(--mono); }

.mcard .body {
  font-size: 13px; line-height: 1.6; color: var(--ink-700);
  overflow: hidden;
  max-height: 0; opacity: 0;
  transition: max-height .26s ease, opacity .2s ease, margin-top .2s ease, padding-top .2s ease;
}
.mcard.open .body {
  max-height: 320px; opacity: 1;
  margin-top: 11px; padding-top: 11px;
  border-top: 1px dashed var(--line-2);
}

/* thinking state */
.mcard.thinking { background: var(--card-2); }
.mcard.thinking .nm { color: var(--ink-400); }
.dots3 { display: inline-flex; gap: 4px; margin-top: 13px; }
.dots3 span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-400);
  animation: blink 1.2s infinite ease-in-out;
}
.dots3 span:nth-child(2) { animation-delay: .2s; }
.dots3 span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.25;transform:translateY(0)} 40%{opacity:1;transform:translateY(-2px)} }

/* ============================================================
   SYNTHESIS HERO
   ============================================================ */
.synth {
  margin-top: 4px;
  background:
    linear-gradient(180deg, rgba(176,138,71,.05), transparent 120px),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}
.synth:before {
  content:""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--brass-400), var(--brass-600));
}
.synth-head {
  display: flex; align-items: center; gap: 13px;
  padding: 18px 24px;
  background: linear-gradient(180deg, var(--navy-850), var(--navy-900));
  color: #fff;
}
.synth-head .meta { line-height: 1.25; min-width: 0; flex: 1; }
.synth-head .meta .k {
  font-family: var(--serif); font-size: 18px; font-weight: 600; color: #fff;
  white-space: nowrap;
}
.synth-head .meta .k em { color: var(--brass-400); font-style: italic; }
.synth-head .meta .by { font-size: 11.5px; color: rgba(233,237,244,.6); margin-top: 3px; font-family: var(--mono); }
.synth-head .tag {
  margin-left: auto;
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brass-400);
  border: 1px solid rgba(176,138,71,.4);
  padding: 5px 11px; border-radius: 20px;
}

.synth-body { padding: 22px 26px 26px; }
.synth-lede {
  font-family: var(--serif);
  font-size: 18px; line-height: 1.55; color: var(--ink-900);
  margin: 0 0 20px;
}
.synth-lede b { color: var(--navy-700); font-weight: 700; }

.synth-sec { margin-top: 20px; }
.synth-sec .sh {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--brass-600);
  margin-bottom: 11px;
}
.synth-sec .sh .mk { width: 6px; height: 6px; background: var(--brass-500); transform: rotate(45deg); }

.kpoints { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.kpoints li {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.55; color: var(--ink-700);
}
.kpoints li .b {
  flex: 0 0 auto; margin-top: 8px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--navy-600);
}

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.steps li {
  display: flex; gap: 13px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.55; color: var(--ink-700);
}
.steps li .n {
  flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy-800); color: #fff;
  font-family: var(--serif); font-weight: 600; font-size: 13px;
  display: grid; place-items: center;
  margin-top: 1px;
}
.steps li b { color: var(--ink-900); font-weight: 600; }

.risk {
  margin-top: 22px;
  display: flex; gap: 13px;
  background: rgba(177,68,47,.05);
  border: 1px solid rgba(177,68,47,.18);
  border-radius: var(--radius);
  padding: 15px 17px;
}
.risk .ic {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(177,68,47,.12); color: var(--danger);
  display: grid; place-items: center; font-weight: 800; font-family: var(--serif);
}
.risk .tx { font-size: 13.5px; line-height: 1.55; color: var(--ink-700); }
.risk .tx b { color: var(--danger); }

.synth-foot {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.synth-foot .agree {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-500);
}
.synth-foot .agree .pips { display: flex; gap: 3px; }
.synth-foot .agree .pips i { width: 7px; height: 14px; border-radius: 2px; background: var(--ok); display: inline-block; }
.synth-foot .agree .pips i.off { background: var(--line-2); }
.synth-foot .acts { margin-left: auto; display: flex; gap: 8px; }
.synth-foot .acts button {
  border: 1px solid var(--line-2); background: var(--card);
  color: var(--ink-600); font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 8px; transition: all .12s ease;
  display: inline-flex; align-items: center; gap: 7px;
}
.synth-foot .acts button:hover { border-color: var(--ink-400); color: var(--ink-900); background: var(--card-2); }

.disclaimer {
  max-width: 880px; margin: 22px auto 0;
  font-size: 11.5px; color: var(--ink-400); line-height: 1.5;
  display: flex; gap: 9px; align-items: flex-start;
}
.disclaimer .s { color: var(--brass-500); font-weight: 700; }

/* ============================================================
   COMPOSER
   ============================================================ */
.composer-wrap {
  flex: 0 0 auto;
  padding: 14px 26px 18px;
  background: linear-gradient(180deg, rgba(246,244,239,0), var(--paper) 36%);
  border-top: 1px solid var(--line);
}
.composer {
  max-width: 880px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--line-2);
  border-radius: 16px;
  padding: 9px 9px 9px 12px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer.focus { border-color: var(--navy-600); box-shadow: 0 0 0 4px rgba(46,74,115,.10), var(--shadow-md); }
.composer .attach {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card-2);
  color: var(--ink-500); display: grid; place-items: center;
  transition: all .12s ease;
}
.composer .attach:hover { color: var(--navy-700); border-color: var(--line-2); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent;
  font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink-900);
  padding: 9px 4px; max-height: 160px; min-height: 24px;
}
.composer textarea::placeholder { color: var(--ink-400); }
.composer .send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(180deg, var(--navy-700), var(--navy-850));
  color: #fff; border: 1px solid rgba(255,255,255,.12);
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(15,29,51,.25);
  transition: filter .12s ease, transform .12s ease;
}
.composer .send:hover { filter: brightness(1.12); transform: translateY(-1px); }
.composer .send:disabled { opacity: .4; cursor: default; transform: none; filter: none; }
.composer-hint {
  max-width: 880px; margin: 9px auto 0;
  text-align: center; font-size: 11.5px; color: var(--ink-400);
}
.composer-hint b { color: var(--ink-500); font-weight: 600; }

/* attached chips in composer */
.attached-row { max-width: 880px; margin: 0 auto 9px; display: flex; gap: 8px; flex-wrap: wrap; }
.attached-row .chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line-2);
  padding: 6px 10px; border-radius: 9px; font-size: 12px; color: var(--ink-700);
  box-shadow: var(--shadow-sm);
}
.attached-row .chip .x { color: var(--ink-400); cursor: pointer; font-weight: 700; }
.attached-row .chip .x:hover { color: var(--danger); }

/* ---- disclosure for individual answers ---- */
.disclose {
  margin: 16px 0 4px;
  display: inline-flex; align-items: center; gap: 9px;
  background: transparent; border: 1px solid var(--line-2);
  color: var(--ink-600); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 20px; transition: all .12s ease;
}
.disclose:hover { border-color: var(--navy-600); color: var(--navy-700); background: var(--card); }
.disclose .chev { transition: transform .2s ease; font-size: 10px; }
.disclose.open .chev { transform: rotate(180deg); }

/* entrance */
.enter { animation: rise .4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 1080px) {
  .model-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
