/* Bulgaria VFS Portal — the flag's own palette, light + dark themes.
 *
 * White #FFFFFF, green #00966E and red #D62612 are the three colours of the
 * Bulgarian flag, and they carry the whole interface: white is the surface,
 * green is the brand (sidebar, buttons, links, focus), red is reserved for the
 * things that destroy or fail. Amber survives as the one non-flag hue because
 * "in flight" needs to be distinguishable from "done" -- three colours cannot
 * carry five states.
 */

:root,
[data-theme="light"] {
  /* The green scale, anchored on the flag's own #00966E at 400. */
  --brand-900: #032B20;
  --brand-800: #05392B;
  --brand-700: #064E39;
  --brand-600: #00694E;
  --brand-500: #00805F;
  --brand-400: #00966E;   /* flag green */
  --brand-300: #4FB99B;
  --brand-200: #A0D8C8;
  --brand-100: #D2ECE4;
  --brand-50:  #EEF7F4;

  --flag-white: #FFFFFF;
  --flag-green: #00966E;
  --flag-red:   #D62612;

  --bg: #F4F9F7;
  --surface: #FFFFFF;
  --text: #06251C;
  --text-muted: rgba(6, 37, 28, 0.62);
  --border: #A0D8C8;
  --border-soft: #D2ECE4;

  --primary: #064E39;
  --primary-hover: #032B20;
  --primary-text: #FFFFFF;
  --accent: #00966E;
  --accent-hover: #00694E;

  --success: #00966E;
  --warning: #E0A800;
  --danger: #D62612;

  --row-hover: #EEF7F4;
  --input-bg: #FFFFFF;
  --shadow: 0 1px 3px rgba(6, 37, 28, 0.08), 0 4px 16px rgba(6, 37, 28, 0.06);
}

[data-theme="dark"] {
  --bg: #06130F;
  --surface: #0A1F18;
  --text: #EAF5F1;
  --text-muted: rgba(234, 245, 241, 0.62);
  --border: #144535;
  --border-soft: #0D2A20;

  --primary: #00805F;
  --primary-hover: #00694E;
  --primary-text: #FFFFFF;
  /* Lifted off the flag green: #00966E on a near-black surface is too dark to
     read as a link. */
  --accent: #2FBF95;
  --accent-hover: #6FD6B5;

  --success: #2FBF95;
  --danger: #F05A45;

  --row-hover: #0D2A20;
  --input-bg: #0D2A20;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------------------------------------------------------------- layout */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color: var(--brand-50);
  position: sticky;
  top: 0;
  height: 100vh;
}

/* The flag itself, drawn down the sidebar's edge: white, green, red. */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    180deg,
    var(--flag-white) 0 33.34%,
    var(--flag-green) 33.34% 66.67%,
    var(--flag-red) 66.67% 100%
  );
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(238, 247, 244, 0.14);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: block;
  object-fit: cover;
}

.brand-mark-lg { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto; }

/* Sized so "Bulgaria VFS Portal" clears the 250px sidebar's 162px of text
   space on one line; it wraps rather than truncates if a longer name lands. */
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: 0.2px; line-height: 1.25; }
.brand-sub { font-size: 10.5px; color: rgba(238, 247, 244, 0.65); margin-top: 1px; }

.nav { padding: 14px 10px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  color: rgba(238, 247, 244, 0.80);
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: rgba(238, 247, 244, 0.10); color: #FFFFFF; }

.nav-link.active {
  background: var(--brand-500);
  border-left-color: var(--accent);
  color: #FFFFFF;
}

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(238, 247, 244, 0.14); }

.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-500);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(238, 247, 244, 0.25);
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 247, 244, 0.85);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s;
}

