:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 10px 30px rgba(2, 6, 23, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Heebo", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, #1e3a8a 0%, var(--bg) 45%) fixed;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 28px; color: #e2e8f0;
}
.brand { display: flex; align-items: center; gap: 14px; }
.shield { font-size: 34px; filter: drop-shadow(0 4px 10px rgba(37,99,235,.5)); }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.tagline { margin: 2px 0 0; font-size: 12.5px; color: #94a3b8; }
.health {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  background: rgba(255,255,255,.06); padding: 7px 13px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; }
.dot.ok { background: var(--good); box-shadow: 0 0 0 4px rgba(22,163,74,.18); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(220,38,38,.18); }

/* Layout */
.layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
  max-width: 1180px; margin: 8px auto 0; padding: 12px 28px 28px;
}
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border-radius: 18px; padding: 20px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

textarea {
  width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font: inherit; font-size: 14px; line-height: 1.7; color: var(--ink);
  background: #f8fafc; min-height: 280px; direction: rtl;
}
textarea:focus { outline: none; border-color: var(--brand); background: #fff; }

.controls { display: flex; align-items: flex-end; gap: 12px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
select {
  font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); min-width: 190px;
}

button { cursor: pointer; font: inherit; border: none; border-radius: 10px; }
.primary {
  flex: 1; background: var(--brand); color: #fff; font-weight: 700; padding: 11px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s, transform .05s;
}
.primary:hover { background: var(--brand-ink); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: progress; }
.ghost {
  background: #eff6ff; color: var(--brand-ink); font-weight: 600; padding: 8px 14px;
  border: 1px solid #dbeafe;
}
.ghost:hover { background: #dbeafe; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.privacy-note {
  margin: 14px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7;
  background: #f1f5f9; border-radius: 10px; padding: 11px 13px;
}

/* Placeholder */
.placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); padding: 40px 20px; min-height: 280px;
}
.placeholder .big { font-size: 42px; margin-bottom: 12px; }
.placeholder p { max-width: 320px; line-height: 1.7; }

/* Alerts */
.alert { border-radius: 12px; padding: 13px 15px; font-size: 14px; line-height: 1.6; margin-bottom: 14px; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Result groups */
.meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.meta-line b { color: var(--ink); font-weight: 600; }

.group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.group > h3 {
  margin: 0; font-size: 13.5px; font-weight: 700; padding: 10px 14px;
  background: #f8fafc; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center;
}
.row { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; font-size: 14px; }
.row + .row { border-top: 1px dashed var(--line); }
.row .k { color: var(--muted); }
.row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.row .v.null { color: #cbd5e1; font-weight: 400; font-style: italic; }
.row.total { background: #eff6ff; }
.row.total .k, .row.total .v { color: var(--brand-ink); font-weight: 800; }

.notes { margin-top: 4px; }
.notes ul { margin: 6px 0 0; padding-inline-start: 20px; }
.notes li { font-size: 13px; line-height: 1.6; color: #92400e; }
.ok-banner {
  background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; border-radius: 12px;
  padding: 11px 14px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
}

.foot {
  text-align: center; color: #94a3b8; font-size: 12.5px; padding: 6px 0 26px;
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
