:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --sidebar: #10141c;
  --sidebar-text: #aab2c0;
  --border: #dde2e8;
  --text: #10141c;
  --text-muted: #5c6675;
  --accent: #17a589;
  --accent-strong: #0f8a72;
  --accent-ink: #ffffff;
  --accent-tint: #e3f5f1;
  --ok: #1f9d63;
  --ok-tint: #e4f5ea;
  --warn: #b8862f;
  --warn-tint: #f7eed9;
  --bad: #c0503f;
  --bad-tint: #f8e4e0;
  --shadow-sm: 0 1px 2px rgba(16, 20, 28, 0.05);
  --shadow-md: 0 4px 16px rgba(16, 20, 28, 0.08);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e14; --surface: #12161f; --surface-2: #171c27; --sidebar: #0b0e14;
    --sidebar-text: #8b93a3; --border: #232935; --text: #e9edf3; --text-muted: #8b93a3;
    --accent: #2bbfa3; --accent-strong: #3fd6b9; --accent-ink: #05201a; --accent-tint: #103029;
    --ok: #3fbf82; --ok-tint: #123322; --warn: #e0ac4f; --warn-tint: #33280f;
    --bad: #e0796a; --bad-tint: #34201c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4); --shadow-md: 0 8px 28px rgba(0,0,0,0.45);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e14; --surface: #12161f; --surface-2: #171c27; --sidebar: #0b0e14;
  --sidebar-text: #8b93a3; --border: #232935; --text: #e9edf3; --text-muted: #8b93a3;
  --accent: #2bbfa3; --accent-strong: #3fd6b9; --accent-ink: #05201a; --accent-tint: #103029;
  --ok: #3fbf82; --ok-tint: #123322; --warn: #e0ac4f; --warn-tint: #33280f;
  --bad: #e0796a; --bad-tint: #34201c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4); --shadow-md: 0 8px 28px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  padding-inline: 16px; padding-block: 24px; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Sora", "Plus Jakarta Sans", sans-serif; text-wrap: balance; margin: 0; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