.logout-btn:hover { background: rgba(214, 38, 18, 0.25); border-color: rgba(214, 38, 18, 0.5); color: #FFFFFF; }
.logout-btn svg { width: 15px; height: 15px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title { font-size: 19px; font-weight: 700; margin: 0; }
.topbar-spacer { flex: 1; }

.content { padding: 28px; width: 100%; }

/* ------------------------------------------------------------- topbar UI */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover { background: var(--row-hover); color: var(--text); }
.icon-btn-danger:hover { background: rgba(214, 38, 18, 0.12); color: var(--danger); }

.menu-btn { display: none; }

/* ------------------------------------------------- collapsible sidebar */

.sidebar { transition: width 0.18s ease; }

/* Collapsed "rail": icons only. Driven by a class on <html> so it can be
   applied before first paint (no flash). Desktop only — on mobile the
   sidebar uses the off-canvas drawer instead. */
@media (min-width: 901px) {
  html.sidebar-collapsed .sidebar { width: 72px; }
  html.sidebar-collapsed .brand-text,
  html.sidebar-collapsed .nav-text,
  html.sidebar-collapsed .user-name,
  html.sidebar-collapsed .logout-text { display: none; }
  html.sidebar-collapsed .brand { justify-content: center; padding: 20px 0; }
  html.sidebar-collapsed .nav-link { justify-content: center; gap: 0; padding: 11px 0; border-left-width: 0; }
  html.sidebar-collapsed .user-chip { justify-content: center; margin-bottom: 0; }
  html.sidebar-collapsed .logout-btn { justify-content: center; padding: 9px 0; }
  html.sidebar-collapsed .logout-btn { margin-top: 10px; }
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-desc { color: var(--text-muted); margin: 0; }

.section-title { font-size: 16px; font-weight: 700; margin: 26px 0 12px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  white-space: nowrap;
}

td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }

.cell-strong { font-weight: 600; }
/* Two related values share one column, stacked: owner over phone, visa type
   over file count. The second line is quieter so the first still reads first. */
.cell-stack > * { display: block; }
.cell-stack .stack-top { margin-bottom: 2px; }
.cell-stack .stack-sub { font-size: 12.5px; color: var(--text-muted); }
.cell-mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.5px; }
.muted { color: var(--text-muted); }

.th-actions { text-align: right; }
.td-actions { text-align: right; }
.td-actions form { display: inline-block; margin: 0; }
.td-actions .icon-btn, .td-actions .btn { vertical-align: middle; }

.locked { color: var(--text-muted); opacity: 0.7; display: inline-flex; padding: 8px; }
.locked svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  background: var(--row-hover);
  color: var(--text);
}

.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-text); }

.btn-accent { background: var(--accent); color: #FFFFFF; }
.btn-accent:hover { background: var(--accent-hover); color: #FFFFFF; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--row-hover); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled, button.btn[disabled] {
  background: var(--border-soft);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.75;
}

/* Pay Now link: rich "come pay me" animation until it has been clicked. */
.pay-link:not(.pay-clicked) {
  position: relative;
  overflow: hidden;
  border: none;
  background: linear-gradient(120deg, #00966E, #2FBF95, #00694E, #00966E);
  background-size: 300% 100%;
  color: #FFFFFF;
  animation: pay-gradient 4s ease infinite, pay-float 2.2s ease-in-out infinite,
             pay-glow 2.2s ease-in-out infinite;
}

/* Moving shine sweep across the surface. */
.pay-link:not(.pay-clicked)::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: pay-shine 2.8s ease-in-out infinite;
}

.pay-link:not(.pay-clicked) svg {
  position: relative;
  animation: pay-nudge 1.6s ease-in-out infinite;
}

.pay-link:not(.pay-clicked):hover {
  animation-play-state: paused;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 22px rgba(0, 150, 110, 0.55);
}

@keyframes pay-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pay-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}

@keyframes pay-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 150, 110, 0.55), 0 4px 12px rgba(0, 150, 110, 0.35); }
  50%      { box-shadow: 0 0 0 8px rgba(0, 150, 110, 0), 0 8px 20px rgba(0, 150, 110, 0.55); }
}

@keyframes pay-shine {
  0%   { left: -60%; }
  60%  { left: 130%; }
  100% { left: 130%; }
}

@keyframes pay-nudge {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(2px, -2px); }
}

@media (prefers-reduced-motion: reduce) {
  .pay-link:not(.pay-clicked),
  .pay-link:not(.pay-clicked)::before,
  .pay-link:not(.pay-clicked) svg { animation: none; }
}

/* Pay Now link, once clicked (persisted per appointment in localStorage):
   burning red -- flickering fire gradient + glow, flames rising off the top. */
