* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  color: #1f2937;
  background: #f3f4f6;
  line-height: 1.35;
}

body:not(.app-locked) .auth-gate {
  display: none;
}

body.app-locked .map-panel {
  display: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.18), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(59, 130, 246, 0.16), transparent 40%),
    linear-gradient(165deg, #0b1220 0%, #111827 46%, #0f172a 100%);
}

.auth-card {
  width: min(640px, 94vw);
  background: #ffffff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.34);
  border: 1px solid #dbe4ee;
}

.auth-branding {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
  justify-content: center;
}

.auth-branding img {
  height: 60px;
  max-height: 60px;
  width: auto;
  display: block;
  object-fit: contain;
  align-self: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 3px;
}

.auth-branding img.iamsar-logo {
  height: 60px;
  max-height: 60px;
  max-width: min(100%, 640px);
  width: auto;
  object-fit: contain;
  background: #000;
  padding: 0;
  border: none;
  border-radius: 4px;
}

.auth-sub {
  margin: 0;
  color: #4b5563;
  font-size: 0.88rem;
  text-align: center;
}

.auth-title {
  margin: 2px 0 6px;
  text-align: center;
  color: #0f172a;
  font-size: 1.45rem;
  letter-spacing: 0.1px;
}

.auth-hint {
  margin: 8px 0 0;
  text-align: center;
  color: #64748b;
  font-size: 0.84rem;
}

.auth-grid {
  margin-top: 14px;
  margin-bottom: 2px;
}

#gateLoginForm label {
  font-size: 0.8rem;
  color: #334155;
  font-weight: 600;
}

#gateLoginForm input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

#gateLoginForm input:focus-visible {
  outline: none;
  border-color: #0369a1;
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.16);
  background: #ffffff;
}

.password-visibility-wrap {
  position: relative;
  display: block;
}

.password-visibility-wrap input {
  width: 100%;
  padding-right: 42px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  cursor: pointer;
}

.password-visibility-toggle:hover {
  background: rgba(148, 163, 184, 0.16);
  color: #0f172a;
}

.password-visibility-toggle:focus-visible {
  outline: 2px solid #0369a1;
  outline-offset: 2px;
}

.password-visibility-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

#gateLoginForm input[type="password"],
#gateForcePasswordForm input[type="password"] {
  -webkit-appearance: auto;
  appearance: auto;
}

#gateLoginForm input[type="password"]::-ms-reveal,
#gateForcePasswordForm input[type="password"]::-ms-reveal,
#gateLoginForm input[type="password"]::-ms-clear,
#gateForcePasswordForm input[type="password"]::-ms-clear {
  display: none;
}

.auth-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-remember-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #334155;
  -webkit-user-select: none;
  user-select: none;
}

.auth-remember-toggle input {
  margin: 0;
}

#gateLoginBtn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #0b5f8b;
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  font-weight: 700;
}

#gateLoginBtn:hover {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
}

.auth-status {
  margin-top: 10px;
  color: #475569;
  font-size: 0.84rem;
  text-align: center;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
}

.auth-force-panel {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.auth-force-panel h3 {
  margin: 0;
  color: #0f172a;
  text-align: center;
}

.auth-force-panel p {
  margin: 6px 0 0;
  text-align: center;
  color: #475569;
  font-size: 0.84rem;
}

.auth-force-actions {
  justify-content: space-between;
}

.auth-force-status {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #334155;
  text-align: center;
}
header {
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-bottom: 1px solid #1e293b;
}

.header-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  position: relative;
}

.header-title {
  text-align: center;
}

.header-status-console {
  position: fixed;
  top: 12px;
  left: 12px;
  width: min(640px, calc(100vw - 24px));
  height: 320px;
  min-width: 260px;
  min-height: 110px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.56);
  padding: 7px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: auto;
  z-index: 970;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
}

.header-status-console[hidden] {
  display: none !important;
}

.header-status-console-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  cursor: move;
  -webkit-user-select: none;
  user-select: none;
}

.header-status-console-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-status-console-title {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.header-status-console-toolbar button.secondary {
  margin-bottom: 0;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.74rem;
  background: rgba(248, 250, 252, 0.9);
  cursor: pointer;
}

.icon-only-btn {
  min-width: 32px;
  width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.icon-only-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}

.status-console-icon-btn {
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(241, 245, 249, 0.94);
}

.status-console-icon-btn:hover {
  background: #ffffff;
}

.header-status-console.is-collapsed #status {
  display: none;
}

.header-status-console.is-collapsed {
  overflow: hidden;
}

.header-status-console.is-collapsed .header-status-console-toolbar {
  margin-bottom: 0;
}

.header-status-console.is-dragging {
  opacity: 0.94;
  box-shadow: 0 14px 32px rgba(2, 6, 23, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  right: 0;
  top: 0;
}

.title-actions button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.78rem;
}

header h1 { margin: 0; font-size: 1.1rem; }
header p { margin: 2px 0 0; opacity: 0.85; font-size: 0.86rem; }

.app-version-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.38);
  background: rgba(255,255,255,0.14);
  font-size: 0.72rem;
  vertical-align: middle;
}

.app-environment-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.app-environment-badge.env-development {
  background: rgba(14, 165, 233, 0.22);
  color: #dbeafe;
  border-color: rgba(125, 211, 252, 0.5);
}

.app-environment-badge.env-test {
  background: rgba(245, 158, 11, 0.22);
  color: #fef3c7;
  border-color: rgba(252, 211, 77, 0.5);
}

.app-environment-badge.env-production {
  background: rgba(34, 197, 94, 0.2);
  color: #dcfce7;
  border-color: rgba(134, 239, 172, 0.5);
}

.brand-strip {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.brand-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 7px;
  text-decoration: none;
  color: #fff;
  background: rgba(255,255,255,0.05);
  min-height: 48px;
}

.brand-item img {
  height: 40px;
  width: auto;
  border-radius: 3px;
  background: #fff;
}

.brand-item img.iamsar-logo {
  height: 42px;
  max-width: min(52vw, 460px);
  width: auto;
  object-fit: contain;
  background: #000;
  border-radius: 2px;
}

.brand-item.wordmark-only {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.brand-item .wordmark {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-item .sub {
  font-size: 0.72rem;
  opacity: 0.9;
}
main {
  display: grid;
  grid-template-columns: minmax(620px, 1.2fr) minmax(320px, 0.8fr);
  align-items: start;
  gap: 12px;
  padding: 12px;
}

@media (max-width: 1500px) and (min-width: 1101px) {
  main {
    grid-template-columns: minmax(540px, 1.08fr) minmax(360px, 0.92fr);
    gap: 10px;
    padding: 10px;
  }

  .panel {
    padding: 10px;
  }

  .nav-buttons {
    gap: 6px;
  }

  .nav-buttons .nav-icon-btn {
    padding: 6px 8px;
  }

  .nav-buttons .nav-icon-btn .ui-btn-label {
    font-size: 0.78rem;
  }

  .map-panel {
    min-height: 66vh;
  }

  #map {
    min-height: 52vh;
  }

  body.trainer-mode #mapPanel {
    min-height: 72vh;
  }

  body.trainer-mode #mapPanel #map {
    min-height: 56vh;
  }

  .history-actions {
    gap: 5px;
    flex-wrap: wrap;
  }
}

body.trainer-mode main {
  grid-template-columns: minmax(0, 1fr);
}

body.trainer-mode #mapPanel {
  min-height: 82vh;
}

body.trainer-mode #mapPanel #map {
  min-height: 62vh;
}

.app-mode-nav {
  display: flex;
  gap: 8px;
  padding: 8px 12px 0;
  align-items: center;
  border-bottom: 1px solid #dbe4ee;
}

#navMenuModeToggle {
  margin-left: auto;
  flex-shrink: 0;
  order: 3;
}

.menu-toggle {
  display: none;
  order: 1;
}

.nav-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  order: 2;
}

.app-mode-nav button {
  min-height: 40px;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.nav-icon-btn .ui-btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon-btn .ui-btn-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  pointer-events: none;
}

.nav-icon-btn .ui-btn-label {
  line-height: 1.1;
}

.nav-buttons .nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px 10px 0 0;
}

.nav-buttons .nav-icon-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-buttons .nav-icon-btn .ui-btn-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  pointer-events: none;
}

.nav-buttons .nav-icon-btn .ui-btn-label {
  white-space: nowrap;
}

.nav-buttons.compact .nav-icon-btn {
  min-width: 40px;
  padding: 6px;
  gap: 0;
}

.nav-buttons.compact .nav-icon-btn .ui-btn-label {
  display: none;
}

.nav-buttons.compact .nav-icon-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
}

.app-mode-nav button.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.app-mode-nav button.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.scenario-panel {
  grid-column: 1 / -1;
}

.consultant-panel {
  grid-column: 1 / -1;
}

.consultant-submenu {
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 10px;
  background: #f8fbff;
}

.consultant-submenu summary {
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
}

.consultant-submenu-actions {
  margin-top: 10px;
}

.consultant-submenu-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 10px;
}

.consultant-submenu-icon-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.consultant-submenu-icon-btn .ui-btn-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.consultant-submenu.compact .consultant-submenu-icon-btn {
  min-width: 40px;
  padding: 6px;
  gap: 0;
}

.consultant-submenu.compact .consultant-submenu-icon-btn .ui-btn-label {
  display: none;
}

.consultant-opendrift-host {
  margin-top: 12px;
  border: 1px solid #c9d8e8;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.consultant-opendrift-frame {
  display: block;
  width: 100%;
  min-height: 78vh;
  border: 0;
}

.settings-panel {
  grid-column: 1 / -1;
}

.admin-panel {
  grid-column: 1 / -1;
}

.admin-panel h3 {
  margin-top: 0;
}

.admin-panel .admin-section > div {
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.admin-panel .admin-section h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: #0f172a;
}

.admin-panel .admin-section label {
  display: grid;
  gap: 4px;
  align-content: start;
  margin-bottom: 8px;
}

.admin-panel .admin-section .settings-grid-compact label {
  margin-bottom: 0;
}

.admin-panel .admin-section label.admin-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-panel .admin-section label.admin-inline-checkbox input[type="checkbox"] {
  margin-right: 0;
}

.admin-panel .admin-section .actions {
  margin-top: 10px;
}

.admin-panel .runs-list {
  max-height: 260px;
}

.admin-panel textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 0.84rem;
  font-family: Consolas, "Courier New", monospace;
}

.system-settings-entry-editor,
.system-settings-template-editor,
.system-settings-schema-viewer {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fbff;
}

.system-settings-entry-editor h4,
.system-settings-template-editor h4,
.system-settings-schema-viewer h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #0f172a;
}

.system-settings-dynamic-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.system-settings-group-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.system-settings-group-actions .secondary {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.admin-system-setting-group {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #ffffff;
}

.admin-system-setting-group > summary {
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
  list-style: none;
  padding: 8px 10px;
  border-bottom: 1px solid transparent;
}

.admin-system-setting-group > summary::-webkit-details-marker {
  display: none;
}

.admin-system-setting-group[open] > summary {
  border-bottom-color: #e2e8f0;
}

.admin-system-setting-group-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  padding: 10px;
}

