:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #15171a;
  --ink-soft: #3a3d44;
  --muted: #6b6f78;
  --line: #e3e0d8;
  --line-strong: #c8c3b6;
  --critical: #b42318;
  --critical-bg: #fdecea;
  --warning: #a35200;
  --warning-bg: #fff2d6;
  --ok: #1f6f47;
  --ok-bg: #dff5e7;
  --info: #1a4f7a;
  --info-bg: #e1edf6;
  --neutral-bg: #ece8de;
  --shadow: 0 18px 70px rgba(20, 20, 20, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(26, 79, 122, .12), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(31, 111, 71, .12), transparent 28rem),
    linear-gradient(135deg, #fbfaf7 0%, var(--bg) 50%, #ece8de 100%);
  color: var(--ink);
  font: 14px/1.45 ui-sans-serif, "Segoe UI", system-ui, sans-serif;
}

a { color: var(--info); }
button, input { font: inherit; }
button {
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  padding: 12px 18px;
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: wait; }
button.secondary, .link-button {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
button.ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
}
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 800;
}
.link-button.strong { background: var(--ink); color: #fff; border-color: var(--ink); }

.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 900;
}
.muted { color: var(--muted); }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 34px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  font-weight: 900;
  margin-bottom: 18px;
}
.login-card h1 {
  margin: 8px 0 6px;
  font-size: 31px;
  letter-spacing: -.04em;
}
.login-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.login-form label {
  color: var(--ink-soft);
  font-weight: 800;
}
.login-form input {
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
}
.alert {
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid var(--critical-bg);
  border-radius: 12px;
  background: var(--critical-bg);
  color: var(--critical);
  font-weight: 800;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 4vw, 56px);
}
.app-header h1 {
  margin: 3px 0 0;
  font-size: clamp(26px, 4vw, 42px);
  letter-spacing: -.05em;
}
.home-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 56px;
}
.hero-card, .run-card, .status-card, .single-panel {
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card {
  padding: clamp(20px, 4vw, 42px);
  display: grid;
  gap: 22px;
}
.hero-copy h2 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 5vw, 58px);
  line-height: .98;
  letter-spacing: -.06em;
  max-width: 820px;
}
.imei-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 10px;
}
.imei-form input {
  height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 18px;
  background: #fff;
}
#imei-input {
  font: 800 22px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: -.02em;
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-card {
  margin-top: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--info);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-card p { margin: 3px 0 0; }

.single-results {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.single-panel {
  padding: clamp(16px, 3vw, 28px);
}
.single-panel .single-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.single-panel .single-title h3 {
  margin: 0;
  font: 900 18px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.run-card {
  margin-top: 14px;
  padding: 18px;
}
.run-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.run-head h3 { margin: 4px 0 0; font-size: 20px; }
#run-count {
  font: 900 20px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.progress-track {
  height: 10px;
  margin: 14px 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--neutral-bg);
}
#run-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--ok));
  transition: width .25s ease;
}
.run-events {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow: auto;
}
.run-event {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdfa;
}
.run-event .sev {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.run-event.critical .sev { color: var(--critical); }
.run-event.warning .sev { color: var(--warning); }
.run-event.ok .sev { color: var(--ok); }
.run-event .imei { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-weight: 800; }
.run-event .reasons { color: var(--muted); font-size: 12px; text-align: right; }

@media (max-width: 760px) {
  .app-header { align-items: flex-start; }
  .imei-form { grid-template-columns: 1fr; }
  .run-event { grid-template-columns: 1fr; }
  .run-event .reasons { text-align: left; }
}
