/* LuyKrav VPN - shared stylesheet (mobile-first) */

:root {
  --brand: #0e5e6f;
  --brand-strong: #0a4855;
  --brand-soft: #e3f1f3;
  --on-brand: #ffffff;
  --accent: #f2a541;
  --accent-strong: #d98a1f;
  --on-accent: #2a1a03;

  --bg: #f5f8f9;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --border: #d5e0e4;
  --text: #13232b;
  --muted: #4d6069;

  --ok: #1d7a46;
  --ok-bg: #e2f4e9;
  --warn: #8a5a00;
  --warn-bg: #fdf0d6;
  --bad: #b3261e;
  --bad-bg: #fbe4e2;
  --neutral-bg: #e7ecee;

  --chart-down: #0080a8;
  --chart-up: #c87510;

  --focus: #f2a541;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(10, 40, 50, .06), 0 6px 20px rgba(10, 40, 50, .06);
  --maxw: 1100px;
  --gutter: 16px;

  --font: "Inter", "Noto Sans Khmer", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-km: "Noto Sans Khmer", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3fb7c7;
    --brand-strong: #6fd0dc;
    --brand-soft: #12333a;
    --on-brand: #04181c;
    --accent: #f2a541;
    --accent-strong: #f6b968;
    --on-accent: #2a1a03;

    --bg: #0b1417;
    --surface: #122026;
    --surface-2: #182a31;
    --border: #26414a;
    --text: #e6eff1;
    --muted: #a3b6bc;

    --ok: #6fd69a;
    --ok-bg: #143324;
    --warn: #f3c46b;
    --warn-bg: #3a2c10;
    --bad: #ff8f86;
    --bad-bg: #3d1a18;
    --neutral-bg: #22343a;

    --chart-down: #1fa5b5;
    --chart-up: #c97a1c;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[lang="km"] body { font-family: var(--font-km); line-height: 1.8; }
main { flex: 1 0 auto; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
html[lang="km"] h1, html[lang="km"] h2, html[lang="km"] h3 { line-height: 1.55; }
h1 { font-size: clamp(1.75rem, 6vw, 2.75rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 4.5vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 6px; word-break: break-all; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--brand); color: var(--on-brand); padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 8px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: 48px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 680px; margin-bottom: 24px; }
.section-head p { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--surface); }
}
.header-inner { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.08rem; margin-right: auto; min-height: 44px; }
.brand img { width: 34px; height: 34px; }
.brand:hover { color: var(--text); }
.brand .brand-sub { color: var(--brand); }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; }
.site-nav {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  display: none; padding: 8px var(--gutter) 16px;
}
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: 10px;
  text-decoration: none; color: var(--text); font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.lang-toggle {
  display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 3px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; color: var(--muted);
  font: inherit; font-size: .9rem;
}
.lang-toggle span { padding: 6px 10px; border-radius: 999px; line-height: 1.2; }
.lang-toggle span.active { background: var(--brand); color: var(--on-brand); font-weight: 600; }

@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .site-nav { position: static; display: block; background: none; border: 0; box-shadow: none; padding: 0; }
  .site-nav ul { display: flex; gap: 4px; }
  .site-nav a { min-height: 44px; }
  .header-inner { gap: 16px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
  background: var(--brand); color: var(--on-brand); transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-strong); color: var(--on-brand); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--brand); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(.92); color: #fff; }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: .92rem; border-radius: 10px; }
.btn-lg { min-height: 56px; padding: 14px 28px; font-size: 1.08rem; }
.btn-block { display: flex; width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #1a0605; } .btn-danger:hover { color: #1a0605; } }

/* ---------- hero ---------- */
.hero { padding: 40px 0 48px; background:
  radial-gradient(1200px 400px at 85% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
  radial-gradient(900px 500px at -10% 10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%); }
.hero-grid { display: grid; gap: 32px; align-items: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: .9rem; margin-bottom: 16px; }
.hero .eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.hero h1 .hl { color: var(--brand); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-cta .btn { flex: 1 1 200px; }
.hero-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .95rem; }
.hero-points li::before { content: "\2713"; color: var(--ok); font-weight: 700; margin-right: 6px; }
.hero-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.hero-card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.hero-card .row:last-child { border-bottom: 0; }
.hero-card .big { font-size: 2.2rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.status-dot { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ok); }
.status-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 20%, transparent); }
@media (min-width: 860px) {
  .hero { padding: 72px 0 80px; }
  .hero-grid { grid-template-columns: 1.3fr 1fr; gap: 48px; }
}

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 16px; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.feature .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 12px; }
.feature .icon svg { width: 24px; height: 24px; }
.feature p { color: var(--muted); }

/* ---------- steps ---------- */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding: 16px 16px 16px 64px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 64px; }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; }
.steps li strong { display: block; }
.steps li span { color: var(--muted); }
@media (min-width: 900px) { .steps.steps-row { grid-template-columns: repeat(5, 1fr); } .steps.steps-row li { padding: 60px 16px 16px; } }