.admin-system-settings-layout {
  align-items: start;
}

.admin-system-settings-column {
  display: grid;
  gap: 10px;
}

.admin-system-settings-column h3 {
  margin-bottom: 6px;
}

.admin-system-settings-layout #adminSystemSettingsList {
  max-height: 360px;
}

.admin-system-settings-guidance {
  margin-top: 0;
}

.system-settings-json-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

#adminSystemSettingPreviewCategory {
  max-width: 280px;
}

.system-settings-json-pane {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #ffffff;
  min-height: 220px;
}

.system-settings-json-pane h5 {
  margin: 0;
  font-size: 0.8rem;
  color: #334155;
}

.system-settings-json-pane .json-tree {
  overflow: auto;
  max-height: 280px;
}

.system-settings-json-raw {
  width: 100%;
  min-height: 220px;
  resize: vertical;
}

.admin-system-setting-form-hint {
  margin: 0 0 8px;
  color: #334155;
  font-size: 0.82rem;
}

.admin-system-setting-field {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #ffffff;
}

.admin-system-setting-field-wide {
  grid-column: 1 / -1;
}

.admin-system-setting-field-label {
  font-weight: 600;
  color: #0f172a;
}

.admin-system-setting-field-control {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 0.84rem;
  background: #ffffff;
  color: #0f172a;
}

.admin-system-setting-field-control[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}

.admin-system-setting-bool-switch {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
}

.admin-system-setting-bool-switch-label {
  font-size: 0.78rem;
  color: #334155;
  font-weight: 600;
}

.admin-system-setting-field-type,
.admin-system-setting-field-help {
  font-size: 0.76rem;
  color: #475569;
}

.admin-system-setting-field-hint {
  margin: 0;
  font-size: 0.76rem;
  color: #475569;
}

@media (max-width: 1100px) {
  .admin-system-settings-layout {
    grid-template-columns: 1fr;
  }

  .system-settings-dynamic-form,
  .system-settings-json-preview-grid,
  .admin-system-setting-group-body {
    grid-template-columns: 1fr;
  }
}

.scenario-panel .worksheet-view {
  max-height: 520px;
}
.panel {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.panel > h2,
.panel > h3 {
  margin-top: 0;
  color: #0f172a;
}
.map-panel { min-height: 70vh; position: static; }
#map { height: min(62vh, 720px); min-height: 360px; border-radius: 6px; }

.map-control-btn {
  width: 38px;
  height: 38px;
  border: 0;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.map-control-btn:hover {
  background: #f1f5f9;
}

.map-control-btn:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: -2px;
}

body.map-maximized .map-panel {
  position: fixed;
  inset: 10px;
  z-index: 950;
  min-height: 0;
  margin: 0;
}

body.map-maximized .map-panel .aux-section-toggle {
  margin-bottom: 6px;
}

body.map-maximized .map-panel #mapPanelBody {
  height: calc(100% - 48px);
  display: flex;
  flex-direction: column;
}

body.map-maximized .map-panel .map-time-controls {
  flex-shrink: 0;
}

body.map-maximized .map-panel #map {
  height: 100%;
  min-height: 300px;
  flex: 1;
}

.map-time-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.map-time-controls #timeLabel {
  margin-left: auto;
  min-width: 0;
  flex: 1 1 220px;
}

.map-time-controls button.secondary {
  margin-bottom: 0;
}

.map-time-controls .map-size-toggle {
  white-space: nowrap;
}

.map-time-controls .map-recenter-toggle {
  white-space: nowrap;
}

.map-time-controls .map-copy-toggle {
  white-space: nowrap;
}

.map-time-controls .map-icon-btn {
  min-width: 42px;
  width: 42px;
  min-height: 42px;
  height: 42px;
  padding: 0;
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.map-time-controls .map-icon-btn svg,
.map-control-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
  pointer-events: none;
}

.map-time-controls input[type="range"] {
  padding: 0;
  flex: 1 1 260px;
  min-width: 180px;
  max-width: 460px;
}

.map-time-controls .timeline-scale {
  flex: 1 0 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: -2px;
  padding: 0 2px;
  font-size: 0.68rem;
  color: #475569;
}

.map-time-controls .timeline-scale .timeline-scale-tick {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  border-top: 1px solid #cbd5e1;
  padding-top: 3px;
  white-space: nowrap;
}

.map-time-controls .timeline-scale .timeline-scale-tick:first-child {
  text-align: left;
}

.map-time-controls .timeline-scale .timeline-scale-tick:last-child {
  text-align: right;
}

.map-time-controls .timeline-scale .timeline-scale-tick.is-active {
  color: #0f172a;
  border-top-color: #0ea5e9;
  font-weight: 700;
}

.map-time-controls span {
  font-size: 0.8rem;
  color: #334155;
  min-width: 0;
  text-align: right;
}

.map-time-controls .map-distance-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #f8fafc;
  color: #1e293b;
  text-align: left;
  white-space: nowrap;
}

.map-time-controls .map-layer-legend {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.map-time-controls .map-layer-legend[hidden] {
  display: none;
}

.map-time-controls .map-track-style-note {
  flex: 1 0 100%;
  font-size: 0.68rem;
  line-height: 1.2;
  color: #475569;
  margin-top: 2px;
}

.map-time-controls .map-center-track-toggle {
  flex: 1 0 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #334155;
  margin-top: 2px;
}

.map-time-controls .map-center-track-toggle input {
  margin: 0;
}

.map-layer-legend-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px 2px 6px;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.map-layer-legend-chip:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.map-layer-legend-chip:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.map-layer-legend-chip.is-hidden {
  opacity: 0.55;
  background: #f8fafc;
}

.map-layer-legend-chip.is-hidden .swatch {
  opacity: 0.55;
}

.map-layer-legend-chip .swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.35);
  flex: 0 0 auto;
}

.map-layer-legend-chip .swatch.swatch-line {
  width: 16px;
  height: 0;
  border: 0;
  border-top-width: 2px;
  border-top-style: solid;
  border-top-color: var(--swatch-color, #334155);
  border-radius: 0;
}

.map-layer-legend-chip .swatch.swatch-line.is-dashed {
  border-top-style: dashed;
}

.map-time-controls .inline-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex: 0 1 auto;
}

.map-time-controls .inline-select select {
  min-height: 32px;
  padding: 4px 6px;
}

.map-time-controls .inline-select input[type="number"] {
  min-height: 32px;
  width: 64px;
  padding: 4px 6px;
}

.map-time-controls .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.map-time-controls .timeline-pan-presets {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.map-time-controls .timeline-pan-preset-btn {
  min-width: 42px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 999px;
}

.map-time-controls .timeline-pan-preset-btn.is-active {
  border-color: #0284c7;
  background: #e0f2fe;
  color: #0c4a6e;
  font-weight: 700;
}

.map-panel .leaflet-control-layers {
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}

.map-panel .leaflet-control-layers-expanded {
  padding: 6px 8px;
  min-width: 190px;
}

.map-panel .leaflet-control-layers-list {
  margin: 0;
  font-size: 0.76rem;
}

.map-panel .leaflet-control-layers-base label,
.map-panel .leaflet-control-layers-overlays label {
  margin: 1px 0;
  line-height: 1.2;
}

.map-panel .leaflet-control-layers-base span,
.map-panel .leaflet-control-layers-overlays span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.map-panel .leaflet-control-layers input[type="checkbox"],
.map-panel .leaflet-control-layers input[type="radio"] {
  margin: 0;
  transform: scale(0.9);
}

.map-panel .leaflet-control-layers-separator {
  margin: 4px 0;
}

.map-panel .layer-category-heading {
  margin: 5px 0 2px;
  padding-top: 3px;
  border-top: 1px solid #dbe4ee;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f172a;
}

.map-panel .leaflet-control-layers-overlays .layer-category-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}


.settings-hint {
  margin: 6px 0 10px;
  color: #475569;
  font-size: 0.82rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-card {
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.settings-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #0f172a;
}

.settings-grid-compact {
  margin-bottom: 0;
}

.settings-wide-field {
  grid-column: 1 / -1;
}

#timeZoneSearch {
  margin-bottom: 4px;
}

.settings-card .actions {
  margin-top: 10px;
}

.position-type-marker {
  background: transparent;
  border: 0;
}

.position-marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.28);
  background: #ffffff;
}

.position-marker-pin-label {
  transform: rotate(45deg);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #0f172a;
  line-height: 1;
}

.position-marker-pin.type-lkp {
  border-color: #111827;
  background: #fde047;
}

.position-marker-pin.type-lkp .position-marker-pin-label {
  color: #111827;
}

.position-marker-pin.type-eip {
  border-color: #111827;
  background: #67e8f9;
}

.position-marker-pin.type-eip .position-marker-pin-label {
  color: #111827;
}

.position-marker-pin.type-pd {
  border-color: #111827;
  background: #f9a8d4;
}

.position-marker-pin.type-pd .position-marker-pin-label {
  color: #111827;
}

.position-marker-badge {
  min-width: 40px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #0f172a;
  color: #0f172a;
  background: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.24);
}

.position-marker-badge.type-lkp {
  border-color: #1d4ed8;
  color: #1e3a8a;
  background: #dbeafe;
}

.position-marker-badge.type-eip {
  border-color: #b45309;
  color: #92400e;
  background: #ffedd5;
}

.position-marker-badge.type-pd {
  border-color: #047857;
  color: #065f46;
  background: #d1fae5;
}

.position-type-inline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 4px;
}

.position-type-inline-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #334155;
}

.model-method-slider-group {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.model-method-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
  margin-top: 2px;
}

.model-method-group-label-future {
  color: #64748b;
}

.model-method-slider-row {
  display: grid;
  grid-template-columns: auto 72px 24px;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.model-method-slider-row.is-future {
  opacity: 0.6;
}

.model-method-name {
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
}

.model-method-slider {
  width: 72px;
  max-width: 72px;
  justify-self: end;
}

.model-method-state {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f172a;
  min-width: 24px;
  text-align: left;
}

.model-method-readout {
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
}

.opendrift-readers-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.opendrift-readers-table-wrap h5 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #1f2937;
}

.opendrift-reader-fetch-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 0.7rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.opendrift-reader-fetch-status.status-loading {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #93c5fd;
}

