:root {
  --bg: #0b1020; --panel: #121a30; --panel2: #18223d; --line: #26335a; --text: #e6ebff; --muted: #8b97c0;
  --accent: #ff4d94; --accent2: #3ad1ff; --ok: #3ddc97; --warn: #ffb74d; --bad: #ff5c5c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent2); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: #0d1429; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent2); }
textarea { min-height: 90px; resize: vertical; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--accent2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #12041a; font-weight: 600; }
button.danger { background: #3a1620; border-color: var(--bad); }
button.small { padding: 2px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; color: var(--muted); font-size: 12px; margin: 8px 0 3px; }

#app { height: 100%; }

/* ---------- login ---------- */
.login { position: relative; min-height: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; background: #05030d; padding: 24px 16px; }
.login-sky { position: absolute; inset: 0; background:
  radial-gradient(ellipse 60% 45% at 50% 38%, rgba(255, 77, 148, .30), transparent 70%),
  radial-gradient(ellipse 45% 40% at 18% 80%, rgba(58, 209, 255, .22), transparent 70%),
  radial-gradient(ellipse 45% 40% at 85% 20%, rgba(150, 70, 255, .25), transparent 70%); animation: skyshift 12s ease-in-out infinite alternate; }
@keyframes skyshift { to { filter: hue-rotate(25deg) brightness(1.15); } }
.login-grid { position: absolute; left: -50%; right: -50%; bottom: -5%; height: 55%; transform: perspective(380px) rotateX(62deg); transform-origin: center bottom;
  background-image: linear-gradient(rgba(255, 77, 148, .55) 1px, transparent 1px), linear-gradient(90deg, rgba(58, 209, 255, .45) 1px, transparent 1px);
  background-size: 64px 64px; animation: gridmove 3s linear infinite; mask-image: linear-gradient(to top, #000 10%, transparent 95%); -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 95%); }
@keyframes gridmove { to { background-position: 0 64px, 64px 0; } }
.login-card { position: relative; z-index: 1; width: min(700px, 100%); text-align: center; padding: 8px 20px 24px; }
.login-logo { width: 100%; height: auto; display: block; mix-blend-mode: screen; animation: floaty 6s ease-in-out infinite;
  /* feather all four edges so the image's dark backdrop melts into the page instead of showing a box */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14%, #000 86%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent 0, #000 14%, #000 86%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%); mask-composite: intersect; }
@keyframes floaty { 50% { transform: translateY(-6px); } }
.login-tag { margin: -6px 0 18px; color: #c9c3ff; letter-spacing: 3px; text-transform: uppercase; font-size: 12px; text-shadow: 0 0 12px rgba(150, 70, 255, .8); }
.discord-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-width: 280px; padding: 15px 30px; border-radius: 10px; background: #5865f2; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 8px 30px rgba(88, 101, 242, .55), 0 0 40px rgba(255, 77, 148, .25); transition: transform .15s, box-shadow .15s, background .15s; }
.discord-btn:hover { background: #6c78ff; transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset, 0 12px 38px rgba(88, 101, 242, .75), 0 0 56px rgba(58, 209, 255, .35); }
.discord-btn:focus-visible { outline: 3px solid var(--accent2); outline-offset: 3px; }
.discord-btn.loading { pointer-events: none; opacity: .75; }
.discord-btn.loading span::after { content: '…'; }
.login-hint { margin: 16px auto 0; max-width: 400px; color: #8f89b8; font-size: 13px; }
.login-features { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.login-features span { padding: 4px 12px; border-radius: 999px; font-size: 12px; color: #d8d4ff; background: rgba(150, 70, 255, .14); border: 1px solid rgba(150, 70, 255, .4); }
.login-error { margin: 0 auto 16px; max-width: 420px; display: grid; gap: 2px; text-align: left; padding: 10px 14px; border-radius: 8px; background: rgba(255, 92, 92, .12); border: 1px solid var(--bad); }
.login-error b { color: #ff9a9a; } .login-error span { color: #f0d4d4; font-size: 13px; }
.login { grid-template-rows: 1fr auto; }
.login-card { align-self: center; }
.login-foot { position: relative; z-index: 1; width: 100%; text-align: center; color: #6a6492; font-size: 12px; padding-top: 12px; }
@media (max-width: 520px) { .discord-btn { min-width: 0; width: 100%; } .login-grid { height: 40%; } }
@media (prefers-reduced-motion: reduce) { .login-sky, .login-grid, .login-logo { animation: none; } }

.brand-img { height: 34px; width: auto; mix-blend-mode: screen; display: block; }
.topbar .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.topbar .brand img { display: block; }
.avatar { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); } .avatar.big { width: 56px; height: 56px; border-color: var(--accent); }
.welcome { max-width: 620px; margin: 40px auto; }

.shell { display: grid; grid-template-rows: 46px 1fr; height: 100%; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 14px; background: linear-gradient(90deg, #170f2e, #0f1d3a); border-bottom: 2px solid var(--accent); }
.brand { font-weight: 800; letter-spacing: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 18px; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 13px 12px; border-bottom: 3px solid transparent; }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--accent2); }
.spacer { flex: 1; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.me-chip { display: flex; align-items: center; gap: 8px; }
.banner { padding: 6px 14px; font-weight: 700; text-align: center; letter-spacing: 1px; }
.banner.s100 { background: var(--bad); color: #fff; animation: blink 1s infinite; }
.banner.panic { background: #8b0000; color: #fff; animation: blink .6s infinite; }
@keyframes blink { 50% { opacity: .55; } }

main { overflow: auto; padding: 12px; }
.grid { display: grid; gap: 12px; align-items: start; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.panel > header { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--panel2); border-bottom: 1px solid var(--line); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; color: var(--accent2); }
.panel > .body { padding: 10px 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 120px; }
.muted { color: var(--muted); }
.mt { margin-top: 10px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 5px 8px; border-bottom: 1px solid var(--line); }
td { padding: 5px 8px; border-bottom: 1px solid #1c2748; vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover { background: #172041; }

.status { padding: 1px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.st-available, .st-in_service { background: #12351f; color: var(--ok); }
.st-busy { background: #3b2a10; color: var(--warn); }
.st-enroute { background: #10304a; color: var(--accent2); }
.st-onscene { background: #3b1f4a; color: #d99bff; }
.st-transporting, .st-at_hospital, .st-returning { background: #1f2a4a; color: #9db4ff; }
.st-out_of_service { background: #2a2a2a; color: #999; }
.pri-1 { color: var(--bad); font-weight: 700; } .pri-2 { color: var(--warn); } .pri-3 { color: var(--ok); }
.panic-row { background: #4a0f14; animation: blink .8s infinite; }

.statusbar { display: flex; gap: 6px; flex-wrap: wrap; }
.statusbar button.on { background: var(--accent2); color: #04121a; border-color: var(--accent2); font-weight: 700; }

.card { border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; margin-bottom: 8px; background: #0e1630; }
.card.wanted { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad) inset; }
.flag { color: #fff; background: var(--bad); padding: 1px 8px; border-radius: 3px; font-size: 11px; font-weight: 700; margin-left: 6px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 2px 8px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tabs button.on { background: var(--accent2); color: #04121a; border-color: var(--accent2); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 12px; }
.perm-grid label { display: flex; gap: 6px; align-items: center; margin: 2px 0; color: var(--text); font-size: 13px; }
.perm-grid input { width: auto; }

.overlay { position: fixed; inset: 0; background: rgba(3,6,16,.7); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; width: min(720px, 94vw); max-height: 90vh; overflow: auto; }
.modal > h3 { margin: 0; padding: 10px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.modal > .body { padding: 12px 14px; }
.modal > footer { padding: 10px 14px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--panel2); border-left: 4px solid var(--accent2); padding: 10px 14px; border-radius: 4px; box-shadow: 0 4px 16px #0008; max-width: 340px; }
.toast.err { border-color: var(--bad); } .toast.alert { border-color: var(--warn); font-weight: 600; }