/* ---------- pricing ---------- */
.plans { display: grid; gap: 16px; }
@media (min-width: 640px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 820px; } }
.plan { position: relative; display: flex; flex-direction: column; gap: 12px; }
.plan.featured { border: 2px solid var(--brand); }
.plan .badge-top { position: absolute; top: -12px; right: 16px; background: var(--accent); color: var(--on-accent); font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.plan .price { font-size: 2.4rem; font-weight: 800; line-height: 1.1; color: var(--text); }
.plan .price small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li::before { content: "\2713"; color: var(--ok); font-weight: 800; flex: none; }
.plan .note { font-size: .9rem; color: var(--muted); }
.plan .btn { margin-top: auto; }

.pay-box { display: grid; gap: 20px; align-items: start; }
@media (min-width: 720px) { .pay-box { grid-template-columns: 260px 1fr; } }
.khqr { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: 12px; text-align: center; }
.khqr img { display: block; margin: 0 auto; width: 100%; max-width: 236px; }
.khqr-missing { display: grid; place-items: center; min-height: 160px; padding: 16px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; background: var(--surface-2); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

/* ---------- apps ---------- */
.app { display: flex; gap: 14px; align-items: flex-start; }
.app .os { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.app .os svg { width: 24px; height: 24px; }
.app h3 { margin: 0; font-size: 1.05rem; }
.app p { margin: 0; color: var(--muted); font-size: .95rem; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); margin-left: 6px; vertical-align: middle; }

/* ---------- callouts ---------- */
.callout { border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--border); background: var(--surface-2); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text); }
.callout.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.callout.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.callout strong { display: block; margin-bottom: 2px; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.faq summary { cursor: pointer; list-style: none; padding: 14px 48px 14px 16px; min-height: 48px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--brand); }
.faq details[open] summary::after { content: "\2212"; }
.faq details > div { padding: 0 16px 16px; color: var(--muted); }

/* ---------- guide ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.guide-section { scroll-margin-top: 80px; margin-bottom: 24px; }
.guide-section ol { padding-left: 1.4em; margin: 0 0 1em; }
.guide-section ol li { margin-bottom: 8px; padding-left: 4px; }
.guide-section ol li::marker { color: var(--brand); font-weight: 700; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); font-size: .9em; font-weight: 600; white-space: nowrap; }
.tips { display: grid; gap: 12px; padding: 0; list-style: none; margin: 0; }
.tips li { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tips li strong { display: block; }

/* ---------- page head ---------- */
.page-head { padding: 36px 0 12px; }
.page-head p { color: var(--muted); max-width: 640px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .88rem; background: var(--neutral-bg); color: var(--text); white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.s-active, .badge.s-approved { background: var(--ok-bg); color: var(--ok); }
.badge.s-suspended, .badge.s-pending { background: var(--warn-bg); color: var(--warn); }   /* temporary: amber, like the Mini App */
.badge.s-disabled, .badge.s-expired, .badge.s-over_limit, .badge.s-rejected { background: var(--bad-bg); color: var(--bad); }

/* ---------- progress ---------- */
.progress { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .4s; }
.progress.warn > span { background: var(--accent-strong); }
.progress.bad > span { background: var(--bad); }
.progress.unlimited > span { width: 100% !important; background: repeating-linear-gradient(45deg, var(--brand-soft) 0 8px, color-mix(in srgb, var(--brand) 25%, transparent) 8px 16px); }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid .span-2 { grid-column: 1 / -1; } }
.stat-label { color: var(--muted); font-size: .92rem; margin: 0 0 4px; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin: 0; word-break: break-word; }
.stat-sub { color: var(--muted); margin: 4px 0 0; font-size: .95rem; }
.dash-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.link-box { width: 100%; min-height: 96px; resize: vertical; font-family: var(--mono); font-size: .85rem; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); word-break: break-all; }
.qr-wrap { background: #fff; border-radius: var(--radius-sm); padding: 12px; width: 100%; max-width: 280px; margin: 0 auto; border: 1px solid var(--border); }
.qr-wrap img { display: block; width: 100%; height: auto; image-rendering: pixelated; aspect-ratio: 1; }
.config-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .config-grid { grid-template-columns: 1fr 280px; align-items: start; } }

.empty-state { text-align: center; max-width: 520px; margin: 24px auto; padding: 32px 20px; }
.empty-state .icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty-state .icon svg { width: 34px; height: 34px; }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 14px; min-width: 0; }
.field .hint { font-size: .85rem; color: var(--muted); font-weight: 400; margin-top: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.form-grid { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .full { grid-column: 1 / -1; } }

/* ---------- footer ---------- */
.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0; color: var(--muted); font-size: .95rem; }
.footer-grid { display: grid; gap: 20px; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { color: var(--text); margin: 0 0 8px; font-size: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); text-decoration: none; }
.site-footer li a:hover { color: var(--brand); text-decoration: underline; }
.footer-bottom { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .88rem; }

