/* The staff pages: FirstReach's look (firstreach.uk), in dark.
 *
 * The same typefaces, the indigo-violet-fuchsia gradient, glass panels and pill controls
 * as the website, turned for a dark surface: near-black ground with soft indigo light,
 * white-on-dark text. Fonts are served from /static/fonts, so nothing loads from elsewhere.
 * Status colours (green, amber, red) are kept for meaning, not decoration: complete,
 * check this, urgent. */

@font-face { font-family: "Space Grotesk"; src: url("fonts/SpaceGrotesk.woff2") format("woff2");
  font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter.woff2") format("woff2");
  font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono.woff2") format("woff2");
  font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/InstrumentSerif-Italic.woff2")
  format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #08080c;
  --bg-2: #0e0e15;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --text: #f3f4f8;
  --text-2: #b6b9c8;
  --text-3: #8b90a4;
  --indigo: #6366f1;
  --indigo-l: #818cf8;
  --indigo-ll: #c7d2fe;
  --violet: #a78bfa;
  --fuchsia: #e879f9;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(100deg, #818cf8, #a78bfa 50%, #e879f9);
  --grad-btn: linear-gradient(100deg, #4f46e5, #7c3aed 55%, #c026d3);
  --grad-btn-hi: linear-gradient(100deg, #6366f1, #a78bfa 55%, #e879f9);
  --glow: 0 30px 70px -40px rgba(99, 102, 241, 0.55);
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --fd: "Space Grotesk", system-ui, sans-serif;
  --fb: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fm: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --fs: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
/* No background on body: the html element carries it, so the fixed glow below can sit
   between the two. */
body {
  margin: 0; min-height: 100vh; position: relative; overflow-x: hidden; color: var(--text);
  font: 15px/1.6 var(--fb); -webkit-font-smoothing: antialiased;
}
/* The light the website's hero sits in: indigo from the top left, a little fuchsia, a dot
   grid that fades out. Fixed, behind everything, never in the way of text. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 620px at 8% -12%, rgba(99, 102, 241, 0.20), transparent 62%),
    radial-gradient(760px 520px at 104% -6%, rgba(232, 121, 249, 0.10), transparent 60%),
    radial-gradient(900px 700px at 50% 118%, rgba(167, 139, 250, 0.08), transparent 60%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}
::selection { background: rgba(129, 140, 248, 0.35); color: #fff; }
:focus-visible { outline: 2px solid var(--indigo-l); outline-offset: 3px; border-radius: 6px; }

a { color: var(--indigo-l); text-decoration: none; transition: color 0.25s; }
a:hover { color: var(--indigo-ll); }

/* ── Type ─────────────────────────────────────────────────────────────────── */

.grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.serif-it { font-family: var(--fs); font-style: italic; font-weight: 400;
  text-transform: none; letter-spacing: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px; margin: 0 0 18px;
  font: 500 11px/1.4 var(--fm); letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--grad);
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.8); }
h1 {
  font: 700 clamp(2rem, 4.4vw, 3.3rem)/1 var(--fd); letter-spacing: -0.03em;
  text-transform: uppercase; margin: 0 0 14px;
}
h1 .grad-text { filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.35)); }
h1 .serif-it { font-size: 1.12em; line-height: 0.9; }
h1 .ref {
  display: inline-block; vertical-align: middle; margin-left: 10px; padding: 6px 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface);
  font: 500 11px/1 var(--fm); letter-spacing: 0.2em; color: var(--text-2);
  text-transform: uppercase;
}
h2 {
  font: 700 0.95rem/1.3 var(--fd); letter-spacing: 0.06em; text-transform: uppercase;
  margin: 44px 0 14px; display: flex; align-items: center; gap: 10px;
}
h2::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--indigo-l); box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.16); }
.panel > h2:first-child, .panel h2.in-panel { margin-top: 0; }
.lede { color: var(--text-2); max-width: 760px; margin: 0 0 8px; }
.lede .dot { color: var(--text-3); padding: 0 6px; }
.lede .mono { font-size: 0.9em; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.mono { font-family: var(--fm); letter-spacing: 0.04em; }

/* ── Header: the website's floating glass pill ────────────────────────────── */

.site-nav {
  position: sticky; top: 14px; z-index: 50;
  width: min(1240px, calc(100% - 24px)); margin: 14px auto 0;
  display: flex; align-items: center; gap: 18px;
  padding: 8px 8px 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(13, 13, 20, 0.72);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 18px 45px -22px rgba(99, 102, 241, 0.45);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); min-width: 0; }
