/* =====================================================================
   CaptainCheck — server-rendered UI
   Modern SaaS look · violet accent · light/dark via CSS variables
   ===================================================================== */

:root {
  /* brand / accent */
  --accent: #7c3aed;
  --accent-2: #6366f1;
  --accent-fg: #ffffff;
  --accent-soft: #f0ecfe;
  --accent-soft-fg: #5b21b6;
  --brand-ink: #002245;

  /* surfaces */
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e8eaf0;
  --border-strong: #d7dae3;
  --text: #0f1729;
  --muted: #64748b;

  /* status */
  --green: #15a34a; --green-soft: #dcfce7;
  --red: #e11d48;   --red-soft: #ffe4e6;
  --amber: #d97706; --amber-soft: #fef3c7;
  --orange: #ea580c;--orange-soft:#ffedd5;
  --gray-soft: #eef1f6; --gray-fg:#475569;

  /* shape */
  --radius: 14px;
  --radius-lg: 18px;
  --radius-sm: 10px;

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 6px 16px -4px rgba(16,24,40,.10), 0 2px 6px -2px rgba(16,24,40,.06);
  --shadow-lg: 0 16px 40px -12px rgba(16,24,40,.18), 0 6px 16px -8px rgba(16,24,40,.08);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
[data-theme="dark"] {
  --accent: #a78bfa;
  --accent-2: #818cf8;
  --accent-fg: #16121f;
  --accent-soft: #2a2440;
  --accent-soft-fg: #d6c9ff;
  --brand-ink: #cfdae6;

  --bg: #0a0c11;
  --surface: #14171f;
  --surface-2: #1a1e28;
  --border: #262b36;
  --border-strong: #333a48;
  --text: #e7eaf0;
  --muted: #97a1b2;

  --green:#34d399; --green-soft:#06371f;
  --red:#fb7185;   --red-soft:#3a1219;
  --amber:#fbbf24; --amber-soft:#3a2c06;
  --orange:#fb923c;--orange-soft:#3a1f06;
  --gray-soft:#1e2330; --gray-fg:#cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 6px 18px -6px rgba(0,0,0,.6);
  --shadow-lg: 0 18px 44px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-feature-settings: "cv02","cv03","cv04","cv11";
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(820px 460px at 100% -8%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(680px 380px at -8% -4%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

.container { width: 100%; max-width: 80rem; margin: 0 auto; padding: 0 1.1rem; }

/* ---- navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.navbar-inner { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.1rem; max-width: 80rem; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; gap: .15rem; }
.brand-logo { width: auto; transition: transform .2s ease; }
.brand:hover .brand-logo { transform: scale(1.05) rotate(-2deg); }
.brand-mark .brand-text { margin-left: -.1rem; }
.brand-text { font-weight: 800; font-size: 1.18rem; letter-spacing: -.02em; color: var(--brand-ink); }
.brand-logo-light { display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }

.nav-links { display: flex; gap: .1rem; margin-left: .6rem; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem;
  border-radius: 9px; color: var(--muted); font-size: .9rem; font-weight: 500; white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.nav-link:hover { background: var(--gray-soft); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }
.nav-link.active::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  width: 18px; height: 3px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.mobile-nav { display: none; gap: .25rem; overflow-x: auto; padding: .5rem 1rem; border-bottom: 1px solid var(--border); }
@media (max-width: 1000px) {
  .nav-links { display: none; }
  .mobile-nav { display: flex; }
}

/* ---- dropdown ---- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: .4rem; display: none; z-index: 60;
  transform-origin: top right; animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: block; width: 100%; text-align: left; padding: .55rem .65rem; border-radius: 8px;
  color: var(--text); font-size: .9rem; background: none; border: none; cursor: pointer; transition: background .12s ease;
}
.dropdown-item:hover { background: var(--gray-soft); text-decoration: none; }
.dropdown-item.danger { color: var(--red); }
.dropdown-sep { height: 1px; background: var(--border); margin: .35rem 0; }

/* ---- layout ---- */
main { padding: 1.6rem 0 3.5rem; min-height: calc(100vh - 60px); }
.page-title { font-size: 1.65rem; font-weight: 800; letter-spacing: -.025em; margin: 0 0 1.15rem; }
.subtitle { color: var(--muted); margin: -.6rem 0 1.2rem; }

/* ---- card ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow); transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.card + .card { margin-top: 1rem; }
/* Inside grids/stacks spacing comes from `gap`, so cancel the adjacent-card margin
   (otherwise the 2nd card in a grid row gets pushed down and rows look misaligned). */
.grid > .card + .card, .grid > .card, .stack > .card + .card { margin-top: 0; }
.card-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.card-title svg { color: var(--accent); }
.card-title.t-danger, .card-title.t-danger svg { color: var(--red); }
a > .card, .card.is-link { cursor: pointer; }
a > .card:hover, .card.is-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3,1fr);} }
@media (max-width: 860px) { .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace; }
.card-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-strong { font-weight: 600; color: var(--text); }

/* ---- forms ---- */
label { font-size: .85rem; font-weight: 600; display: block; margin-bottom: .4rem; color: var(--text); }
input, select, textarea {
  width: 100%; padding: .62rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: .92rem; font-family: inherit;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 160px; line-height: 1.6; }
.field { margin-bottom: 1rem; }
.field-row { display: flex; gap: .6rem; }
.field-row > .field { flex: 1; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; accent-color: var(--accent); }
.error-text { color: var(--red); font-size: .82rem; margin-top: .35rem; }

/* ---- buttons ---- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .62rem 1.05rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .9rem; font-weight: 600; cursor: pointer; background: var(--gray-soft); color: var(--text);
  text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, box-shadow .14s ease, filter .14s ease, background .14s ease, border-color .14s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(.5px) scale(.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--accent-2)));
  color: var(--accent-fg);
  box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 8px 20px -8px color-mix(in srgb, var(--accent) 65%, transparent);
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1.5px); box-shadow: 0 2px 6px rgba(16,24,40,.1), 0 14px 28px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-soft { background: var(--accent-soft); color: var(--accent-soft-fg); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 8px 20px -10px var(--red); }
.btn-danger:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-sm { padding: .38rem .65rem; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: grayscale(.2); }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .48rem .55rem; cursor: pointer; color: var(--text); display: inline-flex;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--gray-soft); border-color: var(--accent); color: var(--accent); }

/* ---- badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem;
  border-radius: 999px; font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  background: var(--gray-soft); color: var(--gray-fg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .8; flex: none;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-soft-fg); }
.badge-live, .badge-green { background: var(--green-soft); color: var(--green); }
.badge-dead, .badge-red { background: var(--red-soft); color: var(--red); }
.badge-checking, .badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-error, .badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-waiting { background: var(--gray-soft); color: var(--gray-fg); }
.badge-checking::before { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .72rem .9rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 700; color: var(--muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; }
th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }
tbody tr { transition: background .12s ease; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }

/* ---- stat tiles ---- */
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.3rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .95rem;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--accent), var(--accent-2)); opacity: .85; }
.stat-icon {
  flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-soft-fg);
}
.stat-body { min-width: 0; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat .value { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; margin-top: .15rem; line-height: 1.1; }
.stat.stat-green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat.stat-green::before { background: var(--green); }
.stat.stat-red .stat-icon { background: var(--red-soft); color: var(--red); }
.stat.stat-red::before { background: var(--red); }
.stat.stat-orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.stat.stat-orange::before { background: var(--orange); }

/* ---- progress ---- */
.progress { height: 10px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.06); }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s cubic-bezier(.4,0,.2,1); position: relative; }
.progress > span::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---- tabs ---- */
.tabs { display: inline-flex; gap: .2rem; background: var(--gray-soft); padding: .3rem; border-radius: 12px; }
.tab { padding: .45rem .95rem; border-radius: 9px; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--muted); border: none; background: transparent; transition: all .14s ease; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---- flash ---- */
.flash-wrap { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.flash { padding: .8rem 1.05rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; border: 1px solid var(--border); background: var(--surface); animation: slidein .25s ease; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.flash-success { border-left: 4px solid var(--green); }
.flash-error { border-left: 4px solid var(--red); }
.flash-info { border-left: 4px solid var(--accent); }

/* ---- auth ---- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  position: relative; overflow: hidden;
}
.auth-wrap::before, .auth-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; z-index: 0;
}
.auth-wrap::before { width: 460px; height: 460px; top: -160px; right: -120px; background: color-mix(in srgb, var(--accent) 45%, transparent); }
.auth-wrap::after { width: 380px; height: 380px; bottom: -150px; left: -120px; background: color-mix(in srgb, var(--accent-2) 40%, transparent); }
.auth-card { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-brand { display:flex; flex-direction: column; align-items:center; justify-content:center; gap:.7rem; margin-bottom: 1.6rem; }
.auth-logo { height: 88px; width: auto; filter: drop-shadow(0 8px 22px rgba(0,34,69,.22)); }
.auth-title { font-weight: 800; font-size: 1.55rem; letter-spacing: -.02em; color: var(--brand-ink); }
.auth-panel { box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); padding: 1.6rem; }

/* ---- callout ---- */
.callout { display:flex; gap:.7rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-soft-fg); margin-bottom: .85rem; border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.callout svg { flex: none; margin-top: .15rem; }

/* ---- hero ---- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 2.1rem 2.3rem; margin-bottom: 1.6rem;
  background:
    radial-gradient(420px 200px at 90% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 1.6rem;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 70%); filter: blur(10px);
}
.hero-logo { height: 96px; width: auto; flex: none; filter: drop-shadow(0 10px 24px rgba(0,34,69,.22)); position: relative; z-index: 1; }
.hero > div { position: relative; z-index: 1; }
.hero h1 { margin: 0 0 .4rem; font-size: 1.8rem; font-weight: 800; letter-spacing: -.03em; }
.hero p { margin: 0; color: var(--muted); }
.hero-actions { margin-top: 1.1rem; display: flex; gap: .6rem; flex-wrap: wrap; }
@media (max-width: 560px) { .hero { flex-direction: column; text-align: center; padding: 1.6rem; } .hero-actions { justify-content: center; } }

/* ---- pricing / plan cards ---- */
.plan-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.plan-card.is-promo { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-md); }
.plan-card.is-promo::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.plan-name { font-size: 1.1rem; font-weight: 700; }
.plan-price { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; margin: .35rem 0 .1rem; line-height: 1; }
.plan-price .cur { font-size: 1.1rem; font-weight: 700; color: var(--muted); vertical-align: super; }
.plan-price .old { font-size: 1rem; font-weight: 600; color: var(--muted); text-decoration: line-through; margin-left: .45rem; }
.plan-meta { display: flex; flex-direction: column; gap: .55rem; margin: 1.1rem 0 1.3rem; }
.plan-feat { display: flex; align-items: center; gap: .55rem; font-size: .9rem; color: var(--text); }
.plan-feat svg { color: var(--green); flex: none; }
.plan-card form { margin-top: auto; }

/* ---- misc ---- */
.empty { text-align: center; color: var(--muted); padding: 3.5rem 1rem; }
.empty svg { display: block; margin: 0 auto .9rem; color: color-mix(in srgb, var(--accent) 55%, var(--muted)); opacity: .7; }
.qr { background: #fff; padding: .9rem; border-radius: 14px; display: inline-block; box-shadow: var(--shadow-sm); }
.countdown { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.divider { height: 1px; background: var(--border); margin: 1.1rem 0; }
.pill-row { display:flex; flex-wrap: wrap; gap: .4rem; }
.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .8rem;
}
.batch-toolbar-left,
.batch-toolbar-right {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.batch-toolbar-left { min-width: 0; }
.batch-toolbar-right { justify-content: flex-end; margin-left: auto; }
.batch-per-page {
  align-items: center;
  padding: .18rem .25rem .18rem .55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.preview-toolbar {
  align-items: flex-start;
  padding: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: .75rem 0 1rem;
}
.preview-toolbar .batch-toolbar-left {
  flex-direction: column;
  align-items: flex-start;
  gap: .65rem;
}
.preview-toolbar .batch-toolbar-right { padding-top: .05rem; }
@media (max-width: 980px) {
  .batch-toolbar { align-items: flex-start; flex-direction: column; }
  .batch-toolbar-right { justify-content: flex-start; margin-left: 0; }
}
.kv { display:flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.bars { display:flex; flex-direction: column; gap: .7rem; }
.bar-row { display:flex; align-items:center; gap:.7rem; }
.bar-label { width: 120px; font-size: .85rem; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex:1; height: 12px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.06); }
.bar-fill { height:100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar-val { width: 86px; text-align: right; font-size: .82rem; color: var(--muted); flex: none; }
.hidden { display: none !important; }

/* ---- checker page ---- */
.checker-form { display: flex; flex-direction: column; gap: 1rem; }
.checker-actions { padding-top: .9rem; border-top: 1px solid var(--border); margin-top: .2rem; }
.mode-select { width: auto; min-width: 130px; }
.zip-col-input { width: 72px; padding: .45rem .5rem; }
.bulk-textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
.checker-single-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; }
.checker-single-grid .field { margin: 0; }
.checker-single-grid .col-full { grid-column: 1 / -1; }
@media (max-width: 640px) { .checker-single-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- country flags ---- */
.flag { display: inline-flex; align-items: center; gap: .45rem; }
.flag-emoji { font-size: 1.15rem; line-height: 1; }
.flag-img { width: 22px; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--border); flex: none; }

/* ---- faq accordion ---- */
details.card { transition: box-shadow .16s ease, border-color .16s ease; }
details.card[open] { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); box-shadow: var(--shadow-md); }
details.card summary {
  cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after {
  content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--accent); line-height: 1; transition: transform .2s ease; flex: none;
}
details.card[open] summary::after { transform: rotate(45deg); }

/* ---- support / tickets ---- */
.ticket-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}
.ticket-row:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--surface-2); transform: translateX(2px); }
.ticket-row-main { min-width: 0; }
.ticket-subject { font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.unread-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.chat-thread { display: flex; flex-direction: column; gap: .9rem; }
.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-admin { justify-content: flex-start; }
.chat-bubble { max-width: min(560px, 82%); padding: .7rem .9rem; border-radius: 14px; border: 1px solid var(--border); }
.chat-msg-user .chat-bubble { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, transparent); border-bottom-right-radius: 4px; }
.chat-msg-admin .chat-bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.chat-sender { font-weight: 700; font-size: .82rem; display: inline-flex; align-items: center; gap: .25rem; }
.chat-msg-admin .chat-sender { color: var(--accent); }
.chat-body { white-space: pre-wrap; word-break: break-word; font-size: .92rem; line-height: 1.55; }

