/* ==========================================================================
   Hiyani styles (the portal, formerly TeamDesk)
   Sign-in: teal KRH-coloured panel with waves, light side with the sign-in card.
   Portal: light dashboard, white rounded cards, green active pill, round chips.
   To change the font, edit --font.
   ========================================================================== */

:root {
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --bg: #e9eef0;
  --surface: #ffffff;
  --soft: #f3f6f7;
  --text: #1d2433;
  --muted: #667085;
  --subtle: #98a2b3;
  --border: #e8ecef;
  --border-strong: #d3dae0;

  /* Teal-green, leaning toward the KRH logo's teal */
  --primary: #0d8077;
  --primary-hover: #0a6a63;
  --primary-soft: #ddf1ee;
  --amber: #f5c400;
  --amber-soft: #fff4c7;
  --amber-text: #7f6200;
  --coral: #ff5a36;
  --coral-soft: #ffe7e0;
  --coral-text: #c23a1b;
  --blue-soft: #e3f1fb;
  --blue-text: #1f6fa8;
  --focus: rgba(13, 128, 119, 0.22);

  --danger: #d92d20;
  --danger-ink: #ffffff;
  --danger-soft: #fee9e6;

  /* Sign-in page */
  --navy: #0c3b4e;
  --sky: #74c3c8;
  --sky-hover: #60b6bc;
  --sky-soft: #e8f5f5;

  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
code { font-family: Consolas, "Courier New", monospace; font-size: 0.9em; }

/* Hugeicons (see assets/js/icons.js) */
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand img { display: block; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn:disabled { cursor: progress; opacity: 0.8; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { color: #ffffff; background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--soft); }
.btn-danger { color: var(--danger-ink); background: var(--danger); }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-sm .icon { width: 15px; height: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.icon-btn:disabled { cursor: progress; opacity: 0.6; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 2px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 0;
  cursor: pointer;
}
.text-btn .icon { width: 15px; height: 15px; }
.text-btn:hover { text-decoration: underline; }
.text-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

.pill-link {
  flex: none;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
a.pill-link:hover { background: var(--soft); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 999px;
}
.tag-green { color: var(--primary-hover); background: var(--primary-soft); }
.tag-amber { color: var(--amber-text); background: var(--amber-soft); }

.chip {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
}
.chip-green { color: var(--primary-hover); background: var(--primary-soft); }
.chip-amber { color: var(--amber-text); background: var(--amber-soft); }
.chip-coral { color: var(--coral-text); background: var(--coral-soft); }
.chip-blue { color: var(--blue-text); background: var(--blue-soft); }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.text-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}
.text-input::placeholder { color: var(--subtle); }
.text-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.file-input { height: auto; padding: 8px 12px; }
.select-sm { width: 180px; height: 34px; padding: 0 10px; font-size: 13px; border-radius: 999px; }
.hint { margin-top: 5px; font-size: 12.5px; color: var(--muted); }

.checkbox { display: flex; align-items: center; gap: 9px; color: var(--muted); cursor: pointer; }
.checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }

.form-error {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 12px;
}
.page-error { margin-bottom: 14px; }

/* ==========================================================================
   Sign-in page
   Left: teal panel in the KRH logo's colours with a large outline logo at the bottom.
   Right: light side with a curved edge, the sign-in card and the four tools.
   ========================================================================== */
.page-login {
  display: grid;
  grid-template-columns: minmax(0, 56fr) minmax(460px, 44fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: #f2f6f7;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.login-hero {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(120% 80% at 18% 8%, rgba(143, 220, 215, 0.22), transparent 55%),
    linear-gradient(150deg, #0a4656 0%, #0b5f66 42%, #0d7d78 100%);
}
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* KRH logo as large thin white lines (traced from the logo, drawn in index.html) */
.hero-watermark {
  position: absolute;
  left: 56%;
  bottom: -150px;
  width: min(780px, 100%, 86vh);
  height: auto;
  transform: translateX(-50%);
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.4;
  stroke-linejoin: round;
  opacity: 0.2;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; padding: 0 14% 140px 11%; }
.hero-brand { display: flex; align-items: center; gap: 22px; }
.hero-mark { width: clamp(64px, 6.4vw, 96px); height: auto; flex: none; }
/* the Hiyani tile on the dark teal panel: a faint light rim and a soft drop shadow so it stands out */
.hero-tile { border-radius: 24%; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.28), 0 14px 32px rgba(0, 20, 18, 0.35); }
.hero-name {
  font-size: clamp(46px, 5.6vw, 84px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}
.hero-name span { color: #8fdcd7; }
.hero-rule { display: block; width: 76px; height: 5px; margin: 34px 0 26px; background: #8fdcd7; border-radius: 3px; }
.hero-tagline {
  max-width: 17ch;
  font-size: clamp(24px, 2.4vw, 36px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #eaf7f6;
}

.login-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 48px 64px 24px;
  background: #f2f6f7;
}
.login-curve { position: absolute; top: 0; bottom: 0; left: -240px; width: 541px; height: 100%; fill: #f2f6f7; pointer-events: none; }
.login-curve .curve-shadow { fill: none; stroke: rgba(6, 40, 46, 0.5); stroke-width: 26; }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  padding: 36px 40px 30px;
  text-align: center;
  background: #ffffff;
  border-radius: 26px;
  box-shadow: 0 1px 2px rgba(12, 59, 78, 0.05), 0 24px 60px rgba(12, 59, 78, 0.10);
}
.card-accent {
  position: absolute;
  top: 0;
  left: 50%;
  width: 42%;
  height: 5px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #4fbdb6, #0d8077);
  border-radius: 0 0 6px 6px;
}
.card-logo { display: block; width: 72px; height: 72px; margin: 0 auto 10px; }
.card-tile { width: 60px; height: 60px; margin-bottom: 14px; border-radius: 24%; box-shadow: 0 10px 24px rgba(11, 106, 99, 0.22); }
.login-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; color: var(--navy); }
.card-sub { margin: 4px 0 24px; font-size: 14px; color: var(--muted); }
/* Pieces of the new look (glass.css) when the look switch (look.css) is off: the greeting and the menu's
   "by Dhoani Labs" hide; the sign-in page's "by Dhoani Labs" stays as a small line. */
.home-hero, .brand-by { display: none; }
.hero-by { margin: 12px 0 0; font-size: 13px; font-weight: 600; letter-spacing: 0.25em; text-transform: uppercase; opacity: 0.85; }

#login-form { display: grid; gap: 14px; text-align: left; }
.icon-field { position: relative; }
.icon-field > .icon { position: absolute; left: 15px; top: 15px; width: 20px; height: 20px; color: #6f8a94; pointer-events: none; }
.icon-field .text-input { height: 50px; padding-left: 46px; border-color: #d6e2e5; border-radius: 13px; }
.icon-field .text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.icon-field .text-input:focus + .icon, .icon-field:focus-within > .icon { color: var(--primary); }
#password { padding-right: 48px; }
.input-wrap { position: relative; }
.input-action { position: absolute; right: 6px; top: 7px; border: 0; background: transparent; }

.login-submit {
  gap: 10px;
  height: 50px;
  font-size: 15px;
  color: #ffffff;
  background: linear-gradient(180deg, #0f8a80, #0b6f69);
  border-radius: 13px;
}
.login-submit:hover:not(:disabled) { background: linear-gradient(180deg, #0c7d74, #095f5a); }
.submit-icon .icon, .login-submit > .icon { width: 20px; height: 20px; }
.notice { margin-bottom: 14px; padding: 10px 14px; font-size: 13px; text-align: left; color: var(--amber-text); background: var(--amber-soft); border-radius: 12px; }
.help { margin-top: 16px; font-size: 13px; color: var(--muted); }
#newpw-form { display: grid; gap: 14px; text-align: left; }
.newpw-hint { margin: -4px 2px 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.link-btn { justify-self: center; padding: 4px 8px; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--primary); }

.login-features {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 430px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}
.login-features li {
  display: grid;
  justify-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}
.login-features li + li { border-left: 1px solid #d6e2e5; }
.login-features .icon { width: 30px; height: 30px; color: var(--primary); }

@media (min-width: 1600px) {
  .login-card { max-width: 470px; padding: 44px 46px 34px; }
  .card-logo { width: 84px; height: 84px; }
  .login-card h1 { font-size: 34px; }
  .login-features { max-width: 470px; }
}

/* ==========================================================================
   App shell
   ========================================================================== */
body.is-loading .shell { visibility: hidden; }

.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 14px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
}
.side-head {
  position: relative;
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.side-head .brand-name { white-space: nowrap; }
.side-toggle {
  position: absolute;
  right: 0;
  top: 22px;
  width: 26px;
  height: 30px;
  color: #ffffff;
  background: var(--primary);
  border: 0;
  border-radius: 8px 0 0 8px;
}
.side-toggle:hover { background: var(--primary-hover); }
.side-toggle .icon { width: 15px; height: 15px; }

.side-label { padding: 16px 20px 6px; font-size: 13px; color: var(--muted); }
.side-nav { display: grid; align-content: start; gap: 4px; padding: 0 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 8px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  border-radius: 999px;
}
.nav-chip {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--text);
  background: var(--soft);
  border-radius: 50%;
}
.nav-chip .icon { width: 17px; height: 17px; }
.nav-item:hover { background: var(--soft); }
.nav-item:hover .nav-chip { background: var(--surface); }
.nav-item.is-active { font-weight: 600; color: #ffffff; background: var(--primary); }
.nav-item.is-active .nav-chip { color: var(--primary); background: #ffffff; }
/* Red number on a menu item (e.g. Ambulance Call edit requests waiting for the admin) */
.nav-item { position: relative; }
.nav-badge { display: grid; place-items: center; min-width: 22px; height: 22px; margin-left: auto; margin-right: 6px; padding: 0 7px; font-size: 12px; font-weight: 800; font-style: normal; line-height: 1; color: #fff; background: var(--danger); border-radius: 999px; box-shadow: 0 0 0 2px #fff; }
.nav-item.is-active .nav-badge { box-shadow: 0 0 0 2px var(--primary); }

/* "Designed and developed by" credit */
.side-credit { margin-top: auto; padding: 14px 20px 18px; font-size: 11.5px; line-height: 1.4; color: var(--subtle); }
.page-credit { display: none; padding: 4px 4px 8px; font-size: 11.5px; text-align: center; color: var(--subtle); }
.login-credit { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0; font-size: 12px; text-align: center; color: var(--subtle); }

/* ---------- Top bar ---------- */
.main { min-width: 0; display: grid; align-content: start; gap: 14px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 20px;
}
.top-search { flex: 1; max-width: 340px; border-radius: 999px; }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 16px 4px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-hover);
  background: var(--primary-soft);
  border-radius: 50%;
}
.avatar-1 { color: var(--blue-text); background: var(--blue-soft); }
.avatar-2 { color: var(--amber-text); background: var(--amber-soft); }
.avatar-3 { color: var(--coral-text); background: var(--coral-soft); }
.user-meta { display: grid; min-width: 0; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.user-role { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.topbar .icon-btn { width: 40px; height: 40px; }

.test-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--amber-text);
  background: var(--amber-soft);
  border-radius: 12px;
}
.test-banner .icon { width: 15px; height: 15px; }

.content { min-width: 0; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 2px 4px;
}
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
/* "Back to Home" button at the right of the title row (added by layout.js) */
.btn-home { color: var(--primary); background: var(--primary-soft); border-color: rgba(13, 128, 119, 0.35); box-shadow: 0 4px 12px rgba(13, 128, 119, 0.16); }
.btn-home:hover { color: #fff; background: var(--primary); border-color: var(--primary); }
.btn-home .icon { width: 18px; height: 18px; }
.page-head.has-home > :first-child { margin-right: auto; }   /* title left; page buttons + Home together on the right */
.page-head.has-home { gap: 8px 8px; }
@media (max-width: 640px) { .btn-home { margin-left: auto; } }   /* on phones it wraps to its own line: keep it on the right */
.date { font-size: 13px; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 16px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 0;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }

.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-bar .search { flex: 1; min-width: 0; max-width: 420px; height: 42px; }
.filter-bar .filter-select { flex: none; width: 220px; border-radius: 999px; }
.page-hint { margin: 0 4px 12px; }

/* ---------- Cards, tables ---------- */
.list, .panel { background: var(--surface); border-radius: 18px; overflow: hidden; }
.list { padding: 6px 8px; }

.list-head { font-size: 13px; font-weight: 500; color: var(--muted); }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.row:first-child, .list-head + div > .row:first-child { border-top: 0; }
.row:hover { background: var(--soft); border-radius: 12px; }
.row-icon { display: grid; place-items: center; color: var(--primary-hover); background: var(--primary-soft); width: 38px; height: 38px; flex: none; border-radius: 12px; }
.row-body { flex: 1; min-width: 0; }
.row-body h3 { font-size: 14px; font-weight: 600; }
.row-body p { font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.row-body p.word-note { margin-top: 2px; color: var(--amber-text); }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--surface); border-radius: 18px; }

.panel { padding: 16px 16px 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.panel-list .row { min-height: 56px; padding: 8px 6px; }
.panel-empty { padding: 12px 6px; color: var(--muted); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.col-stack { display: grid; gap: 14px; }

/* Shortcut cards on staff Home */
/* Large while there are only a few sections. With many more, lower min-height and the icon size. */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 14px; }
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 210px;
  padding: 24px;
  color: var(--text);
  background: var(--surface);
  border-radius: 22px;
  transition: background-color 0.15s;
}
.quick-card:hover { background: var(--primary-soft); }
/* A card that needs attention (e.g. edit requests waiting): red edge, spans the whole row */
.quick-card.is-alert { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; min-height: 0; padding: 16px 24px; background: #fef0ee; box-shadow: inset 5px 0 0 var(--danger); }
.quick-card.is-alert strong { color: #b42318; }
.quick-card.is-alert:hover { background: #fde3df; }
.quick-card.is-alert .chip { width: 46px; height: 46px; border-radius: 14px; }
.quick-card.is-alert .chip .icon { width: 24px; height: 24px; }
.quick-card.is-alert .row-arrow { position: static; margin-left: auto; }
.quick-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.quick-card .chip { width: 60px; height: 60px; border-radius: 18px; }
.quick-card .chip .icon { width: 28px; height: 28px; }
.quick-card .row-arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}
.quick-card:hover .row-arrow { color: #ffffff; background: var(--primary); border-color: var(--primary); }
.quick-body { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.quick-body strong { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }

/* Number cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { display: grid; gap: 8px; padding: 16px; color: var(--text); background: var(--surface); border-radius: 18px; }
.stat:hover .pill-link { background: var(--soft); }
.stat:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.stat-main { display: flex; align-items: center; gap: 10px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12.5px; color: var(--muted); }

/* Horizontal bars: every value is labelled */
.bars { display: grid; gap: 10px; padding: 4px 2px 8px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 30px; align-items: center; gap: 10px; color: var(--text); }
.bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: var(--soft); border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 7px; }
.bar-value { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.action-list { display: grid; gap: 6px; padding-bottom: 6px; }
.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 4px 8px;
  font: inherit;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: var(--soft);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.action-item:hover { background: var(--primary-soft); }
.action-item:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.action-item .nav-chip { background: var(--surface); }

.attention-row { color: inherit; }
.attention-row h3 { font-weight: 500; }
.attention-row .row-icon { color: var(--coral-text); background: var(--coral-soft); }
.attention-row .row-arrow { color: var(--muted); }
.ok-row .row-icon { color: var(--primary-hover); background: var(--primary-soft); }

.dept-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 6px; color: var(--text); border-top: 1px solid var(--border); }
.dept-link:first-child { border-top: 0; }
.dept-link:hover { background: var(--soft); border-radius: 10px; }

/* ---------- Contact directory table ---------- */
.contact-head,
.contact-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 2fr) minmax(0, 1.4fr) 312px;
  align-items: center;
  gap: 0 12px;
  padding: 8px 12px;
}
.contact-head { min-height: 40px; }
.contact-head > span:first-child { grid-column: 2; }
.contact-head .num-cols { display: grid; grid-template-columns: repeat(3, 104px); }
.contact-head .num-cols span { padding-left: 8px; }
.contact-row { min-height: 58px; }
.contact-row .avatar { grid-column: 1; }
.contact-row .row-body { display: contents; }
.contact-row .row-body h3 { grid-column: 2; }
.contact-row .row-body p { grid-column: 3; font-size: 13.5px; }

.number-lines { grid-column: 4; flex-direction: column; align-items: stretch; gap: 0; }
.number-line { display: grid; grid-template-columns: repeat(3, 104px); align-items: center; }

.num {
  display: block;
  padding: 2px 8px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
}
button.num { cursor: pointer; }
button.num:hover { color: var(--primary-hover); background: var(--primary-soft); }
button.num:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.num-label { display: none; font-size: 12px; color: var(--muted); }
.num-value { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-empty .num-value { color: var(--subtle); font-weight: 400; }
.call-link { display: none; }

/* Number lines in the contact form */
.number-head,
.number-edit { display: grid; grid-template-columns: 1fr 1fr 1fr 32px; gap: 8px; align-items: center; }
.number-head { margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.number-edit + .number-edit { margin-top: 8px; }

/* ---------- Room Allocations (CRO) ---------- */
.ra-tabs { display: inline-flex; gap: 4px; margin-bottom: 16px; padding: 4px; background: var(--surface); border-radius: 999px; }
.ra-tab { height: 36px; padding: 0 18px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 999px; cursor: pointer; }
.ra-tab.is-on { color: #fff; background: var(--primary); }
.ra-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px 16px; background: var(--surface); border-radius: 16px; }
.ra-date { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ra-date .text-input { width: 170px; height: 38px; }
.ra-status { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.ra-status.is-bad { color: var(--danger); font-weight: 600; }
.ra-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 22px; background: var(--surface); border-radius: 18px; }
.ra-start p { font-weight: 600; }
.ra-card { margin-bottom: 14px; padding: 16px 18px; background: var(--surface); border-radius: 18px; }
.ra-hint { margin: -4px 4px 10px; }
.ra-muted { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--subtle); }
.ra-in { width: 100%; min-width: 0; height: 34px; padding: 0 10px; font: inherit; font-size: 13px; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; }
.ra-in:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.ra-in.is-bold { font-weight: 700; }
.ra-block-head { margin-bottom: 8px; font-size: 14.5px; }
/* Morning / Afternoon / Evening: each part has its own colour band, edge and icon */
.ra-block { --part: #0d8077; --part-soft: #ddf1ee; --part-text: #0b5f58; position: relative; margin-bottom: 22px; padding-top: 0; overflow: hidden; box-shadow: inset 6px 0 0 var(--part); }
.ra-block.is-morning { --part: #e0a100; --part-soft: #fff4cf; --part-text: #7a5600; }
.ra-block.is-afternoon { --part: #0d8077; --part-soft: #ddf1ee; --part-text: #0b5f58; }
.ra-block.is-evening { --part: #4a57c8; --part-soft: #e5e8fb; --part-text: #2f3a9e; }
.ra-block .ra-block-head { margin: 0 -18px 12px; padding: 12px 18px 12px 24px; background: var(--part-soft); border-bottom: 1px solid rgba(0, 0, 0, 0.05); box-shadow: inset 6px 0 0 var(--part); }
.ra-block .ra-block-head strong { font-size: 16px; font-weight: 800; letter-spacing: 0.01em; color: var(--part-text); }
.ra-block .ra-block-head .ra-muted { color: var(--part-text); opacity: 0.7; }
.ra-part-icon { display: grid; place-items: center; width: 30px; height: 30px; margin-right: 6px; color: #fff; background: var(--part); border-radius: 9px; }
.ra-part-icon .icon { width: 18px; height: 18px; }
.ra-block .ra-rowhead, .ra-block .ra-row { margin-left: 0; }
.ra-block .ra-add { margin-bottom: 4px; }
/* Headings and rows share exact columns: tick, CA, Room, Doctor, Timing, then a fixed-width button area
   (B 30 + shade 96 + colour 30 + delete 30 + gaps), so the headings sit over their boxes. */
.ra-rowhead, .ra-row { display: grid; grid-template-columns: 26px minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.25fr) 198px; gap: 8px; align-items: center; padding: 0 6px; }
.ra-row .ra-shade { width: 96px; flex: none; }
.ra-rowhead { margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--subtle); }
.ra-row { margin: 0 -6px 3px; padding-top: 3px; padding-bottom: 3px; border-radius: 11px; transition: background-color 0.15s; }
.ra-rowhead { margin-left: -6px; margin-right: -6px; }
.ra-rowhead span { padding-left: 11px; }   /* line up with the text inside the boxes */
.ra-rowhead .ra-tick-head { padding-left: 0; }
/* Tick at the left: "checked against the roster". Screen only: the sheet, PNGs and print never show it. */
.ra-tick-head { display: grid; place-items: center; }
.ra-tick-head .icon { width: 15px; height: 15px; }
.ra-tick { display: grid; place-items: center; height: 34px; cursor: pointer; }
.ra-tick input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.ra-row.is-checked { background: #dcefeb; box-shadow: inset 4px 0 0 var(--primary); }
/* Empty boxes look like gaps (grey, dashed, faint hint); filled boxes are white and solid. */
.ra-row .ra-in:placeholder-shown, .ra-person .ra-in:placeholder-shown, .ra-shift-in:placeholder-shown, .ra-room-sel.is-empty {
  background-color: #f3f6f7; border-style: dashed; border-color: #cdd5dc;
}
.ra-row .ra-in::placeholder, .ra-person .ra-in::placeholder, .ra-shift-in::placeholder { color: #b3bcc6; font-weight: 400; }
.ra-row .ra-in:not(:placeholder-shown), .ra-person .ra-in:not(:placeholder-shown), .ra-room-sel:not(.is-empty) { font-weight: 600; border-color: #aab6c0; }
.ra-row .ra-in.is-bold:not(:placeholder-shown) { font-weight: 800; }
.ra-room-sel { padding-right: 4px; cursor: pointer; }
.ra-room-sel.is-empty { color: #b3bcc6; }
.ra-room-sel option { color: var(--text); font-weight: 500; }
.ra-tool:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
/* Rooms heading: tick count, Clear ticks, Arrange rooms */
.ra-rooms-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.ra-rooms-head .list-title { margin: 0 auto 0 4px; }
.ra-tick-count { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ra-tick-count.is-all { color: var(--primary); }
.ra-rooms-head .btn.is-confirm { color: var(--danger); border-color: var(--danger); }
#ra-clear-ticks:disabled { opacity: 0.45; cursor: default; }
#ra-arrange.is-confirm { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
/* Room order card (Staff list tab) */
.ra-order-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.ra-order-head h3 { margin-right: auto; font-size: 15px; }
.ra-order-actions { display: flex; gap: 6px; }
.ra-order-note { margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.ra-order-note.is-bad { color: var(--danger); font-weight: 600; }
.ra-order-empty { padding: 10px 0 4px; font-size: 13px; color: var(--muted); }
.ra-order-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: room; }
.ra-order-chips li { counter-increment: room; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 5px; font-size: 13px; font-weight: 600; background: var(--soft); border: 1px solid var(--border); border-radius: 999px; }
.ra-order-chips li::before { content: counter(room); display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 4px; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 999px; }
.ra-order-list { display: grid; gap: 4px; max-width: 520px; }
.ra-order-row { display: grid; grid-template-columns: 30px 1fr auto auto auto; gap: 6px; align-items: center; padding: 3px 4px 3px 6px; background: var(--soft); border-radius: 10px; }
.ra-order-num { font-size: 12px; font-weight: 700; color: var(--primary); text-align: center; }
.ra-order-name { font-size: 13.5px; font-weight: 600; }
.ra-order-add { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; max-width: 520px; margin-top: 10px; }
.ra-order-add .ra-shade { height: 34px; max-width: 200px; }
.ra-order-add .ra-tool { height: 34px; min-width: 34px; }
.ra-order .form-error { margin-top: 8px; }
.ra-order-changes { display: grid; gap: 6px; margin: 4px 0 6px; padding: 0; list-style: none; font-size: 13.5px; }
.ra-change-kind { display: inline-block; min-width: 68px; margin-right: 8px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; text-align: center; border-radius: 999px; }
.ra-change-kind.is-added { color: #0b5f58; background: var(--primary-soft); }
.ra-change-kind.is-moved { color: var(--blue-text); background: var(--blue-soft); }
.ra-change-kind.is-removed { color: var(--coral-text); background: var(--coral-soft); }
.ra-tools { display: flex; align-items: center; gap: 4px; }
.ra-tool { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; font: inherit; font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; }
.ra-tool .icon { width: 15px; height: 15px; }
.ra-tool:hover { color: var(--primary); border-color: var(--primary); }
.ra-tool.is-del:hover, .ra-tool.is-confirm { color: var(--danger); border-color: var(--danger); }
.ra-tool.is-confirm { font-size: 12px; font-weight: 600; }
/* Room row delete: "Delete?" floats over its neighbours so the row's boxes don't shift */
.ra-row .ra-tool.is-del.is-confirm { position: relative; }
.ra-row .ra-tool.is-del.is-confirm span { position: absolute; top: -1px; right: -1px; z-index: 2; display: grid; place-items: center; height: 30px; padding: 0 10px; white-space: nowrap; color: #fff; background: var(--danger); border-radius: 8px; box-shadow: 0 4px 12px rgba(217, 45, 32, 0.25); }
.ra-tool.is-up .icon { transform: rotate(-90deg); }
.ra-tool.is-down .icon { transform: rotate(90deg); }
.ra-bold { font-weight: 800; }
.ra-bold.is-on { color: #fff; background: var(--primary); border-color: var(--primary); }
.ra-shade { height: 30px; padding: 0 6px; font: inherit; font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; }
.ra-add { margin-top: 4px; }
/* Timing shade dropdown shows the same grey as the sheet */
.ra-shade.is-grey { color: #1d2433; font-weight: 700; background: #bdbdbd; border-color: #9e9e9e; }
.ra-shade.is-dark { color: #111; font-weight: 700; background: #9a9a9a; border-color: #7d7d7d; }
.ra-row .ra-shade:not(.is-grey):not(.is-dark) { color: #b3bcc6; background: #f3f6f7; border-style: dashed; border-color: #cdd5dc; }   /* "No shade" looks empty, like an empty box */
.ra-shade option { color: var(--text); font-weight: 500; background: #fff; }
.ra-shade option[value="grey"] { background: #bdbdbd; }
.ra-shade option[value="dark"] { background: #9a9a9a; }
.ra-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 0 14px; }
.ra-sec-head { margin: -4px -6px 10px; padding: 6px; border-radius: 12px; }
.ra-sec-head.ra-sec-green { background: #127a4a; } .ra-sec-head.ra-sec-blue { background: #0b5e98; } .ra-sec-head.ra-sec-grey { background: #127a4a; }
.ra-sec-title { font-weight: 700; color: #fff; background: transparent; border-color: rgba(255, 255, 255, 0.35); }
.ra-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.ra-col { min-width: 0; }
.ra-shift-in { margin-bottom: 6px; font-weight: 600; background: #e9f9f2; }
.ra-person { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr auto auto auto; gap: 4px; align-items: center; margin-bottom: 4px; padding: 3px; border-radius: 10px; }
.ra-person.is-red { background: #f6d0cc; }
.ra-person .ra-in { height: 30px; padding: 0 7px; font-size: 12.5px; }
.ra-phone-in.is-auto { color: var(--muted); background: var(--soft); }
.ra-check { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.ra-colorbtn { min-width: 30px; width: 30px; padding: 0; }
.ra-colorbtn span { display: block; width: 16px; height: 16px; border: 1px solid var(--border-strong); border-radius: 5px; }
.ra-colorbtn.is-on span { border-color: rgba(0, 0, 0, 0.25); }
.ra-palette { position: absolute; z-index: 50; display: grid; grid-template-columns: repeat(4, 30px); gap: 6px; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(12, 59, 78, 0.18); }
.ra-swatch { width: 30px; height: 30px; padding: 0; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 8px; cursor: pointer; }
.ra-swatch.is-none { display: grid; place-items: center; color: var(--muted); background: #fff; }
.ra-swatch.is-none .icon { width: 14px; height: 14px; }
.ra-swatch.is-on { outline: 2px solid var(--primary); outline-offset: 2px; }
.ra-swatch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ra-link { display: inline-flex; align-items: center; gap: 4px; padding: 4px 2px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--primary); background: none; border: 0; cursor: pointer; }
.ra-link .icon { width: 14px; height: 14px; }
.ra-noteline { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 6px; }
.ra-noteline .ra-in { font-weight: 600; background: #eaf9e9; }
.ra-preview-wrap { overflow: auto; }
.ra-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ra-preview-head .list-title { margin-bottom: 0; }
.ra-preview-head .btn { margin-right: 4px; }
/* Bigger view: the sheet on a white page filling the window */
.ra-zoom { position: fixed; inset: 0; z-index: 200; display: flex; padding: 64px 16px 16px; overflow: auto; background: rgba(20, 30, 45, 0.55); }
.ra-zoom[hidden] { display: none; }
.ra-zoom-sheet { flex: none; margin: auto; padding: 12px; background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.ra-zoom-tools { position: fixed; top: 12px; right: 16px; z-index: 1; display: flex; align-items: center; gap: 4px; padding: 4px; background: #fff; border-radius: 999px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.ra-zoom-btn { display: grid; place-items: center; width: 34px; height: 34px; color: var(--text); background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.ra-zoom-btn:hover { background: var(--soft); }
.ra-zoom-btn .icon { width: 18px; height: 18px; }
.ra-zoom-pct { min-width: 44px; font-size: 13px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
body.ra-zoom-open { overflow: hidden; }
.ra-staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ra-staff-card h3 { margin-bottom: 10px; font-size: 15px; }
.ra-srow { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.ra-srow.is-new .ra-in { border-style: dashed; }
.ra-tool.is-add { color: #fff; background: var(--primary); border-color: var(--primary); }
@media (max-width: 860px) {
  .ra-rowhead { display: none; }
  .ra-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .ra-tick { grid-column: 1 / -1; justify-content: start; height: auto; }
  .ra-tools { grid-column: 1 / -1; }
  .ra-sections { grid-template-columns: 1fr; }
  .ra-group { grid-template-columns: 1fr; }
}

/* The sheet itself (preview, PNG pictures and print). Fixed row heights so rows never stretch. */
.ra-full { display: inline-flex; align-items: flex-start; background: #fff; font-family: var(--font); }
.ra-rooms, .ra-staff { border-collapse: collapse; table-layout: fixed; font-family: var(--font); color: #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ra-rooms td, .ra-staff td { height: 30px; padding: 0 8px; font-size: 15px; line-height: 28px; text-align: center; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid #4a4a4a; }
.ra-rooms .c-ca { width: 150px; } .ra-rooms .c-room { width: 150px; } .ra-rooms .c-doc { width: 200px; } .ra-rooms .c-time { width: 172px; }
.ra-rooms td.ra-ca { font-weight: 700; color: #222; border: 0; background: #fff; }
.ra-rooms td.ra-title, .ra-staff td.ra-title { height: 40px; line-height: 38px; font-size: 18px; font-weight: 800; color: #fff; background: #127a4a; }
.ra-rooms td.ra-room { background: #c3ead6; }
.ra-rooms td.ra-band { font-weight: 800; background: #36c98b; }
.ra-rooms td.ra-time.is-bold { font-weight: 800; }
.ra-rooms td.ra-time.shade-grey { background: #bdbdbd; }
.ra-rooms td.ra-time.shade-dark { background: #9a9a9a; }
.ra-staff .c-name { width: 190px; } .ra-staff .c-phone { width: 110px; }
.ra-staff td.ra-sec { font-weight: 800; color: #fff; }
.ra-staff td.ra-sec-green, .ra-staff td.ra-sec-grey { background: #127a4a; }
.ra-staff td.ra-sec-blue { background: #0b5e98; }
.ra-staff td.ra-shift { font-weight: 800; background: #b5f0d7; }
.ra-staff td.ra-shift.is-grey { background: #9e9e9e; }
.ra-staff td.is-red { background: #e8a19c; }
.ra-staff td.ra-note { font-weight: 800; background: #8ee08b; }
/* Pictures: A5 portrait page for the rooms, natural size for the staff panel */
#ra-export { position: fixed; left: -12000px; top: 0; }
.ra-page { display: inline-block; padding: 14px; background: #fff; }
.ra-page-a5 { box-sizing: border-box; width: 559px; min-height: 794px; padding: 18px 18px; }
.ra-page-a5 .ra-rooms { width: 522px; }
.ra-page-a5 .ra-rooms .c-room { width: 150px; } .ra-page-a5 .ra-rooms .c-doc { width: 200px; } .ra-page-a5 .ra-rooms .c-time { width: 172px; }
/* Print: the whole sheet on one A5 landscape page */
#ra-print-area { display: none; }
#ra-print-area.is-measuring { display: block; position: fixed; left: -12000px; top: 0; }
@media print {
  html:has(body.ra-printing), body.ra-printing { margin: 0; padding: 0; background: #fff !important; }
  body.ra-printing > *:not(#ra-print-area) { display: none !important; }
  body.ra-printing #ra-print-area { display: block; text-align: center; }
}

/* ---------- Ambulance Call Timeline (fill in on screen, print / PDF on A5) ---------- */
.amb-wrap { display: flex; justify-content: center; padding: 6px 0 24px; }
.amb-sheet { width: 100%; max-width: 620px; padding: 26px 26px 16px; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(12, 59, 78, 0.1); }
.amb-table { width: 100%; border-collapse: collapse; table-layout: fixed; color: #111; font-family: var(--font); }
.amb-table .amb-c-label { width: 34%; }
.amb-table th, .amb-table td { border: 1px solid #3b3b3b; }
.amb-table .amb-title { font-size: 19px; font-weight: 800; letter-spacing: 0.02em; text-align: center; }
.amb-table .amb-sec { font-size: 14px; font-weight: 700; text-align: center; background: #eef1f3; }
.amb-table .amb-label { padding: 0 8px; font-size: 13.5px; font-weight: 500; text-align: right; white-space: nowrap; }
.amb-table .amb-note { padding: 10px 8px; font-size: 13.5px; font-weight: 700; font-style: italic; text-align: center; }
.amb-table .amb-remarks { padding: 6px 10px 4px; vertical-align: top; }
.amb-label-inline { display: block; font-size: 13.5px; font-weight: 500; }
.amb-table .amb-choice label { display: flex; align-items: center; gap: 12px; padding: 0 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.amb-box { display: inline-grid; place-items: center; width: 30px; height: 20px; font-size: 15px; font-weight: 800; line-height: 1; border: 1.5px solid #3b3b3b; border-radius: 2px; }
/* On screen: the boxes to type in */
.amb-sheet .amb-title { height: 46px; }
.amb-sheet .amb-sec { height: 34px; }
.amb-sheet td { height: 40px; }
.amb-sheet input:not([type=checkbox]), .amb-sheet textarea { display: block; width: 100%; height: 39px; padding: 0 10px; font: inherit; font-size: 14px; font-weight: 600; color: #0b2a33; background: transparent; border: 0; border-radius: 0; }
.amb-sheet textarea { height: auto; min-height: 64px; padding: 4px 0; resize: vertical; line-height: 1.45; }
.amb-sheet input:not([type=checkbox]):focus, .amb-sheet textarea:focus { outline: none; background: var(--primary-soft); box-shadow: inset 0 -2px 0 var(--primary); }
.amb-sheet .amb-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.amb-sheet .amb-choice input:checked + .amb-box::after { content: "✓"; color: var(--primary); }
.amb-sheet .amb-choice input:focus-visible + .amb-box { outline: 3px solid var(--focus); outline-offset: 2px; }
.amb-sheet .amb-choice label:hover .amb-box { border-color: var(--primary); }
.amb-stamp { margin: 12px 0 0; font-size: 11px; font-weight: 500; color: #9aa1a8; text-align: center; letter-spacing: 0.02em; }
.page-ambulance .head-actions .btn.is-confirm { color: var(--danger); border-color: var(--danger); }
/* Top: title with New call / Download PDF / Print A5 under it on the left, Back to Home on the right */
.page-ambulance .page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px 16px; }
.page-ambulance .page-head > :first-child { grid-column: 1; grid-row: 1; margin-right: 0; }
.page-ambulance .page-head > .head-actions { grid-column: 1; grid-row: 2; }
.page-ambulance .page-head > .btn-home { grid-column: 2; grid-row: 1; margin-left: 0; }
/* The tabs row with a large Save button on the right */
.amb-tabrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.amb-tabrow .ra-tabs { margin-bottom: 0; }
.amb-tabrow .head-actions { align-items: center; justify-content: flex-end; gap: 8px 10px; }
.amb-save-btn { min-width: 200px; height: 52px; padding: 0 26px; font-size: 17px; font-weight: 800; letter-spacing: 0.01em; border-radius: 16px; box-shadow: 0 10px 22px rgba(13, 128, 119, 0.32); }
.amb-save-btn .icon { width: 21px; height: 21px; }
.amb-save-btn:hover:not(:disabled) { transform: translateY(-1px); }
.amb-save-btn.is-saved { color: #0b5f58; background: var(--primary-soft); border-color: #b9e2dc; box-shadow: none; }
.amb-save-btn.is-saved:hover:not(:disabled) { background: #cdebe6; transform: none; }
@media (max-width: 640px) { .amb-save-btn { width: 100%; } }
/* Status of the form being shown (new / saved today / locked / requested / approved) */
.amb-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: 620px; margin: 0 auto 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.amb-status-text { flex: 1 1 260px; }
.amb-status.is-ok { color: #0b5f58; background: var(--primary-soft); border-color: #b9e2dc; }
.amb-status.is-locked { color: #5b6472; background: #eef1f4; border-color: #dde3e8; }
.amb-status.is-wait { color: var(--amber-text); background: var(--amber-soft); border-color: #f1df9c; }
.amb-status .amb-status-icon { display: none; width: 20px; height: 20px; flex: none; }
/* Unsaved: a red warning so it can't be missed */
.amb-status.is-warn { color: #b42318; font-weight: 700; background: #fef0ee; border: 1.5px solid #f4a99f; box-shadow: 0 4px 14px rgba(217, 45, 32, 0.12); }
.amb-status.is-warn .amb-status-icon { display: block; color: #d92d20; }
.amb-sheet.is-locked { background: #fbfbfc; }
.amb-sheet.is-locked input, .amb-sheet.is-locked textarea { color: #3c4450; cursor: default; }
.amb-sheet.is-locked input:focus, .amb-sheet.is-locked textarea:focus { background: transparent; box-shadow: none; }
.amb-sheet.is-locked .amb-choice label { cursor: default; }
.amb-tab-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; }
/* Last 30 days list */
.amb-day { position: relative; display: inline-flex; align-items: center; }
.amb-req-filter { color: #b42318; border-color: #f4a99f; }
.amb-req-filter.is-on { color: #fff; background: var(--danger); border-color: var(--danger); }
.amb-day .text-input { width: 180px; height: 42px; padding: 0 14px 0 18px; border-radius: 999px; }
.amb-list { display: grid; gap: 6px; }
.amb-row { display: grid; grid-template-columns: 96px 1fr auto auto; gap: 14px; align-items: center; width: 100%; padding: 12px 16px; font: inherit; text-align: left; color: var(--text); background: var(--surface); border: 1px solid transparent; border-radius: 14px; cursor: pointer; }
.amb-row:hover { border-color: var(--primary); }
.amb-row.is-open { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.amb-row-when { display: grid; font-size: 12.5px; color: var(--muted); }
.amb-row-when strong { font-size: 13.5px; color: var(--text); }
.amb-row-body { display: grid; min-width: 0; }
.amb-row-body strong { font-size: 14px; }
.amb-row-body span { overflow: hidden; font-size: 12.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.amb-row-by { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.amb-badge { padding: 3px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; border-radius: 999px; }
.amb-badge.is-today { color: #0b5f58; background: var(--primary-soft); }
.amb-badge.is-locked { color: #5b6472; background: #eef1f4; }
.amb-badge.is-requested { color: var(--amber-text); background: var(--amber-soft); }
.amb-badge.is-approved { color: var(--blue-text); background: var(--blue-soft); }
@media (max-width: 760px) { .amb-row { grid-template-columns: 80px 1fr; } .amb-row-by { grid-column: 2; } .amb-badge { grid-column: 2; justify-self: start; } }
/* The A5 page (print and PDF): 148 × 210 mm */
/* The table stretches to fill the whole page (A5 minus 6 mm margins and the stamp line) */
.amb-page { position: relative; box-sizing: border-box; width: 148mm; height: 210mm; padding: 6mm 6mm 11mm; background: #fff; overflow: hidden; }
.amb-page .amb-table { height: 193mm; }
.amb-page .amb-title { height: 9mm; font-size: 13pt; }
.amb-page .amb-sec { height: 6.5mm; font-size: 9.5pt; }
.amb-page td { height: 7.2mm; }
.amb-page .amb-label, .amb-page .amb-label-inline, .amb-page .amb-choice label { font-size: 9pt; }
.amb-page .amb-note { padding: 2.5mm 2mm; font-size: 9pt; }
.amb-page .amb-text { padding: 0 2.5mm; font-size: 9.5pt; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.amb-page .amb-text-multi { min-height: 13mm; padding: 1mm 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.amb-page .amb-remarks { padding: 1.5mm 2.5mm 1mm; }
.amb-page .amb-box { width: 7mm; height: 4.6mm; font-size: 10pt; }
.amb-page .amb-stamp { position: absolute; left: 0; right: 0; bottom: 4mm; margin: 0; font-size: 7.5pt; color: #9aa1a8; }
.amb-export { position: fixed; left: -12000px; top: 0; }
#amb-print-area { display: none; }
@media print {
  html:has(body.amb-printing), body.amb-printing { margin: 0; padding: 0; background: #fff !important; }
  body.amb-printing > *:not(#amb-print-area) { display: none !important; }
  body.amb-printing #amb-print-area { display: block; }
  body.amb-printing .amb-page { page-break-after: avoid; break-after: avoid; }
  body.amb-printing .amb-page { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 640px) { .amb-sheet { padding: 14px 10px 10px; } .amb-table .amb-label { font-size: 12px; white-space: normal; } }

/* ---------- Eye Prescription (admin) ---------- */
.eye-settings { margin-bottom: 18px; padding: 20px 22px; background: var(--surface); border-radius: 20px; }
.eye-head h2 { font-size: 16px; font-weight: 700; }
.eye-head p { margin: 2px 0 14px; font-size: 13px; color: var(--muted); }
.eye-grid { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr auto; gap: 12px; align-items: end; }
.eye-grid .field label { font-size: 12.5px; color: var(--muted); }
.eye-settings .form-error { margin-top: 12px; }
.list-title { margin: 4px 4px 10px; font-size: 16px; font-weight: 700; }
@media (max-width: 860px) { .eye-grid { grid-template-columns: 1fr; } }

/* ---------- Invoice Check (admin): who may use the PC program ---------- */
.invoice-intro { margin-bottom: 18px; padding: 18px 22px; background: var(--surface); border-radius: 20px; }
.invoice-intro h2 { font-size: 16px; font-weight: 700; }
.invoice-intro p { margin-top: 2px; font-size: 13px; color: var(--muted); }
.access-toggle { padding: 7px 12px; border-radius: 999px; background: var(--bg); white-space: nowrap; }
.access-toggle:has(input:checked) { color: var(--primary-hover); background: var(--primary-soft); font-weight: 600; }

/* ---------- Statora (admin): newest version and who may use the PC program ---------- */
.statora-top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.statora-card { padding: 20px 22px; background: var(--surface); border-radius: 20px; }
.statora-card-head { display: flex; align-items: flex-start; gap: 14px; }
.statora-card-head .chip { flex: none; }
.statora-card-title { flex: 1; min-width: 0; }
.statora-card-title h2 { font-size: 16px; font-weight: 700; }
.statora-card-title p { margin-top: 2px; font-size: 13px; color: var(--muted); }
.statora-card-head .btn { flex: none; }
.st-notes { margin: 14px 0 0; padding: 12px 16px 12px 34px; border-radius: 14px; background: var(--soft); font-size: 13.5px; line-height: 1.7; }
.st-foot { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.st-foot .text-btn { display: inline; padding: 0; font-size: 12.5px; }
.st-switch { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--soft); cursor: pointer; }
.st-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.st-switch-track { position: relative; flex: none; width: 40px; height: 22px; margin-top: 1px; border-radius: 999px; background: var(--border-strong); transition: background 0.15s; }
.st-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.st-switch input:checked + .st-switch-track { background: var(--primary); }
.st-switch input:checked + .st-switch-track::after { transform: translateX(18px); }
.st-switch input:focus-visible + .st-switch-track { box-shadow: 0 0 0 4px var(--focus); }
.st-switch-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.st-switch-text strong { font-size: 14px; color: var(--text); font-weight: 600; }
.st-list-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 4px 10px; }
.st-list-head .list-title { margin: 0; }
.st-list-head p { font-size: 13px; color: var(--muted); }
.st-file-card { display: flex; align-items: center; gap: 12px; margin: -4px 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--soft); }
.st-file-card div { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.st-file-card strong { font-size: 14px; color: var(--text); }
.st-notes-box { min-height: 110px; resize: vertical; line-height: 1.6; }
@media (max-width: 980px) { .statora-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .statora-card-head { flex-wrap: wrap; } .statora-card-head .btn { width: 100%; justify-content: center; } }

/* ---------- Links ---------- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 16px; color: var(--text); background: var(--surface); border-radius: 18px; }
.link-card:hover { background: var(--primary-soft); }
.link-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.link-card-body { display: grid; flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.link-card-body strong { font-size: 14.5px; font-weight: 600; color: var(--text); }
.link-card-body small { font-size: 11.5px; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Guides ---------- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.guide-card { display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--text); background: var(--surface); border-radius: 18px; }
.guide-card:hover { background: var(--primary-soft); }
.guide-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.guide-card-body { display: grid; flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.guide-card-body strong { font-size: 14px; font-weight: 600; color: var(--text); }
.row-arrow { display: grid; place-items: center; color: var(--muted); }

.guide-sheet { padding: 12px; background: var(--surface); border-radius: 18px; }
.guide-scroll { overflow-x: auto; border-radius: 12px; }
.guide-table.is-wide { min-width: 760px; }
.guide-table.is-sheet { text-align: left; }
.guide-table td.is-blank { padding: 0; background: transparent; }

/* Editing a guide (admin) */
/* Edit bar: title box and buttons on one line, the tips as one line underneath */
.guide-editbar { display: grid; grid-template-columns: minmax(200px, 520px) 1fr; gap: 10px 16px; align-items: end; margin-bottom: 14px; padding: 16px 18px; background: var(--primary-soft); border-radius: 16px; }
.guide-editbar .field { grid-column: 1; grid-row: 1; }
.guide-editbar .hint { grid-column: 1 / -1; grid-row: 2; margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.editbar-actions { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
@media (min-width: 861px) { .guide-editbar { grid-template-columns: minmax(200px, 1fr) auto; } .editbar-actions { flex-wrap: nowrap; } }
.guide-table.is-editing td[contenteditable] { outline: 1px dashed rgba(13, 128, 119, 0.35); outline-offset: -3px; cursor: text; }
.guide-table.is-editing td[contenteditable]:focus { outline: 2px solid var(--primary); }
.guide-table.is-editing td.is-blank { padding: 11px 12px; }
.guide-table td.row-tools { width: 1%; padding: 2px 0 2px 8px; white-space: nowrap; background: transparent; vertical-align: middle; }
.row-tools button { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: 0 2px; padding: 0; color: var(--muted); background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; }
.row-tools button .icon { width: 15px; height: 15px; }
.row-tools button:hover { color: var(--primary); border-color: var(--primary); }
.row-tools button.del:hover { color: var(--danger); border-color: var(--danger); }
@media (max-width: 860px) {
  .guide-editbar { grid-template-columns: 1fr; }
  .editbar-actions { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .guide-editbar .hint { grid-row: 3; }
}
.editbar-actions #guide-delete:hover, .editbar-actions #guide-delete.is-confirm { color: var(--danger); border-color: var(--danger); }
.editbar-actions #guide-delete.is-confirm { color: #fff; background: var(--danger); }
/* Formatting bar (admin, while editing a guide) */
.guide-format { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; padding: 8px 10px; background: #fff; border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 6px 18px rgba(12, 59, 78, 0.08); }
.gf-sel { min-width: 118px; padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.gf-group { display: inline-flex; flex-wrap: wrap; gap: 4px; padding-left: 10px; border-left: 1px solid var(--border); }
.gf-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 34px; height: 34px; padding: 0 9px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; cursor: pointer; }
.gf-btn .icon { width: 17px; height: 17px; }
.gf-btn:hover { color: var(--primary); border-color: var(--primary); }
.gf-btn.is-on { color: #fff; background: var(--primary); border-color: var(--primary); }
.gf-btn.is-del:hover { color: var(--danger); border-color: var(--danger); }
.gf-bold { font-size: 15px; font-weight: 800; }
.gf-a { font-size: 15px; font-weight: 800; line-height: 1; }
.gf-swatch-btn { padding-bottom: 5px; }
.gf-bar { position: absolute; left: 8px; bottom: 4px; width: 20px; height: 4px; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 2px; }
.gf-label { margin-left: 2px; }
.gf-palette { position: absolute; z-index: 60; width: 300px; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(12, 59, 78, 0.2); }
.gf-none { display: flex; align-items: center; gap: 6px; width: 100%; height: 32px; margin-bottom: 10px; padding: 0 10px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--soft); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.gf-none .icon { width: 14px; height: 14px; color: var(--muted); }
.gf-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.gf-swatch { aspect-ratio: 1; padding: 0; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 7px; cursor: pointer; }
.gf-swatch:hover { transform: scale(1.12); }
.gf-swatch.is-on { outline: 2px solid var(--primary); outline-offset: 2px; }
.gf-more { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.gf-more input { width: 44px; height: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: 7px; background: none; cursor: pointer; }
.guide-table.is-editing td.is-selected { box-shadow: inset 0 0 0 2px var(--primary); outline-color: transparent; }
.guide-table a { font-weight: 600; word-break: break-word; }
.guide-images { display: grid; gap: 12px; justify-items: center; margin-top: 8px; }
.guide-images img { display: block; max-width: 100%; height: auto; border-radius: 12px; }
.guide-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 14px;
  text-align: center;
}
.guide-table th {
  padding: 12px 10px;
  font-weight: 700;
  color: #ffffff;
  background: var(--text);
  border-radius: 10px;
}
.guide-table td { padding: 11px 12px; line-height: 1.4; color: var(--text); border-radius: 10px; }
.guide-table strong { font-weight: 700; }
.tone-yellow { background: #fff1c9; }
.tone-orange { background: #fbd9b0; }
.tone-pink { background: #fbdcdb; }
.tone-rose { background: #f1b6b1; }
.tone-peach { background: #fde8d3; }
.tone-dark { background: #4b5563; }
.tone-plain { background: var(--soft); }

/* ---------- Import preview ---------- */
.import-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.import-list:focus { outline: none; border-color: var(--primary); }
.import-row { display: flex; align-items: center; gap: 10px; min-height: 0; padding: 7px 12px; border-top: 1px solid var(--border); }
.import-row:first-child { border-top: 0; }
.import-num { flex: none; width: 72px; font-size: 13px; font-variant-numeric: tabular-nums; }
.import-head { position: sticky; top: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--soft); }
.import-head .import-num { font-size: 12.5px; }

/* ---------- Dialogs ---------- */
.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 20px;
}
.modal-wide { width: min(620px, calc(100vw - 32px)); }
.modal-sm { width: min(400px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(20, 30, 45, 0.45); }
.modal form { display: grid; gap: 14px; }
.modal h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.checks { margin: 0; padding: 0; border: 0; }
.checks legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 600; }
.checks > div { display: grid; gap: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* Add several people */
.bulk-names { height: auto; min-height: 180px; padding: 10px 14px; line-height: 1.6; resize: vertical; font-family: inherit; }
.bulk-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .bulk-pair { grid-template-columns: 1fr; } }
.bulk-report { display: grid; gap: 8px; max-height: 240px; overflow: auto; padding: 12px 14px; font-size: 13px; background: var(--soft); border-radius: 12px; }
.bulk-group strong { display: block; margin-bottom: 2px; font-size: 13px; }
.bulk-group p { color: var(--muted); }
.bulk-group.is-added strong { color: var(--primary); }
.bulk-group.is-skipped strong { color: var(--amber-text); }
.bulk-group.is-failed strong { color: var(--danger); }
.confirm-body { display: grid; gap: 8px; }
.confirm-body p { color: var(--muted); }
.confirm-body .modal-actions { margin-top: 10px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: var(--text);
  border-radius: 999px;
}

/* Print blank: only the drawn form pages reach the paper */
#print-area { display: none; }
@media print {
  body.printing { background: #ffffff; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  #print-area img { display: block; break-after: page; }
  #print-area img:last-child { break-after: auto; }
}

/* ---------- Collapsed sidebar (desktop only) ---------- */
@media (min-width: 861px) {
  .shell.can-animate { transition: grid-template-columns 0.15s ease; }
  .shell.is-collapsed { grid-template-columns: 74px minmax(0, 1fr); }

  .is-collapsed .side-head { flex-direction: column; justify-content: center; gap: 10px; height: auto; padding: 16px 0 12px; }
  .is-collapsed .side-toggle { position: static; width: 36px; height: 24px; border-radius: 8px; }
  .is-collapsed .brand-name,
  .is-collapsed .side-credit,
  .is-collapsed .side-label,
  .is-collapsed .nav-item span { display: none; }
  .is-collapsed .side-nav { padding: 12px 10px 0; }
  .is-collapsed .nav-item { justify-content: center; justify-self: center; width: 48px; padding: 0; }
  .is-collapsed .nav-badge { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; margin: 0; padding: 0 5px; font-size: 10.5px; }
}

/* ---------- Smaller screens ---------- */
@media (max-width: 1180px) {
  .home-grid { grid-template-columns: 1fr; }
  .hero-content { padding-left: 8%; padding-right: 8%; }
  .login-side { padding-right: 32px; }
}

@media (max-width: 900px) {
  .page-login { display: block; }
  .login-hero { min-height: 0; padding: 44px 0 120px; }
  .hero-content { padding: 0 24px; }
  .hero-brand { gap: 14px; }
  .hero-rule { margin: 20px 0 16px; }
    .hero-watermark { width: 420px; left: 64%; bottom: -40px; }
  .login-curve { display: none; }
  .login-side { padding: 0 16px 56px; margin-top: -56px; background: transparent; }
  .login-card { padding: 30px 22px 24px; }
  .login-features .icon { width: 24px; height: 24px; }
}

@media (max-width: 860px) {
  .shell { display: block; padding: 10px; }
  .side-toggle, .side-label, .side-credit { display: none; }
  .page-credit { display: block; }
  .sidebar { position: static; height: auto; margin-bottom: 10px; }
  .side-head { height: 58px; }
  .side-nav { display: flex; padding: 8px; overflow-x: auto; border-top: 0; }
  .nav-item { flex: 1; justify-content: center; gap: 6px; height: 42px; padding: 0 12px; }
  .nav-chip { display: none; }
  .main { gap: 10px; }
  .topbar { min-height: 0; padding: 10px; border-radius: 16px; }
  .user-meta { display: none; }
  .user-pill { padding: 0; border: 0; }
}

@media (max-width: 780px) {
  .contact-head { display: none; }
  .contact-row { display: block; padding: 10px 8px; }
  .contact-row .avatar { display: none; }
  .contact-row .row-body { display: block; margin-bottom: 4px; }
  .contact-row .row-body p { font-size: 12.5px; }
  .number-line { grid-template-columns: 1fr 1fr 1fr 32px; }
  .num { padding-left: 0; }
  .num-label { display: block; }
  .number-line + .number-line .num-label { display: none; }
  .call-link { display: inline-grid; }
  .call-spacer { visibility: hidden; }

  .row { flex-wrap: wrap; }
  .row-body { flex-basis: calc(100% - 56px); }
  .row-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .contact-row .row-actions { display: block; width: auto; }
  .select-sm { flex: 1; width: auto; min-width: 0; }

  .filter-bar { flex-direction: column; }
  .filter-bar .search { flex: none; max-width: none; }
  .filter-bar .filter-select { width: 100%; }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 28px; }
  .quick-card { min-height: 0; gap: 18px; padding: 18px; }
  .import-num { width: 58px; font-size: 12.5px; }
}
.ra-srow.no-phone { grid-template-columns: 1fr auto; }
.ra-srow.no-phone.has-move { grid-template-columns: 1fr auto auto; }
/* Room Allocations: per-card Clear buttons */
.ra-block-head { display: flex; align-items: center; gap: 4px; }
.ra-clear { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; height: 28px; padding: 0 10px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; }
.ra-clear .icon { width: 13px; height: 13px; }
.ra-clear:hover, .ra-clear.is-confirm { color: var(--danger); border-color: var(--danger); }
.ra-clear.on-dark { flex: none; color: #fff; background: transparent; border-color: rgba(255, 255, 255, 0.45); }
.ra-clear.on-dark.is-confirm { color: #fff; background: var(--danger); border-color: var(--danger); }
.ra-sec-head { display: flex; align-items: center; gap: 8px; }
.ra-sec-head .ra-sec-title { flex: 1; }
.ra-clear.is-right { float: right; margin-top: 2px; }
/* Contact import: repeated numbers to decide */
.import-section { margin: 14px 2px 8px; font-size: 14px; font-weight: 700; }
.dup-card { margin-bottom: 10px; padding: 12px 14px; background: var(--amber-soft); border-radius: 14px; }
.dup-why { margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--amber-text); }
.dup-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dup-side { display: grid; gap: 2px; padding: 10px 12px; background: #fff; border-radius: 10px; }
.dup-label { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--subtle); text-transform: uppercase; }
.dup-side strong { font-size: 14px; }
.dup-dept, .dup-nums { font-size: 12.5px; color: var(--muted); }
.dup-choices { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.dup-choice { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.dup-choice input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
#import-editor button[type="submit"]:disabled { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 640px) { .dup-pair { grid-template-columns: 1fr; } }
/* ---------- Sign-in page animations (switched off when Windows "reduce motion" is on) ---------- */
@keyframes td-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes td-grow { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }
@keyframes td-line-draw {
  from { stroke-dashoffset: 1; transform: translate(var(--x), var(--y)); }
  to   { stroke-dashoffset: 0; transform: none; }
}
@keyframes td-curve-in { from { transform: translateX(-180px); } to { transform: none; } }
@keyframes td-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
@keyframes td-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); }
}
.page-login .hero-brand   { animation: td-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s both; }
.page-login .hero-rule    { transform-origin: left; animation: td-grow 0.5s ease-out 0.3s both; }
.page-login .hero-tagline { animation: td-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.4s both; }
.page-login .login-card   { animation: td-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s both; }
.page-login .login-features li { animation: td-rise 0.5s ease-out both; }
.page-login .login-features li:nth-child(1) { animation-delay: 0.55s; }
.page-login .login-features li:nth-child(2) { animation-delay: 0.62s; }
.page-login .login-features li:nth-child(3) { animation-delay: 0.69s; }
.page-login .login-features li:nth-child(4) { animation-delay: 0.76s; }
.page-login .login-curve { animation: td-curve-in 1s cubic-bezier(0.22, 0.8, 0.2, 1) both; }
.page-login .hero-watermark path { stroke-dasharray: 1; animation: td-line-draw 1.7s cubic-bezier(0.45, 0, 0.25, 1) calc(0.3s + var(--d, 0s)) both; }
.login-submit { transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.login-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(11, 111, 105, 0.28); }
.login-submit.is-busy .spinner { display: none !important; }
.login-submit.is-busy .submit-icon { animation: td-nudge 0.8s ease-in-out infinite; }
.login-card.is-shaking { animation: td-shake 0.42s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
  .page-login .hero-brand, .page-login .hero-rule, .page-login .hero-tagline, .page-login .login-card,
  .page-login .login-features li, .page-login .hero-watermark path, .page-login .login-curve, .login-submit.is-busy .submit-icon, .login-card.is-shaking { animation: none !important; }
  .page-login .hero-watermark path { stroke-dasharray: none; }
  .login-submit:hover:not(:disabled) { transform: none; }
}
/* ---------- Daily Tasks (tasks.html) ---------- */
.page-tasks .content { max-width: 860px; }
.task-top { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; margin-bottom: 12px; }
.task-progress { flex: 1 1 320px; display: grid; gap: 10px; padding: 16px 20px; background: var(--surface); border-radius: 18px; }
.task-progress-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.task-progress-text strong { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.task-progress-text span { font-size: 13px; color: var(--muted); }
.task-bar { height: 10px; overflow: hidden; background: var(--soft); border-radius: 999px; }
.task-bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width 0.3s ease; }
.task-progress.is-complete { background: var(--primary-soft); }
.task-progress.is-complete .task-progress-text strong, .task-progress.is-complete .task-progress-text span { color: #0b5f58; }
.task-progress.is-past .task-bar span { background: #8a96a6; }
.task-daypick { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 8px; }
.task-past-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; color: #5b6472; background: #eef1f4; border: 1px solid #dde3e8; border-radius: 12px; }
.task-past-note .icon { width: 17px; height: 17px; }

.task-list, .task-edit-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.task-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 12px 18px 12px 14px;
  font: inherit; color: var(--text); text-align: left;
  background: var(--surface); border: 1.5px solid transparent; border-radius: 16px; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.task-row:hover:not(:disabled) { border-color: rgba(13, 128, 119, 0.35); }
.task-row:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.task-row:disabled { cursor: default; }
.task-tick { display: grid; place-items: center; width: 34px; height: 34px; color: transparent; background: var(--surface); border: 2px solid var(--border-strong); border-radius: 50%; transition: all 0.15s; }
.task-tick .icon { width: 22px; height: 22px; }
.task-row:hover:not(:disabled) .task-tick { border-color: var(--primary); color: rgba(13, 128, 119, 0.35); }
.task-body { display: grid; gap: 2px; min-width: 0; }
.task-title { font-size: 15px; font-weight: 700; line-height: 1.35; }
.task-note { font-size: 12.5px; color: var(--muted); }
.task-by { display: grid; justify-items: end; gap: 1px; font-size: 12.5px; text-align: right; }
.task-by-name { font-weight: 700; color: #0b5f58; }
.task-by-time { color: var(--muted); }
.task-by-todo { color: var(--subtle); font-weight: 600; }
.task-row.is-done { background: var(--primary-soft); }
.task-row.is-done .task-tick { color: #fff; background: var(--primary); border-color: var(--primary); }
.task-row.is-done .task-title { color: #0b5f58; }
.task-row.is-past:not(.is-done) .task-by-todo { color: #b42318; }
.task-row.is-past:not(.is-done) .task-tick { border-style: dashed; }
/* Second click undoes: the right side asks first */
.task-row.is-confirm { background: #fef0ee; border-color: #f4a99f; }
.task-row.is-confirm .task-tick { background: #d92d20; border-color: #d92d20; }
.task-row.is-confirm .task-by > * { display: none; }
.task-row.is-confirm .task-by::before { content: attr(data-confirm); font-weight: 700; color: #b42318; }

.task-edit-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.task-hint { font-size: 13px; color: var(--muted); }
.task-edit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 60px; padding: 10px 14px; background: var(--surface); border-radius: 16px; }
.task-num { display: grid; place-items: center; width: 30px; height: 30px; font-size: 13px; font-weight: 700; color: var(--primary-hover); background: var(--primary-soft); border-radius: 50%; }
.task-edit-actions { display: flex; align-items: center; gap: 6px; }
.task-up .icon { transform: rotate(-90deg); }
.task-down .icon { transform: rotate(90deg); }
.task-del.is-confirm { color: #fff; background: var(--danger); border-color: var(--danger); }
@media (max-width: 640px) {
  .task-row { grid-template-columns: auto minmax(0, 1fr); }
  .task-by { grid-column: 2; justify-items: start; text-align: left; display: flex; gap: 8px; }
  .task-daypick { flex-direction: row; align-items: center; }
  .task-edit-row { grid-template-columns: auto minmax(0, 1fr); }
  .task-edit-actions { grid-column: 2; }
}
/* CRO / admin: every Clinical Assistant with a red count, or green when all done */
.task-staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.task-staff-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 76px; padding: 12px 14px; font: inherit; color: var(--text); text-align: left;
  background: var(--surface); border: 1.5px solid transparent; border-radius: 16px; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.task-staff-card:hover { border-color: rgba(13, 128, 119, 0.35); }
.task-staff-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.task-staff-card .avatar { width: 40px; height: 40px; font-size: 13px; }
.task-staff-body { display: grid; gap: 2px; min-width: 0; }
.task-staff-body strong { font-size: 14.5px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.task-staff-body span { font-size: 12px; color: var(--muted); }
.task-staff-card.is-done { background: var(--primary-soft); }
.task-ring { display: grid; place-items: center; width: 52px; height: 52px; font-size: 14px; font-weight: 800; color: #b42318; background: #fef0ee; border: 3px solid #e5483a; border-radius: 50%; }
.task-ring.is-done { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 58px; height: 58px; font-size: 9.5px; font-weight: 700; line-height: 1; text-align: center; color: #fff; background: var(--primary); border-color: var(--primary); }
.task-ring.is-done .icon { display: block; width: 20px; height: 20px; }
.task-back { margin-bottom: 12px; }

/* Room Allocations: rows on every day (Staff list tab) and the fixed Biomedical engineers */
.ra-defaults { margin-top: 12px; }
.ra-def-table { display: grid; gap: 3px; max-width: 760px; }
.ra-def-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.2fr); gap: 8px; align-items: center; min-height: 34px; padding: 0 10px; font-size: 13.5px; background: var(--soft); border-radius: 9px; }
.ra-def-row.is-head { min-height: 0; padding-bottom: 2px; font-size: 11.5px; font-weight: 600; color: var(--subtle); background: none; }
.ra-def-room { font-weight: 700; }
.ra-def-time { justify-self: start; padding: 2px 8px; border-radius: 6px; }
.ra-def-time.is-bold { font-weight: 800; }
.ra-def-time.shade-grey { background: #bdbdbd; }
.ra-def-time.shade-dark { background: #9a9a9a; }
.ra-def-edit { display: grid; gap: 6px; margin-bottom: 8px; }
.ra-def-erow { display: grid; grid-template-columns: 112px minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: center; }
.ra-def-erow .ra-shade { width: 96px; }
.ra-def-erow .ra-in.is-bold { font-weight: 800; }
.ra-change-kind.is-changed { color: var(--amber-text); background: var(--amber-soft); }
.ra-fixed-note { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px; font-size: 12px; font-weight: 600; color: var(--blue-text); }
.ra-fixed-note .icon { width: 14px; height: 14px; }
@media (max-width: 760px) {
  .ra-def-row { grid-template-columns: 80px 1fr; padding: 6px 10px; }
  .ra-def-erow { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
}
.ra-del-day.is-confirm { color: #fff; background: var(--danger); border-color: var(--danger); }
.ra-status:empty + .ra-del-day { margin-left: auto; }
.ra-fixed-note.is-past { color: var(--muted); }