/* ---------- toast ---------- */
.toast-region { position: fixed; z-index: 200; left: 16px; right: 16px; bottom: 16px; display: grid; gap: 8px; pointer-events: none; }
@media (min-width: 600px) { .toast-region { left: auto; width: 380px; } }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; display: flex; gap: 10px; align-items: flex-start; animation: toast-in .2s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.error, .toast.ok { color: #0b1417; } }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; min-width: 32px; min-height: 32px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 64px 0; }
.notfound .code { font-size: clamp(4rem, 20vw, 7rem); font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 8px; }

/* =========================================================
   Admin panel
   ========================================================= */
.admin-login { max-width: 400px; margin: 48px auto; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 20px; scrollbar-width: thin; }
.tabs button { flex: none; min-height: 48px; padding: 0 16px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .78rem; line-height: 22px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { margin: 0; flex: 1 1 180px; }
.toolbar .btn { flex: none; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.tile .stat-value { font-size: 1.5rem; }

.meter-row { display: grid; grid-template-columns: 70px 1fr 56px; gap: 10px; align-items: center; margin-bottom: 10px; }
.meter-row .progress { height: 10px; }
.svc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.svc-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.data-table .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.data-table .actions .btn { min-height: 40px; padding: 4px 10px; font-size: .85rem; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 899px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .data-table td { border: 0; padding: 4px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: .85rem; text-align: left; flex: none; }
  .data-table td.actions-cell { display: block; padding-top: 10px; }
  .data-table td.actions-cell::before { content: none; }
  .data-table .actions .btn { min-height: 44px; flex: 1 1 auto; }
}
.mini-progress { width: 100%; min-width: 90px; height: 6px; margin-top: 4px; }

.pay-list { display: grid; gap: 12px; }
@media (min-width: 760px) { .pay-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pay-item { display: grid; grid-template-columns: 88px 1fr; gap: 14px; }
.pay-item .thumb { width: 88px; height: 120px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: .78rem; text-align: center; padding: 0; cursor: pointer; }
.pay-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pay-item .thumb[disabled] { cursor: default; }
.pay-item .meta { min-width: 0; }
.pay-item .meta p { margin: 0 0 2px; word-break: break-word; }
.pay-item .btn-row { margin-top: 10px; }
.pay-item .btn-row .btn { flex: 1 1 auto; }

dialog.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(5, 15, 20, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px; }
.modal-body img.receipt { width: 100%; height: auto; border-radius: 10px; }
pre.json { max-height: 240px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: 10px; font-size: .8rem; white-space: pre; }

/* usage chart */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.chart-plot, .chart-x { min-width: 0; }
.chart-y { white-space: nowrap; display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-size: .75rem; color: var(--muted); text-align: right; }
.chart-plot { position: relative; height: 200px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--border) 1px, transparent 1px) 0 0 / 100% 50%; }
.chart-bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; cursor: pointer; padding: 0; border: 0; background: none; border-radius: 4px 4px 0 0; }
.chart-bar:hover, .chart-bar.sel { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.chart-bar .seg-down { background: var(--chart-down); border-radius: 0; }
.chart-bar .seg-up { background: var(--chart-up); border-radius: 4px 4px 0 0; }
.chart-bar .seg-up.only, .chart-bar .seg-down.top { border-radius: 4px 4px 0 0; }
.chart-x { display: flex; gap: 2px; font-size: .72rem; color: var(--muted); grid-column: 2; }
.chart-x span { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.chart-detail { min-height: 1.6em; margin-top: 10px; font-weight: 600; }
details.table-view summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--brand); font-weight: 600; }
details.table-view .table-scroll { max-height: 320px; overflow: auto; }

@media (min-width: 820px) {
  .site-nav { order: 1; }
  .lang-toggle { order: 2; }
}

/* ---------- utilities ---------- */
.m-0 { margin: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.h-sm { font-size: 1.4rem; }
.justify-center { justify-content: center; }
.section.tight { padding-top: 16px; }
.cta-card { padding: 32px 20px; }
.cta-card .callout { margin-top: 16px; text-align: left; }

/* admin chart legend swatches + bar segments */
.chart-legend i.lg-down { background: var(--chart-down); }
.chart-legend i.lg-up { background: var(--chart-up); }
.chart-bar > span { display: block; min-height: 2px; border-radius: 0; }
.chart-bar > span:first-child { border-radius: 4px 4px 0 0; }
.admin .site-header .header-inner { gap: 12px; }

section[id], [id].guide-section { scroll-margin-top: 76px; }

/* setup guide */
.steps.steps-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .steps.steps-3 { grid-template-columns: 1fr; } }
.chip[aria-current] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.platform { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.platform > summary { list-style: none; cursor: pointer; padding: 16px 48px 16px 20px; position: relative; align-items: center; }
.platform > summary::-webkit-details-marker { display: none; }
.platform > summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--brand); }
.platform[open] > summary::after { content: "\2212"; }
.platform-body { padding: 4px 20px 20px; }
.platform .flow { list-style: none; counter-reset: flow; padding: 0; margin: 16px 0; display: grid; gap: 14px; }
.platform .flow > li { counter-increment: flow; position: relative; padding: 3px 0 0 42px; min-height: 30px; margin: 0; }
.platform .flow > li::before { content: counter(flow); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.srv-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.page-head h1 { text-wrap: balance; }  /* Khmer has no spaces between words: avoids a break inside a word */
