:root {
  --bg: #0a0e17;
  --bg-elevated: #111827;
  --bg-card: #111827;
  --bg-sidebar: #0c1220;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e8edf5;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-hover: #2563eb;
  --brand: #e85d3a;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 220px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #93c5fd; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 0.875rem; font-weight: 550; line-height: 1;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap; color: inherit;
}
.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-outline { color: var(--text); background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { background: rgba(148,163,184,.06); color: var(--text); }
.btn-ghost { color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { color: var(--text); background: rgba(148,163,184,.08); }
.btn-brand { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn-sm { padding: 7px 12px; font-size: .8rem; }
.btn-block { width: 100%; }
.badge {
  display: inline-flex; align-items: center; font-size: .7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--accent-soft);
  color: #93c5fd; border: 1px solid rgba(59,130,246,.25);
}
.badge-demo { color: var(--warn); background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.badge-ok { color: var(--success); background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.25); }
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.alert-info { background: var(--accent-soft); border-color: rgba(59,130,246,.25); color: #bfdbfe; }
.alert-ok { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.25); color: #86efac; }
.alert-err { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.alert-warn { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.input, select, textarea {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-strong);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; font-size: .9rem;
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(59,130,246,.5); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
label { display: block; font-size: .8rem; color: var(--text-secondary); margin-bottom: 6px; }
.form-row { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-muted); font-weight: 550; background: rgba(17,24,39,.6); white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data td { color: var(--text-secondary); }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.sec { color: var(--text-secondary); }

/* Public nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: #0a0e17;
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.05rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 0; overflow: visible;
  background: transparent; display: grid; place-items: center;
  box-shadow: none; border: none;
}
.brand-mark img { width: 28px; height: 28px; display: block; }
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a { color: var(--text-secondary); padding: 8px 12px; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); background: rgba(148,163,184,.08); }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.footer { border-top: 1px solid var(--border); padding: 36px 0 48px; margin-top: 40px; color: var(--text-muted); font-size: .8rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }

/* Hero */
.hero { padding: 88px 0 72px; text-align: center; position: relative; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--text-secondary);
  background: rgba(17,24,39,.9); border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; margin-bottom: 28px;
}
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.15rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.15; max-width: 720px; margin: 0 auto 20px; }
.hero h1 .accent { color: #93c5fd; }
.hero-sub { font-size: 1.1rem; color: var(--text-secondary); max-width: 520px; margin: 0 auto 36px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 48px; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature h3 { font-size: 1rem; margin: 12px 0 8px; }
.feature p { font-size: .875rem; color: var(--text-secondary); }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft);
  border: 1px solid rgba(59,130,246,.2); display: grid; place-items: center; color: #60a5fa;
}
.section { padding: 56px 0; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.section-title { font-size: 1.5rem; font-weight: 650; letter-spacing: -.025em; margin-bottom: 8px; }
.section-desc { color: var(--text-secondary); font-size: .95rem; max-width: 480px; margin: 0 auto; }

/* Auth */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-secondary); font-size: .9rem; margin-bottom: 22px; }

/* App shell (user + admin) */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-sidebar);
  border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 6px 10px 18px; }
.side-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: .875rem; font-weight: 500;
}
.side-nav a:hover { background: rgba(148,163,184,.08); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: #93c5fd; }
.side-foot { padding: 12px 10px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-muted); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: rgba(10,14,23,.6);
  position: sticky; top: 0; z-index: 20; 
}
.topbar-left { font-size: .95rem; color: var(--text-secondary); }
.topbar-left strong { color: var(--text); font-weight: 600; }
.balance-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; font-size: .875rem;
}
.balance-pill b { color: var(--text); font-family: var(--mono); }
.app-content { padding: 24px; max-width: 1100px; width: 100%; }
.page-title { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; }
.stat .label { font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; }
.stat .value { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; font-family: var(--mono); }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.panel-title { font-size: .95rem; font-weight: 600; margin-bottom: 10px; }
.demo-banner {
  margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25);
  color: #fcd34d; font-size: .8rem;
}

