/* ===== LeadVault panel ===== */
:root {
  --bg: #f2f4f8;
  --card: #fff;
  --ink: #131a2a;
  --muted: #667085;
  --line: #e3e7ee;
  --side: #0c1424;
  --side-2: #16203a;
  --accent: #0f9d8a;
  --accent-d: #0b7d6e;
  --danger: #c0262d;
  --warn: #fff6e5;
  --ok-bg: #e8f7f0;
  --err-bg: #fdecec;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); }
a { color: var(--accent-d); }
code { background: #eef1f6; padding: 1px 6px; border-radius: 4px; font-size: .92em; }
h1, h2 { line-height: 1.2; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 18px; border: 1px solid transparent; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: #fff; color: var(--ink); border-color: var(--line); transition: background .15s, border-color .15s; }
.btn:hover { border-color: #c5ccd8; background: #f8f9fc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #efc4c6; }
.btn.danger:hover { background: var(--err-bg); }
.btn.export { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.export:hover { background: #2a3246; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=search], input[type=date], select { width: 100%; height: 42px; padding: 0 12px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #ccd3df; border-radius: 8px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 157, 138, .2); }
form .btn[type=submit] { margin-top: 18px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14.5px; }
.alert.err { background: var(--err-bg); color: #8f1d22; border: 1px solid #f3c2c4; }
.alert.ok { background: var(--ok-bg); color: #0b6140; border: 1px solid #bde5d1; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 99px; background: #e8ecf3; color: #3b4558; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.badge.dark { background: var(--ink); color: #fff; }

/* login / setup */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--side); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 34px 32px 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 22px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 18px; font-size: 14px; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em; }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 10px; border: 0; background: #eef1f6; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: #3b4558; }

/* app shell */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); color: #cbd3e3; padding: 22px 14px; display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 19px; padding: 0 8px 22px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 2px; border-radius: 8px; color: #cbd3e3; text-decoration: none; font-weight: 500; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.on { background: var(--accent); color: #fff; }
.nav-title { margin: 20px 12px 8px; font-size: 12px; font-weight: 700; color: #7f8aa3; text-transform: uppercase; letter-spacing: .08em; }
.nav-empty { margin: 4px 12px; color: #7f8aa3; font-size: 14px; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--side-2); color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.nav-item.on .avatar { background: rgba(255, 255, 255, .25); }
.avatar.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; background: var(--ink); }
.logout { margin-top: auto; padding-top: 20px; }
.logout .btn { color: #cbd3e3; border-color: #2a3550; margin: 0; }
.logout .btn:hover { background: var(--side-2); color: #fff; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 32px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 21px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.burger { display: none; width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.burger span { display: block; width: 18px; height: 2px; background: var(--ink); }
.scrim { display: none; }
.content { padding: 28px 32px 56px; }
.lead { margin-bottom: 22px; }

/* dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.dcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.dcard:hover { border-color: var(--accent); box-shadow: 0 10px 30px rgba(15, 157, 138, .12); }
.dcard-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.dcard h2 { font-size: 18px; }
.status { font-size: 13px; color: var(--muted); }
.status.live { color: #0b7d4f; }
.status.live::before, .status.down::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #19b36b; }
.status.down { color: var(--danger); }
.status.down::before { background: var(--danger); }
.dcard dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.dcard dl div:last-child { grid-column: 1 / -1; }
.dcard dt { font-size: 12.5px; color: var(--muted); }
.dcard dd { margin: 0; font-weight: 700; font-size: 22px; }
.dcard dl div:last-child dd { font-size: 14px; font-weight: 600; }

/* panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px 26px 26px; margin-bottom: 22px; }
.panel.narrow { max-width: 480px; }
.panel h2 { font-size: 18px; margin-bottom: 8px; }

/* filters */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.f-field { min-width: 130px; }
.f-field.grow { flex: 1 1 240px; }
.f-field label { margin: 0 0 6px; font-size: 13px; }
.f-actions { display: flex; gap: 8px; }
.f-actions .btn { margin: 0 !important; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* table */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.table-wrap.flat { border: 0; border-radius: 0; background: transparent; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data th { text-align: left; background: #f8f9fc; font-size: 13px; color: #4b5568; white-space: nowrap; padding: 0; border-bottom: 1px solid var(--line); }
.data th, .data td { padding: 12px 16px; }
.data th .th-sort { display: block; padding: 12px 16px; color: inherit; text-decoration: none; font-weight: 700; }
.data th:has(.th-sort) { padding: 0; }
.th-sort:hover, .th-sort.on { color: var(--ink); }
.arrow { margin-left: 6px; font-size: 10px; }
.data td { border-bottom: 1px solid #eef0f5; white-space: nowrap; }
.data tbody tr:hover td { background: #fafbfd; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tr.row-warn td { background: var(--warn); }
.dash { color: #a2a9b8; }
.actions { text-align: right; white-space: normal; min-width: 150px; }
.actions details[open] { display: block; }
.actions .inline { display: inline; }
.actions > details, .actions > form { display: inline-block; vertical-align: top; margin-left: 6px; text-align: left; }
.actions form .btn { margin: 0 !important; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 18px; }
.pg { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.pg.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pg-info { margin-left: 8px; }

/* user admin forms */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; align-items: start; }
.grid-form .domain-pick, .grid-form > div:last-child { grid-column: 1 / -1; }
.domain-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin-top: 14px; }
.domain-pick legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.domain-pick.off { display: none; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 6px 18px 0 0; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
details.edit > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.edit > summary::-webkit-details-marker { display: none; }
.edit-form { display: block; width: 320px; max-width: 100%; margin-top: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 16px; text-align: left; }
details.edit[open] > summary { background: #f1f3f8; }

/* responsive */
@media (max-width: 960px) {
  .app { display: block; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(5, 10, 25, .55); }
  .burger { display: flex; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px 16px 48px; }
  .who-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
