/* SunuSpeed v2 — design system partagé (palette SunuTechnology bleu & blanc) */

:root {
  --paper: #FFFFFF;
  --surface: #F3F6FC;
  --panel: #FFFFFF;
  --ink: #0E1B33;
  --muted: #5C6B85;
  --line: #E1E7F2;
  --deep: #16337E;
  --blue: #2563EB;
  --sky: #4E9BFF;
  --good: #1B9C63;
  --bad: #DC5B5B;
  --font-display: 'Plus Jakarta Sans', ui-sans-serif, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0A1220;
  --surface: #0F1A2E;
  --panel: #101B31;
  --ink: #EEF2FB;
  --muted: #93A2C2;
  --line: #223257;
  --deep: #274A9E;
  --blue: #6FA0FF;
  --sky: #6FA0FF;
  --good: #34D399;
  --bad: #F87171;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0A1220; --surface: #0F1A2E; --panel: #101B31; --ink: #EEF2FB;
    --muted: #93A2C2; --line: #223257; --deep: #274A9E; --blue: #6FA0FF; --sky: #6FA0FF;
    --good: #34D399; --bad: #F87171; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--surface);
  background-image:
    radial-gradient(900px 480px at 12% -8%, color-mix(in srgb, var(--blue) 12%, transparent), transparent 60%),
    radial-gradient(760px 440px at 100% 6%, color-mix(in srgb, var(--deep) 11%, transparent), transparent 55%),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--deep) 9%, transparent) 1px, transparent 0);
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 24px 24px;
  background-attachment: fixed, fixed, fixed;
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
@media (max-width: 760px) {
  /* fixed backgrounds are unreliable in mobile Safari during scroll */
  body { background-attachment: scroll, scroll, scroll; }
}
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
img { max-width: 100%; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); }

/* ---------- Logo ---------- */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; margin-right: 8px; }
.logo img {
  height: 44px; width: auto; display: block;
  /* SPEED half of the artwork is a white fill on transparent bg; this fakes a 1px outline
     in --ink so it stays legible on the light-theme white header, and is subtle on dark. */
  filter: drop-shadow(1px 0 0 var(--ink)) drop-shadow(-1px 0 0 var(--ink)) drop-shadow(0 1px 0 var(--ink)) drop-shadow(0 -1px 0 var(--ink));
}

/* ---------- Nav ---------- */
nav.top {
  border-bottom: 1px solid var(--line);
  position: relative;
}
.header-container {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 20px;
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 12px clamp(20px, 4vw, 40px);
}
.nav-toggle {
  display: none; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; flex: none;
}
.nav-toggle svg { width: 20px; height: 20px; }
/* .nav-menu is a single flex item (right block): everything except the logo lives inside it,
   so justify-content:space-between on .header-container always pins the logo flush left. */