a { color: inherit; }
button, input, select { font: inherit; }
select { padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.frame {
  max-width: 1080px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden;
}

/* auth */
.auth-frame { display: grid; grid-template-columns: 1fr 1fr; min-height: 580px; }
@media (max-width: 720px) { .auth-frame { grid-template-columns: 1fr; } .auth-side { display: none; } }
.auth-side { background: var(--sidebar); color: #fff; padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.auth-side .brand { margin-bottom: 4px; }
.auth-side .brand .tag { color: #7b8291; }
.auth-side h2 { font-size: 1.5rem; line-height: 1.3; max-width: 320px; }
.auth-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-features li { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: #cdd2db; }
.auth-features svg { flex: none; color: var(--accent-strong); }
.auth-side-foot { font-size: 0.8rem; color: #7b8291; max-width: 300px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 360px; }
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 34px; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand span { font-family: "Sora", sans-serif; font-weight: 600; }
.brand .tag { color: var(--text-muted); font-weight: 500; font-size: 0.82rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card p.lead { color: var(--text-muted); font-size: 0.92rem; margin: 0 0 26px; }
.auth-tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 9px; padding: 3px; margin-bottom: 24px; }
.auth-tabs button { flex: 1; border: none; background: none; padding: 8px; border-radius: 7px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.auth-tabs button[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-pane { display: none; }
.auth-pane.is-active { display: block; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.field input { padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); width: 100%; }
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .hint { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }
.btn-primary { width: 100%; padding: 12px; border: none; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; margin-top: 4px; font-size: 0.95rem; }
.btn-primary:hover { background: var(--accent-strong); }
.auth-foot { margin-top: 20px; font-size: 0.86rem; color: var(--text-muted); text-align: center; }
.auth-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.connect-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.connect-step { display: flex; gap: 10px; font-size: 0.85rem; color: var(--text-muted); }
.connect-step .n { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; color: var(--text); }
.connect-step a { color: var(--accent); font-weight: 600; text-decoration: none; }
.error { background: var(--bad-tint); color: var(--bad); padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 18px; }

/* app shell */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 560px; }
@media (max-width: 720px) { .app { grid-template-columns: 1fr; } .sidebar { display: none; } }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 20px 14px; display: flex; flex-direction: column; }
.sidebar .brand { color: #fff; margin-bottom: 28px; padding-left: 6px; }
.sidebar .brand .tag { color: #6b7383; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; }
.nav-group .label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: #5b6272; padding: 8px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--sidebar-text); text-decoration: none; font-size: 0.88rem; font-weight: 500; }
.nav-item svg { flex: none; opacity: 0.6; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.current { background: var(--accent-tint); color: var(--accent-strong); }
.nav-item.current svg { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 0.8rem; }
.sidebar-foot a { color: var(--sidebar-text); text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }

.main { padding: 26px 30px; overflow-x: hidden; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.4rem; }
.page-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 0.9rem; }

.kpi-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.kpi-row .kpi { flex: 0 0 auto; min-width: 150px; }
.kpi { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: var(--surface-2); }
.kpi .icon { flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--accent-tint); color: var(--accent-strong); display: grid; place-items: center; }
.kpi .k { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 2px; }
.kpi .v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; font-family: "Sora", sans-serif; }
.kpi .v small { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); font-family: "Plus Jakarta Sans", sans-serif; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { font-size: 1rem; }
.btn-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 13px; border-radius: 7px; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.accounts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 26px; }
.account-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); text-decoration: none; transition: border-color 0.15s ease, box-shadow 0.15s ease, translate 0.15s ease; }
.account-row[href]:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); translate: 0 -1px; }
@media (max-width: 640px) { .account-row { grid-template-columns: 1fr; align-items: flex-start; gap: 8px; } }
.account-domain { display: flex; flex-direction: column; gap: 2px; }
.account-domain .name { font-weight: 700; font-family: "Sora", sans-serif; font-size: 0.95rem; color: var(--text); }
.account-domain .plan { font-size: 0.79rem; color: var(--text-muted); }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 78px; }
.stat .k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat .v { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.88rem; color: var(--text); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; text-transform: capitalize; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.active { background: var(--ok-tint); color: var(--ok); }
.chip.suspended { background: var(--warn-tint); color: var(--warn); }
.chip.pending { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.chip.cancelled { background: var(--bad-tint); color: var(--bad); }

.manage-link { text-decoration: none; font-size: 0.84rem; font-weight: 700; color: var(--accent); white-space: nowrap; }

.monitor-list { display: flex; flex-direction: column; gap: 10px; }
.monitor-row { border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; background: var(--surface); }
.monitor-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-bottom: 12px; }
@media (max-width: 640px) { .monitor-head { grid-template-columns: auto 1fr; } .monitor-head .stat { grid-column: 2; } }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status-dot.up { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.status-dot.down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }
.status-dot.unknown { background: var(--text-muted); opacity: 0.4; }
.history-strip { display: flex; gap: 3px; }
.history-tick { flex: 1; height: 18px; border-radius: 2px; background: var(--surface-2); }
.history-tick.up { background: var(--ok); }
.history-tick.down { background: var(--bad); }
.history-tick.unknown { background: var(--surface-2); border: 1px dashed var(--border); }
.sync-note { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; color: var(--accent-strong); padding: 10px 14px; background: var(--accent-tint); border-radius: 8px; margin-bottom: 22px; }
.sync-note .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-strong); flex: none; }
.sync-note .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.breadcrumb { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.detail-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title h1 { font-size: 1.35rem; font-family: "Sora", sans-serif; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin: 18px 0 22px; }
.tabs a { border-bottom: 2px solid transparent; padding: 9px 0; color: var(--text-muted); font-size: 0.88rem; font-weight: 600; text-decoration: none; translate: 0 1px; }
.tabs a.current { color: var(--text); border-bottom-color: var(--accent); }

.panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 640px) { .panel-grid { grid-template-columns: 1fr 1fr; } }
.tile { border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 14px; }
.tile .k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.tile .v { font-weight: 700; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 0 12px 8px; font-weight: 700; }
td { padding: 11px 12px; border-top: 1px solid var(--border); }
td.mono, .credential { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.83rem; }
.type-badge {
  display: inline-block; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.72rem; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 24px; }
.table-wrap table { min-width: 480px; }
.empty { color: var(--text-muted); font-size: 0.9rem; padding: 20px 0; }
