:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --border: #e3e6eb;
  --text: #1b1f24;
  --muted: #667085;
  --accent: #2f6fed;
  --accent-soft: #e8efff;
  --ok: #12a150;
  --ok-soft: #e3f6eb;
  --bad: #d92d20;
  --bad-soft: #fdecea;
  --warn: #c27803;
  --warn-soft: #fdf3df;
  --neutral-soft: #eef0f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a20;
    --panel-2: #1c2027;
    --border: #2a2f38;
    --text: #e6e8eb;
    --muted: #9aa3af;
    --accent: #5b8cff;
    --accent-soft: #1c2a4a;
    --ok: #3ccf7a;
    --ok-soft: #13301f;
    --bad: #ff6b5e;
    --bad-soft: #3a1714;
    --warn: #f0b429;
    --warn-soft: #3a2c0c;
    --neutral-soft: #252a33;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; padding: 0 8px 18px; }
.brand img { width: 26px; height: 26px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); font-weight: 500;
}
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar .spacer { flex: 1; }
.sidebar .foot { padding: 8px 10px; font-size: 12px; color: var(--muted); display: grid; gap: 6px; }

.main { padding: 26px 32px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; }
.page-head .sub { color: var(--muted); margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 1000px) { .grid.two, .grid.side { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 18px 0; }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad .value { color: var(--bad); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.site-cell .name { font-weight: 600; }
.site-cell .domain { color: var(--muted); font-size: 12.5px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 550; background: var(--neutral-soft); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.warn { background: var(--warn); }

/* ---------- forms / buttons ---------- */
button, .btn {
  font: inherit; font-weight: 550; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
button.sm { padding: 4px 9px; font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: auto; flex: none; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 550; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
label.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.toolbar input[type=search] { flex: 1; min-width: 220px; }

/* ---------- modal ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--panel); color: var(--text);
  width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(15, 17, 21, .45); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-content { padding: 20px; max-height: 70vh; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
dialog.wide { width: min(1000px, calc(100vw - 32px)); }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; min-width: 0; }
.logs {
  background: #0d1014; color: #cfd6df; font-family: var(--mono); font-size: 12px; line-height: 1.5;
  padding: 14px; border-radius: 8px; max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0;
}
.uptime-bar { display: flex; gap: 2px; height: 34px; align-items: stretch; justify-content: flex-end; margin-top: 8px; }
.uptime-bar span { flex: 1; border-radius: 2px; background: var(--neutral-soft); min-width: 2px; max-width: 10px; }
.uptime-bar span.ok { background: var(--ok); }
.uptime-bar span.bad { background: var(--bad); }
.chart { width: 100%; height: 120px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.chart .area { fill: var(--accent-soft); }
.chart .fail { fill: var(--bad); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart text { fill: var(--muted); font-size: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 12px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.plan-card { display: flex; flex-direction: column; gap: 10px; }
.plan-card .price { font-size: 26px; font-weight: 650; }
.plan-card ul { margin: 0; padding-left: 18px; color: var(--muted); }
.plan-card .actions { margin-top: auto; }
.notice { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.platform-icon { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 6px; background: var(--neutral-soft); flex: none; font-size: 11px; font-weight: 700; color: var(--muted); }
.platform-icon.docker { background: #e3f0ff; color: #1d63ed; }
.platform-icon.cf_worker, .platform-icon.cf_pages { background: #fff0e3; color: #e2701a; }
@media (prefers-color-scheme: dark) {
  .platform-icon.docker { background: #16284a; color: #7aa7ff; }
  .platform-icon.cf_worker, .platform-icon.cf_pages { background: #3a2412; color: #ffa45c; }
}
.row { display: flex; align-items: center; gap: 10px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 380px; }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); padding: 28px; display: grid; gap: 14px; }
.login .brand { padding: 0 0 6px; font-size: 17px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 1em; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; border-right: none; border-bottom: 1px solid var(--border); }
  .brand { padding: 4px 8px; width: 100%; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav a span { display: none; }
  .sidebar .spacer, .sidebar .foot { display: none; }
  .main { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

[data-mt] { margin-top: 14px; }
[data-mb] { margin-bottom: 16px; }
.card.flush .list li { padding-left: 18px; padding-right: 18px; }
.modal-foot .grow { flex: 1; }

/* ---------- integrations, hide/show ---------- */
.platform-icon.hostinger_docker, .platform-icon.hostinger_web { background: #efe9ff; color: #673de6; }
@media (prefers-color-scheme: dark) {
  .platform-icon.hostinger_docker, .platform-icon.hostinger_web { background: #2a1f4d; color: #a98bff; }
}
.badge.src-hostinger { background: #efe9ff; color: #673de6; }
.badge.src-cloudflare { background: #fff0e3; color: #c25a0c; }
@media (prefers-color-scheme: dark) {
  .badge.src-hostinger { background: #2a1f4d; color: #a98bff; }
  .badge.src-cloudflare { background: #3a2412; color: #ffa45c; }
}
tr.is-hidden td { opacity: .55; }
tr.is-hidden td:last-child { opacity: 1; }
th.sel, td.sel { width: 36px; padding-right: 0; }
button.eye { padding: 4px 6px; color: var(--muted); }
button.eye svg { width: 17px; height: 17px; display: block; }
button.eye:hover { color: var(--text); }
label.toggle { white-space: nowrap; font-size: 13px; }
.bulk {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toolbar input[type=checkbox] { min-width: 0; }
.bulk b { margin-right: 6px; }
.integration { display: flex; flex-direction: column; gap: 12px; }
.integration .form-grid { gap: 10px 14px; }
h2.flat { margin: 0; }
.help { font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.45; }
.sync-status { padding: 10px 12px; background: var(--panel-2); border-radius: 8px; border: 1px solid var(--border); }
.err-text { color: var(--bad); margin-top: 4px; white-space: pre-wrap; }
ul.bullets { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
table.compact th, table.compact td { padding: 7px 10px; }
@media (max-width: 1150px) { .hide-md { display: none; } }

/* platform icons: glyph instead of letter codes */
.platform-icon { width: 30px; height: 30px; border-radius: 8px; }
.platform-icon svg { width: 17px; height: 17px; }
.site-cell { min-width: 0; }
.site-cell .name { overflow-wrap: anywhere; }
.site-cell .domain { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
@media (max-width: 760px) { .site-cell .domain { max-width: 180px; } }

/* per-site price button in the Sites list */
.price-btn { border: none; background: none; padding: 0; cursor: pointer; }
.price-btn:hover { background: none; }
.price-btn:hover .badge { outline: 1px solid currentColor; }
p.flat { margin: 0; }
/* small inline icons (close, external link) */
button svg, a svg { width: 16px; height: 16px; vertical-align: -3px; flex: none; }

/* SSH setup, settings, MFA */
pre.cmd {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 8px 0;
}
pre.codes { font-size: 15px; line-height: 1.8; columns: 2; }
details.setup { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
details.setup summary { cursor: pointer; font-weight: 600; }
details.setup ol { padding-left: 18px; display: grid; gap: 8px; margin: 10px 0 0; }
.qr { background: #fff; padding: 8px; border-radius: 8px; width: max-content; margin: 10px 0; }
.qr svg { display: block; width: 200px; height: 200px; }
.mfa-setup ol { padding-left: 18px; margin: 0; }
.mfa-setup form input { width: 140px; letter-spacing: .2em; font-family: var(--mono); }
code.secret { letter-spacing: .05em; }
.pad-x { padding: 0 18px 14px; margin: 0; }
.login #step-pw, .login #step-code { display: grid; }
.login .hidden { display: none !important; }
p code, .small code, dd code, details code { overflow-wrap: anywhere; word-break: break-all; }
.grid.side > .grid, .grid.two > .grid { min-width: 0; }
.badge.src-ssh { background: var(--accent-soft); color: var(--accent); }

/* token fields: masked without being a password field, so browsers don't autofill the login password */
input.masked { -webkit-text-security: disc; text-security: disc; font-family: var(--mono); }

/* ---------- sites filter bar ---------- */
.filters { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.filter-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; display: block; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; background: var(--panel-2); border-color: transparent; }
.search input:focus { background: var(--panel); }
.filter-row { display: flex; gap: 10px; align-items: flex-start; }
.filter-label { flex: none; width: 64px; padding-top: 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.2;
}
.chip svg { width: 14px; height: 14px; vertical-align: 0; color: var(--muted); }
.chip .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--panel-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.on svg, .chip.on .n { color: var(--accent); }
.chip .dot { width: 7px; height: 7px; box-shadow: none; }
.chip:disabled { opacity: .5; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.seg button { border: none; background: transparent; padding: 5px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.seg button .n { font-size: 11.5px; opacity: .8; font-variant-numeric: tabular-nums; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.seg button:hover { background: var(--panel); }
.eye-chip svg { width: 15px; height: 15px; }
.filter-foot { display: flex; align-items: center; gap: 12px; min-height: 20px; }
.link-btn { border: none; background: none; padding: 0; color: var(--accent); font-size: 13px; font-weight: 500; }
.link-btn:hover { background: none; text-decoration: underline; }
@media (max-width: 760px) {
  .filter-row { flex-direction: column; gap: 6px; }
  .filter-label { width: auto; padding-top: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .chip { flex: none; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
}

/* ---------- slim sites table + row menu ---------- */
table.sites td { padding-top: 9px; padding-bottom: 9px; }
.site-name { font-weight: 600; overflow-wrap: anywhere; }
th.menu-col, td.menu-col { width: 44px; text-align: right; padding-left: 0; }
.kebab { border: none; background: none; padding: 6px; border-radius: 8px; color: var(--muted); }
.kebab svg { width: 18px; height: 18px; display: block; }
.kebab:hover, .kebab[aria-expanded="true"] { background: var(--panel-2); color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.menu {
  position: fixed; z-index: 120; width: 300px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
}
.menu-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; padding: 8px 10px; font-size: 13px; }
.menu-info dt { color: var(--muted); }
.menu-info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.menu-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); text-decoration: none; outline: none; }

/* clickable dashboard numbers */
a.kpi-link { color: inherit; text-decoration: none; display: block; }
a.kpi-link:hover { border-color: var(--accent); text-decoration: none; }

/* dashboard layout: attention card fills the column height */
.grid.side.dash-main { align-items: stretch; }
.card.attention { display: flex; flex-direction: column; }
.card.attention .all-clear { display: flex; align-items: center; gap: 10px; padding: 12px 18px 4px; color: var(--muted); }
.card.attention h3.coming { margin: 14px 18px 0; }
.list.upcoming li { padding-top: 8px; padding-bottom: 8px; }
.date-pill { flex: none; width: 52px; display: grid; justify-items: center; line-height: 1.1; padding: 5px 0; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.date-pill b { font-size: 16px; font-variant-numeric: tabular-nums; }
.date-pill span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.list.activity li { padding-top: 10px; padding-bottom: 10px; }
.list.activity .when { width: 84px; flex: none; }

.all-clear-strip { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }

/* backups */
.setup-card { max-width: 760px; }
ol.steps { padding-left: 18px; display: grid; gap: 6px; margin: 0; color: var(--muted); }
