:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --border:    #2a2d3e;
  --text:      #e2e8f0;
  --muted:     #8892a4;
  --accent:    #6366f1;
  --green:     #22c55e;
  --yellow:    #eab308;
  --red:       #ef4444;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 900px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.header-title { display: flex; align-items: center; gap: 1rem; }
.header-icon { font-size: 2rem; }
h1 { font-size: 1.3rem; font-weight: 700; }
.header-sub { font-size: 0.8rem; color: var(--muted); }

.status-badge {
  padding: 0.35rem 0.85rem; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.status-checking { background: #2a2d3e; color: var(--muted); }
.status-ok       { background: rgba(34,197,94,0.15); color: var(--green); }
.status-error    { background: rgba(239,68,68,0.15); color: var(--red); }

/* Main */
main { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.4rem; }
.section-hint { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.2rem; }

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.label-text { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
input[type="number"] {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 0.55rem 0.75rem;
  font-size: 0.95rem; width: 100%;
  transition: border-color 0.2s;
}
input[type="number"]:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 0.75rem 2rem; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s, opacity 0.2s;
}
button:hover { background: #818cf8; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Risk display */
.risk-display {
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.risk-badge {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.5rem; border-radius: 8px; font-size: 1.1rem; font-weight: 700;
}
.risk-low    { background: rgba(34,197,94,0.15); color: var(--green); }
.risk-medium { background: rgba(234,179,8,0.15);  color: var(--yellow); }
.risk-high   { background: rgba(239,68,68,0.15);  color: var(--red); }

.probability-display { text-align: center; }
.prob-number { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.prob-label  { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }
.threshold-info { font-size: 0.82rem; color: var(--muted); }

.cost-warning {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px; padding: 0.75rem 1rem;
  font-size: 0.9rem; color: var(--red);
  margin-bottom: 1rem;
}

/* SHAP bars */
.shap-section h3 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.shap-bars { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; }
.shap-row { display: grid; grid-template-columns: 180px 1fr 70px; align-items: center; gap: 0.75rem; font-size: 0.82rem; }
.shap-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shap-bar-track { background: var(--border); border-radius: 4px; height: 8px; overflow: hidden; }
.shap-bar-fill { height: 100%; border-radius: 4px; min-width: 2px; transition: width 0.4s ease; }
.shap-bar-fill.risk-up   { background: var(--red); }
.shap-bar-fill.risk-down { background: var(--green); }
.shap-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Info grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; margin-top: 1rem; }
.info-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1.2rem; }
.info-icon { font-size: 1.6rem; margin-bottom: 0.6rem; }
.info-item h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.4rem; }
.info-item p { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }
code { background: var(--border); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.8rem; }

/* Footer */
footer { text-align: center; padding: 2rem; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); }
footer a { color: var(--accent); text-decoration: none; }

.hidden { display: none !important; }
