/* Nicketung Hub. Dark first, light via prefers-color-scheme. */

:root {
  color-scheme: dark;
  --bg: #07070b;
  --bg-elev: #111118;
  --surface: rgba(255, 255, 255, .035);
  --surface-hover: rgba(255, 255, 255, .06);
  --surface-strong: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #f4f4f7;
  --muted: #a1a1b2;
  --faint: #6c6c7d;
  --brand: #8b7bff;
  --brand-2: #2dd4bf;
  --brand-ink: #ffffff;
  --danger: #ff6b6b;
  --ok: #34d399;
  --warn: #fbbf24;
  --blob-1: #6d5dfc;
  --blob-2: #14b8a6;
  --blob-3: #f97362;
  --blob-opacity: .32;
  --grid: rgba(255, 255, 255, .035);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -24px rgba(0, 0, 0, .8);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, .7);
  --glass-blur: 18px;
  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang HK", "Microsoft JhengHei", "Noto Sans HK", "Noto Sans CJK TC", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f4f8;
    --bg-elev: #ffffff;
    --surface: rgba(255, 255, 255, .62);
    --surface-hover: rgba(255, 255, 255, .9);
    --surface-strong: rgba(20, 20, 40, .05);
    --border: rgba(20, 20, 40, .08);
    --border-strong: rgba(20, 20, 40, .16);
    --text: #121219;
    --muted: #5c5c6e;
    --faint: #8b8b9b;
    --brand: #5b48f2;
    --brand-2: #0d9488;
    --blob-opacity: .2;
    --grid: rgba(20, 20, 40, .045);
    --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 18px 40px -26px rgba(30, 30, 70, .35);
    --shadow-pop: 0 30px 80px -24px rgba(30, 30, 70, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--brand) 40%, transparent); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 8px; }

/* ------------------------------------------------------------ background */

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: var(--blob-opacity); will-change: transform;
}
.b1 { background: var(--blob-1); top: -18vmax; left: -10vmax; animation: drift1 26s var(--ease) infinite alternate; }
.b2 { background: var(--blob-2); top: 10vmax; right: -16vmax; animation: drift2 32s var(--ease) infinite alternate; }
.b3 { background: var(--blob-3); bottom: -26vmax; left: 20vmax; width: 38vmax; height: 38vmax; opacity: calc(var(--blob-opacity) * .7); animation: drift3 38s var(--ease) infinite alternate; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
@keyframes drift1 { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-12vmax, 8vmax) scale(.9); } }
@keyframes drift3 { to { transform: translate(-10vmax, -12vmax) scale(1.1); } }

/* ------------------------------------------------------------ top bar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 14px max(16px, calc((100vw - 1160px) / 2));
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: conic-gradient(from 210deg, var(--brand), var(--brand-2), var(--brand));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 6px 20px -6px var(--brand);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 7px; border-radius: 4px;
  background: linear-gradient(90deg, #fff 0 42%, transparent 42% 58%, rgba(255, 255, 255, .6) 58%) top / 100% 42% no-repeat,
              linear-gradient(90deg, rgba(255, 255, 255, .6) 0 42%, transparent 42% 58%, rgba(255, 255, 255, .35) 58%) bottom / 100% 42% no-repeat;
}
.brand:hover .brand-mark { animation: spin-mark .8s var(--spring); }
@keyframes spin-mark { from { transform: rotate(-90deg) scale(.8); } }

.nav { display: flex; gap: 4px; margin-right: auto; }
.nav a {
  position: relative; padding: 7px 12px; border-radius: 10px; text-decoration: none;
  color: var(--muted); font-weight: 500; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--surface-hover); }
.nav a.active { color: var(--text); }
.nav a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  animation: grow .4s var(--ease);
}
@keyframes grow { from { transform: scaleX(0); } }

.langs { display: flex; }
.seg-lang { padding: 3px; border-radius: 10px; }
.seg-lang button { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.seg-lang .thumb { top: 3px; bottom: 3px; border-radius: 7px; }

.account { position: relative; }
.avatar-btn {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.avatar-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.avatar-btn:active { transform: scale(.97); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h, 250) 80% 62%), hsl(calc(var(--h, 250) + 50) 75% 52%));
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop);
  transform-origin: top right; animation: pop .22s var(--ease);
}
.menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head strong { display: block; }
.menu-head span { color: var(--muted); font-size: 13px; }
.menu a, .menu button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 9px;
  background: none; text-decoration: none; text-align: left; cursor: pointer; color: var(--text);
}
.menu a:hover, .menu button:hover { background: var(--surface-hover); }
.menu .danger { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(-4px); } }

/* ------------------------------------------------------------ layout */

