:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #2a3240;
  --text: #e6edf3;
  --muted: #8b97a7;
  --accent: #4c8dff;
  --green: #2ea043;
  --red: #e5534b;
  --amber: #d29922;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 14px; }

/* Clause-stack brandmark — accent spine (the clause index) + green/amber/red
   verdict bars. Replaces the old "§" square. Sharp (square) tile. */
.logo {
  position: relative;
  width: 40px; height: 40px;
  background: #0b1018;
  border: 1px solid var(--border);
}
.logo-spine {
  position: absolute; left: 22%; top: 22%; bottom: 22%;
  width: 3px; background: var(--accent); border-radius: 999px;
}
.logo-bars {
  position: absolute; top: 22%; bottom: 22%; right: 22%; left: 39%;
  display: flex; flex-direction: column; justify-content: space-between;
}
.logo-bars i { height: 5px; border-radius: 999px; display: block; }
.logo-bars i:nth-child(1) { width: 100%; background: var(--green); }
.logo-bars i:nth-child(2) { width: 66%; background: var(--amber); }
.logo-bars i:nth-child(3) { width: 40%; background: var(--red); }

.title { font-weight: 700; font-size: 18px; }
.subtitle { color: var(--muted); font-size: 13px; }
.auth-slot { display: flex; align-items: center; gap: 10px; min-height: 36px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 24px; }
.banner {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .health-grid { grid-template-columns: 1fr; } }
.hrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 0;
}
.hrow .name { font-weight: 600; font-size: 14px; }
.hrow .note { color: var(--muted); font-size: 12px; }
.pill {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill.ok { background: rgba(46,160,67,0.15); color: var(--green); }
.pill.off { background: rgba(229,83,75,0.12); color: var(--red); }
.pill.warn { background: rgba(210,153,34,0.15); color: var(--amber); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.btn {
  background: var(--accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 0; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.phases { margin: 0; padding-left: 20px; font-size: 14px; }
.phases li { margin-bottom: 8px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
.google-slot { font-size: 14px; }

/* ---- Phase 1 workspace ---- */
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tab {
  background: transparent; border: none; color: var(--muted);
  padding: 8px 14px; border-radius: 0; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel-2); border: 1px solid var(--border); }

.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; }
.crumb-item { color: var(--accent); cursor: pointer; }
.crumb-item:last-child { color: var(--text); cursor: default; }
.crumb-sep { color: var(--muted); }

.createrow, .uploadrow { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.createrow input, .uploadrow input, .uploadrow select {
  flex: 1; min-width: 140px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 0; padding: 9px 12px; font-size: 14px;
}
.uploadbox { background: var(--panel-2); border: 1px solid var(--border); border-radius: 0; padding: 14px; margin-bottom: 16px; }
.prog { font-size: 13px; min-height: 20px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row.item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 0; cursor: pointer;
}
.row.item:hover { border-color: var(--accent); }
.row.item .chev { color: var(--muted); font-size: 18px; }

.clause { background: var(--panel-2); border: 1px solid var(--border); border-radius: 0; padding: 12px 14px; margin-bottom: 10px; }
.ctype { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 3px; }
.chead { font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.cbody { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.score { color: var(--green); }
.std, .stdtoggle { color: var(--amber); }
.stdtoggle { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-top: 8px; cursor: pointer; }

.braincols { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
@media (max-width: 720px) { .braincols { grid-template-columns: 1fr; } }
.typebtn.active { border-color: var(--accent); }
#bresults { margin-top: 10px; }
.del {
  background: transparent; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 4px 8px; margin-left: auto; border-radius: 0;
}
.del:hover { color: var(--red); background: rgba(229,83,75,0.12); }
.row.item .chev { margin-left: 8px; }

/* ---- Phase 2 compare findings ----
   Verdict color now reads as a medium line along the BASE of the card
   (was a 3px left rail). Square corners. */
.finding {
  position: relative; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 0; padding: 12px 14px; margin-bottom: 10px;
}
.finding::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 4px; background: transparent;
}
.finding.v-accepted::after { background: var(--green); }
.finding.v-deviation::after { background: var(--amber); }
.finding.v-novel::after { background: var(--red); }
.frow { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.frationale { font-size: 13px; margin-top: 7px; }
.fmatch { margin-top: 9px; padding: 8px 10px; border-left: 2px solid var(--border); background: var(--bg); border-radius: 0; }
#revbox { margin-top: 14px; }

/* ---- Phase 3 gate ---- */
.gatebanner { font-weight: 700; font-size: 18px; padding: 10px 16px; border-radius: 0; margin-bottom: 14px; display: inline-block; }
.gatebanner.pass { background: rgba(46,160,67,0.15); color: var(--green); }
.gatebanner.fail { background: rgba(229,83,75,0.15); color: var(--red); }

/* ---- Landing (signed-out) ---- */
.landing { max-width: 760px; margin: 0 auto; }
.hero { text-align: center; padding: 52px 16px 32px; }
.logo-lg { width: 64px; height: 64px; margin: 0 auto 22px; }
.logo-lg .logo-spine { width: 4px; }
.logo-lg .logo-bars i { height: 7px; }
.hero-title { font-size: 34px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.5px; }
.hero-tagline { color: var(--accent); font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.hero-sub { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 580px; margin: 0 auto 24px; }
.btn-lg { padding: 12px 30px; font-size: 15px; }
.hero-note { color: var(--muted); font-size: 12px; margin-top: 14px; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
@media (max-width: 640px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { background: var(--panel); border: 1px solid var(--border); padding: 16px; }
.feature-title { font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.feature-title::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.feature-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }
.srcmaster { color: var(--accent); font-weight: 600; }
