/* HSS — dark "liquid glass" theme.
   Depth comes from three layers: a lit backdrop with soft colour orbs,
   translucent glass panels that blur what is behind them, and raised
   controls with a top highlight and a soft drop shadow. */
:root {
  color-scheme: dark;
  --bg: #070b14;
  --ink: #eef2f8;
  --muted: #9aa7ba;
  --line: rgba(255, 255, 255, 0.12);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --accent: #5aa9ff;
  --accent-2: #7c6cff;
  --warn: #ffb057;
  --ok: #4fd69c;
  --bad: #ff7b7b;
  --radius: 20px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.35);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font: 15px/1.55 -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 12% -10%, #16284a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #251a4a 0%, transparent 55%),
    linear-gradient(180deg, #0a101d 0%, #070b14 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Backdrop orbs: give the glass something to refract. */
.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.scene i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.7; animation: drift 26s ease-in-out infinite alternate; }
.scene i:nth-child(1) { width: 460px; height: 460px; left: -120px; top: 18%; background: radial-gradient(circle at 30% 30%, #2f7bff, #123a8a 60%, transparent 72%); }
.scene i:nth-child(2) { width: 520px; height: 520px; right: -160px; top: 38%; background: radial-gradient(circle at 30% 30%, #8a5cff, #3a1f8a 60%, transparent 72%); animation-duration: 32s; animation-delay: -8s; }
.scene i:nth-child(3) { width: 380px; height: 380px; left: 38%; bottom: -180px; background: radial-gradient(circle at 30% 30%, #19c2c2, #0c5a6a 60%, transparent 72%); animation-duration: 38s; animation-delay: -15s; opacity: 0.4; }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(60px, -50px, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .scene i { animation: none; } * { transition: none !important; } }

a { color: var(--accent); text-decoration: none; }
a:hover { color: #8cc4ff; }

/* Glass surfaces */
.panel, .tile, header.top {
  background: linear-gradient(145deg, var(--glass-strong), var(--glass) 45%, rgba(255, 255, 255, 0.03));
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--edge);
}

header.top {
  position: sticky; top: 14px; z-index: 10;
  max-width: 1120px; margin: 14px auto 0; padding: 10px 16px 10px 20px;
  border-radius: 999px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
header.top .name {
  font-weight: 800; letter-spacing: 0.14em;
  background: linear-gradient(180deg, #fff, #9cc7ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
header.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
header.top nav a { color: #cfd9e8; padding: 6px 12px; border-radius: 999px; transition: background 0.2s, color 0.2s; }
header.top nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
header.top .who { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; }
header.top form { margin: 0; }
header.top button { font: inherit; font-size: 13px; color: #fff; cursor: pointer; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); box-shadow: var(--edge); }
header.top button:hover { background: rgba(255, 255, 255, 0.16); }

main { max-width: 1120px; margin: 30px auto 60px; padding: 0 16px; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; letter-spacing: 0.02em; }
.muted { color: var(--muted); }

.panel { position: relative; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; overflow: hidden; }
/* Specular sweep across the top-left of each pane. */
.panel::before, .tile::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 22%, transparent 42%);
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tile {
  position: relative; display: block; color: inherit; border-radius: var(--radius); padding: 18px 20px; overflow: hidden;
  transform: translateZ(0); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s, border-color 0.35s;
}
.tile:hover { color: inherit; transform: perspective(900px) translateY(-6px) rotateX(6deg) rotateY(-4deg) scale(1.02); border-color: rgba(255, 255, 255, 0.28); box-shadow: 0 34px 60px -24px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(90, 169, 255, 0.18), var(--edge); }
.tile .n { font-size: 36px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; text-shadow: 0 2px 12px rgba(90, 169, 255, 0.35); }
.tile .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tile.alert .n { color: var(--warn); text-shadow: 0 2px 14px rgba(255, 176, 87, 0.45); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); vertical-align: top; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

.tag { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; color: var(--muted); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.tag.incident { color: var(--warn); background: rgba(255, 176, 87, 0.13); border-color: rgba(255, 176, 87, 0.35); }
.tag.new { color: var(--accent); background: rgba(90, 169, 255, 0.13); border-color: rgba(90, 169, 255, 0.35); }
.tag.ok { color: var(--ok); background: rgba(79, 214, 156, 0.12); border-color: rgba(79, 214, 156, 0.32); }

form.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
input[type=text], input[type=search], input[type=password], input[type=file], select {
  font: inherit; color: var(--ink); padding: 9px 12px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: #6f7c90; }
input:focus, select:focus { outline: none; border-color: rgba(90, 169, 255, 0.7); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(90, 169, 255, 0.22); }
input[type=search] { flex: 1; min-width: 220px; }
label { color: var(--muted); }
.helptext { color: var(--muted); font-size: 13px; display: block; margin-top: 4px; }

.btn, button.btn {
  font: inherit; font-weight: 600; color: #fff; cursor: pointer; display: inline-block; padding: 9px 16px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(180deg, #6ab4ff 0%, #2f7bff 55%, #2362d9 100%);
  box-shadow: 0 10px 22px -10px rgba(47, 123, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.22);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); box-shadow: 0 4px 10px -6px rgba(47, 123, 255, 0.9), inset 0 2px 4px rgba(0, 0, 0, 0.35); }
.btn.secondary { color: var(--ink); background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)); border-color: var(--line); box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.9), var(--edge); }
.actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.actions form { margin: 0; }

.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li, .notice { color: var(--ok); background: rgba(79, 214, 156, 0.1); border: 1px solid rgba(79, 214, 156, 0.3); border-radius: 14px; padding: 10px 14px; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.errors, .errorlist { color: var(--bad); }

dl.meta { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
.narrative { white-space: pre-wrap; }
.pager { margin-top: 16px; display: flex; gap: 14px; align-items: center; }

/* Clients → locations → shifts */
.client-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.client-head h2 { margin: 0; font-size: 19px; }
.client-head .edit, .site .edit { margin-left: auto; font-size: 12.5px; }
.site .edit { float: right; font-weight: 400; }
.client > p { margin: 0 0 14px; font-size: 13.5px; }
.client.inactive { opacity: 0.62; }
.sites { align-items: start; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.site { border-radius: 16px; padding: 14px 16px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025)); box-shadow: 0 12px 24px -16px rgba(0, 0, 0, 0.9), var(--edge); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s; }
.site:hover { transform: perspective(900px) translateY(-4px) rotateX(4deg); border-color: rgba(255, 255, 255, 0.26); }
.site h3 { color: #fff; }
.shifts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shifts li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.06); font-size: 13.5px; }
.shifts li strong { font-weight: 600; }
.shifts li .muted { font-size: 12.5px; text-align: right; }

/* Sign in */
.login { max-width: 380px; margin: 14vh auto 0; padding: 30px 28px; }
.login h1 { text-align: center; }
.login p { margin: 0 0 14px; }
.login input { width: 100%; }
.login label { display: block; font-size: 13px; margin-bottom: 5px; }
.login .btn { width: 100%; margin-top: 4px; }

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }

/* Paper stays plain: black on white, no glass. */
@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #000; }
  .scene, header.top, .actions, .no-print { display: none !important; }
  .panel { background: none; border: 0; box-shadow: none; padding: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .panel::before { display: none; }
  main { margin: 0; max-width: none; }
  th, td { border-bottom: 1px solid #ccc; color: #000; }
  th, .muted, dl.meta dt { color: #444; }
  a { color: #000; }
}

/* Location status */
.loc { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.loc.ok { color: var(--ok); border-color: rgba(79, 214, 156, 0.35); background: rgba(79, 214, 156, 0.1); }
.loc.away { color: var(--bad); border-color: rgba(255, 123, 123, 0.4); background: rgba(255, 123, 123, 0.1); }
.loc.none { color: var(--warn); border-color: rgba(255, 176, 87, 0.4); background: rgba(255, 176, 87, 0.1); }
.loc:empty { display: none; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); display: block; }
code { font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); user-select: all; }
.issued { border-color: rgba(90, 169, 255, 0.5); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline-flex; gap: 6px; margin: 0 8px 0 0; }
.row-actions .btn { padding: 5px 11px; font-size: 13px; font-weight: 500; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 16px; align-items: end; }
.grid-form p { margin: 0 0 10px; }
.grid-form label { display: block; font-size: 13px; margin-bottom: 4px; }
.grid-form input[type=text], .grid-form input[type=email] { width: 100%; }
input[type=email], input[type=datetime-local], textarea {
  font: inherit; color: var(--ink); padding: 9px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.06);
}
textarea:focus, input[type=email]:focus, input[type=datetime-local]:focus { outline: none; border-color: rgba(90, 169, 255, 0.7); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(90, 169, 255, 0.22); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); vertical-align: middle; }
.messages li.error { color: var(--bad); background: rgba(255, 123, 123, 0.1); border-color: rgba(255, 123, 123, 0.35); }

/* Officer phone screens */
body.m main { max-width: 520px; margin: 16px auto 48px; padding: 0 14px calc(env(safe-area-inset-bottom) + 8px); }
.m-top { display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px 4px; }
.m-top .name { font-weight: 800; letter-spacing: 0.14em; background: linear-gradient(180deg, #fff, #9cc7ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.m-top .muted { flex: 1; font-size: 13.5px; }
.m-top form { margin: 0; }
.m-top button { font: inherit; font-size: 13px; color: #fff; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); }
body.m h1 { font-size: 24px; margin: 10px 0 4px; }
body.m input, body.m select, body.m textarea { width: 100%; font-size: 16px; } /* 16px stops iPhones zooming in */
body.m input[type=checkbox] { width: 24px; height: 24px; flex: none; }
body.m label { display: block; font-size: 14px; margin-bottom: 6px; color: #c5cfdd; }
.clock { text-align: center; padding: 24px 20px; }
.clock form { margin-top: 14px; text-align: left; }
.clock.on { border-color: rgba(79, 214, 156, 0.35); box-shadow: var(--shadow), var(--edge), 0 0 60px -20px rgba(79, 214, 156, 0.5); }
.btn.big { display: block; width: 100%; margin-top: 14px; padding: 16px; font-size: 18px; border-radius: 16px; }
.btn.danger { background: linear-gradient(180deg, #ff8f8f 0%, #f04a4a 55%, #c93434 100%); box-shadow: 0 10px 22px -10px rgba(240, 74, 74, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.22); }
.btn:disabled { opacity: 0.6; }
.small { font-size: 12.5px; }
.locating { text-align: center; margin: 10px 0 0; }
.m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.m-actions .tile { text-align: center; padding: 20px 12px; }
.m-actions .tile .n { font-size: 30px; text-shadow: none; }
.m-actions .tile .l { color: var(--ink); font-size: 14.5px; font-weight: 600; }
.m-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.m-list li { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.06); }
.m-list li .muted { font-size: 13px; }
.m-form p { margin: 0 0 16px; }
.m-form p.check { display: flex; gap: 12px; align-items: center; }
.m-form p.check label { margin: 0; font-size: 15.5px; color: var(--ink); }
.back { display: inline-block; margin: 4px 0 12px; }

/* Onboarding, officer files, map points */
input[type=date] { font: inherit; color: var(--ink); padding: 9px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.06); }
body.onboard .notice { color: var(--warn); background: rgba(255, 176, 87, 0.1); border-color: rgba(255, 176, 87, 0.35); margin: 0; }
body.onboard .m-form .panel { margin-bottom: 16px; }
body.onboard .m-form h2 { margin-bottom: 14px; }
body.onboard .errorlist { list-style: none; padding: 0; margin: 6px 0 12px; font-size: 14px; }
body.onboard p.check { align-items: flex-start; }
code.wrap { display: block; word-break: break-all; font-size: 13px; font-weight: 500; line-height: 1.5; padding: 10px 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0 20px; }
.docs figure { margin: 0; }
.docs figcaption { font-size: 13px; margin-top: 6px; }
details.panel summary { cursor: pointer; color: var(--muted); }
.point { font-size: 12.5px; margin: 0 0 8px; color: var(--warn); }
.point.ok { color: var(--ok); }
.setpoint { font-size: 12.5px; margin-bottom: 10px; }
.setpoint summary { cursor: pointer; color: var(--accent); }
.setpoint form { display: grid; gap: 8px; margin-top: 8px; }
.setpoint input { width: 100%; font-size: 13px; padding: 7px 10px; }
.setpoint label { font-size: 12px; }
.setpoint .btn, .btn.tiny { padding: 5px 11px; font-size: 12.5px; font-weight: 500; }
form.inline { display: inline; margin-left: 6px; }
@media print { .docs img { max-height: 3in; width: auto; } .detail-grid { display: block; } }
