/* Site maintenance panel. One stylesheet, no framework. Light and dark follow the OS. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter_regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/inter_medium.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter_semibold.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f1b2d;
  --body: #3d4b5f;
  --muted: #5b6b80;
  --line: #e1e6ed;
  --line-strong: #c9d1dc;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --on: #157f3b;
  --on-soft: #e3f4e9;
  --off: #b4400e;
  --off-soft: #fdeee4;
  --warn-soft: #fff6e0;
  --warn-line: #f0d48a;
  --error: #b42318;
  --error-soft: #fdecea;
  --focus: #1d4ed8;
  --shadow: 0 1px 2px rgb(15 27 45 / .05), 0 2px 8px rgb(15 27 45 / .04);
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b111c;
    --surface: #121a28;
    --surface-2: #172133;
    --ink: #eef2f7;
    --body: #c3ccd8;
    --muted: #93a1b4;
    --line: #233046;
    --line-strong: #31415c;
    --accent: #7aa2ff;
    --accent-ink: #0b111c;
    --accent-soft: #1a2747;
    --on: #4ccf7d;
    --on-soft: #12301f;
    --off: #ff9a5c;
    --off-soft: #3a2113;
    --warn-soft: #2e2510;
    --warn-line: #6b5420;
    --error: #ff8a80;
    --error-soft: #3a1714;
    --focus: #7aa2ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--body);
  font: 400 15px/1.55 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: .8125rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); margin: 0 0 .625rem; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .875em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .05em .35em; overflow-wrap: anywhere; }
b, strong { color: var(--ink); font-weight: 600; }
b.mono { font-weight: 500; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- frame */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar__inner { max-width: 960px; margin: 0 auto; padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: .625rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand__mark { width: 28px; height: 28px; flex: none; }
.brand__mark rect { fill: var(--ink); }
.brand__mark path { fill: none; stroke: var(--bg); stroke-width: 2.6; stroke-linecap: round; }
.brand__mark--lg { width: 44px; height: 44px; }
.topbar__nav { display: flex; align-items: center; gap: 1.25rem; font-size: .875rem; white-space: nowrap; }
.topbar__nav .wide-only { display: inline; }
.topbar__nav a { color: var(--body); text-decoration: none; }
.topbar__nav a:hover, .topbar__nav a[aria-current] { color: var(--ink); text-decoration: underline; }
.topbar__nav form { margin: 0; }
main { max-width: 960px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.is-auth main { display: grid; place-items: center; min-height: 100vh; padding-block: 2rem; }

/* ---------------------------------------------------------------- pieces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 1.125rem 1.25rem; }
.lede { color: var(--muted); margin-top: .375rem; }
.text-off { color: var(--off); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 40px; padding: .5rem 1rem; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 500 .875rem/1 var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn--primary:hover { background: var(--body); border-color: var(--body); }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 34px; padding: .375rem .75rem; font-size: .8125rem; }
.btn--block { width: 100%; }
.btn[disabled], .switch[disabled] { opacity: .55; cursor: progress; }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--body); cursor: pointer; text-decoration: none; }
.linklike:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.flash { margin: 0 0 1.25rem; padding: .75rem 1rem; border-radius: 10px; border: 1px solid; font-size: .9rem; }
.flash--ok { background: var(--on-soft); border-color: color-mix(in srgb, var(--on) 30%, transparent); color: var(--ink); }
.flash--error { background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 35%, transparent); color: var(--ink); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin: 0 0 1.25rem; padding: .875rem 1rem; border-radius: 10px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--ink); }
.notice p { flex: 1 1 22rem; }

/* ---------------------------------------------------------------- forms */
.form { padding: 1.5rem; display: grid; gap: 1rem; }
.field { display: grid; gap: .375rem; font-size: .875rem; font-weight: 500; color: var(--ink); }
.field small { font-weight: 400; color: var(--muted); font-size: .8125rem; }
.field input {
  width: 100%; min-height: 42px; padding: .5rem .75rem; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 400 1rem/1.4 var(--font); transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--muted); opacity: 1; }
.field input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.form__error { padding: .625rem .75rem; border-radius: 8px; background: var(--error-soft); color: var(--error); font-size: .875rem; font-weight: 500; }
.form__actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .25rem; }

.auth { width: 100%; max-width: 380px; }
.auth__head { text-align: center; margin-bottom: 1.5rem; display: grid; justify-items: center; gap: .625rem; }
.auth__head p { color: var(--muted); max-width: 30ch; }
.narrow { max-width: 460px; display: grid; gap: 1rem; }