.nav-menu { display: flex; align-items: center; gap: clamp(24px, 3vw, 48px); }
.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 0.925rem; font-weight: 600; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.lang-switch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); flex: none;
  transition: border-color .15s ease;
}
.lang-switch .flag { width: 20px; height: 15px; border-radius: 2px; display: block; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.lang-switch:hover { border-color: var(--blue); }
.btn-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; background: var(--deep); color: #fff; font-size: 0.85rem; font-weight: 700;
  padding: 10px 20px; border-radius: 999px; border: none; cursor: pointer; font-family: var(--font-display);
}
.btn-pill:hover { filter: brightness(1.08); }
.btn-pill.outline { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.account-wrap { position: relative; }
.avatar-btn {
  border: none; cursor: pointer; background: transparent; padding: 0;
  display: flex; align-items: center; gap: 10px;
}
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--deep), var(--sky));
  color: #fff; font-weight: 700; font-size: 0.9rem; display: grid; place-items: center;
}
.avatar-name { display: none; font-size: 0.9rem; font-weight: 700; color: var(--ink); }
.account-dropdown {
  position: absolute; top: calc(100% + 12px); right: 0; width: 260px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px -12px rgba(14,27,51,.28); padding: 8px; display: none; z-index: 200;
}
.account-dropdown.open { display: block; }
.account-dropdown .head {
  padding: 12px 12px 10px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.account-dropdown a {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  font-size: 0.9rem; font-weight: 600; padding: 10px 12px; border-radius: 9px;
}
.account-dropdown a:hover { background: var(--surface); }
.account-dropdown a svg { width: 17px; height: 17px; color: var(--blue); flex: none; }
.account-dropdown hr { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }
.account-dropdown a.danger svg { color: var(--bad); }

/* ---------- Mobile nav (hamburger menu) ---------- */
@media (max-width: 900px) {
  .header-container { padding: 10px 16px; }
  .logo { margin-right: 4px; }
  .logo img { height: 32px; }
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    display: none; flex-direction: column; align-items: stretch; gap: 4px;
    width: 100%; order: 3; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  }
  .nav-menu.open { display: flex; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-links a { padding: 11px 6px; font-size: 1rem; border-radius: 8px; }
  .nav-links a:hover, .nav-links a.active { background: var(--surface); }
  .nav-right { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 10px; }
  .lang-switch { align-self: center; }
  .nav-right .btn-pill { width: 100%; padding: 12px 20px; }
  .account-wrap { width: 100%; }
  .avatar-btn { width: 100%; padding: 8px 6px; border-radius: 10px; }
  .avatar-btn:hover { background: var(--surface); }
  .avatar-name { display: block; }
  .account-dropdown { position: static; width: 100%; box-shadow: none; border: none; padding: 4px 0 0; margin-top: 4px; }
  .account-dropdown.open { display: block; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(10px, 1.6vw, 16px) 0 2px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); font-weight: 600;
}
.eyebrow::before { content:""; width:7px; height:7px; border-radius:50%; background: var(--blue); }
.hero h1 {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem); line-height: 1.2; font-weight: 800; letter-spacing: -0.015em;
  margin: 8px auto 0; max-width: 44ch;
}
.hero h1 .accent { color: var(--blue); }
.hero-sub { margin: 6px auto 0; color: var(--muted); font-size: 0.92rem; max-width: 50ch; line-height: 1.5; }

