@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');
/* TailAdmin-inspired tokens */
:root {
  --brand:#465fff; --brand-600:#3641f5; --brand-50:#ecf3ff;
  --bg:#f9fafb; --card:#fff; --line:#e4e7ec; --text:#1d2939; --muted:#667085; --hover:#f2f4f7; --input:#fff;
  --ok:#039855; --ok-bg:#ecfdf3; --err:#d92d20; --err-bg:#fef3f2; --warn:#dc6803; --warn-bg:#fffaeb;
  --shadow:0 1px 3px rgba(16,24,40,.1),0 1px 2px rgba(16,24,40,.06);
  --ring:0 0 0 4px rgba(70,95,255,.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-50:rgba(70,95,255,.12); --bg:#0c111d; --card:#161b26; --line:#262f3f; --text:#e4e7ec; --muted:#98a2b3;
    --hover:#1f2633; --input:#0c111d; --ok:#32d583; --ok-bg:rgba(18,183,106,.12); --err:#f97066; --err-bg:rgba(240,68,56,.12);
    --warn:#fdb022; --warn-bg:rgba(247,144,9,.12); --shadow:none;
  }
}
* { box-sizing:border-box; }
body { margin:0; font:14px/1.55 Outfit,system-ui,sans-serif; background:var(--bg); color:var(--text); -webkit-font-smoothing:antialiased; }
h1,h2,h3 { margin:0; font-weight:600; }
h1 { font-size:20px; } h2 { font-size:16px; } h3 { font-size:14px; }
a { color:var(--brand); text-decoration:none; }
svg { width:20px; height:20px; flex:none; }
[hidden] { display:none !important; }
.dim { color:var(--muted); font-size:13px; }