.view { max-width: 1160px; margin: 0 auto; padding: 0 16px 80px; }
.page-head { padding: 56px 0 28px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

h1.hero {
  margin: 20px 0 12px; font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -.045em; font-weight: 800;
}
.gradient-text {
  background: linear-gradient(100deg, var(--text) 10%, var(--brand) 45%, var(--brand-2) 70%, var(--text) 95%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 9s ease-in-out infinite alternate;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.lede { margin: 0; max-width: 560px; color: var(--muted); font-size: 1.08rem; }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 8px 0 22px; flex-wrap: wrap; }
.search {
  position: relative; flex: 1; min-width: 220px; max-width: 380px;
}
.search input {
  width: 100%; padding: 11px 44px 11px 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.search input:focus { border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: var(--surface-hover); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.search svg { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--faint); }
.search kbd {
  position: absolute; right: 10px; top: 50%; translate: 0 -50%;
  padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border); color: var(--faint); font: 12px/1.6 var(--font);
}
.count { color: var(--faint); font-size: 14px; }

/* ------------------------------------------------------------ app cards */

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.card {
  --accent: var(--brand);
  --mx: 50%; --my: 0%;
  position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 230px;
  padding: 22px; border-radius: var(--radius); text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .5s var(--ease), border-color .3s, background .3s;
  isolation: isolate; overflow: hidden;
}
.card::before {
  /* cursor spotlight */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%);
}
.card::after {
  /* glowing border following the cursor */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; opacity: 0; transition: opacity .35s;
  background: radial-gradient(260px circle at var(--mx) var(--my), var(--accent), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.card:hover, .card:focus-visible { --lift: -4px; background: var(--surface-hover); outline: none; }
.card:hover::before, .card:hover::after, .card:focus-visible::before, .card:focus-visible::after { opacity: 1; }
.card.moving { transition: transform .12s linear, border-color .3s, background .3s; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mono {
  position: relative; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: #fff; overflow: hidden;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #1d1b3a));
  box-shadow: 0 10px 28px -10px var(--accent), 0 0 0 1px rgba(255, 255, 255, .15) inset;
  transition: transform .5s var(--spring);
}
.mono::after {
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .45) 50%, transparent 60%);
  transform: translateX(-70%); transition: transform .9s var(--ease);
}
.card:hover .mono { transform: scale(1.06) rotate(-3deg); }
.mono.has-icon { background: none; box-shadow: 0 12px 28px -12px var(--accent); }
.mono.has-icon img { width: 100%; height: 100%; display: block; border-radius: inherit; }
.card:hover .mono::after { transform: translateX(70%); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }

.card h3 { margin: 4px 0 0; font-size: 1.28rem; letter-spacing: -.02em; }
.card p { margin: 0; color: var(--muted); flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13.5px; }
.card-foot .path { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; color: var(--faint); }
.open-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.open-link svg { transition: transform .35s var(--spring); }
.card:hover .open-link svg { transform: translateX(4px); }
.card.locked .open-link { color: var(--muted); }

.empty-state {
  grid-column: 1 / -1; padding: 60px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

/* skeleton */
.skeleton { pointer-events: none; }
.skeleton .sk {
  border-radius: 8px; background: linear-gradient(90deg, var(--surface-strong) 25%, var(--surface-hover) 50%, var(--surface-strong) 75%);
  background-size: 300% 100%; animation: skel 1.4s ease-in-out infinite;
}
@keyframes skel { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ------------------------------------------------------------ reveal */

.reveal { animation: rise .75s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(6px); } }

/* ------------------------------------------------------------ buttons & forms */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .15s var(--ease), box-shadow .3s, opacity .2s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary {
  border-color: transparent; color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--brand-2)));
  box-shadow: 0 10px 30px -12px var(--brand), 0 0 0 1px rgba(255, 255, 255, .14) inset;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--brand-2))); box-shadow: 0 14px 34px -10px var(--brand), 0 0 0 1px rgba(255, 255, 255, .2) inset; filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-ghost { background: none; border-color: transparent; }