.opendrift-reader-fetch-status.status-ok {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.opendrift-reader-fetch-status.status-warn {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.opendrift-reader-fetch-status.status-error {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.opendrift-reader-fetch-timestamp {
  margin: 0 0 6px;
  color: #475569;
  font-size: 0.74rem;
  line-height: 1.2;
}

.opendrift-readers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: auto;
  min-width: 580px;
}

.opendrift-readers-table th,
.opendrift-readers-table td {
  border: 1px solid #d1d5db;
  padding: 6px 8px;
  vertical-align: top;
  word-break: break-all;
}

.opendrift-readers-table th {
  background: #f8fafc;
  color: #1e293b;
  text-align: left;
  white-space: nowrap;
}

.opendrift-readers-table .reader-state-enabled {
  color: #065f46;
  font-weight: 700;
}

.opendrift-readers-table .reader-state-disabled {
  color: #9a3412;
  font-weight: 700;
}

.position-type-inline-legend .position-marker-badge {
  min-width: 30px;
  min-height: 20px;
  padding: 1px 6px;
  font-size: 0.62rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.16);
}

.latlon-grid-label {
  background: transparent;
  border: 0;
}

.latlon-grid-label span {
  display: inline-block;
  min-width: 48px;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(51, 65, 85, 0.35);
  background: rgba(255, 255, 255, 0.78);
  color: #1e293b;
  font-size: 0.64rem;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.weather-barb-icon {
  background: transparent;
  border: 0;
}

.weather-barb-icon .barb-wrap {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  transform-origin: 13px 13px;
}

.weather-barb-icon svg {
  width: 26px;
  height: 26px;
  overflow: visible;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.28));
}

.weather-barb-legend-control {
  background: #ffffff;
  border: 1px solid rgba(30, 41, 59, 0.2);
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.2);
  padding: 8px 10px;
  min-width: 220px;
  max-width: 280px;
}

.weather-barb-legend h4 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: #0f172a;
}

.weather-barb-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.weather-barb-legend-toggle {
  border: 1px solid #94a3b8;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 5px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.weather-barb-legend-toggle:hover {
  background: #e2e8f0;
}

.weather-barb-legend-body {
  margin-top: 4px;
}

.weather-barb-legend.is-collapsed .weather-barb-legend-header h4 {
  margin-bottom: 0;
}

.weather-barb-legend .legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  color: #1e293b;
  margin-bottom: 2px;
}

.weather-barb-legend .legend-row .sample {
  font-weight: 600;
  color: #0f766e;
}

.weather-barb-density-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: #1e293b;
}

.weather-barb-density-select {
  min-width: 112px;
  border: 1px solid #94a3b8;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.72rem;
  background: #f8fafc;
  color: #0f172a;
}

.weather-barb-legend .legend-note {
  margin: 6px 0 0;
  font-size: 0.68rem;
  line-height: 1.25;
  color: #334155;
}

.tz-region-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-height: 120px;
  overflow: auto;
  padding: 2px 0;
}

.tz-region-actions {
  display: inline-flex;
  gap: 6px;
  width: 100%;
  margin-bottom: 2px;
}

.tz-region-action-btn {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 0.74rem;
  margin-bottom: 0;
}

.tz-region-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  padding: 2px 8px;
  font-size: 0.75rem;
  line-height: 1.2;
}

.tz-region-chip input[type="checkbox"] {
  margin-right: 0;
}

body.map-hidden main {
  grid-template-columns: 1fr;
}

body.map-hidden .map-panel {
  display: none;
}
.grid { display: grid; gap: 8px; margin-bottom: 8px; }
.grid.one { grid-template-columns: 1fr; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.grid.five { grid-template-columns: repeat(5, 1fr); }
label { font-size: 0.85rem; display: grid; gap: 4px; }
input, select, button {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 0.9rem;
}

button,
input,
select {
  min-height: 36px;
}
input[type="checkbox"] {
  width: auto;
  margin-right: 6px;
  vertical-align: middle;
  border: none;
  padding: 0;
}

input[type="range"] {
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}
button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #d7e2ef;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 600;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.14);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.16);
}

button:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

button:disabled,
button[disabled] {
  opacity: 0.62;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button.secondary {
  margin-bottom: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-color: #cbd5e1;
  color: #1e293b;
}

button.danger {
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
  color: #9f1239;
  border-color: #fecdd3;
}
.actions { margin-top: 8px; display: flex; gap: 8px; }

.actions .nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.actions .nav-icon-btn .ui-btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #334155;
}

.actions .nav-icon-btn .ui-btn-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.actions .nav-icon-btn .ui-btn-label {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.1;
}

.actions .nav-icon-btn.danger {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.actions .nav-icon-btn.danger .ui-btn-icon {
  color: #b91c1c;
}

.actions .nav-icon-btn.danger:disabled,
.actions .nav-icon-btn.danger[disabled] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  opacity: 0.65;
}

.runtime-summary .actions .runtime-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.runtime-summary .actions .runtime-action-icon-btn .ui-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: #334155;
}

.runtime-summary .actions .runtime-action-icon-btn .ui-btn-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.runtime-summary .actions .runtime-action-icon-btn .ui-btn-label {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
}

body.short-menu-mode .nav-icon-btn,
body.short-menu-mode .runtime-summary .actions .runtime-action-icon-btn,
body.short-menu-mode #operationsPanel .grid .nav-icon-btn {
  min-width: 40px;
  max-width: 48px;
  padding: 4px;
  gap: 0;
}

body.short-menu-mode .nav-icon-btn .ui-btn-label,
body.short-menu-mode .runtime-summary .actions .runtime-action-icon-btn .ui-btn-label,
body.short-menu-mode #operationsPanel .grid .nav-icon-btn .ui-btn-label {
  display: none;
}

body.short-menu-mode .nav-icon-btn .ui-btn-icon,
body.short-menu-mode .runtime-summary .actions .runtime-action-icon-btn .ui-btn-icon,
body.short-menu-mode #operationsPanel .grid .nav-icon-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
}

body.short-menu-mode .toolbar-hint {
  display: none;
}

body.short-menu-mode .workspace-nav-group {
  padding: 4px;
}

body.short-menu-mode .workspace-nav-group .field-hint {
  display: none;
}

body.short-menu-mode .workspace-nav-group h5 {
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.manager-dialog .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.manager-dialog .actions button {
  width: 100%;
  margin: 0;
}

.switch-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.settings-grid-compact .switch-toggle {
  grid-template-columns: auto auto 1fr;
}

.switch-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.switch-toggle .switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #e5e7eb;
  position: relative;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.switch-toggle .switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s ease;
}

.switch-toggle input[type="checkbox"]:checked + .switch-track {
  background: #2563eb;
  border-color: #1d4ed8;
}

.switch-toggle input[type="checkbox"]:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch-toggle input[type="checkbox"]:focus-visible + .switch-track {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

.mobile-form-tools {
  margin: 0 0 10px;
}

.workspace-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  overflow-x: visible;
  overflow-y: visible;
  margin: 0 0 6px;
  padding: 0 0 4px;
  border-bottom: 1px solid #e2e8f0;
}

.workspace-nav-groups {
  display: grid;
  gap: 6px;
}

.workspace-nav-group {
  border: 1px solid #dbe4ee;
  border-radius: 7px;
  background: #f8fafc;
  padding: 6px;
}

.workspace-nav-group h5 {
  margin: 0 0 3px;
  font-size: 0.8rem;
  color: #0f172a;
}

.workspace-nav-group .field-hint {
  margin: 0 0 4px;
  font-size: 0.76rem;
}

.workspace-nav-group[aria-label="Worksheet Review menu"] .workspace-nav button {
  min-width: 110px;
  min-height: 30px;
  padding: 4px 7px;
  font-size: 0.74rem;
}

.workspace-nav-group[aria-label="Worksheet Review menu"] .workspace-nav button.workspace-nav-density-toggle {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.workspace-nav button {
  flex: 0 0 auto;
  width: auto;
  min-width: 148px;
  min-height: 34px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #d7e2ef;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  white-space: nowrap;
}

.workspace-nav button:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.14);
}

.workspace-nav .workspace-nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.workspace-nav .workspace-nav-icon-btn .ui-btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workspace-nav .workspace-nav-icon-btn .ui-btn-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  pointer-events: none;
}

.workspace-nav .workspace-nav-icon-btn .ui-btn-label {
  white-space: normal;
  line-height: 1.15;
  text-align: left;
}

.workspace-nav button.active {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  color: #fff;
  border-color: #1e40af;
  box-shadow: 0 8px 18px rgba(30, 64, 175, 0.25);
}

.workspace-nav .workspace-nav-action {
  white-space: normal;
}

.workspace-nav button.secondary {
  margin-bottom: 0;
}

.workspace-nav .workspace-nav-action .ui-btn-label {
  white-space: nowrap;
}

.workspace-nav-group[aria-label="Current Wx Reports menu"] .workspace-nav button {
  min-width: 172px;
}

.workspace-nav-group[aria-label="Current Wx Reports menu"] .workspace-nav button .ui-btn-label {
  white-space: normal;
  line-height: 1.15;
}

.workspace-nav.compact {
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
}

.workspace-nav.compact button {
  min-width: 40px;
  min-height: 30px;
  padding: 4px 5px;
  border-radius: 10px;
}

.workspace-nav.compact .workspace-nav-icon-btn .ui-btn-label {
  display: none;
}

.workspace-nav .workspace-nav-mode-toggle .ui-btn-label {
  display: inline;
}

.workspace-nav.compact .workspace-nav-mode-toggle {
  min-width: 44px;
}

.workspace-nav,
.admin-submenu {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px;
}

.toolbar-hint {
  margin: 4px 0 10px;
  color: #475569;
  font-size: 0.8rem;
}

.parameter-abbreviations {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin: 0 0 10px;
  background: #f8fafc;
}

.parameter-abbreviations h3,
.parameter-abbreviations h4 {
  margin: 0 0 6px;
}

.parameter-abbreviations ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: #334155;
}

.parameter-abbreviations li {
  margin-bottom: 4px;
}

.parameter-abbreviations .abbr-hint {
  margin: 0 0 6px;
  color: #475569;
  font-size: 0.78rem;
}

.field-hint {
  margin: 0 0 8px;
  color: #475569;
  font-size: 0.8rem;
}

.runtime-instructions {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  color: #1f2937;
}

.runtime-instructions h4 {
  margin: 0 0 8px;
  font-size: 0.86rem;
  color: #0f172a;
}

.runtime-instructions h5 {
  margin: 8px 0 4px;
  font-size: 0.8rem;
  color: #1e3a8a;
}

.runtime-instructions ul {
  margin: 0 0 6px;
  padding-left: 18px;
}

.runtime-instructions li {
  margin-bottom: 2px;
}

.runtime-instructions .runtime-note {
  margin: 0;
  font-size: 0.78rem;
  color: #475569;
}

.runtime-instructions .runtime-note.warn {
  color: #9a3412;
  font-weight: 600;
}

.runtime-input-group {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #ffffff;
}

.runtime-input-group h4 {
  margin: 0 0 8px;
  font-size: 0.86rem;
  color: #0f172a;
}

.runtime-model-group-wrap {
  border: 1px dashed #c9d9ee;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #fcfdff 0%, #f7fbff 100%);
}

.runtime-model-group-title {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: #1e3a8a;
}

#opendriftOptions,
#opendriftOptionsExtra {
  align-items: start;
}

#opendriftOptions > label,
#opendriftOptionsExtra > label {
  align-self: start;
}

#opendriftOptions .opendrift-core-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-self: start;
}

