﻿/* Icon color & effects */
i[data-lucide] { stroke-width: 2.5; transition: color 0.15s, filter 0.15s; filter: drop-shadow(0 0 1px rgba(0,0,0,0.05)); }
i[data-lucide]:hover { filter: drop-shadow(0 0 3px currentColor); }
.card-icon[data-lucide], .nav-icon[data-lucide] { stroke-width: 2.5; }
[data-theme="dark"] .status-active, [data-theme="dark"] .sector-mixed { color: #34d399 !important; }
:root {
  --bg: #eef5f1;
  --bg-strong: #dcece4;
  --panel: #ffffff;
  --panel-muted: #f7faf8;
  --ink: #10251d;
  --text: #163126;
  --muted: #66776f;
  --border: #c8d8d0;
  --primary: #0f8f68;
  --primary-strong: #086246;
  --primary-soft: #dff4ec;
  --accent: #2364aa;
  --warning: #b7791f;
  --danger: #b42318;
  --amber: #a85d09;
  --amber-soft: #fff4df;
  --coral: #c2413b;
  --shadow: 0 18px 45px rgba(16, 49, 38, 0.14);
  --shadow-soft: 0 8px 22px rgba(16, 49, 38, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.mobile-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: rgba(7, 24, 18, 0.72);
}

.mobile-login-panel {
  width: min(100%, 390px);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mobile-login-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
}

.mobile-login-kicker {
  margin: 18px 0 4px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mobile-login-panel h1 {
  margin: 0;
  font-size: 24px;
}

.mobile-login-panel > p:not(.mobile-login-kicker) {
  margin: 8px 0 20px;
  color: var(--muted);
}

.mobile-login-panel label {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
}

.mobile-login-panel input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-muted);
  color: var(--ink);
  font-size: 16px !important;
}

.mobile-login-panel button {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  border: 0;
  border-radius: 6px;
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 12px 22px rgba(15, 143, 104, 0.24) !important;
  font-weight: 800;
}

#mobileLoginButton {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 22px rgba(15, 143, 104, 0.24) !important;
}

.mobile-login-panel button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.mobile-login-error {
  min-height: 20px;
  margin: 10px 0 0 !important;
  color: var(--danger) !important;
  font-size: 13px;
}

.mobile-login-panel small {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.secondary-action,
.button-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  background: #eaf3ff;
  color: #173f68;
  font-weight: 800;
  text-decoration: none;
}

.checkbox-row {
  display: flex !important;
  min-height: 44px;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  margin: 0;
}

[data-theme="dark"] .secondary-action,
body[data-theme="dark"] .secondary-action,
[data-theme="dark"] .button-link,
body[data-theme="dark"] .button-link {
  border-color: #67e8f9;
  background: #14344b;
  color: #e2f7ff;
}

.phone {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 12px 12px calc(94px + env(safe-area-inset-bottom));
  background: var(--bg);
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin: -12px -12px 12px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: rgba(238, 245, 241, 0.92);
  border-bottom: 1px solid rgba(200, 216, 208, 0.8);
  backdrop-filter: blur(14px);
}

.brand-lockup,
.assignment-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-mark,
.section-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
}

.brand-mark svg,
.section-icon svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.4;
}

.section-icon {
  background: #e7efff;
  color: #2455a4;
}

header p,
ul,
h1,
h2,
h3 {
  margin-top: 0;
}

header p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 18px;
}

#syncState {
  min-width: 58px;
  border: 1px solid rgba(15, 143, 104, 0.22);
  border-radius: 999px;
  padding: 7px 8px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.location-toggle-btn {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.location-toggle-btn svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
}

.location-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 143, 104, 0.45);
}