/* ---------- Results dashboard : panneau unifié façon nPerf ---------- */
.dashboard-panel {
  margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  overflow: hidden; text-align: left;
}
.panel-top {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
.gauge-col {
  padding: clamp(16px, 2vw, 26px) clamp(12px, 1.8vw, 22px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
}
.gauge-col::before {
  content: "";
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, 96%); aspect-ratio: 1 / 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--blue) 10%, transparent) 0%, transparent 68%);
  pointer-events: none;
}
.chart-col {
  padding: clamp(12px, 1.6vw, 18px) clamp(14px, 2vw, 20px);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 200px;
}
.phase-label {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 2px; height: 1.2em; text-align: center;
}
.phase-label .dl { color: var(--blue); }
.phase-label .ul { color: var(--deep); }
.dial-wrap { position: relative; width: min(400px, 92%); z-index: 1; }
.dial-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.tick-label { font-family: var(--font-mono); font-size: 12px; fill: var(--muted); text-anchor: middle; }
.dial-arc-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.dial-arc-fg { fill: none; stroke: url(#dialGrad); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.needle { transform-origin: 200px 210px; transition: transform .25s cubic-bezier(.4,1.4,.6,1); }
.needle polygon { fill: var(--ink); }
.needle circle { fill: var(--ink); }
.hub {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  width: 34%; height: 34%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--deep), #0B1830);
  color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-align: center; font-family: var(--font-display); font-weight: 800; font-size: clamp(0.7rem, 1.7vw, 0.9rem);
  letter-spacing: 0.01em; box-shadow: 0 16px 30px -10px rgba(22,51,126,.55), inset 0 0 0 6px rgba(255,255,255,.06);
}
:root[data-theme="dark"] .hub { background: radial-gradient(circle at 35% 30%, var(--sky), #05070d); }
@media (prefers-color-scheme: dark) { .hub { background: radial-gradient(circle at 35% 30%, var(--sky), #05070d); } }
.hub:disabled { cursor: progress; opacity: 0.6; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.68rem;
  font-weight: 600; color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); padding: 3px 9px; border-radius: 999px; flex: none;
  margin-top: 4px;
}
.status-pill::before { content:""; width:6px; height:6px; border-radius:50%; background: var(--good); }
.status-pill.offline { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.status-pill.offline::before { background: var(--bad); }

.chart-legend { display: flex; align-items: center; gap: 18px; font-size: 0.76rem; font-weight: 600; color: var(--muted); }
.chart-legend .dot { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .dot::before { content:""; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.chart-legend .dl-dot { --dot: var(--blue); }
.chart-legend .ul-dot { --dot: var(--ink); }
.chart-col canvas { flex: 1; width: 100%; margin-top: 8px; min-height: 120px; }
.chart-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.82rem; text-align: center; padding: 12px; }

.panel-bottom {
  display: flex; border-top: 1px solid var(--line);
}
.stat-seg {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 12px clamp(10px, 1.6vw, 18px); border-left: 1px solid var(--line);
}
.stat-seg:first-child { border-left: none; }
.stat-seg .icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--surface); color: var(--blue);
}
.stat-seg .icon svg { width: 16px; height: 16px; }
.stat-seg .body { min-width: 0; }
.stat-seg .lbl { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-seg .val { margin-top: 2px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 800; font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-seg .val .unit { font-size: 0.62rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat-seg .sub-val { margin-top: 1px; font-size: 0.7rem; color: var(--muted); font-family: var(--font-mono); }
.stat-seg.isp-seg .ip-val { font-size: 0.85rem; font-weight: 700; }
.stat-seg.server-seg .server-val { font-size: 0.8rem; }

@media (max-width: 860px) {
  .panel-top { grid-template-columns: 1fr; }
  .chart-col { border-left: none; border-top: 1px solid var(--line); min-height: 0; }
  .panel-bottom { flex-wrap: wrap; }
  .stat-seg { flex: 1 1 50%; border-top: 1px solid var(--line); }
  .stat-seg:nth-child(odd) { border-left: none; }
  .stat-seg:nth-child(-n+2) { border-top: none; }
}

@media (max-width: 560px) {
  .dashboard-panel { margin-top: 10px; border-radius: 18px; }
  .gauge-col { padding: 8px 10px 6px; }
  .dial-wrap { width: min(210px, 58vw); }
  .hub { font-size: 0.62rem; }
  .chart-col { padding: 10px 12px; min-height: 0; }
  .chart-col canvas { min-height: 64px; margin-top: 4px; }
  .chart-legend { font-size: 0.7rem; gap: 12px; }
  .stat-seg { padding: 8px 10px; gap: 6px; }
  .stat-seg .icon { width: 26px; height: 26px; border-radius: 7px; }
  .stat-seg .icon svg { width: 13px; height: 13px; }
  .stat-seg .val { font-size: 0.95rem; }
  .stat-seg.server-seg { display: none; }
}

.demo-note { text-align: center; font-size: 0.73rem; color: var(--muted); margin: 8px auto 0; max-width: 46ch; }
.save-notice {
  margin: 6px auto 0; max-width: 46ch; text-align: center; font-size: 0.8rem; font-weight: 600;
  color: var(--good); display: none;
}
.save-notice.visible { display: block; }

/* ---------- Share results ---------- */
.share-card {
  width: 95%; max-width: 30em; margin: 24px auto 0; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
}
.share-card h3 { font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; }
.share-card .share-sub { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.share-preview {
  margin-top: 16px; width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block;
  background: var(--surface);
}
.share-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.78rem; background: var(--surface); color: var(--ink);
}
.share-link-row .btn-sm { flex: none; padding: 0 14px; }
.share-actions .btn-pill { width: 100%; }
.share-copied-msg {
  font-size: 0.76rem; font-weight: 700; color: var(--good); display: none; margin-top: -2px;
}
.share-copied-msg.visible { display: block; }

/* ---------- Public result page ---------- */
.result-hero { text-align: center; padding: 48px 0 8px; }
.result-hero h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 800; letter-spacing: -0.02em; }
.result-hero .meta-line { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
.result-hero .meta-line span + span::before { content: '•'; margin: 0 8px; color: var(--line); }
.result-not-found { text-align: center; padding: 90px 0; }
.result-not-found h1 { font-size: 1.6rem; font-weight: 800; }
.result-not-found p { margin-top: 10px; color: var(--muted); }
.result-not-found .btn-pill { margin-top: 22px; display: inline-flex; }

/* ---------- PWA install banner ---------- */
.install-banner { background: var(--panel); border-bottom: 1px solid var(--line); }
.install-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.install-banner-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.install-banner-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; display: block; }
.install-banner-title { font-weight: 700; font-size: 0.92rem; color: var(--ink); }
.install-banner-desc { margin-top: 2px; font-size: 0.8rem; color: var(--muted); }
.install-banner-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.install-banner-close {
  border: none; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1;
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
}
.install-banner-close:hover { background: var(--surface); color: var(--ink); }
@media (max-width: 640px) {
  .install-banner-desc { display: none; }
}

/* ---------- Cross-promo (SunuCyberSecurity bridge) ---------- */
.cross-promo {
  width: 95%; max-width: 30em; margin: 16px auto 0; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
}
.cross-promo .icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--surface); color: var(--deep);
  display: grid; place-items: center; margin: 0 auto 12px;
}
.cross-promo .icon svg { width: 20px; height: 20px; }
.cross-promo h3 { font-size: 0.95rem; font-weight: 800; }
.cross-promo p { margin-top: 6px; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.cross-promo .btn-pill { margin-top: 14px; width: 100%; }

/* ---------- Sections / cards ---------- */
.section { padding: clamp(56px, 8vw, 92px) 0; }
.section-head { max-width: 60ch; }
.section-head h2 { margin-top: 12px; font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 800; letter-spacing: -0.015em; }
.section-head p { margin-top: 12px; color: var(--muted); font-size: 1rem; line-height: 1.6; }

.card-grid { margin-top: 32px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .card-grid { grid-template-columns: 1fr; } }
.spec-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.spec-card .icon {
  width: 42px; height: 42px; border-radius: 11px; background: var(--surface); display: grid; place-items: center;
  color: var(--deep); margin-bottom: 18px;
}
:root[data-theme="dark"] .spec-card .icon { color: var(--sky); }
@media (prefers-color-scheme: dark) { .spec-card .icon { color: var(--sky); } }
.spec-card .icon svg { width: 22px; height: 22px; }
.spec-card h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.spec-card p { margin-top: 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.spec-card .tags { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.spec-card .tags span {
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px;
}

/* ---------- Auth / form pages ---------- */
.auth-shell { min-height: calc(100vh - 200px); display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: clamp(28px, 5vw, 40px); }
.auth-card h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.015em; }
.auth-card .auth-sub { margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.field { margin-top: 18px; text-align: left; }
.field label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.field input {
  width: 100%; font-family: var(--font-display); font-size: 0.95rem; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
.field-hint { margin-top: 6px; font-size: 0.76rem; color: var(--muted); }
.form-actions { margin-top: 24px; }
.form-actions .btn-pill { width: 100%; padding: 12px 20px; font-size: 0.9rem; }
.form-footer { margin-top: 18px; text-align: center; font-size: 0.86rem; color: var(--muted); }
.form-footer a { color: var(--blue); font-weight: 700; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }
.alert { margin-top: 18px; padding: 11px 14px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; text-align: left; }
.alert.error { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.success { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); }

/* ---------- Account / history page ---------- */
.account-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 30px; }
.account-header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.015em; }
.account-header p { margin-top: 4px; color: var(--muted); font-size: 0.92rem; }
.history-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
table.history-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 560px; }
table.history-table th, table.history-table td {
  text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.history-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
table.history-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.history-table tr:last-child td { border-bottom: none; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .btn-pill { margin-top: 18px; display: inline-flex; }

@media (max-width: 640px) {
  .account-header { flex-direction: column; align-items: stretch; text-align: center; }
  .account-header .btn-pill { width: 100%; }

  /* On phones, turn the results table into a stack of cards instead of a scrolling table */
  .history-table-wrap:has(.history-table--cards) { overflow-x: visible; border: none; background: transparent; }
  table.history-table--cards { min-width: 0; display: block; }
  table.history-table--cards thead { display: none; }
  table.history-table--cards tbody { display: block; }
  table.history-table--cards tr {
    display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
    padding: 6px 16px; margin-bottom: 12px;
  }
  table.history-table--cards tr:last-child { margin-bottom: 0; }
  table.history-table--cards td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 0; border-bottom: 1px solid var(--line); white-space: normal; text-align: right;
  }
  table.history-table--cards tr td:last-child { border-bottom: none; }
  table.history-table--cards td::before {
    content: attr(data-label); font-family: var(--font-display); font-weight: 700; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); text-align: left;
  }

  /* Actions cell holds buttons/forms, not a single value: stack instead of a left/right row */
  table.history-table--cards td.td-actions { display: block; text-align: left; }
  table.history-table--cards td.td-actions::before { display: block; margin-bottom: 8px; }
  table.history-table--cards .row-actions { flex-wrap: wrap; }
  table.history-table--cards .pw-form { flex-wrap: wrap; }
  table.history-table--cards .pw-form input[type="password"] { flex: 1; min-width: 140px; }
}

/* ---------- Admin dashboard ---------- */
.admin-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 20px 0 34px; }
@media (max-width: 980px) { .admin-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .admin-stats { grid-template-columns: repeat(2, 1fr); } }
.admin-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.admin-stat .lbl { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.admin-stat .val { margin-top: 4px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.admin-stat .val .unit { font-size: 0.62rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.admin-section-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 14px; }

table.admin-table td { font-family: var(--font-display); }
table.admin-table td:nth-child(4), table.admin-table td:nth-child(5) { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; margin-right: 4px; white-space: nowrap;
}
.badge.admin { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); }
.badge.blocked { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.badge.active { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm {
  font-family: var(--font-display); font-size: 0.76rem; font-weight: 700; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
}
.btn-sm:hover { filter: brightness(0.97); }
.btn-sm.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.pw-form { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.pw-form input[type="password"] {
  font-family: var(--font-display); font-size: 0.8rem; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 160px;
}
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.admin-pagination-status { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); }

/* ---------- Footer ---------- */
footer.site-footer { background: var(--deep); color: rgba(255,255,255,.75); margin-top: auto; flex-shrink: 0; }
:root[data-theme="dark"] footer.site-footer { background: #060B16; }
@media (prefers-color-scheme: dark) { footer.site-footer { background: #060B16; } }
.footer-inner {
  padding: 34px clamp(20px, 4vw, 40px) 24px; max-width: 1180px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; font-size: 0.85rem;
}
.footer-inner a { text-decoration: none; color: #fff; font-weight: 700; }
.footer-right { display: flex; align-items: center; gap: 18px; }
.footer-right .privacy { font-weight: 600; opacity: 0.85; }
.footer-right .privacy:hover { opacity: 1; text-decoration: underline; }
.visitors { font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.85; }

/* ---------- Privacy policy modal ---------- */
#privacyPolicy {
  position: fixed; top: 2em; bottom: 2em; left: 2em; right: 2em; overflow-y: auto;
  box-shadow: 0 0 3em 1em rgba(0,0,0,.25); z-index: 999999; text-align: left;
  background: var(--panel); color: var(--ink); padding: 2em; border-radius: 16px;
}
#privacyPolicy h2 { font-size: 1.3rem; }
#privacyPolicy h4 { margin-top: 1.2em; font-size: 1rem; }
#privacyPolicy .privacy { text-align: center; font-size: 0.85em; color: var(--blue); font-weight: 700; text-decoration: none; }
#privacyPolicy .privacy:hover { text-decoration: underline; }