.pay-link.pay-clicked {
  position: relative;
  z-index: 0;
  overflow: visible;
  border: none;
  background: linear-gradient(180deg, #F97316 0%, #EF4444 50%, #B91C1C 100%);
  background-size: 100% 200%;
  color: #FFFFFF;
  animation: pay-fire-flicker 1.3s ease-in-out infinite;
}
.pay-link.pay-clicked:hover { color: #FFFFFF; filter: brightness(1.1); }

/* Two flame tongues licking up from the top edge. */
.pay-link.pay-clicked::before,
.pay-link.pay-clicked::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 10px;
  height: 14px;
  background: radial-gradient(circle at 50% 85%, #FDE047 0%, #FB923C 45%, #EF4444 70%, rgba(239, 68, 68, 0) 100%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  filter: blur(1.5px);
  pointer-events: none;
  animation: pay-flame-rise 1s ease-in infinite;
}
.pay-link.pay-clicked::before { left: 22%; }
.pay-link.pay-clicked::after { right: 22%; animation-delay: 0.45s; animation-duration: 1.25s; }

@keyframes pay-fire-flicker {
  0%, 100% {
    background-position: 0 0;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.55), 0 0 22px rgba(239, 68, 68, 0.35);
  }
  25% {
    box-shadow: 0 0 16px rgba(249, 115, 22, 0.75), 0 0 30px rgba(239, 68, 68, 0.5);
  }
  50% {
    background-position: 0 60%;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.45), 0 0 18px rgba(239, 68, 68, 0.3);
  }
  75% {
    box-shadow: 0 0 14px rgba(253, 224, 71, 0.6), 0 0 26px rgba(239, 68, 68, 0.45);
  }
}

@keyframes pay-flame-rise {
  0% { transform: translateY(4px) scaleY(0.6); opacity: 0; }
  30% { opacity: 0.9; }
  100% { transform: translateY(-10px) scaleY(1.15) scaleX(0.7); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pay-link.pay-clicked { animation: none; }
  .pay-link.pay-clicked::before,
  .pay-link.pay-clicked::after { display: none; }
}

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

/* One per Appointment.STATUS_CHOICES, in the order the walk reaches them.
   Nothing yet / withdrawn reads as the flag's white band, a run in flight is
   amber, and everything the walk resolved is green. */
.badge-pending    { background: var(--border-soft); color: var(--text-muted); }
.badge-processing { background: rgba(224, 168, 0, 0.16); color: #9A7500; }
.badge-completed  { background: rgba(0, 150, 110, 0.18); color: #006B4F; }
.badge-paid       { background: #00966E; color: #FFFFFF; }
.badge-cancelled  { background: var(--border-soft); color: var(--text-muted); }
.badge-none       { background: var(--border-soft); color: var(--text-muted); }

[data-theme="dark"] .badge-processing { color: #E0A800; }
[data-theme="dark"] .badge-completed  { color: #4FD1A8; }

/* ---------------------------------------------------------------- alerts */

.alerts { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14px;
  font-weight: 500;
}

.alert-success { background: rgba(0, 150, 110, 0.1);  border-color: rgba(0, 150, 110, 0.4);  color: var(--success); }
.alert-error   { background: rgba(214, 38, 18, 0.1);   border-color: rgba(214, 38, 18, 0.4);   color: var(--danger); }
.alert-warning { background: rgba(224, 168, 0, 0.1);   border-color: rgba(224, 168, 0, 0.4);   color: var(--warning); }
.alert-info    { background: rgba(0, 150, 110, 0.1);  border-color: rgba(0, 150, 110, 0.4);  color: var(--accent); }

.alert-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
}
.alert-close:hover { opacity: 1; }

/* ----------------------------------------------------------------- forms */

.form-card { max-width: 560px; padding: 28px; margin-bottom: 18px; }

.form-intro { color: var(--text-muted); margin: 0 0 22px; font-size: 14px; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 7px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 150, 110, 0.22);
}

/* Checkboxes are laid out beside their label, not above it. */
.field input[type="checkbox"] { width: auto; }

.field input[type="date"] { color-scheme: light; }
[data-theme="dark"] .field input[type="date"] { color-scheme: dark; }

.field input.input-invalid { border-color: var(--danger); }
.field input.input-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(214, 38, 18, 0.22);
}

.field-error { color: var(--danger); font-size: 13px; margin: 6px 0 0; }
.field-help { color: var(--text-muted); font-size: 12px; margin: 6px 0 0; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }

.password-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
}

.password-toggle .icon-eye-off { display: none; }
.password-toggle.shown .icon-eye { display: none; }
.password-toggle.shown .icon-eye-off { display: block; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}

/* ------------------------------------------------------------ empty state */

.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.empty-state svg { width: 44px; height: 44px; color: var(--brand-300); margin-bottom: 14px; }
.empty-state h2 { font-size: 17px; margin: 0 0 6px; }
.empty-state p { color: var(--text-muted); margin: 0 0 20px; }

/* ------------------------------------------------------------- pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.page-info { color: var(--text-muted); font-size: 13.5px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 16px;
}
.back-link svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ login */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Green from the top corner, red from the bottom -- the flag's two coloured
     bands washed across the page, with the white one left as the card itself. */
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(0, 150, 110, 0.16), transparent 60%),
    radial-gradient(700px 450px at 0% 110%, rgba(214, 38, 18, 0.10), transparent 55%),
    var(--bg);
}