.btn-sm { padding: 6px 11px; border-radius: 10px; font-size: 13.5px; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn.loading { color: transparent; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--faint); }
.input, .field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.field textarea { resize: vertical; min-height: 84px; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: var(--surface-hover);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.field select option { background: var(--bg-elev); }
.form { display: flex; flex-direction: column; gap: 16px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-error {
  padding: 10px 13px; border-radius: 11px; font-size: 14px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  animation: shake .4s var(--ease);
}
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 44px; height: 26px; border-radius: 999px; flex: none;
  background: var(--surface-strong); border: 1px solid var(--border-strong); transition: background .3s var(--ease), border-color .3s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .4s var(--spring);
}
.switch input:checked + .track { background: var(--brand); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 3px; }

/* segmented control with a sliding thumb */
.seg {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--border);
}
.seg button {
  position: relative; z-index: 1; padding: 7px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: color .25s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--text); }
.seg .thumb {
  position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 9px; z-index: 0;
  background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .5);
  transition: transform .45s var(--spring), width .45s var(--spring);
}

/* ------------------------------------------------------------ auth pages */

.auth-wrap { min-height: calc(100dvh - 140px); display: grid; place-items: center; padding: 40px 0; }
.auth-card {
  width: min(420px, 100%); padding: 32px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.auth-card h1 { margin: 18px 0 6px; font-size: 1.7rem; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); }
.auth-card .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
.auth-card .brand-mark::after { inset: 11px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-switch button { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; }

/* ------------------------------------------------------------ home photo */

.page-head.with-photo { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 40px; }
.polaroid {
  --tilt: 4deg;
  position: relative; width: clamp(200px, 24vw, 290px); padding: 12px 12px 46px; border: 0; cursor: zoom-in;
  background: #fbf8f1; border-radius: 6px; transform: rotate(var(--tilt));
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .06);
  transition: transform .6s var(--spring), box-shadow .4s;
  animation-name: rise, float; animation-duration: .75s, 7s; animation-timing-function: var(--ease), ease-in-out;
  animation-delay: calc(var(--i, 0) * 70ms), 1s; animation-iteration-count: 1, infinite; animation-fill-mode: both, none;
  animation-direction: normal, alternate;
}
.polaroid::before {
  /* a strip of tape */
  content: ""; position: absolute; top: -12px; left: 50%; width: 86px; height: 26px; translate: -50% 0; rotate: -3deg;
  background: color-mix(in srgb, var(--brand) 28%, rgba(255, 255, 255, .55)); backdrop-filter: blur(2px); border-radius: 2px;
}
.polaroid img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; }
.polaroid:hover { transform: rotate(0deg) scale(1.04); box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .75), 0 0 0 1px rgba(0, 0, 0, .06); }
body.booted .polaroid { animation: float 7s ease-in-out 1s infinite alternate; }
@keyframes float { from { translate: 0 0; } to { translate: 0 -10px; } }
.modal.modal-photo { width: auto; max-width: min(92vw, 900px); padding: 10px; background: #fbf8f1; }
.photo-full { display: block; max-width: 100%; max-height: calc(100dvh - 60px); border-radius: 12px; }

.photo-admin { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.photo-preview { width: 120px; height: 150px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.photo-empty {
  width: 120px; height: 150px; border-radius: 12px; border: 1px dashed var(--border-strong); color: var(--faint);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; text-align: center; padding: 8px;
}
.photo-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------ localized fields */

.loc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.loc-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-strong); }
.loc-tabs button {
  position: relative; border: 0; background: none; padding: 2px 8px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--faint); transition: color .2s, background .2s;
}
.loc-tabs button.filled::after { content: ""; position: absolute; top: 3px; right: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--ok); }
.loc-tabs button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); }
.loc-field input[hidden], .loc-field textarea[hidden] { display: none; }