.brand:hover { color: var(--text); }
.brand svg { width: 28px; height: 28px; flex: none; transition: transform 0.5s var(--ease); }
.brand:hover svg { transform: scale(1.12) rotate(-4deg); }
.brand .word { font: 700 1.08rem/1 var(--fd); letter-spacing: -0.02em; white-space: nowrap; }
.brand .word em { font-style: normal; color: var(--indigo-l); }
.brand .practice {
  font: 500 10px/1.2 var(--fm); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-3); padding-left: 12px; border-left: 1px solid var(--line-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-link {
  position: relative; padding: 6px 0; color: var(--text-2);
  font: 500 10px/1 var(--fm); letter-spacing: 0.24em; text-transform: uppercase;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--grad); box-shadow: 0 0 8px rgba(129, 140, 248, 0.8);
  transition: width 0.4s var(--ease);
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.who {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font: 500 10px/1 var(--fm); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-2); max-width: 180px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis;
}
.who::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--green); box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18); }

/* ── Layout ───────────────────────────────────────────────────────────────── */

main { width: min(1240px, 100%); margin: 0 auto; padding: 52px 24px 72px; }
.page-head { margin-bottom: 26px; }
.grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px;
  align-items: start; }
.grid > section > h2:first-child { margin-top: 18px; }
.site-foot {
  width: min(1240px, 100%); margin: 0 auto; padding: 26px 24px 40px;
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  border-top: 1px solid var(--line);
  font: 500 10px/1.6 var(--fm); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-3);
}
.site-foot em { font-style: normal; color: var(--indigo-l); }
.site-foot .sep { margin-left: auto; }

/* ── Glass panels ─────────────────────────────────────────────────────────── */

.panel {
  position: relative; margin-bottom: 18px; padding: 22px 24px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.5s, box-shadow 0.5s;
}
.panel:hover { border-color: rgba(129, 140, 248, 0.26); box-shadow: inset 0 1px 0
  rgba(255, 255, 255, 0.05), var(--glow); }
.panel > p:last-child { margin-bottom: 0; }
.scroll { overflow-x: auto; }

/* ── Tables ───────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line);
  vertical-align: top; }
tr:last-child > th, tr:last-child > td { border-bottom: 0; }
th { font: 500 10px/1.6 var(--fm); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3); }
tbody tr, table tr { transition: background 0.25s; }
table tr:hover > td { background: rgba(129, 140, 248, 0.045); }
td .pet { font: 600 1rem/1.3 var(--fd); color: var(--text); letter-spacing: -0.01em; }
td .pet:hover { color: var(--indigo-ll); }
td .sub { font: 400 11px/1.5 var(--fm); letter-spacing: 0.12em; color: var(--text-3);
  margin-top: 2px; }
td.when { font-family: var(--fm); font-size: 13px; letter-spacing: 0.02em; color: var(--text-2);
  white-space: nowrap; }
table.kv th { width: 38%; letter-spacing: 0.14em; padding-top: 14px; }
table.kv td { color: var(--text); }
table.log td { font-size: 13px; color: var(--text-2); padding: 9px 10px; }
table.log td:first-child { font-family: var(--fm); font-size: 12px; color: var(--text-3);
  white-space: nowrap; }

/* ── Badges and banners ───────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font: 500 10px/1.5 var(--fm); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap; vertical-align: middle;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.9; }
.badge.ok { color: #86efac; background: rgba(74, 222, 128, 0.09);
  border-color: rgba(74, 222, 128, 0.28); }
.badge.warn { color: #fcd34d; background: rgba(251, 191, 36, 0.09);
  border-color: rgba(251, 191, 36, 0.28); }
.badge.urgent { color: #fca5a5; background: rgba(248, 113, 113, 0.11);
  border-color: rgba(248, 113, 113, 0.36); }
.badge.urgent::before { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
  animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0.05); } }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 14px 18px; margin-bottom: 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
}
.banner strong { color: var(--text); font-family: var(--fd); letter-spacing: 0.01em; }
.banner.urgent { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca; }
.banner.urgent strong { color: #fca5a5; }
.banner.warn { background: rgba(251, 191, 36, 0.07); border-color: rgba(251, 191, 36, 0.3);
  color: #fde68a; }
.banner.warn strong { color: #fcd34d; }
.banner.ok { background: rgba(74, 222, 128, 0.07); border-color: rgba(74, 222, 128, 0.3);
  color: #bbf7d0; }

/* ── Buttons: the website's pills ─────────────────────────────────────────── */