.login-theme-toggle { position: fixed; top: 18px; right: 18px; }

.login-wrap { width: 100%; max-width: 400px; padding: 24px; }

.login-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 34px 30px 30px;
}

/* The flag laid across the top of the card: white band left as the card's own
   surface, then green, then red. */
.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--flag-white) 0 33.34%,
    var(--flag-green) 33.34% 66.67%,
    var(--flag-red) 66.67% 100%
  );
}

.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 21px; margin: 14px 0 2px; }
.login-brand p { color: var(--text-muted); font-size: 13px; margin: 0; }

.login-card .alert { margin-bottom: 16px; }

.login-foot {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 18px;
}

/* --------------------------------------------- appointment request form */

/* The booking form carries five sections, so it is wider than the stock
   single-column card the rest of the portal uses. */
.form-card-wide { max-width: 860px; }

.form-section { border: 0; padding: 0; margin: 0 0 26px; }

.form-section > legend {
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.form-section-desc { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }

/* Two columns on a desktop, one on a phone (see the responsive block). */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}
.field-grid .field-wide { grid-column: 1 / -1; }

/* A checkbox and its explanation, as one clickable card. */
.check-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  cursor: pointer;
  margin-bottom: 18px;
}
.check-field:hover { border-color: var(--accent); }
.check-field:has(input:checked) {
  border-color: var(--accent);
  background: rgba(0, 150, 110, 0.06);
}
.check-field input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.check-field-text { display: flex; flex-direction: column; gap: 3px; }
.check-field-title { font-size: 14.5px; font-weight: 600; }
.check-field-desc { color: var(--text-muted); font-size: 12.5px; line-height: 1.45; }

/* Advanced panel: the pacing/watch knobs, folded away by default because the
   defaults are the ones the script measured. */
.advanced {
  border: 1px solid var(--border);
  border-radius: 11px;
  margin-bottom: 26px;
  overflow: hidden;
}
.advanced > summary {
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--input-bg);
  list-style: none;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.advanced[open] > summary::before { transform: rotate(90deg); }
.advanced-body { padding: 18px 16px 2px; border-top: 1px solid var(--border-soft); }

/* ------------------------------------------------------------- applicants */

.applicant-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  background: var(--input-bg);
}

.applicant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.applicant-title { font-size: 14.5px; font-weight: 700; margin: 0; }
.applicant-sub { color: var(--text-muted); font-size: 12.5px; margin: 2px 0 0; }

/* can_delete renders a checkbox; it reads better as a "Remove" control. */
.applicant-remove {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.applicant-remove input { accent-color: var(--danger); }
.applicant-remove:hover { color: var(--danger); }

/* A row flagged for deletion stays on screen -- greyed, so an accidental tick
   is obvious before the form is posted. */
.applicant-card:has(.applicant-remove input:checked) { opacity: 0.55; }

/* ------------------------------------------------------- appointment detail */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px 24px;
}
.detail-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.detail-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.detail-value { font-size: 14.5px; word-break: break-word; }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 37, 28, 0.5);
    z-index: 30;
  }

  .sidebar-overlay.show { display: block; }

  .menu-btn { display: inline-flex; }
  .collapse-btn { display: none; }

  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px; }

  /* One column: two 14px-tall inputs side by side on a phone is unusable. */
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .form-card, .form-card-wide { padding: 20px; }
}