.location-toggle-btn.active {
  border-color: rgba(15, 143, 104, 0.45);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.context-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(15, 143, 104, 0.18);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.context-identifiers {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}

.context-identifiers summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.context-identifiers[open] summary {
  margin-bottom: 10px;
}

.field-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.readiness-chip {
  display: inline-flex;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.readiness-chip svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.readiness-chip.ready {
  border-color: #76bfa2;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.readiness-chip.attention {
  border-color: #e9b96b;
  background: var(--amber-soft);
  color: var(--amber);
}

.context-card > div:first-child {
  display: grid;
  gap: 2px;
}

.context-card p {
  margin-bottom: 0;
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.context-card h2 {
  margin-bottom: 0;
  font-size: 19px;
}

#selectedCitizenMeta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.context-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.context-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.map-shortcut {
  min-height: 48px;
  border: 1px solid rgba(35, 100, 170, 0.25);
  border-radius: 8px;
  padding: 13px 14px;
  background: #eaf3ff;
  color: #173f68;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.map-shortcut:hover {
  transform: translateY(-1px);
  border-color: rgba(35, 100, 170, 0.42);
  background: #dcebff;
}

.map-shortcut.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.scope-note {
  border: 1px solid rgba(35, 100, 170, 0.15);
  border-left: 4px solid var(--accent);
  margin: 0;
  padding: 10px 11px;
  border-radius: 8px;
  background: #edf5ff;
  color: #254563;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

#diagnosticsForm .scope-note {
  border-left-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.tabs {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.field-shortcuts {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  z-index: 50;
  display: grid;
  width: min(100%, 480px);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  margin: 0;
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.field-shortcuts button {
  display: grid;
  min-width: 0;
  min-height: 56px;
  place-items: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.field-shortcuts button svg {
  width: 20px;
  height: 20px;
}

.field-shortcuts button.active {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--primary-strong) !important;
  box-shadow: none !important;
}

.field-shortcuts button.active svg {
  width: 30px;
  height: 26px;
  padding: 4px;
  border-radius: 8px;
  background: var(--primary-soft);
}

.tools-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
  color: var(--ink);
}

.tools-heading div {
  display: grid;
  gap: 2px;
}

.tools-heading span {
  font-size: 14px;
  font-weight: 900;
}

.tools-heading small {
  color: var(--muted);
  font-size: 11px;
}

.tools-heading svg {
  width: 19px;
  color: var(--accent);
}

.tabs details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 8px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.tabs summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  padding: 8px;
  list-style-position: inside;
}

.tabs details[open] {
  display: grid;
  gap: 8px;
}

.tabs details[open] summary {
  border-bottom: 1px solid rgba(200, 216, 208, 0.75);
  margin: -2px -2px 6px;
  padding: 10px;
}

.tabs details button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  margin: 4px;
  padding: 10px 13px;
  color: var(--text);
  background: #edf4f0;
  font-size: 13px;
  font-weight: 850;
  box-shadow: none;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tabs details button:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 143, 104, 0.22);
  background: #e0f0e9;
}

.tabs details button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(15, 143, 104, 0.22);
}