/* ------------------------------------------------------------ admin */

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 24px; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; transition: color .2s, background .25s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); background: var(--surface-strong); box-shadow: 0 0 0 1px var(--border) inset; }
.tabs .n { font-size: 12px; padding: 0 7px; border-radius: 999px; background: var(--surface-strong); color: var(--muted); }

.panel {
  padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
}
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.1rem; letter-spacing: -.01em; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.app-admin { --accent: var(--brand); display: grid; gap: 16px; }
.app-admin .who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-admin .who .mono { width: 46px; height: 46px; border-radius: 14px; font-size: 16px; }
.app-admin .who h3 { margin: 0; font-size: 1.05rem; }
.app-admin .who code { color: var(--faint); font-size: 12.5px; }
.app-admin .controls { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.control { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.control > span { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.control .seg { width: 100%; }
.summary {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; font-size: 14px; color: var(--muted);
  background: color-mix(in srgb, var(--accent) 7%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.summary svg { flex: none; margin-top: 2px; color: var(--accent); }
.summary.warn { --accent: var(--warn); color: var(--text); }
.claude-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 11px 13px; border-radius: 12px;
  border: 1px dashed var(--border); font-size: 14px;
}
.claude-row.on { border-style: solid; border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 6%, transparent); }
.claude-row.failed { border-style: solid; border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.claude-info { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.claude-info svg { flex: none; margin-top: 2px; color: var(--muted); }
.claude-row.on .claude-info svg { color: var(--ok); }
.claude-info strong { display: block; font-weight: 600; }
.claude-info span { color: var(--muted); }
.claude-info code { color: var(--text); font-size: 13px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; animation: rise .4s var(--ease); }
.person {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; font-weight: 500;
  transition: border-color .2s, background .2s, transform .15s;
}
.person .avatar { width: 24px; height: 24px; font-size: 10px; }
.person:active { transform: scale(.96); }
.person[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.person[aria-pressed="true"]::after { content: "✓"; color: var(--accent); font-weight: 700; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-row .sub { color: var(--faint); font-size: 13px; }
.list-row .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.icon-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-opt {
  padding: 3px; border-radius: 16px; border: 2px solid transparent; background: none; cursor: pointer;
  transition: transform .25s var(--spring), border-color .2s;
}
.icon-opt:hover { transform: scale(1.06); }
.icon-opt[aria-pressed="true"] { border-color: var(--text); }
.icon-opt img, .icon-opt .mono { width: 46px; height: 46px; border-radius: 13px; display: grid; font-size: 15px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 28px; height: 28px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; background: var(--c);
  box-shadow: 0 0 0 1px var(--border) inset; transition: transform .25s var(--spring);
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { border-color: var(--text); transform: scale(1.08); }
.swatches input[type="color"] { width: 34px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }

/* ------------------------------------------------------------ modal & toasts */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 5, 10, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade .25s ease;
}
.modal {
  width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 26px; border-radius: 22px;
  background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  animation: modal-in .45s var(--spring);
}
.modal h2 { margin: 0 0 4px; font-size: 1.3rem; letter-spacing: -.02em; }
.modal > p { margin: 0 0 20px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-backdrop.closing { animation: fade .2s ease reverse forwards; }
.modal-backdrop.closing .modal { animation: modal-out .2s ease forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

.toasts { position: fixed; z-index: 60; bottom: 20px; left: 50%; translate: -50% 0; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; font-weight: 500; font-size: 14px;
  background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  animation: toast-in .45s var(--spring);
}
.toast .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; background: var(--ok); }
.toast.error .ic { background: var(--danger); }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.95); } }

/* ------------------------------------------------------------ status page (served by the auth check) */

.status-page { display: grid; place-items: center; padding: 16px; }
.status-card {
  width: min(460px, 100%); padding: 36px; text-align: center; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.status-code {
  font-size: 4.2rem; font-weight: 800; letter-spacing: -.05em; line-height: 1;
  background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.status-card h1 { margin: 14px 0 8px; font-size: 1.4rem; }
.status-card p { margin: 0 0 24px; color: var(--muted); }

/* ------------------------------------------------------------ admin > monitoring */

:root {
  /* Chart colors: two series hues and the four status classes (validated palette, dark steps). */
  --series-1: #3987e5;
  --series-2: #d95926;
  --st-2: #0ca30c;
  --st-3: #7d7d8c;
  --st-4: #fab219;
  --st-5: #d03b3b;
  --globe-ocean: #0b1222;
  --globe-ocean-2: #17233d;
  --globe-land: #2b3448;
  --globe-line: rgba(10, 14, 24, .9);
  --globe-grid: rgba(255, 255, 255, .06);
  --land: #2b3448;
}
@media (prefers-color-scheme: light) {
  :root {
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --st-3: #8b8b9b;
    --globe-ocean: #c9d8ee;
    --globe-ocean-2: #e8f0fb;
    --globe-land: #fbfbfd;
    --globe-line: rgba(90, 100, 130, .35);
    --globe-grid: rgba(40, 60, 100, .08);
    --land: #e3e8f0;
  }
}

.mon { display: grid; gap: 16px; }
.mon .panel + .panel { margin-top: 0; }
.mon h3 { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.mon .hint { margin: 0; color: var(--faint); font-size: 13px; }
.mon .num { text-align: right; font-variant-numeric: tabular-nums; }
.mon .code, .mon .uri { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
#m-info { overflow-wrap: anywhere; }

.live-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
}
.live-badge.stale { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ping 1.8s var(--ease) infinite; }
.live-badge.stale .pulse::after { animation: none; }
@keyframes ping { from { transform: scale(1); opacity: .7; } to { transform: scale(3); opacity: 0; } }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.kpi {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 13px 14px; border-radius: 16px;
  background: var(--surface-strong); border: 1px solid var(--border);
}
.kpi .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.kpi .v { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12.5px; color: var(--faint); min-height: 1.2em; overflow-wrap: anywhere; }
.kpi[data-kpi="net"] .v { display: flex; flex-direction: column; font-size: 1.02rem; line-height: 1.35; }
.kpi[data-kpi="net"] .s { display: none; }
.kpi[data-kpi="net"] .v .ul { color: var(--muted); }
.kpi[data-kpi="net"] .v .ul, .kpi[data-kpi="net"] .v .dl { display: block; }
.meter { display: block; height: 5px; margin-top: 6px; border-radius: 999px; background: var(--surface-strong); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--series-1); transition: width .6s var(--ease); }
.meter.warm span { background: var(--st-4); }
.meter.hot span { background: var(--st-5); }
.meter.bat span { background: var(--st-2); }

.mon-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; flex-wrap: wrap; }
.mon-sub h3 { margin: 0; }
.seg-sm button { padding: 5px 11px; font-size: 13px; }
.seg-wrap { display: inline-block; max-width: 100%; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chart-box { position: relative; margin: 0; padding: 12px 12px 6px; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--border); min-width: 0; }
.chart-box figcaption { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; margin: 0 2px 6px; }
.legend { display: inline-flex; gap: 12px; flex-wrap: wrap; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.legend i, .tip i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart { position: relative; width: 100%; }
.plot { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.plot .gridline { stroke: var(--border); stroke-width: 1; }
.plot .axis { stroke: var(--border-strong); stroke-width: 1; }
.plot .ylab, .plot .xlab { fill: var(--faint); font: 500 11px var(--font); font-variant-numeric: tabular-nums; }
.plot .ylab { text-anchor: end; dominant-baseline: middle; }
.plot .xlab { text-anchor: middle; }
.plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .area { opacity: .14; }
.plot .hair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.plot .hover-dot { stroke: var(--bg-elev); stroke-width: 2; }
.plot .hit { cursor: crosshair; }
.plot .bar { transition: opacity .15s; }
.plot .bar.dim { opacity: .45; }
.plot .brush { fill: color-mix(in srgb, var(--series-1) 18%, transparent); stroke: var(--series-1); stroke-width: 1; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: 2px; min-width: 120px; max-width: 260px;
  padding: 8px 10px; border-radius: 10px; background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  font-size: 12.5px; color: var(--muted);
}
.tip[hidden] { display: none; }
.tip .tip-time { color: var(--text); font-weight: 700; }
.tip b { color: var(--text); font-variant-numeric: tabular-nums; }
.tip .muted { color: var(--faint); }

.mon-cols { display: grid; grid-template-columns: 1fr 1.1fr 1.3fr; gap: 10px; margin-top: 10px; }
.mon-card { padding: 14px; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--border); min-width: 0; }
.cores { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 3px; height: 64px; }
.core { position: relative; border-radius: 4px; background: var(--surface-strong); overflow: hidden; }
.core span { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px; background: var(--series-1); transition: height .6s var(--ease); }
.sensors { display: grid; gap: 4px; }
.sensor { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.sensor b { color: var(--text); font-variant-numeric: tabular-nums; }
.services { display: grid; gap: 8px; }
.service { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.svc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-2) 20%, transparent); flex: none; }
.service.down .svc-dot { background: var(--st-5); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-5) 20%, transparent); }
.svc-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.svc-main b { font-size: 14px; }
.svc-main span, .svc-side { font-size: 12.5px; color: var(--faint); }
.svc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-variant-numeric: tabular-nums; }
.procs { display: grid; gap: 2px; }
.proc { display: grid; grid-template-columns: minmax(0, 1fr) 64px 76px; gap: 8px; align-items: center; padding: 5px 4px; font-size: 13px; border-radius: 8px; }
.proc:not(.proc-head):hover { background: var(--surface); }
.proc-head { color: var(--faint); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.pname { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.pname b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* traffic */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.mon-search { flex: 1 1 220px; max-width: none; min-width: 180px; }
.status-filter { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-strong); border: 1px solid var(--border); }
.st-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 600 13px var(--font); font-variant-numeric: tabular-nums; transition: background .2s, color .2s;
}
.st-btn::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.st-btn.s2 { --c: var(--st-2); } .st-btn.s3 { --c: var(--st-3); } .st-btn.s4 { --c: var(--st-4); } .st-btn.s5 { --c: var(--st-5); }
.st-btn:hover { color: var(--text); }
.st-btn[aria-pressed="true"] { color: var(--text); background: color-mix(in srgb, var(--c) 20%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent) inset; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.active-filters:empty { display: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 999px; cursor: pointer; font: 500 13px var(--font);
  color: var(--text); background: color-mix(in srgb, var(--brand) 14%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  animation: pop-in .25s var(--spring);
}
.filter-chip .fk { color: var(--muted); }
.filter-chip > span[aria-hidden] { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-strong); }
.filter-chip:hover > span[aria-hidden] { background: var(--brand); color: var(--brand-ink); }
.link-btn { border: 0; background: none; color: var(--faint); cursor: pointer; font: 600 13px var(--font); padding: 4px 6px; }
.link-btn:hover { color: var(--text); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } }
.mon.loading-traffic .kpis-traffic, .monitor-root .loading-traffic .kpis-traffic { opacity: .6; }
.kpis-traffic { transition: opacity .2s; }
.kpis-traffic .v { font-size: 1.3rem; }

.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 10px; margin-top: 10px; }
.map-box { position: relative; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--border); overflow: hidden; padding: 8px; min-width: 0; }
.globe { display: block; width: 100%; height: 480px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.globe.grabbing { cursor: grabbing; }
.globe.pointing { cursor: pointer; }
.globe-hint { margin: 4px 0 0; text-align: center; font-size: 12px; color: var(--faint); pointer-events: none; transition: opacity .6s; }
.globe-hint.gone { opacity: 0; }
.map-tools { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 8px; z-index: 2; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
.zoom { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-strong); border: 1px solid var(--border); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.zoom button { width: 30px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 600 15px var(--font); cursor: pointer; }
.zoom button:hover { background: var(--surface-hover); color: var(--text); }
.zoom button[aria-pressed="true"] { color: var(--series-1); }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 8px 6px 2px; font-size: 12.5px; color: var(--muted); }
.map-legend i { display: inline-block; vertical-align: -1px; margin-right: 6px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--series-1); }
.lg-live { width: 10px; height: 10px; border-radius: 50%; background: var(--series-2); }
.lg-home { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text); }
.lg-ramp { display: inline-flex; align-items: center; gap: 6px; }
.lg-ramp i { width: 70px; height: 8px; border-radius: 4px; margin: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--series-1) 18%, var(--land)), var(--series-1)); }
.lg-credit { margin-left: auto; font-size: 11.5px; }
.lg-credit a { color: var(--faint); }
.live-list { padding: 14px; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--border); min-width: 0; max-height: 520px; overflow: auto; }
.live-list h3 { display: flex; align-items: center; gap: 9px; color: var(--series-2); }
.live-list .hint { margin-bottom: 8px; }
.live-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 10px; border: 0; background: none; cursor: pointer;
  text-align: left; color: var(--text); font: inherit; animation: fade-up .3s var(--ease);
}
.live-item:hover { background: var(--surface); }
.live-item .flag { font-size: 18px; width: 22px; text-align: center; }
.li-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.li-main b { font: 600 12.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; }
.li-main small, .li-side small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.svc { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding: 1px 6px; border-radius: 6px; background: var(--surface-strong); color: var(--muted); }
.svc.ssh { color: var(--warn); }