/* ---- admin panel ---- */
.admin-navbar .nav-link { font-size: .88rem; }
.admin-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); background: var(--accent-soft); padding: .1rem .4rem; border-radius: 6px; margin-left: .15rem; }
.nav-badge { margin-left: .15rem; padding: .05rem .4rem; font-size: .68rem; }
.nav-badge::before { display: none; }
.nav-dropdown { position: relative; }
.nav-dropdown > .nav-link { border: none; background: transparent; cursor: pointer; font-family: inherit; }
.nav-dropdown .dropdown-menu { left: 0; right: auto; min-width: 180px; }
.dropdown-item.is-active { background: var(--accent-soft); color: var(--accent-soft-fg); }

/* dashboard charts */
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: .5rem; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.chart-bar { width: 100%; max-width: 34px; min-height: 3px; border-radius: 6px 6px 0 0; background: linear-gradient(var(--accent), var(--accent-2)); transition: height .5s cubic-bezier(.4,0,.2,1); }
.chart-bar-2 { background: linear-gradient(var(--accent-2), color-mix(in srgb, var(--accent-2) 60%, #22d3ee)); }
.chart-bar-green { background: linear-gradient(var(--green), color-mix(in srgb, var(--green) 70%, #4ade80)); }
.chart-val { font-size: .64rem; font-weight: 700; color: var(--text); white-space: nowrap; line-height: 1; margin-bottom: 1px; min-height: .8em; }
.chart-x { font-size: .62rem; color: var(--muted); white-space: nowrap; transform: rotate(-30deg); transform-origin: center; height: 1.2em; }
.chart-x-sm { font-size: .6rem; transform: none; }
/* dense mode (30/90-day ranges): thinner bars, sparse rotated labels, no value tags */
.chart-bars.dense { gap: 2px; }
.chart-bars.dense .chart-col { gap: 2px; }
.chart-bars.dense .chart-bar { border-radius: 3px 3px 0 0; }
.chart-bars.dense .chart-x { font-size: .55rem; transform: rotate(-45deg); }

/* result distribution */
.result-legend { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-bottom: .9rem; }
.result-legend > div { font-size: .9rem; }
.result-legend b { margin: 0 .15rem 0 .3rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: .3rem; vertical-align: middle; }
.dot-live { background: var(--green); } .dot-dead { background: var(--red); } .dot-unknown { background: var(--muted); }
.result-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--gray-soft); }
.result-bar .seg { height: 100%; transition: width .5s ease; }
.seg-live { background: var(--green); } .seg-dead { background: var(--red); } .seg-unknown { background: color-mix(in srgb, var(--muted) 55%, transparent); }

/* admin plan editor grid */
.admin-plan-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto auto; gap: .7rem; align-items: end; }
.admin-plan-grid .field { margin: 0; }
.admin-plan-flags { display: flex; flex-direction: column; gap: .3rem; white-space: nowrap; }
.admin-plan-save { min-width: 90px; }
@media (max-width: 980px) { .admin-plan-grid { grid-template-columns: repeat(2, 1fr); } .admin-plan-flags, .admin-plan-save { grid-column: 1 / -1; } }

/* ---- scrollbars ---- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