/* ---------------------------------------------------------------- dashboard */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.group { margin-bottom: 2rem; }
.sites { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.site { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; padding: 1rem 1.25rem; scroll-margin-top: 5rem; }
.site + .site { border-top: 1px solid var(--line); }
.site--off, .site--partial { background: color-mix(in srgb, var(--off-soft) 55%, var(--surface)); }
.site:target { box-shadow: inset 0 0 0 2px var(--accent); }
.site__main { min-width: 0; display: grid; gap: .3rem; }
.site__title { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; }
.site__hosts { display: flex; flex-wrap: wrap; gap: .25rem .875rem; font-size: .8125rem; }
.site__hosts a { color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.site__hosts a:hover { color: var(--accent); text-decoration: underline; }
.site__hosts a.is-off { color: var(--off); }
.site__since { font-size: .8125rem; color: var(--off); }
.site__note { font-size: .8125rem; color: var(--muted); max-width: 62ch; }
.site__switch { display: flex; align-items: center; gap: .75rem; margin: 0; flex: none; }

.status { display: inline-flex; align-items: center; gap: .375rem; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--on { color: var(--on); background: var(--on-soft); }
.status--off, .status--partial { color: var(--off); background: var(--off-soft); }

/* The switch is a submit button: on = site online. */
.switch { display: inline-flex; align-items: center; gap: .625rem; padding: .375rem; margin: -.375rem; border: 0; background: none; cursor: pointer; font: 600 .8125rem/1 var(--font); color: var(--ink); border-radius: 999px; }
.switch__track { position: relative; width: 48px; height: 28px; border-radius: 999px; background: var(--line-strong); transition: background-color .2s cubic-bezier(.2, .8, .2, 1); }
.switch__thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.switch[aria-checked="true"] .switch__track { background: var(--on); }
.switch[aria-checked="true"] .switch__thumb { transform: translateX(20px); }
.switch[aria-checked="false"] .switch__track { background: var(--off); }
.switch:hover .switch__track { filter: brightness(1.08); }
.switch__label { min-width: 1.75em; }
.switch.is-busy .switch__thumb { transform: translateX(10px); }

.empty { padding: 1.5rem; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 1.5rem; align-items: start; }
.columns .card { display: grid; gap: 1rem; }
.myip { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; padding: .75rem .875rem; border-radius: 9px; background: var(--surface-2); }
.myip form { margin: 0; }
.iplist { list-style: none; margin: 0; padding: 0; display: grid; }
.iplist li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .875rem; }
.iplist li:first-child { border-top: 0; }
.iplist small { display: block; }
.iplist form { margin: 0; }
.addip summary { cursor: pointer; color: var(--accent); font-size: .875rem; font-weight: 500; width: max-content; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: .75rem; align-items: end; margin-top: .75rem; }
@media (max-width: 560px) { .inline-form { grid-template-columns: 1fr; } }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: .625rem; font-size: .875rem; }
.activity li { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; }
.activity time { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .activity li { grid-template-columns: 1fr; gap: 0; } }

@media (max-width: 640px) {
  main { padding-top: 1.25rem; }
  .site { align-items: flex-start; }
  .topbar__nav { gap: .875rem; }
  .brand span { font-size: .9375rem; }
  .topbar__nav .wide-only { display: none; }
  .topbar__nav a::first-letter { text-transform: uppercase; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* ---------------------------------------------------------------- sign-in (modelled on the SIMS login) */
:root { --brand: #1d3fd8; --brand-dark: #1631b0; --gold: #f0a500; }
@media (prefers-color-scheme: dark) { :root { --brand: #1f3fc9; --brand-dark: #2a4be0; } }
.is-login main { max-width: none; padding: 0; }
.login { min-height: 100vh; display: flex; background: var(--surface); }
.login__brand {
  width: 42%; background: var(--brand); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 3rem 2.5rem;
}
.login__brand::before, .login__brand::after { content: ""; position: absolute; border-radius: 50%; background: rgb(255 255 255 / .06); }
.login__brand::before { width: 380px; height: 380px; top: -120px; right: -120px; }
.login__brand::after { width: 280px; height: 280px; bottom: -80px; left: -80px; background: rgb(255 255 255 / .045); }
.login__brand-inner { position: relative; z-index: 1; text-align: center; }
.login__logo {
  display: inline-grid; place-items: center; width: 132px; height: 132px; margin-bottom: 1.75rem;
  background: #fff; border-radius: 16px; border: 4px solid rgb(255 255 255 / .25);
  box-shadow: 0 8px 32px rgb(0 0 0 / .35); background-clip: padding-box;
}
.login__logo svg { width: 84px; height: 84px; }
.login__logo rect { fill: #0f1b2d; }
.login__logo path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.login__name { color: #fff; font-size: 1.6rem; font-weight: 600; letter-spacing: .04em; line-height: 1.3; margin-bottom: .6rem; }
.login__motto { color: rgb(255 255 255 / .78); font-size: .9rem; font-style: italic; max-width: 26ch; margin: 0 auto; }
.login__divider { display: block; width: 48px; height: 3px; border-radius: 2px; background: var(--gold); margin: 1.5rem auto 0; }

.login__panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; background: var(--surface); }
.login__card { width: 100%; max-width: 420px; animation: fadeUp .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes fadeUp { from { opacity: .4; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login__header { margin-bottom: 2rem; }
.login__header h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.login__header p { color: var(--muted); font-size: .9rem; margin-top: .35rem; }

.lfield { margin-bottom: 1.1rem; }
.lfield label { display: block; margin-bottom: .45rem; font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--body); }
.input-wrap { position: relative; }
.field-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; pointer-events: none;
  fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.input-wrap:focus-within .field-icon { stroke: var(--brand); }
.input-wrap input {
  width: 100%; min-height: 50px; padding: .8rem 3rem .8rem 2.85rem; border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface-2); color: var(--ink); font: 400 1rem/1.4 var(--font);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.input-wrap input::placeholder { color: var(--muted); opacity: 1; }
.input-wrap input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
@media (prefers-color-scheme: dark) { .input-wrap input:focus { border-color: var(--accent); } .input-wrap:focus-within .field-icon { stroke: var(--accent); } }
.eye-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 10px; cursor: pointer; color: var(--muted); }
.eye-toggle:hover { color: var(--brand); }
.eye-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.eye-toggle .eye-shut, .eye-toggle[aria-pressed="true"] .eye-open { display: none; }
.eye-toggle[aria-pressed="true"] .eye-shut { display: block; }

.btn-login, .btn-clear { display: block; width: 100%; min-height: 50px; border-radius: 14px; font: 600 1rem/1 var(--font); cursor: pointer; margin-top: .5rem; }
.btn-login { background: var(--brand); color: #fff; border: 0; letter-spacing: .01em; transition: background-color .2s, transform .15s, box-shadow .2s; }
.btn-login:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-login:active { transform: none; }
.btn-clear { background: var(--surface-2); color: var(--body); border: 2px solid var(--line); font-weight: 500; font-size: .95rem; transition: background-color .2s; }
.btn-clear:hover { background: var(--line); }

.alert { display: flex; align-items: flex-start; gap: .65rem; padding: .9rem 1rem; border-radius: 14px; font-size: .875rem; margin-bottom: 1.25rem; border: 1.5px solid; }
.alert .icon { flex: none; margin-top: 2px; }
.alert--error { background: var(--error-soft); border-color: color-mix(in srgb, var(--error) 35%, transparent); color: var(--error); animation: shake .45s ease; }
.alert--ok { background: var(--on-soft); border-color: color-mix(in srgb, var(--on) 30%, transparent); color: var(--ink); }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.login__forgot { margin-top: 1rem; text-align: center; font-size: .85rem; }
.login__forgot summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; color: var(--muted); list-style: none; padding: .25rem; border-radius: 6px; }
.login__forgot summary::-webkit-details-marker { display: none; }
.login__forgot summary:hover { color: var(--brand); }
.login__forgot p { margin-top: .5rem; text-align: left; color: var(--body); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .875rem; }
.login__footer { margin-top: 2rem; text-align: center; font-size: .76rem; color: var(--muted); }

@media (max-width: 768px) {
  .login { flex-direction: column; }
  .login__brand { width: 100%; padding: 1.5rem; justify-content: flex-start; }
  .login__brand::before, .login__brand::after { display: none; }
  .login__brand-inner { display: flex; align-items: center; gap: 1rem; text-align: left; }
  .login__logo { width: 64px; height: 64px; margin: 0; flex: none; border-width: 3px; border-radius: 12px; }
  .login__logo svg { width: 40px; height: 40px; }
  .login__name { font-size: 1.05rem; margin-bottom: .15rem; }
  .login__motto { font-size: .8rem; margin: 0; }
  .login__divider { display: none; }
  .login__panel { align-items: flex-start; padding: 2rem 1.25rem; }
}
@media (min-width: 1280px) {
  .login__brand { width: 46%; padding: 4rem 3.5rem; }
  .login__name { font-size: 1.8rem; }
}