.card,
.form-panel {
  display: none;
  border: 1px solid rgba(200, 216, 208, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
  scroll-margin-top: calc(72px + env(safe-area-inset-top));
}

.card:last-child,
.active-form {
  display: grid;
  gap: 12px;
}

.card h2,
.form-panel h3 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.form-kicker {
  margin: -3px 0 -4px;
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.field-shell {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-shell > span {
  line-height: 1.25;
}

.field-shell.wide-field {
  grid-column: 1 / -1;
}

input[readonly] {
  background: var(--panel-muted);
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8d8d0;
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--text);
  padding: 13px 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

#mobileLoginEmail,
#mobileLoginPassword,
.phone input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
.phone select,
.phone textarea {
  font-size: 16px !important;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #7d8c85;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 143, 104, 0.72);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 143, 104, 0.12);
}

form button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 13px 16px;
  color: #ffffff !important;
  background: var(--primary) !important;
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(15, 143, 104, 0.24) !important;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

form button:disabled {
  cursor: wait;
  opacity: 0.78;
  transform: none;
}

.medical-loader {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -4px;
  animation: field-spin 0.75s linear infinite;
}

.medical-loader::before,
.medical-loader::after {
  position: absolute;
  inset: 7px 3px auto;
  height: 2px;
  background: currentColor;
  content: "";
}

.medical-loader::after {
  transform: rotate(90deg);
}

@keyframes field-spin {
  to { transform: rotate(360deg); }
}

.form-feedback {
  display: none;
  grid-column: 1 / -1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.form-feedback.visible {
  display: block;
}

.form-feedback.success {
  border: 1px solid #76bfa2;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.form-feedback.queued {
  border: 1px solid #e9b96b;
  background: var(--amber-soft);
  color: var(--amber);
}

.form-feedback.error {
  border: 1px solid #e4a09c;
  background: #fff0ef;
  color: var(--danger);
}

form button:hover {
  transform: translateY(-1px);
  background: var(--primary-strong);
}

form button:active,
.tabs details button:active,
.location-toggle-btn:active {
  transform: translateY(0);
}

#activity {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-left: 0;
  list-style: none;
}

#activity li {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

#mapPanel > div:first-of-type {
  margin-bottom: 10px;
}

#mobileMap {
  height: min(58dvh, 460px) !important;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 8px !important;
  overflow: hidden;
}

#mobileMapLegend {
  padding: 8px 2px !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* One chip per layer that is currently drawn, so the worker can see what is on the map
   and switch a single layer off without losing the rest. */
#mobileMapLegend .map-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
}

#mobileMapLegend .map-chip--muted {
  color: var(--muted);
  border-style: dashed;
  white-space: normal;
}

#mobileMapLegend .map-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

#mobileMapLegend .map-chip button:hover,
#mobileMapLegend .map-chip button:focus-visible {
  color: var(--text);
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
}

[data-theme="dark"],
body[data-theme="dark"] {
  --bg: #071017;
  --bg-strong: #0c1a22;
  --panel: #10201b;
  --panel-muted: #132820;
  --ink: #f6fff9;
  --text: #e9fff3;
  --muted: #b7cec3;
  --border: #335448;
  --primary: #34d399;
  --primary-strong: #9af2ca;
  --primary-soft: #14382c;
  --accent: #7db7ff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] body,
body[data-theme="dark"] {
  background: #071017;
}

[data-theme="dark"] header,
body[data-theme="dark"] header {
  background: rgba(7, 16, 23, 0.92);
  border-bottom-color: #294238;
}

[data-theme="dark"] .context-card,
body[data-theme="dark"] .context-card {
  background: var(--panel);
  border-color: #376150;
}

[data-theme="dark"] .field-shortcuts,
body[data-theme="dark"] .field-shortcuts {
  background: rgba(16, 32, 27, 0.95);
}

[data-theme="dark"] .readiness-chip.attention,
body[data-theme="dark"] .readiness-chip.attention,
[data-theme="dark"] .form-feedback.queued,
body[data-theme="dark"] .form-feedback.queued {
  border-color: #8c642e;
  background: #352915;
  color: #ffd28c;
}

[data-theme="dark"] .form-feedback.error,
body[data-theme="dark"] .form-feedback.error {
  border-color: #8d4b49;
  background: #321a1a;
  color: #ffb4af;
}

[data-theme="dark"] .tabs details,
body[data-theme="dark"] .tabs details,
[data-theme="dark"] .card,
body[data-theme="dark"] .card,
[data-theme="dark"] .form-panel,
body[data-theme="dark"] .form-panel {
  background: #10201b;
  border-color: #335448;
}

[data-theme="dark"] .tabs details button,
body[data-theme="dark"] .tabs details button {
  border-color: #3f6255;
  background: #172e26;
  color: #f3fff8;
}

[data-theme="dark"] .tabs details button:hover,
body[data-theme="dark"] .tabs details button:hover {
  background: #1e3a30;
  border-color: #56a887;
}

[data-theme="dark"] .tabs details button.active,
body[data-theme="dark"] .tabs details button.active,
[data-theme="dark"] form button,
body[data-theme="dark"] form button {
  background: #22c985;
  color: #03140e;
  border-color: #22c985;
}

[data-theme="dark"] .map-shortcut,
body[data-theme="dark"] .map-shortcut {
  background: #143454;
  color: #e6f2ff;
  border-color: #4f87c2;
}

[data-theme="dark"] .map-shortcut.active,
body[data-theme="dark"] .map-shortcut.active {
  background: #7db7ff;
  color: #061523;
  border-color: #7db7ff;
}

[data-theme="dark"] input,
body[data-theme="dark"] input,
[data-theme="dark"] select,
body[data-theme="dark"] select,
[data-theme="dark"] textarea,
body[data-theme="dark"] textarea {
  background: #0b1814;
  border-color: #45685b;
  color: #f3fff8;
}

[data-theme="dark"] input::placeholder,
body[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #9eb8ad;
}

[data-theme="dark"] .scope-note,
body[data-theme="dark"] .scope-note {
  background: #10263d;
  border-color: #315f8f;
  border-left-color: #7db7ff;
  color: #d7ebff;
}

[data-theme="dark"] #diagnosticsForm .scope-note,
body[data-theme="dark"] #diagnosticsForm .scope-note {
  background: #123629;
  border-left-color: #34d399;
  color: #c6f7df;
}