/* Step 6.5: force 2 columns so span-2 particle type always fills one row */
#run-form .form-section[data-section-key] #opendriftOptionsExtra {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

#opendriftOptionsExtra .opendrift-object-type-field {
  grid-column: span 2;
}

#opendriftObjectType {
  width: 100%;
  min-height: 32px;
  font-size: 0.84rem;
}

.runtime-step-group {
  border: 1px solid #cfe0f8;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%);
}

.runtime-step-group h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: #0f172a;
}

.runtime-leeway-transfer-table-wrap {
  margin-top: 6px;
}

.runtime-leeway-transfer-table-wrap h5 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: #334155;
}

.runtime-leeway-transfer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}

.runtime-leeway-transfer-table th,
.runtime-leeway-transfer-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
}

.runtime-leeway-transfer-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
}

.runtime-leeway-transfer-table tbody tr:last-child td {
  border-bottom: 0;
}

.field-hint-box {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.8rem;
  line-height: 1.3;
}

.admin-submenu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.admin-scope-bar {
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
  margin-bottom: 10px;
}

.admin-scope-bar h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.admin-scope-bar .actions {
  margin-top: 6px;
  align-items: center;
}

.admin-submenu button {
  min-height: 34px;
  background: #f8fafc;
}

.admin-submenu .admin-submenu-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.admin-submenu .admin-submenu-icon-btn .ui-btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-submenu .admin-submenu-icon-btn .ui-btn-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  pointer-events: none;
}

.admin-submenu .admin-submenu-icon-btn .ui-btn-label {
  white-space: nowrap;
}

.admin-submenu.compact .admin-submenu-icon-btn {
  min-width: 40px;
  max-width: 48px;
  padding: 6px;
  gap: 0;
}

.admin-submenu.compact .admin-submenu-icon-btn .ui-btn-label {
  display: none;
}

.admin-submenu.compact .admin-submenu-icon-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
}

.admin-submenu button.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.admin-section {
  display: none;
}

.admin-section.is-active {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.2fr) minmax(220px, 0.9fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 1460px) {
  .admin-section.is-active {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1180px) {
  .admin-section.is-active {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .admin-section.is-active {
    grid-template-columns: 1fr;
  }
}

.admin-placeholder {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.admin-placeholder p {
  margin: 0;
  color: #475569;
  font-size: 0.84rem;
}

.usage-report-summary {
  align-self: start;
}

.usage-report-summary .field-hint {
  margin-top: 6px;
}

.admin-layers-section .admin-layer-form-wrap {
  min-width: 0;
}

.admin-layer-settings-layout {
  grid-template-columns: 1fr;
}

.admin-layer-settings-layout .settings-card {
  padding: 10px;
}

.admin-layer-switch-grid {
  margin-bottom: 8px;
}

.admin-layer-opacity {
  display: block;
  margin-top: 8px;
}

.admin-layer-opacity-controls {
  margin-top: 6px;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 78px auto;
  gap: 8px;
  align-items: center;
}

.admin-layer-opacity-controls input[type="range"] {
  width: 100%;
  accent-color: #0f172a;
}

.admin-layer-opacity-controls input[type="number"] {
  text-align: right;
}

.admin-layer-opacity-unit {
  color: #475569;
  font-size: 0.83rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  .admin-layer-opacity-controls {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
  }

  .admin-layer-opacity-controls input[type="number"] {
    width: 100%;
    max-width: 92px;
    justify-self: start;
  }

  .admin-layer-opacity-unit {
    justify-self: start;
  }
}

.form-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
  background: #fcfdff;
}
.runtime-summary {
  border: 1px solid #c7d2fe;
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}
.runtime-summary .field-hint {
  color: #3730a3;
}

.runtime-summary .runtime-data-instruction {
  padding: 7px 9px;
  border: 1px solid #facc15;
  border-radius: 6px;
  background: #fef9c3;
  color: #6d28d9;
}

.runtime-instructions .runtime-msg-group {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #f8fafc;
}

.runtime-instructions .runtime-msg-group h5 {
  margin-top: 0;
}

.runtime-instructions .runtime-msg-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.runtime-instructions .runtime-msg-error h5 {
  color: #b91c1c;
}

.runtime-instructions .runtime-msg-warning {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.runtime-instructions .runtime-msg-warning h5 {
  color: #b45309;
}

.runtime-instructions .runtime-msg-instruction {
  border-color: #facc15;
  background: #fef9c3;
  color: #6d28d9;
}

.runtime-instructions .runtime-msg-instruction h5 {
  color: #6d28d9;
}

.runtime-instructions .runtime-msg-review {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
}

.runtime-instructions .runtime-msg-review h5 {
  color: #1d4ed8;
}

.runtime-object-review-table-wrap {
  overflow-x: auto;
}

.runtime-object-review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.runtime-object-review-table th,
.runtime-object-review-table td {
  border: 1px solid #bfdbfe;
  padding: 5px 6px;
  text-align: left;
  white-space: nowrap;
}

.runtime-object-review-table th {
  background: #dbeafe;
  color: #1e3a8a;
}

.runtime-autocorrect-hint {
  margin-top: -2px;
  margin-bottom: 8px;
  padding: 7px 9px;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.8rem;
}

#validateRuntimeBtn {
  min-width: 190px;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

#validateRuntimeBtn.is-ready {
  background: #dcfce7;
  border-color: #16a34a;
  color: #166534;
}

#validateRuntimeBtn.is-blocked {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}

#validateRuntimeBtn.is-ready:hover {
  background: #bbf7d0;
}

#validateRuntimeBtn.is-blocked:hover {
  background: #fecaca;
}

#runtimeSubmitBtn.submit-failed {
  border-color: #dc2626;
  color: #7f1d1d;
  background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

#runtimeSubmitBtn.submit-failed:hover:not(:disabled) {
  background: linear-gradient(180deg, #fecaca 0%, #fca5a5 100%);
}

.runtime-summary input[readonly],
.runtime-summary select:disabled {
  background: #dbeafe;
  border-color: #93c5fd;
}

.runtime-summary input.leeway-auto-locked {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e3a8a;
  font-weight: 600;
}

.runtime-summary input.leeway-manual-editable {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  font-weight: 500;
}

.runtime-summary input.runtime-field-warning,
.runtime-summary select.runtime-field-warning,
.runtime-summary textarea.runtime-field-warning {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
}

.runtime-summary input.runtime-field-error,
.runtime-summary select.runtime-field-error,
.runtime-summary textarea.runtime-field-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22) !important;
}

.form-section:last-child {
  margin-bottom: 0;
}

.section-toggle {
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  color: #1f2937;
  padding: 9px 12px;
}

.section-toggle::after {
  content: "▾";
  float: right;
  opacity: 0.8;
}

.section-toggle[aria-expanded="false"]::after {
  content: "▸";
}

.aux-section-toggle {
  margin-bottom: 8px;
}

.map-panel .aux-section-toggle {
  font-size: 1rem;
}

.aux-section-body {
  min-width: 0;
}

.form-section-body {
  padding-top: 8px;
}

.form-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.chip {
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
}

.chip.input {
  background: #fffbeb;
  border-color: #f59e0b;
}

.chip.calc {
  background: #eef2ff;
  border-color: #94a3b8;
}

.formula-note {
  font-size: 0.78rem;
  color: #475569;
}

.method-note {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.82rem;
}

.scenario-case-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  position: sticky;
  top: 8px;
  z-index: 125;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: rgba(255, 247, 237, 0.97);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
}

#caseFieldScenarioName,
#caseFieldDatumNumber,
#caseFieldSearchPlan {
  grid-column: auto;
}

.incident-required-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: #334155;
  font-size: 0.76rem;
}

.incident-compact-summary {
  display: none;
  grid-column: 1 / -1;
  margin: 0;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 600;
}

#caseFieldMethod .model-method-slider-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow: visible;
}

#caseFieldMethod .model-method-group-label {
  flex: 1 0 100%;
  margin: 0;
}

#caseFieldMethod .model-method-slider-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

#caseFieldMethod .model-method-slider {
  width: 52px;
  min-width: 52px;
}

#caseFieldMethod .model-method-name {
  font-size: 0.72rem;
}

#caseFieldMethod .model-method-state {
  min-width: 22px;
  text-align: center;
  font-size: 0.7rem;
}

.scenario-case-bar .case-field {
  min-width: 0;
}

.scenario-case-bar .case-field input,
.scenario-case-bar .case-field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.scenario-case-bar .case-field input.is-invalid {
  border-color: #dc2626;
  background: #fef2f2;
}

.scenario-case-bar #searchObject {
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scenario-case-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.scenario-case-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.scenario-case-header-actions button {
  margin-bottom: 0;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.scenario-case-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

.scenario-case-header p {
  margin: 0;
  color: #475569;
  font-size: 0.8rem;
}

.incident-save-state {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 600;
}

.incident-save-state.is-dirty {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.scenario-case-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
  align-items: stretch;
  width: 100%;
}

.scenario-case-actions.is-short {
  grid-template-columns: repeat(4, minmax(40px, 48px));
  justify-content: start;
}

.scenario-case-actions.is-short .scenario-case-action-icon-btn {
  width: 40px;
  min-width: 40px;
  max-width: 48px;
  padding: 4px;
}

.scenario-case-actions.is-short .scenario-case-action-icon-btn .ui-btn-label {
  display: none;
}

.scenario-case-actions.is-short .scenario-case-action-icon-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
}

.scenario-case-actions.is-short #saveScenarioFromDetailsBtn .ui-btn-icon {
  color: #047857;
}

.scenario-case-bar.is-minimized .case-field,
.scenario-case-bar.is-minimized .case-notes-field {
  display: none;
}

.scenario-case-bar.is-minimized .incident-required-hint {
  display: none;
}

.scenario-case-bar.is-minimized .incident-compact-summary {
  display: block;
}

.scenario-case-actions button {
  margin-bottom: 0;
  width: 100%;
  min-height: 32px;
  font-size: 0.78rem;
  padding: 4px 8px;
}

@media (min-width: 1120px) {
  .scenario-case-bar {
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    align-items: start;
  }

  .scenario-case-bar > .case-field {
    grid-column: 1;
  }

  #caseFieldCaseTitle {
    grid-column: 1;
    grid-row: 3;
  }

  #caseFieldScenarioName {
    grid-column: 2;
    grid-row: 3;
  }

  #caseFieldCaseNumber {
    grid-column: 1;
    grid-row: 4;
  }

  #caseFieldDatumNumber {
    grid-column: 2;
    grid-row: 4;
  }

  #caseFieldCaseDate {
    grid-column: 1;
    grid-row: 5;
  }

  #caseFieldSearchPlan {
    grid-column: 2;
    grid-row: 5;
  }

  #caseFieldPlanner {
    grid-column: 1;
    grid-row: 6;
  }

  #caseFieldMethod {
    grid-column: 2;
    grid-row: 6;
  }

  #caseFieldSearchObject {
    grid-column: 1 / -1;
    grid-row: 7;
    align-self: start;
  }

  #caseFieldSearchObject .search-object-picker {
    min-height: 240px;
  }

  #caseScenarioNotesWrap {
    grid-column: 1 / -1;
    grid-row: 8;
  }
}

