/* =========================================================
   IMEI SpeedCellOS · Dark Luxe (Cult UI inspired)
   ========================================================= */
:root {
  --bg-0: #07080d;
  --bg-1: #0c0e15;
  --bg-2: #11141d;
  --bg-3: #161a25;
  --bg-elev: rgba(255, 255, 255, 0.03);
  --bg-elev2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-0: #f4f4f5;
  --text-1: #d4d4d8;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --text-4: #52525b;
  --brand: #3b82f6;
  --brand-2: #60a5fa;
  --brand-3: #93c5fd;
  --brand-soft: rgba(59, 130, 246, 0.12);
  --brand-glow: rgba(59, 130, 246, 0.32);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*::selection { background: var(--brand-soft); color: var(--brand-3); }
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-0);
  color: var(--text-0);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'ss02', 'cv11';
}
body {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(circle at 88% 92%, rgba(99, 102, 241, 0.08), transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ========================= DOT GRID & ORBS ========================= */
.dot-grid {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.6;
}
.orb-blue { background: radial-gradient(circle, rgba(59, 130, 246, 0.6), transparent 70%); }
.orb-indigo { background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%); }

/* ========================= LOGIN ========================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 75%);
}
.login-wrap .orb-1 { top: -120px; left: -120px; width: 380px; height: 380px; background: radial-gradient(circle, rgba(59, 130, 246, 0.45), transparent 70%); filter: blur(110px); }
.login-wrap .orb-2 { bottom: -120px; right: -120px; width: 360px; height: 360px; background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 70%); filter: blur(110px); }

.login-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 38px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 30%);
  pointer-events: none;
}
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.02);
}
.login-brand .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand-glow);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
.login-card h1 {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin-bottom: 6px;
}
.login-card h1 em { font-style: italic; color: var(--brand-2); font-weight: 400; }
.login-card .sub {
  color: var(--text-2);
  font-size: 13.5px;
  margin-bottom: 28px;
}
.login-card label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 16px 0 8px;
}
.field {
  position: relative;
}
.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14.5px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-0);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.login-card input::placeholder { color: var(--text-4); }
.login-card input:focus {
  outline: none;
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.btn-shimmer {
  position: relative;
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 24px -8px var(--brand-glow), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
}
.btn-shimmer::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.btn-shimmer:hover::before { transform: translateX(100%); }
.btn-shimmer:hover { transform: translateY(-1px); box-shadow: 0 12px 32px -10px var(--brand-glow), 0 1px 0 rgba(255, 255, 255, 0.15) inset; }
.btn-shimmer:active { transform: translateY(0); }
.btn-shimmer:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.error-msg {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 13px;
  display: none;
}
.error-msg.show { display: block; }

/* ========================= APP SHELL ========================= */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.08), transparent 50%);
  pointer-events: none;
}
.sidebar > * { position: relative; }

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  width: fit-content;
  letter-spacing: -0.01em;
}
.brand-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand-glow);
  animation: pulse 2.2s ease-in-out infinite;
}
.brand-pill .name { color: var(--text-0); }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sidebar nav a svg { width: 18px; height: 18px; opacity: 0.7; flex: 0 0 18px; }
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-0);
}
.sidebar nav a.active {
  background: var(--brand-soft);
  color: var(--brand-3);
  border-color: rgba(59, 130, 246, 0.22);
}
.sidebar nav a.active svg { opacity: 1; color: var(--brand-2); }

.kpi-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.kpi-card .label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.kpi-card .val {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
  color: var(--text-0);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.kpi-card .sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.btn-ghost-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.btn-ghost-logout:hover { background: rgba(239, 68, 68, 0.08); color: #fca5a5; border-color: rgba(239, 68, 68, 0.2); }

/* ========================= MAIN ========================= */
.main {
  padding: 36px 44px 60px;
  overflow-y: auto;
  position: relative;
}
.page-header {
  margin-bottom: 26px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--brand-soft);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 14px;
}
.page-header h1 {
  font-family: 'Fraunces', serif;
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin-bottom: 8px;
}
.page-header h1 em { font-style: italic; color: var(--brand-2); font-weight: 400; }
.page-header p {
  color: var(--text-2);
  font-size: 14.5px;
  max-width: 70ch;
}

/* ========================= CARDS ========================= */
.glass-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.glass-card + .glass-card { margin-top: 18px; }
.glass-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.row-input {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}
.row-input input[type="text"], .row-input input[type="file"] {
  flex: 1;
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-0);
  font-size: 14.5px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.row-input input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.btn {
  padding: 13px 22px;
  background: linear-gradient(135deg, var(--brand) 0%, #6366f1 100%);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 6px 18px -6px var(--brand-glow), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
  white-space: nowrap;
}
.btn::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.25) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.btn:hover::before { transform: translateX(100%); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-0);
  box-shadow: none;
}
.btn.ghost::before { display: none; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--border-strong); }
.btn.danger {
  background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
  box-shadow: 0 6px 18px -6px rgba(239, 68, 68, 0.4);
}

