/* Suits — Hector's office. Tokens first; dark mode redefines them. */
:root {
  --bg: #f5f2ec;
  --surface: #fffdf9;
  --surface-2: #efe9df;
  --ink: #1d2433;
  --muted: #5f6676;
  --line: #ddd4c6;
  --accent: #94743f;
  --accent-soft: #f1e6d2;
  --on-accent: #ffffff;
  --ok: #2d7a4c;
  --ok-soft: #e1f0e6;
  --bad: #b23a2a;
  --bad-soft: #f7e1dc;
  --warn: #9a6200;
  --warn-soft: #f6ead2;
  --donna: #9b3d5a;
  --mike: #2b67a8;
  --harvey: #1f2a44;
  --louis: #6a4891;
  --hector: #5f6676;
  --support: #2d7a4c;
  --attack: #c0392b;
  --cite: #9097a5;
  --basis: #94743f;
  --shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 4px 14px rgba(29, 36, 51, .06);
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141b; --surface: #191e28; --surface-2: #222937; --ink: #ebe7df; --muted: #a2a9b7;
    --line: #2f3747; --accent: #cfa96b; --accent-soft: #3a3020; --on-accent: #1a1406;
    --ok: #5cc287; --ok-soft: #173325; --bad: #ef7b68; --bad-soft: #3d1d18; --warn: #e4b155; --warn-soft: #3a2c10;
    --donna: #e07a9a; --mike: #6aa5e8; --harvey: #9fb3dd; --louis: #b896e3; --hector: #a2a9b7;
    --support: #5cc287; --attack: #ef7b68; --cite: #7d8596; --basis: #cfa96b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11141b; --surface: #191e28; --surface-2: #222937; --ink: #ebe7df; --muted: #a2a9b7;
  --line: #2f3747; --accent: #cfa96b; --accent-soft: #3a3020; --on-accent: #1a1406;
  --ok: #5cc287; --ok-soft: #173325; --bad: #ef7b68; --bad-soft: #3d1d18; --warn: #e4b155; --warn-soft: #3a2c10;
  --donna: #e07a9a; --mike: #6aa5e8; --harvey: #9fb3dd; --louis: #b896e3; --hector: #a2a9b7;
  --support: #5cc287; --attack: #ef7b68; --cite: #7d8596; --basis: #cfa96b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hidden { display: none !important; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand b { font-family: var(--serif); font-size: 1.25rem; letter-spacing: .02em; }
.brand span { color: var(--muted); font-size: .85rem; }
.nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a, .nav button {
  color: var(--ink); padding: 6px 10px; border-radius: 8px; font: inherit; background: none; border: 0; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 64px; }
.banner {
  max-width: 1200px; margin: 12px auto 0; padding: 10px 14px; border-radius: 10px; font-size: .92rem;
  background: var(--warn-soft); color: var(--ink); border: 1px solid var(--line);
}
.banner a { font-weight: 600; }
.wrap-banner { padding: 0 16px; }

/* Building blocks */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; min-width: 0;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid.two, .grid.half { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: default; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.field + .field { margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.error { color: var(--bad); font-size: .9rem; margin-top: 8px; }
.ok-text { color: var(--ok); }

.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot.live { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-family: var(--serif); font-weight: 700; background: var(--hector);
}
.avatar.donna { background: var(--donna); } .avatar.mike { background: var(--mike); }
.avatar.harvey { background: var(--harvey); } .avatar.louis { background: var(--louis); }

/* Team strip */
.team { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 860px) { .team { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.member { display: flex; gap: 10px; align-items: center; padding: 12px; }
.member b { display: block; font-family: var(--serif); }
.member span { color: var(--muted); font-size: .85rem; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.case-card { display: block; color: var(--ink); padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.case-card:hover { border-color: var(--accent); text-decoration: none; }
.case-card b { font-family: var(--serif); font-size: 1.05rem; }
.cases { display: grid; gap: 10px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .bubble { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.msg.hector { flex-direction: row-reverse; }
.msg.hector .bubble { background: var(--accent-soft); border-color: transparent; }
.msg .who { font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
.compose { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.compose textarea { min-height: 44px; height: 44px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* Work strip */
.work { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Documents */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted);
  cursor: pointer; background: var(--bg);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.doc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.doc-icon { width: 36px; height: 44px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--muted); }
.doc b { overflow-wrap: anywhere; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 16px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline .date { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Citations */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--ink); background: var(--surface); max-width: 100%;
}
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.ok::before { content: "✓"; color: var(--ok); font-weight: 700; }
.chip.bad { border-style: dashed; color: var(--muted); }
.chip.bad::before { content: "?"; color: var(--bad); font-weight: 700; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Debate transcript */
.turn { border-left: 4px solid var(--line); }
.turn.harvey { border-left-color: var(--harvey); }
.turn.louis { border-left-color: var(--louis); }
.claim { padding: 10px 0; border-top: 1px solid var(--line); }
.claim:first-of-type { border-top: 0; }
.claim-id { font: 600 .75rem/1 var(--sans); padding: 3px 6px; border-radius: 5px; background: var(--surface-2); }
.rel-ataca { color: var(--attack); } .rel-apoya { color: var(--support); }

/* Assessment */
.assess-favorable { background: var(--ok-soft); color: var(--ok); }
.assess-desfavorable { background: var(--bad-soft); color: var(--bad); }
.assess-disputado { background: var(--warn-soft); color: var(--warn); }

/* Argument map */
.map-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.map { position: relative; display: grid; grid-template-columns: 1fr 1.15fr 1.15fr 1fr; gap: 56px; padding: 18px 20px 24px; min-width: 1000px; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map-col { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; min-width: 0; }
.map-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--sans); margin: 0 0 2px; display: flex; align-items: center; gap: 6px; }
.node {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: .86rem;
  cursor: pointer; transition: opacity .15s, box-shadow .15s;
}
.node:hover, .node.sel { box-shadow: 0 0 0 2px var(--accent); }
.node .nt { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.node.harvey { border-left: 4px solid var(--harvey); } .node.louis { border-left: 4px solid var(--louis); }
.node.fuentes.unverified { border-style: dashed; color: var(--muted); }
.node.conclusiones { border-width: 2px; }
.node.conclusiones.favorable { border-color: var(--ok); } .node.conclusiones.desfavorable { border-color: var(--bad); }
.node.conclusiones.disputado { border-color: var(--warn); }
.node .meta { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.map.focus .node:not(.lit) { opacity: .28; }
.map.focus path.edge:not(.lit) { opacity: .08; }
path.edge { fill: none; stroke-width: 1.6; }
path.e-sustenta { stroke: var(--cite); }
path.e-apoya { stroke: var(--support); stroke-width: 2; }
path.e-ataca { stroke: var(--attack); stroke-width: 2; }
path.e-fundamenta { stroke: var(--basis); stroke-width: 2; }
path.unverified { stroke-dasharray: 5 4; }
.m-sustenta { fill: var(--cite); } .m-apoya { fill: var(--support); } .m-ataca { fill: var(--attack); } .m-fundamenta { fill: var(--basis); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin: 10px 2px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 5px; }
.detail { margin-top: 14px; }

/* Documents and laws */
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { min-width: 34px; text-align: center; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--ink); }
.pager a.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.page-text { font-family: var(--serif); font-size: 1rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
mark { background: var(--accent-soft); color: inherit; outline: 2px solid var(--accent); border-radius: 2px; }
.article { padding: 12px 0; border-top: 1px solid var(--line); }
.article.focus { background: var(--accent-soft); margin: 0 -16px; padding: 12px 16px; }
.article h3 { font-size: .95rem; }
.snippet { color: var(--muted); font-size: .9rem; }

.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.stat { display: flex; justify-content: space-between; font-size: .9rem; padding: 3px 0; }
.stat b { font-variant-numeric: tabular-nums; }

/* Login and onboarding */
.center { max-width: 460px; margin: 8vh auto; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

/* Cards that are direct grid cells line up; stacked cards inside a column keep their gap. */
.grid > .card + .card, .team > .card + .card { margin-top: 0; }
@media (max-width: 600px) {
  .brand span { display: none; }
  .top-inner { gap: 8px; }
  .nav a, .nav button { padding: 6px 8px; }
  h1 { font-size: 1.45rem; }
}