@media (max-width: 1119px) {
  .scenario-case-bar {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .scenario-case-bar > .case-field {
    grid-column: auto;
    grid-row: auto;
  }

  #caseFieldSearchObject {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .scenario-case-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .scenario-case-bar > .case-field,
  #caseFieldSearchObject,
  #caseScenarioNotesWrap {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 1200px) {
  #caseFieldScenarioName,
  #caseFieldDatumNumber,
  #caseFieldSearchPlan {
    grid-column: auto;
  }

  #caseFieldMethod .model-method-slider-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow: visible;
  }

  #caseFieldMethod .model-method-slider-row {
    min-width: 0;
    white-space: nowrap;
  }
}
.scenario-case-actions .scenario-case-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.scenario-case-actions .scenario-case-action-icon-btn .ui-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: #334155;
}

.scenario-case-actions .scenario-case-action-icon-btn .ui-btn-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.scenario-case-actions .scenario-case-action-icon-btn .ui-btn-label {
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.1;
}

.scenario-case-actions button.is-dirty {
  border-color: #f59e0b;
  background: #f59e0b;
  color: #111827;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.case-field {
  display: grid;
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
  min-width: 0;
}

.case-field label {
  font-size: 0.8rem;
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22) !important;
  font-weight: 600;
  overflow-wrap: normal;
}

.case-field input,
.case-field select {
  background: #fcd9ad;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#searchObject {
  text-overflow: ellipsis;
}

.search-object-native {
  display: none;
}

.search-object-picker {
  display: grid;
  gap: 6px;
  border: 1px solid #fdba74;
  border-radius: 8px;
  background: #fff7ed;
  padding: 6px;
}

#searchObjectFilter {
  background: #ffffff;
  border: 1px solid #fdba74;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.8rem;
}

.search-object-selection-summary {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7c2d12;
}

.search-object-checklist {
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  background: #ffffff;
  padding: 4px;
  display: grid;
  gap: 2px;
}

.search-object-check-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #111827;
  padding: 3px 4px;
  border-radius: 4px;
}

.search-object-check-item:hover {
  background: #fff7ed;
}

.search-object-check-item.is-selected {
  background: #ffedd5;
  box-shadow: inset 0 0 0 1px #fdba74;
}

.search-object-check-item input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.search-object-switch-track {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.search-object-switch-track::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #94a3b8;
  transition: transform 0.15s ease;
}

.search-object-check-item input[type="checkbox"]:checked + .search-object-switch-track {
  background: #0ea5e9;
  border-color: #0284c7;
}

.search-object-check-item input[type="checkbox"]:checked + .search-object-switch-track::after {
  transform: translateX(12px);
  border-color: #0369a1;
}

.search-object-check-item input[type="checkbox"]:focus-visible + .search-object-switch-track {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.35);
}

.search-object-switch-label {
  font-weight: 600;
}

.search-object-check-indicator {
  font-size: 0.66rem;
  font-weight: 700;
  color: #9a3412;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  min-width: 62px;
  text-align: center;
}

.search-object-check-indicator:empty {
  display: none;
}

.search-object-check-indicator.is-primary {
  border-color: #0ea5e9;
  background: #e0f2fe;
  color: #0c4a6e;
}

.search-object-check-empty {
  font-size: 0.75rem;
  color: #6b7280;
  padding: 6px;
}

.leeway-object-profiles {
  margin-top: 6px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 4px;
  display: grid;
  gap: 4px;
}

.leeway-object-profiles-header h5 {
  margin: 0 0 3px;
  font-size: 0.82rem;
  color: #0f172a;
}

.leeway-object-profiles-header .field-hint {
  margin: 0;
  font-size: 0.75rem;
}

.leeway-object-profiles-header .secondary {
  margin: 6px 0 0;
  min-height: 28px;
  font-size: 0.74rem;
  padding: 4px 10px;
}

.leeway-object-profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leeway-object-tab {
  min-height: 22px;
  border: 1px solid #d7e2ef;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  cursor: pointer;
}

.leeway-object-tab:hover {
  border-color: #93c5fd;
}

.leeway-object-tab.active {
  background: #ffedd5;
  border-color: #fb923c;
  color: #7c2d12;
}

.leeway-object-profile-panel {
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #ffffff;
  padding: 6px;
}

.leeway-object-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px;
}

.leeway-object-profile-grid > label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.leeway-object-profile-empty {
  font-size: 0.76rem;
  color: #6b7280;
}

.opendrift-model-checklist .search-object-check-item.is-disabled {
  opacity: 0.56;
  background: #f8fafc;
}

.opendrift-model-checklist .search-object-check-item {
  position: relative;
  grid-template-columns: 32px 1fr auto;
}

.opendrift-model-checklist .search-object-check-item input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.opendrift-model-switch-track {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.opendrift-model-switch-track::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #94a3b8;
  transition: transform 0.15s ease;
}

.opendrift-model-checklist .search-object-check-item input[type="checkbox"]:checked + .opendrift-model-switch-track {
  background: #0ea5e9;
  border-color: #0284c7;
}

.opendrift-model-checklist .search-object-check-item input[type="checkbox"]:checked + .opendrift-model-switch-track::after {
  transform: translateX(12px);
  border-color: #0369a1;
}

.opendrift-model-checklist .search-object-check-item input[type="checkbox"]:focus-visible + .opendrift-model-switch-track {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.35);
}

.opendrift-model-switch-label {
  font-weight: 600;
}

.opendrift-model-checklist .search-object-check-item.is-disabled .search-object-check-indicator {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #64748b;
}

.visually-hidden-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.case-notes-field {
  grid-column: 1 / -1;
  border: 1px solid #fdba74;
  border-radius: 8px;
  background: rgba(255, 237, 213, 0.9);
  padding: 6px 8px;
}

.case-notes-field > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7c2d12;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.case-notes-field label {
  display: block;
  margin: 8px 0 4px;
  font-size: 0.76rem;
  color: #7c2d12;
}

.case-notes-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  background: #fff7ed;
}

.asw-c1-row .asw-c1-field {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  min-width: 0;
}

.asw-c1-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.marine-datum-twc-row {
  margin-bottom: 2px;
}

.marine-datum-section {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #fcfdff;
  padding: 8px;
  margin-bottom: 8px;
}

.marine-datum-twc-value-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 220px));
  gap: 8px;
  align-items: center;
}

.marine-datum-twc-error-group {
  grid-template-columns: minmax(140px, 220px);
}

.marine-datum-inline-field {
  display: grid;
  gap: 4px;
  align-content: start;
  margin: 0;
}

.marine-datum-inline-field > input {
  margin-top: 0;
}

.marine-datum-twc-value-group input[readonly] {
  text-align: right;
  font-weight: 700;
}

.marine-datum-section input[readonly] {
  text-align: right;
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
  font-weight: 600;
}

.twc-b-subgroup {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0;
  background: #ffffff;
}

.twc-b-subgroup.is-disabled {
  opacity: 0.55;
  background: #f8fafc;
}

.twc-b-subgroup.is-disabled h5 {
  color: #64748b;
}

.asw-c1-row .asw-c1-title {
  display: block;
  min-height: 1.2em;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.asw-c1-row .asw-c1-note {
  display: block;
  min-height: 1.2em;
  margin: 2px 0 4px;
}

.asw-c1-row > label {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.asw-c1-row > label input,
.asw-c1-row > label select {
  margin-top: 0;
  width: 100%;
}

#run-form .form-section .grid.two,
#run-form .form-section .grid.three,
#run-form .form-section .grid.four,
#run-form .form-section .grid.five {
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
  justify-content: flex-start;
  align-items: start;
}

#run-form .form-section .grid.two > label,
#run-form .form-section .grid.three > label,
#run-form .form-section .grid.four > label,
#run-form .form-section .grid.five > label {
  align-self: start;
}

#run-form .form-section input:not([type="checkbox"]):not([type="range"]),
#run-form .form-section select,
#run-form .form-section button {
  min-height: 31px;
  padding: 5px 7px;
}

#run-form .grid.three,
#run-form .grid.four {
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
  justify-content: flex-start;
  align-items: start;
}

#run-form .grid.three > label,
#run-form .grid.four > label {
  min-width: 0;
  overflow-wrap: anywhere;
}

#run-form .form-section[data-section-key] .grid.three,
#run-form .form-section[data-section-key] .grid.four {
  grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
  justify-content: flex-start;
  align-items: start;
}

@media (min-width: 1700px) {
  #run-form .form-section[data-section-key] .grid.three,
  #run-form .form-section[data-section-key] .grid.four {
    grid-template-columns: repeat(2, minmax(240px, 320px));
    justify-content: flex-start;
  }
}

#run-form .form-section[data-section-key] .grid.two,
#run-form .form-section[data-section-key] .grid.three,
#run-form .form-section[data-section-key] .grid.four {
  grid-template-columns: repeat(auto-fit, minmax(200px, 280px));
  justify-content: flex-start;
  align-items: start;
  gap: 6px;
}

#run-form .form-section .total-error-a-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  justify-content: flex-start;
  align-items: start;
}

#run-form .form-section[data-section-key] input:not([type="checkbox"]):not([type="range"]),
#run-form .form-section[data-section-key] select {
  min-height: 30px;
  padding: 4px 6px;
}

#run-form .form-section[data-section-key] .grid.one > button {
  width: auto;
  min-width: 0;
  justify-self: start;
}

#run-form.density-normal .form-section[data-section-key] .grid.two,
#run-form.density-normal .form-section[data-section-key] .grid.three,
#run-form.density-normal .form-section[data-section-key] .grid.four {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  justify-content: stretch;
  gap: 8px;
}

#run-form.density-normal .form-section[data-section-key] .grid.one {
  grid-template-columns: 1fr;
}

#run-form.density-normal .form-section[data-section-key] input:not([type="checkbox"]):not([type="range"]),
#run-form.density-normal .form-section[data-section-key] select,
#run-form.density-normal .form-section[data-section-key] button {
  min-height: 36px;
  padding: 7px 8px;
}

#run-form.density-normal .form-section[data-section-key] .grid.one > button {
  width: 100%;
}

#run-form .form-section[data-section-key="marine-datum-summary"] .marine-datum-section {
  padding: 6px;
  margin-bottom: 6px;
}

#positionLongitudeHemisphere,
#twcObservedErrKn,
#windCurrentDownwindDirDeg,
#xDrDistanceNm,
#xDrNavErrorNm,
#deTotalNm,
#yDrDistanceNm,
#yDrNavErrorNm,
#hours,
#windKn,
#dtMin,
#opendriftCurrentReaderUrl,
#opendriftObjectType {
  width: 100%;
  min-width: 0;
}

.marine-datum-section .grid.four > label {
  min-width: 0;
}

