.theme-toggle {
  display:grid;
  width:44px;
  height:44px;
  padding:0;
  place-items:center;
  flex:0 0 auto;
  border:1px solid #ffffff45;
  border-radius:50%;
  background:#ffffff12;
  color:#fff;
  cursor:pointer;
}
.theme-toggle:hover { background:#ffffff24; }
.theme-toggle:focus-visible { outline:3px solid #a8b7e2;outline-offset:2px; }
.theme-icon { width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round; }
.theme-icon-sun { display:none; }
html[data-theme="dark"] .theme-icon-sun { display:block; }
html[data-theme="dark"] .theme-icon-moon { display:none; }

.account-nav .theme-toggle {
  width:32px;
  height:32px;
}
.account-nav .theme-icon { width:16px;height:16px; }

html[data-theme="dark"] {
  --brand:#9eb2e8;
  --brand-dark:#c9d5f4;
  --coral:#f08a68;
  --sea:#6fa99b;
  --paper:#11151c;
  --sand:#1a202a;
  --ink:#eef2f8;
  --muted:#aab4c4;
  --line:#343d4c;
  --card:#1a2029;
  --shadow:0 12px 30px rgba(0,0,0,.38);
}
html[data-theme="dark"] .site-header { background:#20283f; }
html[data-theme="dark"] .newsletter { background:#344675;color:#fff; }
html[data-theme="dark"] .button.secondary { background:#5268a0;color:#fff; }
html[data-theme="dark"] .account-popover,
html[data-theme="dark"] .directory-head,
html[data-theme="dark"] .search,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .email-bar,
html[data-theme="dark"] .review-panel,
html[data-theme="dark"] .review-apply-bar,
html[data-theme="dark"] .source-disclosure { background:var(--card);color:var(--ink); }
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .search input,
html[data-theme="dark"] .email-bar input { background:#151a22;color:var(--ink); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color:#7f8a9d; }
html[data-theme="dark"] .space-photo { background:linear-gradient(135deg,#242c3b,#303b51); }
html[data-theme="dark"] .space-card:nth-child(4n+2) .space-photo { background:#20332f; }
html[data-theme="dark"] .space-card:nth-child(4n+3) .space-photo { background:#3a2926; }

/* Visa directory browsing controls and card treatment. */
.account-nav { margin-left:0; }
.nav-item { position:relative; }
.nav-submenu { position:absolute; top:calc(100% + .7rem); right:0; min-width:190px; display:grid; gap:.15rem; padding:.5rem; background:var(--card); color:var(--ink); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); opacity:0; visibility:hidden; transform:translateY(-.3rem); transition:opacity .15s ease,transform .15s ease,visibility .15s ease; z-index:20; }
.nav-submenu a { padding:.5rem .65rem; border-radius:8px; font:600 .9rem Mulish,sans-serif; white-space:nowrap; }
.nav-submenu a:hover,.nav-submenu a:focus-visible { background:var(--sand); }
.nav-item:hover .nav-submenu,.nav-item:focus-within .nav-submenu { opacity:1; visibility:visible; transform:translateY(0); }
.space-photo { border-top: 0 !important; }
.terms { border-top: 0 !important; }
.directory-head h1 { font-size: clamp(2rem, 4vw, 3.5rem); margin: .2rem 0 .65rem; }
.directory-intro { max-width: 760px; color: var(--muted); margin: 0; }
.directory-toolbar { display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; margin-top:1.1rem; }
.filter-control { display:grid; gap:.25rem; color:var(--muted); font:700 .72rem/1.2 'DM Mono',monospace; text-transform:uppercase; letter-spacing:.05em; }
.filter-control select { min-width:150px; border:1px solid var(--line); border-radius:999px; padding:.68rem .85rem; color:var(--ink); background:var(--card); font:600 .88rem Mulish,sans-serif; text-transform:none; letter-spacing:normal; }
.clear-filters { color:var(--brand); font-weight:800; padding:.65rem .35rem; }
.directory-actions { display:flex; justify-content:flex-end; padding-top:1rem; }
.map-toggle { border-radius:999px; }
.results-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.results-heading h2 { font-size:clamp(1.5rem,3vw,2.2rem); margin:0; }
.results-heading p { margin:.25rem 0 0; }
.view-controls { display:flex; gap:.35rem; }
.chip.is-active { background:var(--brand); color:#fff; border-color:var(--brand); }
.space-card .space-body { min-height:120px; }
.space-card .space-meta { line-height:1.4; }
.text-directory { margin-top:1.25rem; columns:2 260px; column-gap:2.5rem; }
.directory-group { break-inside:avoid; margin:0 0 1.8rem; }
.directory-group h3 { color:var(--brand-dark); border-bottom:1px solid var(--line); padding-bottom:.35rem; margin:0 0 .7rem; }
.directory-city h4 { margin:.65rem 0 .15rem; font-size:1rem; }
.directory-city ul { margin:0; padding-left:1.1rem; }
.directory-city li { margin:.18rem 0; }
.pagination { align-items:center; }
.directory-layout.map-collapsed { grid-template-columns:1fr; }
.directory-layout.map-collapsed .map-shell { display:none; }
.visa-directory.is-loading .results { opacity:.55; transition:opacity .15s ease; }
@media (max-width:800px) {
  .directory-toolbar .search { min-width:100%; }
  .filter-control { flex:1 1 45%; }
  .filter-control select { min-width:0; width:100%; }
  .results-heading { display:block; }
  .view-controls { margin-top:.75rem; }
  .directory-actions { padding-top:.75rem; }
}
html[data-theme="dark"] .tag,
html[data-theme="dark"] .value-icon,
html[data-theme="dark"] .account-avatar,
html[data-theme="dark"] .profile-avatar { background:#28334a;color:#dbe4ff; }
html[data-theme="dark"] .map-placeholder { background:linear-gradient(90deg,#ffffff12 2px,transparent 2px),linear-gradient(#ffffff12 2px,transparent 2px),#202631;background-size:42px 42px; }
html[data-theme="dark"] .review-row.has-conflict { background:#2b1f1d; }
html[data-theme="dark"] .review-row.is-applied { background:#17251f; }
html[data-theme="dark"] .review-status.conflict { background:#5a3027;color:#ffd0c0; }
html[data-theme="dark"] .review-value.proposed pre { color:#c9d5f4; }
html[data-theme="dark"] .unavailable { background:#38221d;border-color:#704438;color:#f2b39f; }
html[data-theme="dark"] .message { background:#1b342d;color:#b8e1d4; }
html[data-theme="dark"] .auth-card .logo { filter:brightness(0) invert(1); }
.auth-shell>.theme-toggle { position:fixed;z-index:5;top:1rem;right:1rem;background:var(--card);color:var(--ink);border-color:var(--line); }
.auth-shell>.theme-toggle:hover { background:var(--sand); }

.staff-table .status-pill {
  align-items:center;
  width:max-content;
  max-width:none;
  white-space:nowrap;
  line-height:1;
}

/* Keep the management table in normal page flow instead of a nested scroller. */
.staff-table-card .staff-table { min-width:0; }

@media (prefers-reduced-motion:no-preference) {
  body,.card,.directory-head,.account-popover,.field input,.field select,.field textarea { transition:background-color .18s ease,color .18s ease,border-color .18s ease; }
}

@media (max-width:600px) {
  .nav { gap:.75rem; }
  .account-nav { gap:.5rem; }
  .account-create,.account-summary { display:none; }
}

/* Directory controls: keep search, filters, and view switching visually distinct. */
.visa-directory .directory-toolbar { display:grid; gap:1rem; margin-top:1.5rem; }
.visa-directory .directory-search-row { display:flex; }
.visa-directory .directory-search-row .search { width:min(100%,680px); min-width:0; border-radius:12px; }
.visa-directory .directory-search-row .button { border-radius:10px; }
.visa-directory .directory-filter-row { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)) auto; align-items:end; gap:.75rem; }
.visa-directory .filter-control select { width:100%; min-width:0; padding-right:2.25rem; border-radius:10px; appearance:none; background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%); background-position:calc(100% - 1.05rem) 50%,calc(100% - .78rem) 50%; background-repeat:no-repeat; background-size:.34rem .34rem,.34rem .34rem; }
.visa-directory .clear-filters { align-self:end; white-space:nowrap; }
.visa-directory .directory-actions { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding-top:1rem; }
.visa-directory .view-controls { display:flex; gap:.5rem; }
.visa-directory .view-controls .chip,.visa-directory .map-toggle { border-radius:10px; }
.visa-directory .results-heading { justify-content:flex-start; }
.directory-flat { margin:0; padding-left:1.2rem; }
.directory-flat li { margin:.35rem 0; }
.directory-flat a { font-weight:700; }

@media (max-width:1100px) {
  .visa-directory .directory-filter-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:800px) {
  .visa-directory .directory-actions { align-items:flex-start; }
  .visa-directory .directory-filter-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:560px) {
  .visa-directory .directory-filter-row { grid-template-columns:1fr; }
  .visa-directory .directory-actions { display:grid; }
  .visa-directory .view-controls { width:100%; }
  .visa-directory .view-controls .chip { flex:1; text-align:center; }
}
