:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #939aab;
  --accent: #4da3ff;
  --green: #3fbf7f;
  --green-dim: #2b8f5e;
  --cyan: #38bec9;
  --yellow: #d9a441;
  --magenta: #b57edc;
  --red: #e5484d;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-2: #f0f2f5;
    --line: #dde1e8;
    --text: #14171f;
    --muted: #5f6775;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: .2px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 10px var(--green);
}

/* The ceiling notice is permanent on purpose: the tool should never let you
   forget what free-mode data cannot see. */
.modeflag {
  font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; background: var(--panel-2);
}
.modeflag strong { color: var(--yellow); margin-right: 8px; }

main { max-width: 1180px; margin: 0 auto; padding: 22px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .3px; color: var(--muted); font-weight: 600; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); }

.drop {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--panel-2); }
.drop p { margin: 4px 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin: 14px 0;
}
.stat {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px;
}
.stat .n { font-size: 21px; font-weight: 600; }
.stat .k { font-size: 12px; color: var(--muted); }

.costline { margin: 14px 0; font-size: 15px; }
.cost-zero { color: var(--green); font-weight: 700; font-size: 18px; }

button.primary {
  background: var(--accent); color: #06121f; border: 0;
  border-radius: 8px; padding: 10px 18px;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: .5; cursor: not-allowed; }

.progress {
  height: 8px; background: var(--panel-2);
  border-radius: 999px; overflow: hidden; margin-bottom: 10px;
}
.bar { height: 100%; width: 0%; background: var(--accent); transition: width .3s; }
.bar.failed { background: var(--red); }

/* Quota exhaustion must be impossible to miss - full-width red, not a chip. */
.halt { border-color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--panel)); }
.halt h2 { color: var(--red); }
.halt pre {
  white-space: pre-wrap; font-size: 13px; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.assessment {
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 13.5px; white-space: pre-wrap;
}

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px;
  cursor: pointer; font-size: 13px; color: var(--text);
}
.tab.active { border-color: var(--accent); color: var(--accent); }
.tab .c { color: var(--muted); margin-left: 6px; }

.exportbar {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.exportbar label { font-size: 13px; color: var(--muted); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
td.ev { color: var(--muted); font-size: 12px; max-width: 420px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.b-MOBILE { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.b-MOBILE_LIKELY { background: color-mix(in srgb, var(--green-dim) 22%, transparent); color: var(--green-dim); }
.b-SMS_CAPABLE { background: color-mix(in srgb, var(--cyan) 20%, transparent); color: var(--cyan); }
.b-NOT_MOBILE { background: color-mix(in srgb, var(--yellow) 20%, transparent); color: var(--yellow); }
.b-UNKNOWN { background: color-mix(in srgb, var(--magenta) 20%, transparent); color: var(--magenta); }
.b-NOT_VERIFIED { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.b-INVALID { background: var(--panel-2); color: var(--muted); }

.capped { color: var(--yellow); cursor: help; }
.conflict { color: var(--magenta); font-size: 11px; }

/* ------------------------------------------------------------ hosted app */

.topbar .right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand img { display: block; }
.center { justify-content: center; text-align: center; }

button.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 13px; font-size: 13px; cursor: pointer;
}
button.ghost:hover { color: var(--text); border-color: var(--muted); }
button.wide { width: 100%; }

/* Login */
.loginwrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 22px;
}
.logincard {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 30px 26px;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 14px;
}
.logincard .brand { justify-content: center; }
.logincard input[type="password"] {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 13px;
  color: var(--text); font-size: 15px; width: 100%;
}
.logincard input[type="password"]:focus {
  outline: none; border-color: var(--accent);
}

/* Mobile - this gets used from a laptop and phone while dialling */
@media (max-width: 720px) {
  main { padding: 14px; }
  .card { padding: 15px; border-radius: 10px; }
  .topbar { padding: 11px 14px; }
  .modeflag { font-size: 11.5px; }
  table { font-size: 12px; }
  td.ev { display: none; }          /* evidence is unreadable on a phone */
  th:last-child { display: none; }
  .drop { padding: 26px 14px; }
}