#positionLongitudeHemisphere {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1180px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .asw-c1-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .asw-c1-row .asw-c1-title {
    min-height: 2.2em;
    white-space: normal;
  }
}

@media (max-width: 1500px) and (min-width: 901px) {
  .asw-c1-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asw-c1-row .asw-c1-title {
    min-height: 2.2em;
  }

  .marine-datum-section .grid.four,
  .twc-b-subgroup .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #run-form .form-section[data-section-key] .grid.two,
  #run-form .form-section[data-section-key] .grid.three,
  #run-form .form-section[data-section-key] .grid.four {
    grid-template-columns: repeat(2, minmax(220px, 300px));
    justify-content: flex-start;
    align-items: start;
  }

  #run-form.density-normal .form-section[data-section-key] .grid.two,
  #run-form.density-normal .form-section[data-section-key] .grid.three,
  #run-form.density-normal .form-section[data-section-key] .grid.four {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    justify-content: stretch;
  }

  #run-form .form-section[data-section-key] .grid.one {
    grid-template-columns: minmax(240px, 620px);
    justify-content: flex-start;
  }

  #run-form.density-normal .form-section[data-section-key] .grid.one {
    grid-template-columns: 1fr;
  }

  #run-form .form-section[data-section-key] .grid.one > label,
  #run-form .form-section[data-section-key] .grid.two > label,
  #run-form .form-section[data-section-key] .grid.three > label,
  #run-form .form-section[data-section-key] .grid.four > label,
  #run-form .form-section[data-section-key] .grid.five > label {
    font-size: 0.79rem;
    line-height: 1.15;
  }

  #run-form .form-section[data-section-key] .field-hint,
  #run-form .form-section[data-section-key] small.field-hint,
  #run-form .form-section[data-section-key] .formula {
    font-size: 0.72rem;
    line-height: 1.2;
  }
}

@media (max-width: 900px) {
  #run-form .form-section[data-section-key] .grid.two,
  #run-form .form-section[data-section-key] .grid.three,
  #run-form .form-section[data-section-key] .grid.four,
  #run-form .form-section[data-section-key] .grid.one {
    grid-template-columns: 1fr;
  }

  #run-form.density-normal .form-section[data-section-key] .grid.two,
  #run-form.density-normal .form-section[data-section-key] .grid.three,
  #run-form.density-normal .form-section[data-section-key] .grid.four,
  #run-form.density-normal .form-section[data-section-key] .grid.one {
    grid-template-columns: 1fr;
  }

  #run-form .form-section[data-section-key] #opendriftOptionsExtra {
    grid-template-columns: 1fr;
  }

  #opendriftOptionsExtra .opendrift-object-type-field {
    grid-column: span 1;
  }

  #run-form .form-section .total-error-a-grid {
    grid-template-columns: 1fr;
  }

  .leeway-object-profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .asw-c1-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .asw-c1-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .asw-c1-row {
    grid-template-columns: 1fr;
  }
}

#searchObject,
#scenarioDetailsMethod {
  background: #fcd9ad;
}

#plannerName[readonly] {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #334155;
  font-weight: 600;
}

#driftIntervalHours[readonly] {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
  font-weight: 600;
}

#aswDirectionFromDeg[readonly],
#aswSpeedKnCalc[readonly],
#aswTotalHoursCalc[readonly] {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
  font-weight: 600;
}

input:read-only {
  background: #eef2ff;
  border-color: #94a3b8;
}

input:not(:read-only), select {
  background: #fcd9ad;
}

input.field-integrity-invalid,
select.field-integrity-invalid,
textarea.field-integrity-invalid,
input:invalid,
select:invalid,
textarea:invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16);
}

.formula {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  color: #475569;
}

.login-branding-note {
  margin: 4px 0 10px;
  font-size: 0.8rem;
  color: #334155;
  padding: 7px 9px;
  border: 1px solid #dbeafe;
  background: #f0f9ff;
  border-radius: 6px;
}

.report-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.report-table th, .report-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 4px;
  text-align: left;
  font-size: 0.82rem;
}
.report-table input { width: 100%; }
#status {
  margin: 0;
  padding: 8px;
  background: #0b1020;
  color: #e2e8f0;
  border-radius: 6px;
  min-height: 48px;
  max-height: none;
  flex: 1 1 auto;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.8rem;
}

#status .status-entry {
  display: block;
  margin: 0 0 2px;
}

#status .status-entry-info {
  color: #86efac;
}

#status .status-entry-warning {
  color: #fbbf24;
}

#status .status-entry-error {
  color: #f87171;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.history-header-tight {
  gap: 6px;
  margin-top: 6px;
}

.history-header-tight .history-title {
  gap: 6px;
  font-size: 0.96rem;
}

.history-header-tight .history-actions {
  gap: 4px;
}

.history-header-tight .run-history-selection-count {
  min-height: 24px;
  padding: 0 8px;
  font-size: 0.7rem;
}

.history-header-tight .run-history-toolbar-icon-btn {
  min-width: 30px;
  min-height: 30px;
  width: 30px;
  height: 30px;
  border-radius: 5px;
}

.history-header-tight .run-history-toolbar-icon-btn svg {
  width: 15px;
  height: 15px;
}

.history-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.run-history-selection-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
  background: #e2e8f0;
}

.run-history-toolbar-icon-btn {
  min-width: 34px;
  min-height: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-bottom: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.run-history-toolbar-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
  pointer-events: none;
}

.run-history-toolbar-icon-btn.danger {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fee2e2;
}

.trainer-panel {
  grid-column: 1 / -1;
}

.trainer-panel-actions {
  margin-top: 0;
  margin-bottom: 8px;
}

.visibility-scope-summary {
  margin-bottom: 10px;
  padding: 7px 10px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
}

.trainer-class-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.trainer-class-card {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
  font-size: 0.78rem;
  color: #334155;
}

.trainer-class-card h5 {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: #0f172a;
}

.trainer-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.trainer-filter-label select {
  min-height: 30px;
  min-width: 170px;
}

.trainer-runs-list {
  max-height: 360px;
}

.trainer-class-dialog {
  width: min(1180px, calc(100vw - 24px));
}

.trainer-class-dialog-grid {
  margin-top: 8px;
}

.history-title {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.run-history-asof {
  color: #475569;
  font-weight: 500;
  font-size: 0.82rem;
}

.runs-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
}

.runs-list-tight {
  margin-top: 6px;
  max-height: 188px;
}

.runs-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.82rem;
  background: #ffffff;
  cursor: pointer;
}

.runs-list-tight li {
  gap: 6px;
  padding: 6px 7px;
  font-size: 0.78rem;
}

.runs-list li.run-history-status-success {
  border-left: 3px solid #16a34a;
}

.runs-list li.run-history-status-cancelled {
  border-left: 3px solid #d97706;
}

.runs-list li.run-history-status-fail {
  border-left: 3px solid #dc2626;
}

.runs-list li.run-history-status-in-progress {
  border-left: 3px solid #2563eb;
}

.runs-list li.selected {
  background: #e8f0ff;
  border-left: 3px solid #0f172a;
}

.runs-list li:last-child {
  border-bottom: none;
}

.runs-list button {
  white-space: nowrap;
}

.run-history-icon-btn {
  min-width: 34px;
  min-height: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-bottom: 0;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.run-history-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
  pointer-events: none;
}

.run-history-icon-btn.danger {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fee2e2;
}

.run-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: capitalize;
}

.run-status-success {
  color: #14532d;
  background: #dcfce7;
}

.run-status-cancelled {
  color: #78350f;
  background: #fef3c7;
}

.run-status-fail {
  color: #7f1d1d;
  background: #fee2e2;
}

.run-status-in-progress {
  color: #1e3a8a;
  background: #dbeafe;
}

.runs-list-empty {
  justify-content: flex-start;
  color: #475569;
}

.scenario-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scenario-list-icon-btn {
  min-width: 32px;
  min-height: 32px;
  padding: 4px 6px;
  line-height: 1;
  font-size: 0.95rem;
  margin-bottom: 0;
}

.scenario-list-icon-btn.danger {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fee2e2;
}

.worksheet-view {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
  max-height: 420px;
  overflow: auto;
  font-size: 0.84rem;
}

.worksheet-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
}

.worksheet-card h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.worksheet-card table {
  width: 100%;
  border-collapse: collapse;
}

.worksheet-card td {
  border-bottom: 1px solid #f1f5f9;
  padding: 4px 6px;
}

.worksheet-card td:first-child {
  color: #334155;
  width: 60%;
}

.json-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.json-tree {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}

.json-node,
.json-leaf {
  margin: 2px 0;
}

.json-children {
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1px dashed #cbd5e1;
}

.json-key {
  color: #1e40af;
  font-weight: 600;
}

.json-shape {
  color: #334155;
  font-weight: 600;
}

.json-value.json-string {
  color: #065f46;
}

.json-value.json-number {
  color: #9a3412;
}

.json-value.json-boolean,
.json-value.json-null {
  color: #7c3aed;
}

.json-empty {
  color: #64748b;
  font-style: italic;
}

.manager-dialog {
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  overflow-y: auto;
  overflow-x: auto;
}

.manager-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.about-dialog {
  width: min(640px, calc(100vw - 24px));
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
}

.about-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.scenario-picker-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
}

.scenario-picker-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.scenario-picker-controls {
  margin-bottom: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
  justify-content: flex-start;
  gap: 8px;
}

.scenario-picker-controls > label {
  width: min(100%, 320px);
}

.scenario-picker-controls input[type="text"],
.scenario-picker-controls select {
  width: min(100%, 320px);
}

.scenario-picker-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.78rem;
}

.scenario-picker-actions {
  margin-top: auto;
}

.scenario-picker-controls .actions {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.scenario-picker-controls .actions button {
  margin-bottom: 0;
  width: 100%;
}

.scenario-picker-list {
  max-height: min(58dvh, 460px);
}

.scenario-picker-list li {
  align-items: center;
  cursor: pointer;
}

.scenario-picker-list li.selected {
  border-color: #0ea5e9;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.45);
  background: #f0f9ff;
}

.scenario-picker-list .scenario-picker-meta {
  font-size: 0.79rem;
  color: #475569;
}

.run-log-dialog {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
}

.run-log-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.workflow-wizard-dialog {
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100dvh - 18px);
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  overflow: auto;
}

.workflow-wizard-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.workflow-wizard-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}

.workflow-wizard-step-nav {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px;
}

.workflow-wizard-step-nav .toolbar-hint {
  margin: 0 0 6px;
}

.workflow-wizard-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
  gap: 5px;
}