/* Free page */
.free-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.num-card {
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); margin-bottom: 10px; cursor: pointer; transition: .15s;
}
.num-card:hover, .num-card.active { border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.08); }
.num-card .tel { font-family: var(--mono); font-weight: 600; font-size: .95rem; }
.num-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: .75rem; color: var(--text-muted); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.product-card { padding: 16px; }
.product-card h3 { font-size: 1rem; margin-bottom: 4px; }
.price { font-family: var(--mono); color: var(--text); font-weight: 650; font-size: 1.1rem; }

@media (max-width: 900px) {
  .features { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr; }
  .grid-2, .free-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .app-content { padding: 16px; }
  .nav-links { display: none; }
}
@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
  .wrap { padding: 0 16px; }
}

/* Free page — guest locked / blurred */
.free-locked { position: relative; }
.free-locked .free-blur {
  filter: blur(7px); user-select: none; pointer-events: none;
  opacity: .55;
}
.free-gate {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(10,14,23,.55);
  border-radius: var(--radius);
}
.free-gate-card {
  max-width: 420px; width: 100%; text-align: center;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 28px 24px;
}
.free-gate-card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.free-gate-card p { color: var(--text-secondary); font-size: .9rem; margin-bottom: 18px; }
.num-card.masked .tel { letter-spacing: .08em; }

.num-list { display: flex; flex-direction: column; gap: 10px; }
.num-card .num-meta { align-items: center; gap: 8px; flex-wrap: wrap; }
.num-card .tel { word-break: break-all; }

.lang-switch { display: inline-flex; align-items: center; gap: 4px; }
.lang-switch a { color: var(--text-muted); font-size: .8rem; text-decoration: none; }
.lang-switch a:hover, .lang-switch a.active-lang { color: var(--text); }
.nav-actions .lang-switch .btn { padding: 6px 8px; font-size: .75rem; }
.nav-actions .lang-switch .active-lang { color: var(--text); border-color: var(--border-strong); }

/* ——— Light theme for /app client (api.cc-like) ——— */
body.theme-light {
  --bg: #f5f7fb;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border: #e6eaf0;
  --border-strong: #d5dbe6;
  --text: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent: #3b82f6;
  --accent-soft: #eff6ff;
  --accent-hover: #2563eb;
  background: var(--bg);
  color: var(--text);
}
body.theme-light a { color: var(--accent); }
body.theme-light a:hover { color: var(--accent-hover); }
body.theme-light .app-shell { background: var(--bg); }
body.theme-light .sidebar {
  background: #fff; border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 rgba(15,23,42,.02);
}
body.theme-light .side-nav a { color: #4b5563; }
body.theme-light .side-nav a:hover { background: #f3f4f6; color: #111827; }
body.theme-light .side-nav a.active {
  background: #e8eefc; color: #1d4ed8; font-weight: 600;
}
body.theme-light .topbar {
  background: #fff; border-bottom: 1px solid var(--border);
}
body.theme-light .card, body.theme-light .balance-pill {
  background: #fff; border-color: var(--border);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
body.theme-light .input, body.theme-light select, body.theme-light textarea {
  background: #fff; border-color: var(--border-strong); color: var(--text);
}
body.theme-light table.data th { background: #f8fafc; color: #6b7280; }
body.theme-light table.data td { color: #374151; }
body.theme-light .demo-banner {
  background: #fff7ed; border-color: #fed7aa; color: #9a3412;
}
body.theme-light .alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
body.theme-light .alert-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
body.theme-light .alert-err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
body.theme-light .badge { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
body.theme-light .btn-outline { color: #374151; border-color: #d1d5db; background: #fff; }
body.theme-light .btn-outline:hover { background: #f9fafb; }
body.theme-light .btn-ghost { color: #6b7280; }
body.theme-light .side-foot { border-top-color: var(--border); color: var(--text-muted); }
body.theme-light .price { color: #111827; }

.nav-group-title {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 12px; margin-top: 8px;
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: .75rem; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-muted);
}
.nav-group-title .chev { transition: transform .15s; font-size: .7rem; }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group-items { list-style: none; display: flex; flex-direction: column; gap: 2px; }
body.theme-light .nav-group-title:hover { color: #374151; }