/* ========================= SCANNER ========================= */
.scanner-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
}
.scanner-wrap video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.scanner-frame {
  position: absolute; inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-window {
  position: relative;
  width: 78%;
  height: 28%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  border-radius: 6px;
}
.scanner-window::before, .scanner-window::after,
.scanner-window > span:nth-child(1)::before, .scanner-window > span:nth-child(1)::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid var(--brand-2);
  filter: drop-shadow(0 0 8px var(--brand-glow));
}
.scanner-window::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.scanner-window::after { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.scanner-window > span:nth-child(1)::before { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.scanner-window > span:nth-child(1)::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.scanner-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-2) 50%, transparent);
  filter: drop-shadow(0 0 8px var(--brand-glow));
  top: 0;
  animation: scan-sweep 2.5s ease-in-out infinite;
}
@keyframes scan-sweep {
  0%, 100% { top: 0; opacity: 1; }
  50% { top: calc(100% - 2px); opacity: 1; }
}

.scanner-status {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  display: none;
}
.scanner-status.show { display: block; }

.scanner-controls {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.scanner-controls .upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 13px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.scanner-controls .upload:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--border-strong); }

/* ========================= RESULT ========================= */
.result-box {
  margin-top: 22px;
  padding: 22px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  display: none;
}
.result-box.show { display: block; }
.verdict {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.verdict svg { width: 22px; height: 22px; flex: 0 0 22px; }
.verdict.clean { background: var(--success-soft); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.22); }
.verdict.dirty { background: var(--danger-soft); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.22); }
.verdict.warn { background: var(--warning-soft); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.22); }
.warnings-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: var(--radius);
  color: #fde68a;
  font-size: 13px;
}
.warnings-box ul { margin: 0; padding-left: 20px; }
.warnings-box li { margin: 4px 0; }

.kv-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 10px 20px;
  font-size: 13.5px;
}
.kv-grid .k { color: var(--text-3); font-size: 12.5px; letter-spacing: 0.04em; }
.kv-grid .v { font-weight: 500; color: var(--text-0); font-family: 'JetBrains Mono', monospace; word-break: break-word; }
.kv-grid .v.ok { color: #4ade80; }
.kv-grid .v.bad { color: #fca5a5; }
.kv-grid .v.warn { color: #fcd34d; }
.info-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.info-section:first-of-type { border-top: 0; margin-top: 18px; padding-top: 0; }
.info-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-title::before {
  content: "";
  display: block;
  width: 18px;
  height: 1px;
  background: var(--border-strong);
}

/* ========================= TABLES ========================= */
.tbl-wrap { overflow-x: auto; }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl thead th {
  text-align: left;
  padding: 11px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  font-weight: 600;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
}
.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .mono { color: var(--text-0); }
.tbl a.pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--brand-soft);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: var(--brand-3);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s;
}
.tbl a.pdf-link:hover { background: rgba(59, 130, 246, 0.2); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pill.ok { background: var(--success-soft); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.22); }
.pill.bad { background: var(--danger-soft); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.22); }
.pill.warn { background: var(--warning-soft); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.22); }

/* ========================= SECTIONS ========================= */
.section { display: none; animation: fade-in 0.25s ease; }
.section.active { display: block; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================= MOBILE ========================= */
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px 14px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: rgba(12, 14, 21, 0.92);
    backdrop-filter: blur(16px);
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar nav { flex-direction: row; overflow-x: auto; flex: 1; }
  .sidebar nav a { padding: 8px 12px; font-size: 12.5px; white-space: nowrap; }
  .sidebar nav a svg { display: none; }
  .kpi-card { display: none; }
  .btn-ghost-logout { width: auto; padding: 8px 14px; }
  .main { padding: 22px 18px 48px; }
  .page-header h1 { font-size: 28px; }
  .scanner-wrap { aspect-ratio: 3 / 4; }
  .kv-grid { grid-template-columns: 1fr; gap: 6px; }
  .kv-grid .k { margin-top: 6px; }
}