[data-theme="dark"] #activity li,
body[data-theme="dark"] #activity li {
  background: #132820;
  color: #d8efe5;
}

button.selected,
button.active,
.tabs details button.active,
.map-shortcut.active,
.location-toggle-btn.active,
.active-form {
  border-color: #67e8f9 !important;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.16), 0 12px 24px rgba(15, 118, 110, 0.18) !important;
}

button.selected,
button.active,
.tabs details button.active,
.map-shortcut.active,
.location-toggle-btn.active {
  background: #146f68 !important;
  color: #ffffff !important;
}

[data-theme="light"] button.selected,
[data-theme="light"] button.active,
[data-theme="light"] .tabs details button.active,
[data-theme="light"] .map-shortcut.active,
[data-theme="light"] .location-toggle-btn.active {
  background: #146f68 !important;
  color: #ffffff !important;
  border-color: #14b8a6 !important;
}

@media (max-width: 519px) {
  .mobile-login-overlay {
    display: block;
    overflow: auto;
    padding: 0;
    background: var(--panel);
  }

  .mobile-login-panel {
    width: 100%;
    min-height: 100dvh;
    padding: max(34px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .mobile-login-mark {
    margin-top: 8dvh;
  }

  .quick-actions {
    display: none;
  }
}

@media (min-width: 520px) {
  body {
    background: var(--bg-strong);
  }

  .phone {
    padding: 16px 16px calc(98px + env(safe-area-inset-bottom));
    box-shadow: 0 0 0 1px rgba(16, 49, 38, 0.08), var(--shadow);
  }

  header {
    margin: -16px -16px 14px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  }

  .context-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tabs details[open] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs summary {
    grid-column: 1 / -1;
  }
}

@media (min-width: 680px) {
  .phone,
  .field-shortcuts {
    width: min(100%, 520px);
  }
}

@media (max-width: 380px) {
  .phone {
    padding-right: 10px;
    padding-left: 10px;
  }

  header {
    grid-template-columns: 1fr auto auto;
    margin: -10px -10px 12px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  }

  .location-toggle-btn {
    padding: 7px;
  }

  #locationStatusText {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .field-status-grid {
    grid-template-columns: 1fr;
  }

  .readiness-chip {
    justify-content: flex-start;
  }

  h1 {
    font-size: 18px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .field-shortcuts button {
    font-size: 9px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .field-shortcuts button {
    min-height: 46px;
  }

  .field-shortcuts button span {
    display: none;
  }

  .phone {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