form.inline { display: inline; }
button, .button {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 22px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 11.5px/1.2 var(--fd); letter-spacing: 0.1em; text-transform: uppercase;
  color: #fff; background: var(--grad-btn); text-decoration: none;
  box-shadow: 0 8px 30px -8px rgba(99, 102, 241, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.4s var(--ease), box-shadow 0.4s;
}
button::before, .button::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--grad-btn-hi);
  opacity: 0; transition: opacity 0.4s;
}
button::after, .button::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: skewX(-20deg); transition: left 0.7s var(--ease);
}
button:hover, .button:hover { color: #fff; transform: translateY(-1px);
  box-shadow: 0 14px 36px -10px rgba(139, 92, 246, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
button:hover::before, .button:hover::before { opacity: 1; }
button:hover::after, .button:hover::after { left: 130%; }
button:active { transform: translateY(0); }

button.secondary {
  background: rgba(255, 255, 255, 0.04); color: var(--text);
  border: 1px solid var(--line-2); box-shadow: none;
}
button.secondary::before { background: rgba(129, 140, 248, 0.1); }
button.secondary:hover { color: var(--indigo-ll); border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 10px 30px -14px rgba(99, 102, 241, 0.6); }
button.small { padding: 10px 16px; font-size: 10px; letter-spacing: 0.16em; }

button.link {
  padding: 2px 0; border-radius: 0; background: none; box-shadow: none; overflow: visible;
  color: var(--indigo-ll); font: 500 10.5px/1.4 var(--fm); letter-spacing: 0.16em;
  border-bottom: 1px solid rgba(129, 140, 248, 0.5);
}
button.link::before, button.link::after { display: none; }
button.link:hover { transform: none; box-shadow: none; color: #fff; border-color: var(--fuchsia); }
.banner.urgent button.link { color: #fecaca; border-color: rgba(252, 165, 165, 0.6); }
.banner.warn button.link { color: #fde68a; border-color: rgba(253, 230, 138, 0.6); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; align-items: center; }

/* ── Forms ────────────────────────────────────────────────────────────────── */

label {
  display: block; margin: 20px 0 8px; color: var(--text-2);
  font: 500 10.5px/1.4 var(--fm); letter-spacing: 0.2em; text-transform: uppercase;
}
label .muted { font-size: 10px; letter-spacing: 0.12em; text-transform: none; }
input[type=text], input[type=tel], input[type=date], input[type=time], input[type=password],
select, textarea {
  width: 100%; max-width: 460px; padding: 13px 16px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04);
  color: var(--text); font: 500 15px/1.4 var(--fb);
  transition: border-color 0.35s, background 0.35s, box-shadow 0.35s;
}
input::placeholder, textarea::placeholder { color: #6b7084; }  /* dimmer than any value */
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: rgba(129, 140, 248, 0.7); background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), 0 0 30px -8px rgba(99, 102, 241, 0.6);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23818cf8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center;
}
select option { background: var(--bg-2); color: var(--text); }
textarea { max-width: 100%; min-height: 96px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0; flex: none;
  accent-color: var(--indigo); cursor: pointer; }
label.check {
  display: flex; gap: 12px; align-items: flex-start; max-width: 640px;
  margin: 22px 0 6px; padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025);
  font: 400 14px/1.55 var(--fb); letter-spacing: 0; text-transform: none; color: var(--text-2);
  cursor: pointer;
}
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row input[type=date] { max-width: 220px; }
.field-row input[type=time] { max-width: 150px; }
.hint { color: var(--text-3); font-size: 13px; margin: 6px 0 0; max-width: 520px; }
.form-foot { margin-top: 26px; }

/* ── Sign-in ──────────────────────────────────────────────────────────────── */

.auth { display: grid; place-items: center; min-height: calc(100vh - 260px); }
.auth-card { width: min(460px, 100%); position: relative; }
.auth-card::before {
  content: ""; position: absolute; inset: -60px -40px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(124, 58, 237, 0.28), transparent);
  filter: blur(10px);
}
.auth-card .panel { padding: 30px 30px 26px; }
.auth-card h1 { font-size: clamp(2.1rem, 7vw, 2.8rem); }
.auth-card input { max-width: 100%; }
.auth-card button[type=submit] { width: 100%; padding: 15px 22px; }

/* ── The conversation, as the owner saw it ────────────────────────────────── */

.chat-scroll { display: flex; flex-direction: column-reverse; overflow-y: auto;
  max-height: 72vh; padding: 18px; }
/* column-reverse with a single child: the panel opens scrolled to the newest message
   while the messages themselves stay in reading order. */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg {
  max-width: 88%; padding: 10px 14px 11px; border-radius: 18px;
  border: 1px solid var(--line); overflow-wrap: anywhere;
}
.msg .text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; color: var(--text); }
.msg .meta { font: 500 9.5px/1.5 var(--fm); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 4px; white-space: normal; }
.msg.in { align-self: flex-start; background: rgba(255, 255, 255, 0.055);
  border-bottom-left-radius: 6px; }