/* controls */
input, select { font:inherit; color:var(--text); background:var(--input); border:1px solid var(--line); border-radius:8px; height:44px; padding:0 14px; box-shadow:0 1px 2px rgba(16,24,40,.05); }
input:focus, select:focus { outline:0; border-color:#9cb9ff; box-shadow:var(--ring); }
input::placeholder { color:#98a2b3; }
button { font:inherit; font-weight:500; cursor:pointer; color:var(--text); background:var(--card); border:1px solid var(--line); border-radius:8px; height:44px; padding:0 16px; display:inline-flex; align-items:center; justify-content:center; gap:8px; box-shadow:0 1px 2px rgba(16,24,40,.05); transition:.15s; white-space:nowrap; }
button:hover { background:var(--hover); }
button:focus-visible { outline:0; box-shadow:var(--ring); }
button.primary { background:var(--brand); border-color:var(--brand); color:#fff; }
button.primary:hover { background:var(--brand-600); }
button.danger { color:var(--err); }
button.danger:hover { background:var(--err-bg); }
button.small { height:34px; padding:0 12px; font-size:13px; }
.check { display:inline-flex; align-items:center; gap:8px; color:var(--muted); cursor:pointer; }
.check input { width:18px; height:18px; padding:0; box-shadow:none; accent-color:var(--brand); }
.field { display:grid; gap:6px; }
.field > span { font-weight:500; font-size:13px; }

/* layout bits */
.row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.row.between { justify-content:space-between; }
.grow { flex:1; min-width:160px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); }
.card-head { padding:18px 24px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.card-body { padding:24px; }
.card-head p { margin:2px 0 0; }

.badge { display:inline-flex; align-items:center; gap:6px; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:500; }
.badge.ok { background:var(--ok-bg); color:var(--ok); }
.badge.err { background:var(--err-bg); color:var(--err); }
.badge.warn { background:var(--warn-bg); color:var(--warn); }
.badge.brand { background:var(--brand-50); color:var(--brand); display:inline-flex; font-size:12px; font-weight:500; gap:6px; }
.pulse { width:8px; height:8px; border-radius:50%; background:currentColor; animation:pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity:.3; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation:none; } }

.avatar { width:40px; height:40px; border-radius:50%; display:grid; place-items:center; background:var(--brand-50); color:var(--brand); font-weight:600; flex:none; text-transform:uppercase; }

/* tables */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th { text-align:left; font-weight:500; font-size:12px; color:var(--muted); padding:12px 24px; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:14px 24px; border-bottom:1px solid var(--line); white-space:nowrap; }
tr:last-child td { border-bottom:0; }
td .row { flex-wrap:nowrap; gap:8px; }
td.empty { text-align:center; color:var(--muted); padding:40px; }

/* toast */
#msg { position:fixed; right:20px; bottom:20px; z-index:50; max-width:min(420px,calc(100vw - 40px)); background:var(--text); color:var(--bg); padding:12px 16px; border-radius:10px; box-shadow:0 12px 24px rgba(16,24,40,.18); }

/* ---------- admin shell ---------- */
.layout { display:flex; min-height:100vh; }
.sidebar { width:280px; flex:none; background:var(--card); border-right:1px solid var(--line); padding:28px 20px; position:sticky; top:0; height:100vh; display:flex; flex-direction:column; gap:28px; }
.brand { display:flex; align-items:center; gap:10px; font-size:20px; font-weight:600; color:var(--text); }
.brand .logo { width:36px; height:36px; border-radius:10px; background:var(--brand); color:#fff; display:grid; place-items:center; }
.menu-label { font-size:12px; color:var(--muted); letter-spacing:.06em; margin:0 0 10px 12px; }
.nav { display:grid; gap:4px; }
.nav button { justify-content:flex-start; border:0; box-shadow:none; background:none; color:var(--muted); width:100%; gap:12px; }
.nav button:hover { background:var(--hover); color:var(--text); }
.nav button.active { background:var(--brand-50); color:var(--brand); }
.content { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar { position:sticky; top:0; z-index:10; background:var(--card); border-bottom:1px solid var(--line); padding:14px 24px; display:flex; align-items:center; gap:16px; }
.topbar h1 { flex:1; }
.icon-btn { width:44px; padding:0; }
#menuBtn { display:none; }
.user { display:flex; align-items:center; gap:10px; font-weight:500; }
.page { padding:24px; display:grid; grid-template-columns:minmax(0,1fr); gap:24px; max-width:1200px; width:100%; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:24px; }
.stat { padding:24px; }
.stat .icon { width:48px; height:48px; border-radius:12px; background:var(--hover); display:grid; place-items:center; color:var(--text); margin-bottom:20px; }
.stat .value { font-size:28px; font-weight:700; margin-top:4px; }
.steps { margin:0; padding-left:20px; display:grid; gap:8px; color:var(--muted); }
.steps b { color:var(--text); font-weight:500; }
.overlay { display:none; }
@media (max-width:1023px) {
  .sidebar { position:fixed; z-index:40; left:0; transform:translateX(-100%); transition:transform .2s; }
  .sidebar.open { transform:none; }
  .sidebar.open + .overlay { display:block; position:fixed; inset:0; z-index:30; background:rgba(16,24,40,.4); }
  #menuBtn { display:inline-flex; }
  .page { padding:16px; }
  .topbar { padding:12px 16px; gap:10px; }
  .topbar > a.dim { display:none; }
  .card-body form.row > * { flex:1 1 100%; }
  .user span:not(.avatar) { display:none; }
}

/* ---------- auth screen ---------- */
.auth { min-height:100vh; display:grid; grid-template-columns:1fr 1fr; }
.auth-form { display:grid; place-items:center; padding:40px 20px; }
.auth-form form { width:100%; max-width:420px; display:grid; gap:20px; }
.auth-form h1 { font-size:28px; }
.auth-side { background:#161950; color:#fff; display:grid; place-items:center; padding:40px; position:relative; overflow:hidden; text-align:center; }
.auth-side::before { content:''; position:absolute; inset:0; background:radial-gradient(circle at 20% 20%,rgba(70,95,255,.45),transparent 45%),radial-gradient(circle at 80% 85%,rgba(70,95,255,.35),transparent 40%); }
.auth-side > div { position:relative; display:grid; gap:14px; justify-items:center; max-width:360px; }
.auth-side .logo { width:56px; height:56px; border-radius:14px; background:var(--brand); display:grid; place-items:center; }
.auth-side p { color:#c7cbe8; margin:0; }
@media (max-width:1023px) { .auth { grid-template-columns:1fr; } .auth-side { display:none; } }

/* ---------- public page ---------- */
.pub-top { background:var(--card); border-bottom:1px solid var(--line); }
.pub-top .inner { max-width:960px; margin:0 auto; padding:14px 20px; display:flex; align-items:center; justify-content:space-between; }
.pub { max-width:960px; margin:0 auto; padding:28px 20px 60px; display:grid; gap:24px; }
.hero { text-align:center; display:grid; gap:6px; padding:8px 0; }
.hero h1 { font-size:30px; }
.addr { display:flex; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:12px; background:var(--input); overflow:hidden; box-shadow:0 1px 2px rgba(16,24,40,.05); padding:0 8px; }
.addr:focus-within { border-color:#9cb9ff; box-shadow:var(--ring); }
.addr input, .addr select { border:0; box-shadow:none; height:52px; font-size:16px; border-radius:0; background:transparent; }
.addr input { field-sizing:content; min-width:6ch; max-width:55%; text-align:right; padding:0 4px 0 0; }
.addr select { max-width:45%; padding:0 4px; font-weight:500; cursor:pointer; }
.addr .at { color:var(--muted); font-size:18px; }
.actions { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-top:16px; }
@media (max-width:640px) { .actions { grid-template-columns:1fr 1fr; } .hero h1 { font-size:24px; } }
.list { list-style:none; margin:0; padding:0; }
.list li + li { border-top:1px solid var(--line); }
.list li > button { width:100%; height:auto; border:0; border-radius:0; box-shadow:none; background:none; padding:14px 24px; justify-content:flex-start; gap:14px; text-align:left; white-space:normal; }
.list li > button:hover { background:var(--hover); }
.li-main { flex:1; min-width:0; display:grid; }
.li-main b, .li-main span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; }
.li-main b { font-weight:600; }
.empty-state { padding:48px 24px; text-align:center; display:grid; gap:8px; justify-items:center; color:var(--muted); }
.empty-state .avatar { width:56px; height:56px; }
iframe { width:100%; min-height:460px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.dns-box { display:grid; gap:10px; padding:16px; border:1px dashed var(--line); border-radius:12px; background:var(--bg); }
.dns-table th, .dns-table td { padding:8px 12px; }
code { font:13px ui-monospace,monospace; background:var(--hover); padding:2px 6px; border-radius:6px; }
button:disabled { opacity:.6; cursor:wait; }

/* live dot off when SSE disconnected */
#live.off { background:var(--hover); color:var(--muted); }
#live.off .pulse { animation:none; }

/* OTP */
.otp-card { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 24px; flex-wrap:wrap; border-color:#9cb9ff; background:linear-gradient(135deg,var(--brand-50),var(--card) 60%); }
.otp-code { font:700 34px/1.2 ui-monospace,SFMono-Regular,monospace; letter-spacing:.18em; color:var(--brand); margin:4px 0; }
.otp-chip { cursor:copy; font-family:ui-monospace,monospace; letter-spacing:.06em; }
.otp-chip:hover { background:var(--brand); color:#fff; }
.otp-inline { display:flex; align-items:center; gap:12px; padding:10px 14px; border-radius:10px; background:var(--brand-50); width:fit-content; }
.otp-inline b { font:700 20px ui-monospace,monospace; letter-spacing:.12em; color:var(--brand); }

/* attachments */
.files { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:10px; }
.file { display:flex; align-items:center; gap:10px; padding:10px 14px; border:1px solid var(--line); border-radius:10px; color:var(--text); min-width:0; }
.file:hover { background:var(--hover); border-color:#9cb9ff; }
.file svg:last-child { color:var(--muted); }

/* admin stats */
.chart { display:flex; align-items:flex-end; gap:6px; height:200px; padding-top:8px; }
.bar { flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; justify-content:flex-end; min-width:0; }
.bar i { display:block; width:100%; max-width:36px; border-radius:6px 6px 2px 2px; background:var(--brand); min-height:2px; transition:height .3s; }
.bar:hover i { background:var(--brand-600); }
.bar i.zero { background:var(--line); }
.bar span { font-size:11px; color:var(--muted); white-space:nowrap; }
.bar b { font-size:11px; font-weight:500; }
.meter { height:8px; border-radius:99px; background:var(--hover); overflow:hidden; }
.meter i { display:block; height:100%; background:var(--brand); border-radius:99px; }
.meter.warn i { background:var(--warn); } .meter.err i { background:var(--err); }
.grid2 { display:grid; grid-template-columns:2fr 1fr; gap:24px; }
@media (max-width:1023px) { .grid2 { grid-template-columns:1fr; } }
.kv { display:grid; gap:14px; }
.kv > div { display:grid; gap:6px; }
.kv .row { justify-content:space-between; }