.workflow-wizard-step {
  display: inline-flex;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.workflow-wizard-step-btn {
  width: auto !important;
  min-width: 104px;
  max-width: 210px;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.76rem;
  flex: 0 0 auto;
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.workflow-wizard-step-list.compact .workflow-wizard-step-btn {
  min-width: 78px;
  min-height: 30px;
  padding: 4px 7px;
}

.workflow-wizard-step-list.compact {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
}

.workflow-wizard-step.active .workflow-wizard-step-btn {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(29, 78, 216, 0.25);
  background: #eff6ff;
}

.workflow-wizard-detail {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
}

.workflow-wizard-detail h4 {
  margin: 0 0 4px;
}

.workflow-wizard-detail p {
  margin: 0;
  color: #334155;
  font-size: 0.84rem;
}

.workflow-wizard-data-elements {
  margin-top: 6px;
  border-top: 1px solid #dbe4ee;
  padding-top: 5px;
}

.workflow-wizard-data-elements h5 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.workflow-wizard-data-elements > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
  justify-content: flex-start;
  gap: 4px;
}

.workflow-wizard-field-row {
  display: grid;
  gap: 2px;
  width: min(100%, 320px);
}

.workflow-wizard-field-row-wide {
  width: min(100%, 680px);
}

.workflow-wizard-field-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #0f172a;
}

.workflow-wizard-field-control {
  display: grid;
  justify-items: start;
  gap: 2px;
}

.workflow-wizard-field-control-wide {
  width: min(100%, 680px);
}

.workflow-wizard-input {
  width: min(100%, 320px);
  min-height: 28px;
}

.workflow-wizard-leeway-profiles {
  width: min(100%, 680px);
  display: grid;
  gap: 6px;
}

.workflow-wizard-search-object-picker {
  width: min(100%, 320px);
}

.workflow-wizard-search-object-picker input[type="search"] {
  background: #ffffff;
  border: 1px solid #fdba74;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 0.8rem;
}

.workflow-wizard-search-object-checklist {
  max-height: 180px;
}

.workflow-wizard-switch {
  justify-content: flex-start;
}

.workflow-wizard-switch-label {
  min-width: 2.2rem;
  font-size: 0.8rem;
  color: #334155;
}

.workflow-wizard-actions {
  margin-top: 6px;
  gap: 6px;
}

.workflow-wizard-actions button {
  min-height: 32px;
  padding: 4px 7px;
  font-size: 0.78rem;
}

.workflow-wizard-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.workflow-wizard-action-btn .ui-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: #334155;
}

.workflow-wizard-action-btn .ui-btn-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.workflow-wizard-action-btn .ui-btn-label {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.1;
}

.workflow-wizard-dialog.compact .workflow-wizard-action-btn {
  min-width: 40px;
  max-width: 48px;
  padding: 4px;
  gap: 0;
}

.workflow-wizard-dialog.compact .workflow-wizard-action-btn .ui-btn-label {
  display: none;
}

.workflow-wizard-dialog.compact .workflow-wizard-action-btn .ui-btn-icon {
  width: 16px;
  height: 16px;
}

#run-form.menu-driven-sections .form-section > .section-toggle {
  display: none;
  justify-content: flex-start;
  text-align: left;
  pointer-events: none;
  cursor: default;
}

#run-form.menu-driven-sections.show-section-titles .form-section > .section-toggle {
  display: flex;
}

#run-form.menu-driven-sections .form-section-body {
  padding-top: 0;
}

body.short-menu-mode #run-form.menu-driven-sections .form-section > .section-toggle {
  display: none;
}

.run-log-meta {
  margin: 0 0 8px;
  color: #334155;
  font-size: 0.82rem;
}

.run-log-body {
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  max-height: min(60dvh, 520px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.about-table {
  width: 100%;
  border-collapse: collapse;
}

.about-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px;
  font-size: 0.85rem;
}

.about-table td:first-child {
  width: 34%;
  color: #334155;
}

.page-footer {
  margin: 8px 12px 12px;
  padding: 10px 12px;
  border-top: 3px solid #f97316;
  border-left: 1px solid #d1d5db;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 0.82rem;
  line-height: 1.4;
}

.report-table.wide {
  table-layout: fixed;
  min-width: 1160px;
}

.report-table.wide th,
.report-table.wide td {
  vertical-align: middle;
}

.report-table.wide input {
  padding: 5px 6px;
  font-size: 0.82rem;
}

.report-table .interval,
.report-table .duration {
  min-width: 74px;
  max-width: 84px;
}

.report-table .direction,
.report-table .speed {
  min-width: 96px;
}

.report-table .remove-row-btn {
  min-width: 32px;
  min-height: 30px;
  line-height: 1;
  padding: 3px 6px;
  margin-bottom: 0;
}

#currentDialog .report-table.wide,
#windDialog .report-table.wide {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

#currentDialog .report-table th,
#currentDialog .report-table td,
#windDialog .report-table th,
#windDialog .report-table td {
  padding: 3px 4px;
}

#currentDialog .report-table input,
#windDialog .report-table input,
#windDialog .report-table select {
  min-height: 30px;
  padding: 4px 5px;
}

#currentDialog .report-table .obs,
#windDialog .report-table .obs {
  min-width: 210px;
}

#currentDialog col.obs-col,
#windDialog col.obs-col {
  width: 220px;
}

#currentDialog col.interval-col,
#currentDialog col.duration-col,
#windDialog col.interval-col,
#windDialog col.duration-col {
  width: 78px;
}

#currentDialog col.direction-col,
#windDialog col.direction-col {
  width: 120px;
}

#currentDialog col.speed-col,
#windDialog col.speed-col {
  width: 108px;
}

#windDialog col.type-col {
  width: 96px;
}

#currentDialog col.contribution-col,
#windDialog col.contribution-col {
  width: 126px;
}

#currentDialog col.action-col,
#windDialog col.action-col {
  width: 44px;
}

#currentDialog .report-table .interval,
#currentDialog .report-table .duration,
#currentDialog .report-table .contribution,
#windDialog .report-table .interval,
#windDialog .report-table .duration,
#windDialog .report-table .contribution {
  text-align: right;
}

#windDialog .report-table.wide {
  min-width: 1060px;
}

#windDialog .report-table .obs {
  min-width: 170px;
}

#windDialog .report-table .interval,
#windDialog .report-table .duration {
  min-width: 68px;
  max-width: 74px;
}

#windDialog .report-table .report-type {
  min-width: 0;
  width: 100%;
}

.wc-graph-controls {
  margin: 6px 0 2px;
}

.wc-graph-panel {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
  margin: 6px 0 10px;
}

.wc-graph-layout {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.wc-graph-panel svg {
  display: block;
  width: min(100%, 520px);
  height: auto;
  flex: 1 1 auto;
}

.wc-latitude-rule {
  min-width: 170px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px;
  color: #0f172a;
}

.wc-latitude-rule h6 {
  margin: 0 0 6px;
  font-size: 0.8rem;
}

.wc-latitude-rule p {
  margin: 0 0 5px;
  font-size: 0.76rem;
  line-height: 1.25;
}

.wc-graph-readout {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #0f172a;
  font-weight: 600;
}

.leeway-graphs-panel {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 4px;
  margin: 2px 0 6px;
}

.leeway-graph-controls {
  margin: 2px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: end;
}

.leeway-graph-controls label {
  margin-bottom: 0;
  font-size: 0.72rem;
}

.leeway-graph-controls .switch-toggle {
  min-width: 0;
  flex: 1 1 220px;
  gap: 5px;
  font-size: 0.7rem;
  line-height: 1.1;
}

.leeway-graph-controls .switch-toggle span:last-child {
  overflow-wrap: anywhere;
}

.leeway-graph-controls .switch-toggle .switch-track {
  width: 34px;
  height: 18px;
}

.leeway-graph-controls .switch-toggle .switch-track::after {
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
}

.leeway-graph-controls .switch-toggle input[type="checkbox"]:checked + .switch-track::after {
  transform: translateX(16px);
}

.leeway-graph-controls select {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.leeway-control-actions {
  margin-top: 5px;
  gap: 5px;
}

.leeway-control-actions button {
  min-height: 30px;
  padding: 3px 9px;
  font-size: 0.76rem;
}

.leeway-object-filters {
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #ffffff;
  padding: 8px;
  margin-bottom: 8px;
  max-height: 320px;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.leeway-object-filter-item {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 2fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #1f2937;
}

.leeway-object-filter-name {
  font-weight: 600;
}

.leeway-object-filter-item input[type="range"] {
  width: 100%;
  margin: 0;
  min-height: 16px;
}

.leeway-object-filter-value {
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.leeway-object-dialog {
  width: min(720px, 94vw);
}

.leeway-object-filters-modal {
  margin-top: 8px;
}

#leewayObjectFiltersSummary {
  margin: 1px 0 6px;
  color: #334155;
  font-size: 0.72rem;
}

.leeway-sheet {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px;
  margin-bottom: 4px;
  font-size: 0.76rem;
}

.leeway-sheet-row-block {
  border-top: 1px solid #d1d5db;
  padding-top: 6px;
  margin-top: 6px;
}

.leeway-sheet-row-block:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.leeway-sheet .grid {
  gap: 4px;
}

.leeway-sheet .grid.one {
  grid-template-columns: 1fr;
}

.leeway-sheet .grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.leeway-sheet .grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.leeway-sheet label {
  margin-bottom: 0;
  font-size: 0.74rem;
  line-height: 1.15;
}

.leeway-sheet input {
  margin-top: 2px;
  text-align: right;
  width: min(100%, 106px);
  min-height: 24px;
  padding: 2px 5px;
  justify-self: start;
}

.leeway-sheet input.calculated {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
  font-weight: 600;
}

.leeway-sheet input.leeway-auto-locked {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e3a8a;
  font-weight: 600;
}

.leeway-sheet input.leeway-manual-editable {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  font-weight: 500;
}

.leeway-sheet input.graph-sourced-field {
  background: #f1c58f;
  border-color: #f59e0b;
}

.leeway-sheet .field-hint {
  font-size: 0.72rem;
  color: #1e3a8a;
  font-style: italic;
  font-weight: 600;
  margin-top: 2px;
}

.leeway-graphs-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.leeway-graph-card {
  margin: 0;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
}

.leeway-graph-card figcaption {
  margin-bottom: 4px;
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 700;
}

.leeway-graph-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.leeway-graphs-readout {
  margin-top: 6px;
  font-size: 0.76rem;
  color: #0f172a;
  font-weight: 600;
}

.leeway-graph-legend {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.7rem;
  color: #0f172a;
}

.leeway-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leeway-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid transparent;
}

.leeway-legend-dot-red {
  background: #dc2626;
  border-color: #7f1d1d;
}

.leeway-legend-dot-blue {
  background: #2563eb;
  border-color: #1e3a8a;
}

.leeway-reference-images {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.leeway-reference-card {
  margin: 0;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
}

.leeway-reference-card.is-active-reference {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.leeway-reference-card figcaption {
  margin-bottom: 4px;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 700;
}

.leeway-reference-card img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
  cursor: zoom-in;
}

.reference-image-modal {
  width: min(1200px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
}

.reference-image-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.reference-image-modal h3 {
  margin: 0 0 8px;
}

.reference-image-modal-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  padding: 8px;
}

.reference-image-modal-body img {
  max-width: 100%;
  max-height: calc(100dvh - 180px);
  object-fit: contain;
}

.leeway-reference-missing {
  margin-top: 6px;
  font-size: 0.76rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 6px 8px;
}

@media (max-width: 1100px) {
  main { grid-template-columns: 1fr; }
  .map-panel { position: static; }
  #map { height: 56vh; }

  .scenario-case-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-time-controls {
    gap: 6px;
  }

  .map-time-controls #timeLabel {
    margin-left: 0;
    flex-basis: 100%;
    text-align: left;
  }

  .map-time-controls input[type="range"] {
    flex: 1 1 min(380px, 100%);
    max-width: 100%;
  }

  .map-time-controls .inline-select {
    flex: 0 1 auto;
  }

  .map-time-controls .inline-check {
    margin-left: auto;
  }

  .map-time-controls span {
    min-width: 0;
    text-align: left;
  }

  .wc-graph-layout {
    flex-direction: column;
  }

  .wc-latitude-rule {
    min-width: 0;
  }

  .leeway-graphs-layout {
    grid-template-columns: 1fr;
  }

  .leeway-reference-images {
    grid-template-columns: 1fr;
  }

  .leeway-sheet .grid.two,
  .leeway-sheet .grid.four {
    grid-template-columns: 1fr;
  }

  .leeway-object-filters {
    max-height: 280px;
  }

  .leeway-object-filter-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .leeway-object-filter-value {
    text-align: left;
  }
}

@media (max-width: 900px) {
  header {
    padding: 12px;
  }

  header h1 {
    font-size: 1rem;
  }

  main {
    gap: 10px;
    padding: 10px;
  }

  .panel {
    padding: 10px;
  }

  .auth-gate {
    padding: 0;
    place-items: stretch;
    align-content: stretch;
    overflow: hidden;
  }

  .auth-card {
    width: 100vw;
    max-width: 100vw;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  }

  .auth-branding {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-item {
    width: 100%;
    justify-content: flex-start;
  }

  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-wizard-dialog {
    width: calc(100vw - 14px);
    max-height: calc(100dvh - 14px);
    padding: 8px;
  }

  .workflow-wizard-step-btn {
    min-width: 96px;
    max-width: 180px;
  }

  .workflow-wizard-actions button {
    flex: 1 1 150px;
  }

  .actions {
    flex-wrap: wrap;
  }

  .actions button {
    flex: 1 1 180px;
  }

  .settings-layout,
  .admin-system-settings-layout,
  .admin-layer-settings-layout,
  .workflow-wizard-layout,
  .scenario-panel,
  .trainer-panel,
  .consultant-panel,
  .settings-panel,
  .admin-panel {
    min-width: 0;
  }

  #run-form .form-section label,
  .settings-panel label,
  .admin-panel label,
  .trainer-panel label,
  .scenario-panel label,
  .consultant-panel label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #run-form .form-section input,
  #run-form .form-section select,
  .settings-panel input,
  .settings-panel select,
  .admin-panel input,
  .admin-panel select,
  .trainer-panel input,
  .trainer-panel select,
  .scenario-panel input,
  .scenario-panel select,
  .consultant-panel input,
  .consultant-panel select {
    min-width: 0;
    width: 100%;
  }

  .manager-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 10px;
  }

  .scenario-picker-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 10px;
  }

  .menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    font-size: 1.05rem;
    line-height: 1;
  }

  .app-mode-nav {
    flex-wrap: nowrap;
  }

  #navMenuModeToggle {
    order: 2;
    margin-left: auto;
  }

  .nav-buttons {
    display: flex;
    width: 100%;
    flex-direction: row;
    order: 2;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .nav-buttons button {
    width: auto;
    text-align: center;
    justify-content: center;
    white-space: nowrap;
  }

  .workflow-wizard-layout {
    grid-template-columns: 1fr;
  }
}