.hist-box { margin-top: 10px; }
.hist-box .hint { margin: 2px 2px 4px; font-size: 12px; }
.tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.top-list { padding: 14px; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--border); min-width: 0; }
.top-row {
  position: relative; display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: 500 13px var(--font); cursor: pointer; text-align: left; isolation: isolate;
}
.top-row::before {
  content: ""; position: absolute; inset: 2px auto 2px 0; width: var(--w); border-radius: 7px; z-index: -1;
  background: color-mix(in srgb, var(--series-1) 16%, transparent); transition: width .5s var(--ease);
}
.top-row:hover::before { background: color-mix(in srgb, var(--series-1) 28%, transparent); }
.top-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-label small { color: var(--faint); }
.top-n { color: var(--muted); font-variant-numeric: tabular-nums; }

/* request history */
.new-pill {
  padding: 7px 14px; border-radius: 999px; border: 0; cursor: pointer; font: 600 13px var(--font); color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--brand-2))); box-shadow: 0 10px 24px -10px var(--brand);
  animation: pop-in .3s var(--spring);
}
.new-pill[hidden] { display: none; }
.req-table { display: grid; }
.req-row {
  display: grid; grid-template-columns: 128px minmax(0, 1fr) 62px minmax(0, 210px) 74px 74px; gap: 12px; align-items: center;
  width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font: 400 13.5px var(--font); text-align: left; cursor: pointer;
}
.req-head { cursor: default; color: var(--faint); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); border-radius: 0; }
.req { border-bottom: 1px solid var(--border); animation: fade-up .25s var(--ease); }
.req:last-child { border-bottom: 0; }
.req > .req-row:hover, .req.open > .req-row { background: var(--surface-strong); }
.c-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-req { display: flex; align-items: center; gap: 8px; min-width: 0; }
.c-req .uri { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.method { flex: none; font: 700 10.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: 2px 6px; border-radius: 6px; background: var(--surface-strong); color: var(--muted); }
.method.m-post, .method.m-put, .method.m-patch { color: var(--series-1); }
.method.m-delete { color: var(--danger); }
.tag { flex: none; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.tag.bot { color: var(--faint); }
.tag.probe { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.status { display: inline-flex; align-items: center; gap: 6px; font: 700 12.5px var(--font); font-variant-numeric: tabular-nums; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }
.status.s2 { --c: var(--st-2); } .status.s3 { --c: var(--st-3); } .status.s4 { --c: var(--st-4); } .status.s5 { --c: var(--st-5); }
.c-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.c-who .flag { font-size: 16px; flex: none; }
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.who b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-dur, .c-size { color: var(--muted); font-size: 12.5px; }
.req-detail { padding: 6px 12px 16px; animation: fade-up .25s var(--ease); }
.req-detail dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; margin: 6px 0 10px; font-size: 13px; }
.req-detail dt { color: var(--faint); font-weight: 600; }
.req-detail dd { margin: 0; overflow-wrap: anywhere; }
.req-detail details { margin-bottom: 10px; }
.req-detail summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.req-detail dl.headers { grid-template-columns: 200px minmax(0, 1fr); font-size: 12px; margin-top: 8px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.more-wrap { display: flex; justify-content: center; margin-top: 14px; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mon-cols { grid-template-columns: 1fr 1fr; }
  .mon-cols > :last-child { grid-column: 1 / -1; }
  .map-wrap { grid-template-columns: 1fr; }
  .live-list { max-height: 280px; }
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts, .mon-cols { grid-template-columns: 1fr; }
  .mon-cols > :last-child { grid-column: auto; }
  .panel.mon-machine, .panel.mon-traffic, .panel.mon-history { padding: 16px; }
  .globe { height: 340px; }
  .req-head { display: none; }
  .req-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "req status" "who time" "who dur"; gap: 4px 10px; }
  .c-req { grid-area: req; }
  .c-status { grid-area: status; justify-self: end; }
  .c-who { grid-area: who; }
  .c-time { grid-area: time; justify-self: end; }
  .c-dur { grid-area: dur; justify-self: end; }
  .c-size { display: none; }
  .req-detail dl, .req-detail dl.headers { grid-template-columns: 1fr; gap: 2px; }
  .req-detail dd { margin-bottom: 6px; }
  .filters > .seg-wrap, .status-filter { max-width: 100%; overflow-x: auto; }
  .lg-credit { margin-left: 0; }
}

/* ------------------------------------------------------------ view transitions */

/* Only the page content transitions; the top bar and background stay still. */
#view { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(page) { animation: vt-out .14s ease both; }
::view-transition-new(page) { animation: vt-in .28s var(--ease) both; }
body.booted .reveal { animation: none; }
.fade-swap { animation: fade-up .26s var(--ease); }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------ responsive & motion */

@media (max-width: 720px) {
  .topbar { gap: 10px; }
  .brand-name { display: none; }
  .avatar-btn .who-name { display: none; }
  .avatar-btn { padding: 3px; }
  .page-head { padding: 36px 0 22px; }
  .page-head.with-photo { grid-template-columns: 1fr; gap: 28px; }
  .polaroid { justify-self: center; width: min(250px, 70vw); }
  .seg-lang button { padding: 4px 7px; }
  .app-admin .controls { grid-template-columns: 1fr; }
  .seg button { padding: 7px 6px; font-size: 12.5px; }
  .list-row { flex-wrap: wrap; }
  .list-row .actions { width: 100%; justify-content: flex-start; }
  .auth-card, .modal { padding: 22px; }
  .tabs { display: flex; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .blob { animation: none; }
}
