/* Forgewatch portal — the "forge" identity, matching getforgewatch.com. */
:root {
  --forge-black: #0f0c0a;
  --char: #17120f;
  --iron: #211a15;
  --iron-2: #2c231c;
  --ash: #403227;
  --ember: #e4611c;
  --ember-bright: #fb8b3c;
  --ember-deep: #b23e0e;
  --ochre: #d9a441;
  --patina: #6fa096;
  --text: #f4ede4;
  --text-soft: #b7a897;
  --text-faint: #8a7a6c;
  --font-display: "Archivo", system-ui, sans-serif;
  --font-sans: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--forge-black);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--ember-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.kicker {
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.22em; font-size: 0.7rem; color: var(--ember-bright);
}
.display { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 800; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.98rem;
  padding: 0.72rem 1.3rem; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: background-color .14s, transform .14s, border-color .14s;
}
.btn-ember { background: var(--ember); color: #160f0a; box-shadow: 0 10px 30px -12px rgba(228,97,28,.6); }
.btn-ember:hover { background: var(--ember-bright); transform: translateY(-1px); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--ash); }
.btn-outline:hover { border-color: var(--ember); background: rgba(228,97,28,.08); text-decoration: none; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; position: relative; overflow: hidden; }
.heat {
  position: absolute; width: 34rem; height: 26rem; left: 50%; top: 10%;
  transform: translateX(-50%); border-radius: 50%; filter: blur(80px); opacity: .4;
  background: radial-gradient(circle, var(--ember) 0%, var(--ember-deep) 42%, transparent 70%);
  pointer-events: none;
}
.card {
  position: relative; width: 100%; max-width: 24rem;
  background: var(--iron); border: 1px solid var(--ash); border-radius: 14px;
  padding: 2rem 1.75rem;
}
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.brand-mark { width: 1.6rem; height: 1.6rem; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
label { display: block; font-size: .8rem; color: var(--text-soft); margin: 1rem 0 .35rem; }
input[type=email], input[type=password] {
  width: 100%; padding: .7rem .85rem; border-radius: 8px;
  background: var(--char); border: 1px solid var(--ash); color: var(--text);
  font-family: var(--font-sans); font-size: .98rem;
}
input:focus { outline: none; border-color: var(--ember); }
.btn-block { width: 100%; margin-top: 1.5rem; }
.flash { border-radius: 8px; padding: .65rem .85rem; font-size: .88rem; margin-bottom: .5rem; }
.flash-error { background: rgba(178,62,14,.16); border: 1px solid var(--ember-deep); color: var(--ember-bright); }

/* ---- App shell ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.5rem; border-bottom: 1px solid var(--ash); background: var(--char);
}
.topbar .who { color: var(--text-soft); font-size: .9rem; }
.topbar .who strong { color: var(--text); }
.container { max-width: 68rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-title { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; margin: .3rem 0 0; }

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat { background: var(--iron); border: 1px solid var(--ash); border-radius: 12px; padding: 1.1rem 1.2rem; }
.stat .num { font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1; }
.stat .lbl { color: var(--text-soft); font-size: .82rem; margin-top: .4rem; }
.stat.alert .num { color: var(--ember-bright); }

/* ---- Table ---- */
.panel { background: var(--iron); border: 1px solid var(--ash); border-radius: 12px; overflow: hidden; }
.panel h2 { font-family: var(--font-display); font-size: 1.1rem; margin: 0; padding: 1rem 1.2rem; border-bottom: 1px solid var(--ash); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .7rem 1.2rem; border-bottom: 1px solid var(--ash); vertical-align: top; }
th { color: var(--text-faint); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
tr:last-child td { border-bottom: none; }
td .sub { color: var(--text-faint); font-size: .8rem; }

.chip {
  display: inline-flex; align-items: center; font-family: var(--font-mono);
  font-size: .72rem; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--ash); color: var(--text-soft); background: var(--char);
}
.chip.ai { color: var(--ember-bright); border-color: var(--ember-deep); }
.risk { font-weight: 600; }
.risk-severe { color: #ff7a4d; }
.risk-significant { color: var(--ochre); }
.risk-limited, .risk-minimal, .risk-low { color: var(--patina); }
.muted { color: var(--text-faint); }
.empty { padding: 2.5rem 1.2rem; text-align: center; color: var(--text-soft); }

/* ---- Risk hero (donut + legend) ---- */
.lead { color: var(--text-soft); max-width: 60ch; margin: .5rem 0 1.5rem; }
.risk-hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2.5rem;
  background: var(--iron); border: 1px solid var(--ash); border-radius: 14px;
  padding: 1.75rem 2rem; margin: 1.5rem 0;
}
.donut-wrap { flex: 0 0 auto; }
.donut { width: 180px; height: 180px; }
.donut-num { font-family: var(--font-display); font-weight: 800; font-size: 34px; fill: var(--text); }
.donut-lbl { font-family: var(--font-mono); font-size: 11px; fill: var(--text-faint); letter-spacing: .1em; text-transform: uppercase; }
.risk-legend { flex: 1 1 20rem; min-width: 18rem; }
.legend-row { display: flex; align-items: baseline; gap: .7rem; padding: .45rem 0; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; flex: 0 0 auto; align-self: center; }
.legend-n { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; min-width: 1.6rem; }
.legend-t { color: var(--text-soft); font-size: .92rem; }
.legend-t strong { color: var(--text); }
.tier-red { background: #ff7a4d; }
.tier-yellow { background: var(--ochre); }
.tier-green { background: var(--patina); }
.cta { margin-top: 1.4rem; font-size: 1.02rem; }
.cta-badge {
  background: rgba(22,15,10,.35); color: #160f0a; font-family: var(--font-mono);
  font-size: .8rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; margin-left: .1rem;
}

/* ---- Chips as traffic-light tiers ---- */
.chip.tier-red { color: #ff9068; border-color: #b23e0e; background: rgba(255,122,77,.12); }
.chip.tier-yellow { color: var(--ochre); border-color: #a66a12; background: rgba(217,164,65,.12); }
.chip.tier-green { color: var(--patina); border-color: #3f6b5b; background: rgba(111,160,150,.12); }

/* ---- Remediation cards ---- */
.section-h { font-family: var(--font-display); font-size: 1.15rem; margin: 2rem 0 1rem; display: flex; align-items: center; gap: .6rem; }
.muted-h { color: var(--text-faint); }
.count-pill { font-family: var(--font-mono); font-size: .8rem; background: var(--char); border: 1px solid var(--ash); color: var(--text-soft); padding: .05rem .5rem; border-radius: 999px; }
.all-clear { background: rgba(111,160,150,.1); border: 1px solid #3f6b5b; color: var(--patina); border-radius: 12px; padding: 1.1rem 1.3rem; }

.rem-card { background: var(--iron); border: 1px solid var(--ash); border-left-width: 4px; border-radius: 12px; margin-bottom: .9rem; }
.tier-border-red { border-left-color: #ff7a4d; }
.tier-border-yellow { border-left-color: var(--ochre); }
.tier-border-green { border-left-color: var(--patina); }
.rem-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; }
.rem-title { flex: 1 1 auto; }
.rem-title strong { font-size: 1rem; }
.rem-status { font-family: var(--font-mono); font-size: .74rem; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; border: 1px solid var(--ash); color: var(--text-soft); }
.status-open { color: #ff9068; border-color: #b23e0e; }
.status-acknowledged { color: var(--ochre); border-color: #a66a12; }
.status-resolved { color: var(--patina); border-color: #3f6b5b; }
.status-accepted_risk { color: var(--text-faint); }

.rem-details { border-top: 1px solid var(--ash); }
.rem-details summary { cursor: pointer; padding: .7rem 1.2rem; color: var(--ember-bright); font-size: .9rem; user-select: none; }
.rem-details summary:hover { color: var(--ember); }
.rem-body { padding: 0 1.2rem 1.2rem; }
.rem-body p { color: var(--text-soft); }
.steps { background: var(--char); border: 1px solid var(--ash); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; font-family: var(--font-mono); font-size: .82rem; color: var(--text-soft); white-space: pre-wrap; }
.alt { color: var(--text-soft); }
.alt strong { color: var(--ember-bright); }
.resolved-note { font-size: .85rem; color: var(--text-faint); }

.rem-form { display: grid; gap: .5rem; max-width: 34rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--ash); }
.rem-form label { color: var(--text-soft); font-size: .82rem; }
.rem-form select, .rem-form textarea {
  width: 100%; margin-top: .3rem; padding: .55rem .7rem; border-radius: 8px;
  background: var(--char); border: 1px solid var(--ash); color: var(--text);
  font-family: var(--font-sans); font-size: .92rem;
}
.rem-form textarea { resize: vertical; }
.rem-form select:focus, .rem-form textarea:focus { outline: none; border-color: var(--ember); }
.rem-form button { justify-self: start; margin-top: .3rem; }

@media (max-width: 560px) { .risk-hero { gap: 1.5rem; padding: 1.25rem; } }

/* ---- Hero row (risk chart + insights side by side) ---- */
.hero-row { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1.5rem 0; align-items: stretch; }
.hero-row .risk-hero { margin: 0; flex: 3 1 24rem; }
.insights-card {
  flex: 1 1 17rem; background: var(--iron); border: 1px solid var(--ash);
  border-radius: 14px; padding: 1.4rem 1.5rem;
}
.ic-title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; margin: 0; }
.ic-sub { color: var(--text-faint); font-size: .78rem; margin: .2rem 0 1.1rem; }
.ic-block { margin-bottom: 1rem; }
.ic-label { display: block; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .1em; font-size: .68rem; color: var(--ember-bright); margin-bottom: .4rem; }
.ic-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .18rem 0; }
.ic-name { color: var(--text); font-weight: 600; font-size: .92rem; }
.ic-n { color: var(--text-faint); font-family: var(--font-mono); font-size: .78rem; white-space: nowrap; }
.ic-none { color: var(--text-faint); font-size: .85rem; }
.ic-hint { color: var(--text-soft); font-size: .82rem; margin-top: .25rem; }
.ic-hint strong { color: var(--ember-bright); }
.ic-experiment { border-top: 1px solid var(--ash); padding-top: 1rem; margin-bottom: 0; }
.scans-panel { margin: 0 0 1.5rem; }