@media print {
  body.printing-usage-report * {
    visibility: hidden !important;
  }

  body.printing-usage-report #usageReportDialog,
  body.printing-usage-report #usageReportDialog * {
    visibility: visible !important;
  }

  body.printing-usage-report #usageReportDialog {
    position: static;
    inset: auto;
    width: 100%;
    max-width: 100%;
    max-height: none;
    border: none;
    border-radius: 0;
    padding: 0;
    overflow: visible;
    background: #ffffff;
    box-shadow: none;
  }

  body.printing-usage-report #usageReportDialog .actions {
    display: none;
  }

  body.printing-usage-report #usageReportDialog .worksheet-view {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 700px) {
  .auth-title {
    font-size: 1.3rem;
    line-height: 1.2;
  }

  .auth-sub {
    font-size: 0.84rem;
    text-align: center;
  }

  .auth-branding {
    gap: 8px;
    margin-bottom: 10px;
    justify-content: center;
    align-items: center;
  }

  .auth-branding img,
  .auth-branding img.iamsar-logo {
    height: 54px;
    max-height: 54px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .auth-actions button {
    width: 100%;
  }

  .header-top {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    position: static;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .map-time-controls {
    gap: 6px;
  }

  .map-time-controls #timeLabel {
    flex-basis: 100%;
  }

  .map-time-controls input[type="range"] {
    flex-basis: 100%;
    min-width: 0;
  }

  .map-time-controls .inline-select {
    flex: 1 1 210px;
    min-width: 0;
  }

  .map-time-controls .inline-check {
    margin-left: 0;
  }

  .map-time-controls span {
    text-align: left;
    min-width: 0;
  }

  .workspace-nav {
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
    padding-bottom: 4px;
  }

  .workspace-nav.compact {
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
  }

  .workspace-nav button {
    white-space: nowrap;
    min-width: 148px;
    min-height: 40px;
  }

  .mobile-form-tools {
    display: block;
  }

  #run-form.mobile-compact-enabled .form-section {
    padding: 6px;
    margin-bottom: 8px;
  }

  #run-form.mobile-compact-enabled .section-toggle {
    font-size: 0.86rem;
    padding: 8px;
  }

  #run-form.mobile-compact-enabled .form-section-body {
    padding-top: 6px;
  }

  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .scenario-case-bar {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .scenario-case-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .scenario-case-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .scenario-case-actions {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    width: 100%;
  }

  .scenario-case-actions.is-short {
    grid-template-columns: repeat(4, minmax(36px, 1fr));
    width: 100%;
  }

  label {
    font-size: 0.83rem;
  }

  .formula {
    font-size: 0.7rem;
  }

  .worksheet-view {
    max-height: 320px;
  }

  .json-toolbar {
    flex-wrap: wrap;
  }

  .json-toolbar button {
    flex: 1 1 160px;
  }

  #map {
    height: 48vh;
    min-height: 300px;
  }

  .runs-list {
    max-height: 180px;
  }

  .runs-list li {
    flex-direction: column;
    align-items: stretch;
  }

  .runs-list button {
    width: 100%;
  }

  .run-history-icon-btn {
    width: 100%;
  }

  .manager-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 10px;
  }

  .report-table th,
  .report-table td {
    font-size: 0.78rem;
    padding: 5px;
  }

  #currentDialog .report-table.wide,
  #windDialog .report-table.wide {
    min-width: 0;
    table-layout: auto;
  }

  #currentDialog .report-table .obs,
  #windDialog .report-table .obs {
    min-width: 0;
  }

  #currentDialog .report-table thead,
  #windDialog .report-table thead {
    display: none;
  }

  #currentDialog .report-table tbody tr,
  #windDialog .report-table tbody tr {
    display: block;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
  }

  #currentDialog .report-table tbody td,
  #windDialog .report-table tbody td {
    display: grid;
    grid-template-columns: minmax(120px, 42%) minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    border: 0;
    padding: 4px 0;
  }

  #currentDialog .report-table tbody td::before,
  #windDialog .report-table tbody td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
  }

  #currentDialog .report-table tbody td:last-child,
  #windDialog .report-table tbody td:last-child {
    grid-template-columns: 1fr;
  }

  #currentDialog .report-table tbody td:last-child::before,
  #windDialog .report-table tbody td:last-child::before {
    margin-bottom: 2px;
  }

  #currentDialog .report-table tbody td:last-child button,
  #windDialog .report-table tbody td:last-child button {
    width: 100%;
    margin: 0;
  }

  #currentDialog .actions,
  #windDialog .actions,
  #sruDialog .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #dbe4ee;
    background: #ffffff;
  }

  #currentDialog .actions button,
  #windDialog .actions button,
  #sruDialog .actions button {
    width: 100%;
    margin: 0;
  }

  .about-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .scenario-picker-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 10px;
  }

  .scenario-picker-controls .actions button {
    width: 100%;
  }

  .auth-card {
    padding: 12px;
  }
}

@media (max-width: 420px) {
  html,
  body {
    overflow-x: hidden;
  }

  main {
    padding: 8px;
    gap: 8px;
  }

  .panel {
    padding: 8px;
    border-radius: 6px;
  }

  .title-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .title-actions button {
    width: 100%;
    min-height: 34px;
    font-size: 0.74rem;
    padding: 5px 6px;
  }

  .scenario-case-bar {
    padding: 8px;
    gap: 6px;
    position: static;
  }

  .scenario-case-actions {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .scenario-case-actions.is-short {
    grid-template-columns: repeat(4, minmax(32px, 1fr));
  }

  .workspace-nav {
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
    gap: 5px;
    padding-bottom: 4px;
  }

  .workspace-nav.compact {
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
  }

  .workspace-nav button {
    white-space: nowrap;
    min-width: 96px;
    min-height: 34px;
    font-size: 0.78rem;
    padding: 5px 8px;
  }

  .actions button,
  .workflow-wizard-actions button,
  .scenario-case-actions button,
  .title-actions button {
    min-width: 0;
    width: 100%;
  }

  .leeway-graph-controls .switch-toggle {
    flex: 1 1 100%;
  }

  .workflow-wizard-step-btn {
    min-width: 84px;
  }

  .operations-panel,
  #run-form,
  .form-section,
  .form-section-body,
  .scenario-case-bar {
    min-width: 0;
    overflow-x: hidden;
  }

  #mobileFormTools button {
    width: 100%;
    margin-bottom: 8px;
  }

  #run-form.mobile-compact-enabled .section-toggle {
    font-size: 0.82rem;
    padding: 7px 8px;
  }

  .map-time-controls {
    gap: 6px;
  }

  .map-time-controls input[type="range"],
  .map-time-controls .inline-select,
  .map-time-controls .inline-check,
  .map-time-controls span {
    flex: 1 1 100%;
    min-width: 0;
  }

  .map-time-controls .inline-check {
    margin-left: 0;
  }

  #map {
    height: 38vh;
    min-height: 230px;
  }

  .chip {
    font-size: 0.7rem;
  }

  .formula-note,
  .method-note {
    font-size: 0.76rem;
  }

  .header-top {
    grid-template-columns: 1fr;
  }

  .header-title {
    text-align: left;
  }

  .header-status-console {
    top: 8px;
    left: 8px;
    width: min(340px, calc(100vw - 16px));
  }

  #status {
    font-size: 0.8rem;
    min-height: 56px;
  }
}
