/* ============================================================================
   CRR Assessment — UI styles
   Restrained, professional Responsible-AI / governance SaaS look.
   Light background, dark typography, restrained blue/violet accents.
   ========================================================================== */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e5e8ef;
  --border-strong: #d4d9e3;

  --text: #171a23;
  --text-muted: #5b6474;
  --text-faint: #8a93a5;

  --primary: #4f46e5;          /* indigo */
  --primary-strong: #4338ca;
  --primary-soft: #eef0ff;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;

  /* risk-band colors */
  --strong: #16a34a;
  --strong-soft: #e9f8ef;
  --acceptable: #2563eb;
  --acceptable-soft: #eaf2ff;
  --material: #d97706;
  --material-soft: #fdf3e3;
  --high: #ea580c;
  --high-soft: #fdeee2;
  --critical: #dc2626;
  --critical-soft: #fdeaea;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(23, 26, 35, 0.05);
  --shadow: 0 1px 3px rgba(23, 26, 35, 0.07), 0 8px 24px -18px rgba(23, 26, 35, 0.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }

h1, h2, h3, h4 {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 0.5em;
}
h1 { font-size: 1.9rem; line-height: 1.2; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 1em; color: var(--text-muted); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.82rem; }
.mono { font-family: var(--mono); font-size: 0.86em; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.container--narrow { max-width: 820px; }

/* ------------------------------------------------------------------ header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c6ff0);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  letter-spacing: 0;
}
.brand-name { font-weight: 700; font-size: 1.02rem; color: var(--text); }
.brand-sub { font-size: 0.72rem; color: var(--text-faint); line-height: 1.2; }

.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--primary); background: var(--primary-soft); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 20px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); color: #fff; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ------------------------------------------------------------------ hero */
.hero {
  padding: 74px 0 66px;
  background:
    radial-gradient(1200px 480px at 50% -180px, #eef0ff 0%, rgba(238,240,255,0) 60%),
    var(--bg);
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #e2e5ff;
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 { font-size: 2.5rem; max-width: 760px; margin-bottom: 16px; }
.hero .lede { font-size: 1.12rem; max-width: 640px; color: var(--text-muted); margin-bottom: 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero-meta { margin-top: 26px; font-size: 0.82rem; color: var(--text-faint); }

/* ------------------------------------------------------------------ sections */
.section { padding: 52px 0; }
.section--tint { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: 30px; }
.section-head h2 { margin-bottom: 8px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: 6px; }
.card .icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem;
  margin-bottom: 12px;
}

.dim-card { display: flex; flex-direction: column; }
.dim-card .tag {
  font-size: 0.7rem; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.dim-card h3 { margin-bottom: 8px; }
.dim-card p { font-size: 0.86rem; margin: 0; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}
.badge--strong    { color: var(--strong); background: var(--strong-soft); border-color: #bfe7cf; }
.badge--acceptable{ color: var(--acceptable); background: var(--acceptable-soft); border-color: #c6d9ff; }
.badge--material  { color: var(--material); background: var(--material-soft); border-color: #f3dcae; }
.badge--high      { color: var(--high); background: var(--high-soft); border-color: #f6d4bc; }
.badge--critical  { color: var(--critical); background: var(--critical-soft); border-color: #f2c5c5; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--strong { background: var(--strong); }
.dot--acceptable { background: var(--acceptable); }
.dot--material { background: var(--material); }
.dot--high { background: var(--high); }
.dot--critical { background: var(--critical); }

/* ------------------------------------------------------------------ forms */
.form-card { max-width: 720px; }
.field { margin-bottom: 20px; }
.field label {
  display: block; font-weight: 600; font-size: 0.88rem;
  margin-bottom: 7px; color: var(--text);
}
.field .hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 5px; }
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 11px 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input[type="text"]:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { min-height: 84px; resize: vertical; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

/* ------------------------------------------------------------------ results */
.results-head { padding: 34px 0 26px; border-bottom: 1px solid var(--border); background: var(--surface); }
.results-head .title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.results-head h1 { font-size: 1.5rem; margin-bottom: 4px; }
.results-head .sub { color: var(--text-muted); font-size: 0.9rem; }

.overview { display: grid; grid-template-columns: 300px 1fr; gap: 24px; margin: 28px 0; align-items: start; }

.score-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.gauge { position: relative; width: 176px; height: 176px; margin: 0 auto 6px; }
.gauge svg { display: block; }
.gauge .gauge-value {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.gauge .gauge-value .num { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.gauge .gauge-value .lbl { font-size: 0.72rem; color: var(--text-faint); margin-top: 4px; }
.score-panel .risk-label { margin-top: 10px; }

.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-top: 18px;
}
.stat {
  background: var(--surface-2);
  border-radius: 10px; padding: 12px 14px; text-align: center;
}
.stat .v { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.stat .k { font-size: 0.72rem; color: var(--text-faint); }

.dims-panel {
  display: flex; flex-direction: column; gap: 14px;
}
.dim-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.dim-row-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dim-row-head .name { font-weight: 650; font-size: 0.98rem; }
.dim-row-head .score { font-weight: 700; font-size: 1.05rem; }

.bar {
  height: 8px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; margin-top: 10px;
}
.bar > span {
  display: block; height: 100%; border-radius: 999px;
  width: 0;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar > span.strong { background: var(--strong); }
.bar > span.acceptable { background: var(--acceptable); }
.bar > span.material { background: var(--material); }
.bar > span.high { background: var(--high); }
.bar > span.critical { background: var(--critical); }

/* list panels */
.list-panel { margin-top: 26px; }
.list-panel h2 { margin-bottom: 4px; }
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-top: 14px;
}
.finding {
  display: flex; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.finding:last-child { border-bottom: none; }
.finding .case-ref {
  flex: 0 0 auto; font-family: var(--mono); font-size: 0.76rem;
  color: var(--primary); background: var(--primary-soft);
  border-radius: 6px; padding: 2px 7px; height: fit-content;
}
.finding p { margin: 0; color: var(--text); font-size: 0.92rem; }

/* case table */
.case-table { width: 100%; border-collapse: collapse; }
.case-table th, .case-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 0.9rem; vertical-align: middle;
}
.case-table th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }
.case-table tr:hover td { background: var(--surface-2); }
.case-table .mono { font-size: 0.82rem; }
.case-link { font-weight: 600; }
.score-chip {
  display: inline-block; min-width: 52px; text-align: center;
  font-weight: 700; font-size: 0.9rem; padding: 3px 8px; border-radius: 7px;
}
.score-chip.strong { color: var(--strong); background: var(--strong-soft); }
.score-chip.acceptable { color: var(--acceptable); background: var(--acceptable-soft); }
.score-chip.material { color: var(--material); background: var(--material-soft); }
.score-chip.high { color: var(--high); background: var(--high-soft); }
.score-chip.critical { color: var(--critical); background: var(--critical-soft); }

/* ------------------------------------------------------------------ case detail */
.detail-hero { background: var(--surface); border-bottom: 1px solid var(--border); padding: 30px 0; }
.detail-hero .crumbs { font-size: 0.8rem; color: var(--text-faint); margin-bottom: 12px; }
.detail-hero h1 { font-size: 1.5rem; margin-bottom: 10px; }
.detail-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; }

.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; margin: 26px 0; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 18px; }
.detail-side { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 18px; }

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.block h3 { margin-bottom: 12px; }
.block .prompt, .block .response {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 14px 16px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  color: var(--text);
  margin: 0;
}

.dim-block { border-left: 3px solid var(--border-strong); }
.dim-block.strong { border-left-color: var(--strong); }
.dim-block.acceptable { border-left-color: var(--acceptable); }
.dim-block.material { border-left-color: var(--material); }
.dim-block.high { border-left-color: var(--high); }
.dim-block.critical { border-left-color: var(--critical); }

.dim-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.dim-block-head .name { font-weight: 650; }
.dim-block-head .score { font-weight: 700; font-size: 1.1rem; }

.criteria-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.criterion {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  background: var(--surface);
}
.criterion .pol {
  flex: 0 0 auto; font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 7px;
  border-radius: 5px; margin-top: 2px;
}
.criterion .pol--positive { color: var(--strong); background: var(--strong-soft); }
.criterion .pol--risk { color: var(--critical); background: var(--critical-soft); }
.criterion .txt { flex: 1 1 auto; font-size: 0.86rem; color: var(--text); }
.criterion .scr {
  flex: 0 0 auto; font-family: var(--mono); font-weight: 700; font-size: 0.86rem;
  color: var(--text-muted);
}

.evidence { margin-top: 10px; }
.evidence blockquote {
  margin: 8px 0 0; padding: 8px 12px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
  font-size: 0.86rem; color: var(--text);
  font-style: italic;
}
.reason { font-size: 0.9rem; color: var(--text-muted); margin-top: 8px; }
.risk-note {
  margin-top: 8px; font-size: 0.85rem; color: var(--high);
  background: var(--high-soft); border-radius: 8px; padding: 8px 12px;
}
.risk-note:empty { display: none; }

/* accordion */
.accordion-toggle {
  width: 100%; text-align: left; background: none; border: none;
  cursor: pointer; font: inherit; padding: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.accordion-toggle .chev { transition: transform 0.2s ease; color: var(--text-faint); }
.accordion.open .chev { transform: rotate(90deg); }
.accordion-body { display: none; }
.accordion.open .accordion-body { display: block; }

/* ------------------------------------------------------------------ footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 26px 0;
  margin-top: 50px;
}
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 28px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--text-faint);
}

/* ------------------------------------------------------------------ misc */
.empty {
  text-align: center; color: var(--text-faint);
  padding: 40px 20px; font-size: 0.9rem;
}

hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

/* ------------------------------------------------------------------ mode cards */
.mode-grid { align-items: stretch; }
.mode-card { display: flex; flex-direction: column; }
.mode-card > p { flex: 1 1 auto; }
.mode-card .btn { align-self: flex-start; margin-top: 4px; }
.mode-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.mode-icon {
  width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; font-size: 0.95rem;
}
.mode-head h2 { margin: 0; }
.mode-head .badge { margin-left: auto; }
.mode-card--pro { border-color: #dcd6ff; }
.badge--pro { color: #6d28d9; background: #efeaff; border-color: #ddd3ff; }

.mode-points { list-style: none; margin: 0 0 20px; padding: 0; }
.mode-points li { position: relative; padding-left: 18px; margin-bottom: 7px; color: var(--text-muted); font-size: 0.9rem; }
.mode-points li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}

/* ------------------------------------------------------------------ radio rows */
.radio-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px;
  margin-bottom: 8px; cursor: pointer; font-weight: 500;
}
.radio-row input { margin-top: 3px; }
.radio-row .hint { margin: 0; display: block; font-weight: 400; }

@media (max-width: 900px) {
  .overview { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .grid-3, .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .stat-row { grid-template-columns: 1fr; }
}
