/* NCTTI Sites dashboard — mobile-first, native feel. Exam Blue, light/dark. */
:root {
  --bg: #ffffff; --bg2: #f4f6fb; --card: #ffffff; --ink: #0f172a; --muted: #64748b;
  --line: #e7ebf3; --brand: #1d4ed8; --brand-soft: #e8effe; --ok: #16a34a; --ok-soft: #dcfce7;
  --danger: #dc2626; --danger-soft: #fee2e2; --amber-soft: #fef3c7; --amber: #b45309;
  --r: 16px; --shadow: 0 8px 28px rgba(15,23,42,.08);
  --tabbar-h: 64px;
}
[data-theme="dark"] {
  --bg: #0b1120; --bg2: #0f172a; --card: #131c31; --ink: #e8edf7; --muted: #8b96ad;
  --line: #1f2a44; --brand: #5b8cff; --brand-soft: #1a2b52; --ok-soft: #123a24;
  --danger-soft: #3f1414; --amber-soft: #3d2c0e; --shadow: 0 8px 28px rgba(0,0,0,.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg2); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55; min-height: 100dvh; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.appbar-in { max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 60px;
  display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--ink); }
.brand .dot { width: 11px; height: 11px; border-radius: 4px; background: linear-gradient(135deg, #1d4ed8, #7c3aed); }
.appbar .sp { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .12s; }
.icon-btn:active { transform: scale(.93); }
.icon-btn svg { width: 20px; height: 20px; }
.plan-pill { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap; }

/* ---------- layout / tabs ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 18px 16px calc(var(--tabbar-h) + 26px); }
.view { display: none; animation: fadeUp .25s ease; }
.view.on { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 16px; }
.view-head h1 { font-size: 24px; letter-spacing: -.5px; margin: 0; }
.view-head p { color: var(--muted); font-size: 13.5px; margin: 2px 0 0; }

/* bottom tab bar (mobile) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--tabbar-h);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabbar button { flex: 1; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
  border-radius: 12px; min-height: 48px; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--brand); }
/* desktop: top segmented tabs instead */
.segtabs { display: none; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 5px; }
.segtabs button { border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 9px 18px; border-radius: 10px; cursor: pointer; }
.segtabs button.on { background: var(--brand-soft); color: var(--brand); }
@media (min-width: 860px) {
  .tabbar { display: none; }
  .segtabs { display: inline-flex; }
  .page { padding-bottom: 40px; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 15px; padding: 13px 22px; border-radius: 14px; transition: transform .12s, opacity .12s;
  min-height: 48px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(29,78,216,.28); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 40px; padding: 9px 15px; font-size: 13.5px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; }
.btn svg { width: 18px; height: 18px; }

/* FAB */
.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 18px); z-index: 39; width: 58px; height: 58px;
  border-radius: 19px; border: 0; background: var(--brand); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 26px rgba(29,78,216,.4);
  transition: transform .12s; }
.fab:active { transform: scale(.92); }
.fab svg { width: 26px; height: 26px; }
@media (min-width: 860px) { .fab { display: none; } }

/* ---------- site cards ---------- */
.site-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.site-top { display: flex; gap: 13px; align-items: flex-start; }
.avatar { width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 19px; color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed); text-transform: uppercase; }
.site-meta { flex: 1; min-width: 0; }
.site-meta .t { font-weight: 700; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-meta .u { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--brand);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.site-meta .stats { display: flex; gap: 12px; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.pill { font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.pill.live { background: var(--ok-soft); color: var(--ok); }
.pill.draft { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.pill.susp { background: var(--danger-soft); color: var(--danger); }
.meter { height: 6px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); margin-top: 12px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #7c3aed); transition: width .4s; }
.site-actions { display: flex; gap: 8px; margin-top: 13px; }
.site-actions .btn { flex: 1; }
.kebab { position: relative; }
.kebab-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 168px; padding: 6px;
  display: none; }
.kebab-menu.show { display: block; animation: fadeUp .15s ease; }
.kebab-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none;
  color: var(--ink); font-size: 14px; font-weight: 600; padding: 12px; border-radius: 10px; cursor: pointer; text-align: left; }
.kebab-menu button:active { background: var(--bg2); }
.kebab-menu button.danger { color: var(--danger); }
.kebab-menu svg { width: 17px; height: 17px; opacity: .75; }

/* toggle switch */
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .tr { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: .2s; }
.switch .tr::after { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.switch input:checked + .tr { background: var(--ok); }
.switch input:checked + .tr::after { transform: translateX(20px); }
.pub-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px;
  padding-top: 13px; border-top: 1px solid var(--line); }
.pub-row .lbl { font-size: 13.5px; font-weight: 600; }
.pub-row .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- bottom sheet ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(8,12,24,.55); display: none;
  align-items: flex-end; justify-content: center; }
.sheet-bg.show { display: flex; }
.sheet { background: var(--bg); border-radius: 24px 24px 0 0; width: 100%; max-width: 560px;
  max-height: 88dvh; overflow-y: auto; padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .28s cubic-bezier(.32,.72,.35,1); }
@keyframes slideUp { from { transform: translateY(60px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; }
.sheet .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
@media (min-width: 860px) {
  .sheet-bg { align-items: center; padding: 20px; }
  .sheet { border-radius: 24px; animation: fadeUp .2s ease; }
}

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.input { width: 100%; border: 1.5px solid var(--line); border-radius: 13px; padding: 13px 15px;
  font-size: 16px; font-family: inherit; background: var(--card); color: var(--ink); min-height: 50px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.mono { font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.form-err { display: none; background: var(--danger-soft); color: var(--danger); border-radius: 12px;
  padding: 11px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.form-err.show { display: block; }

/* dropzone + upload list */
.dropzone { border: 2px dashed var(--line); border-radius: var(--r); padding: 30px 18px; text-align: center;
  color: var(--muted); cursor: pointer; transition: .15s; background: var(--card); }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone svg { width: 34px; height: 34px; margin-bottom: 8px; opacity: .7; }
.dropzone b { display: block; color: var(--ink); font-size: 15px; }
.upl-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.upl-row .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.upl-row .st { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.upl-row .st.ok { color: var(--ok); }
.upl-row .st.bad { color: var(--danger); }
.pbar { height: 8px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; margin: 14px 0 6px; }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #7c3aed); transition: width .25s; border-radius: 99px; }

/* plan cards */
.plan-hero { background: linear-gradient(135deg, #1e3a8a, #6d28d9); color: #fff; border-radius: 20px;
  padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.plan-hero h3 { margin: 0; font-size: 21px; }
.plan-hero p { margin: 6px 0 0; opacity: .85; font-size: 13.5px; }
.tier-card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 18px; margin-bottom: 12px; }
.tier-card.cur { border-color: var(--brand); }
.tier-card .top { display: flex; align-items: center; justify-content: space-between; }
.tier-card h4 { margin: 0; font-size: 16.5px; }
.tier-card .amt { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.tier-card .amt small { font-size: 13px; font-weight: 500; color: var(--muted); }
.tier-card ul { list-style: none; margin: 10px 0 14px; padding: 0; }
.tier-card li { font-size: 13.5px; color: var(--muted); padding: 3px 0 3px 22px; position: relative; }
.tier-card li::before { content: "✓"; position: absolute; left: 2px; color: var(--ok); font-weight: 800; }

/* account */
.acct-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px;
  display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.acct-card .avatar { width: 54px; height: 54px; font-size: 22px; }
.acct-card .n { font-weight: 700; font-size: 16.5px; }
.acct-card .e { color: var(--muted); font-size: 13.5px; }
.list-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 17px; margin-bottom: 10px; font-weight: 600; font-size: 14.5px;
  cursor: pointer; width: 100%; text-align: left; color: var(--ink); }
.list-row svg { width: 19px; height: 19px; opacity: .7; }
.list-row .chev { margin-left: auto; opacity: .4; }
.list-row.danger { color: var(--danger); }

/* ---------- file manager ---------- */
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.crumbs button { border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 9px; padding: 6px 11px; font-weight: 600; cursor: pointer; font-size: 12.5px; }
.crumbs button.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.frow { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.frow .fic { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; background: var(--bg2); color: var(--muted); }
.frow .fic svg { width: 20px; height: 20px; }
.frow.dir .fic { background: var(--brand-soft); color: var(--brand); }
.frow .fn { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.frow .fn small { display: block; font-family: inherit; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.frow .fdel { width: 38px; height: 38px; border-radius: 11px; border: 0; background: none; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.frow .fdel:active { background: var(--danger-soft); color: var(--danger); }
.frow .fdel svg { width: 18px; height: 18px; }
.frow .fopen { font-size: 12px; font-weight: 700; color: var(--brand); border: 0; background: none; cursor: pointer;
  padding: 10px 6px; flex-shrink: 0; }

/* skeleton */
.skel { border-radius: 12px; background: linear-gradient(90deg, var(--line) 25%, var(--bg2) 50%, var(--line) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px); transform: translateX(-50%) translateY(16px);
  background: #111827; color: #fff; padding: 13px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; transition: .25s; z-index: 100; pointer-events: none; max-width: calc(100vw - 40px);
  text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
[data-theme="dark"] .toast { background: #e8edf7; color: #0f172a; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; padding: 44px 22px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: .35; margin-bottom: 10px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