.msg.out { align-self: flex-end; border-bottom-right-radius: 6px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(167, 139, 250, 0.12));
  border-color: rgba(129, 140, 248, 0.3); }
.msg.out .meta { color: #a5b4fc; }
.msg.system, .msg.template { background: rgba(255, 255, 255, 0.02); border-style: dashed;
  border-color: var(--line-2); }
.msg.staff { background: linear-gradient(135deg, rgba(232, 121, 249, 0.18), rgba(167, 139, 250, 0.1));
  border-color: rgba(232, 121, 249, 0.35); }
.msg.staff .meta { color: #f0abfc; }
.msg.emergency { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.4); }
.msg.emergency .meta { color: #fca5a5; }
.msg img { max-width: 240px; border-radius: 12px; display: block; margin-top: 8px;
  border: 1px solid var(--line-2); }

/* ── Small screens ────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .brand .practice { display: none; }
}
@media (max-width: 760px) {
  .site-nav { flex-wrap: wrap; border-radius: 22px; gap: 10px 12px; padding: 10px 10px 10px 14px; }
  .nav-links { order: 3; width: 100%; margin: 0; gap: 20px; overflow-x: auto;
    padding: 8px 4px 2px; border-top: 1px solid var(--line); }
  .nav-right { margin-left: auto; }
  .who { display: none; }
  main { padding: 34px 16px 56px; }
  .site-foot { padding: 22px 16px 32px; }
  .site-foot .sep { margin-left: 0; }
  .panel { padding: 18px 16px; border-radius: 20px; }
  h1 .ref { margin: 10px 0 0; display: table; }
  .msg { max-width: 94%; }
  table.kv th { width: 42%; }
}
/* Lists of intakes become cards on a phone: pet and status on top, the rest labelled. */
@media (max-width: 640px) {
  .panel.scroll:has(table.rows) { padding: 6px 16px; }
  table.rows, table.rows tbody, table.rows tr, table.rows td { display: block; width: 100%; }
  table.rows tr.head { display: none; }
  table.rows tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px;
    padding: 16px 0; border-bottom: 1px solid var(--line); }
  table.rows tr:last-child { border-bottom: 0; }
  table.rows td { padding: 0; border: 0; grid-column: 1 / -1; }
  table.rows tr:hover > td { background: none; }
  table.rows td.lead { grid-column: 1; }
  table.rows td.status { grid-column: 2; grid-row: 1; display: flex; flex-direction: column;
    align-items: flex-end; gap: 6px; }
  table.rows td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font: 500 9.5px/1.5 var(--fm); letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--text-3);
  }
  table.rows td.when { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
