:root {
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-surface-soft: #fbfcfe;
  --color-border: #dbe4ee;
  --color-border-strong: #c8d4e1;
  --color-text: #172033;
  --color-muted: #64748b;
  --color-muted-soft: #94a3b8;
  --color-primary: #0f766e;
  --color-primary-hover: #115e59;
  --color-primary-soft: #e6fffb;
  --color-blue-soft: #eaf3ff;
  --color-warning: #b7791f;
  --color-warning-soft: #fff7db;
  --color-danger: #c2410c;
  --color-danger-hover: #9a3412;
  --color-danger-soft: #fff1ed;
  --color-success: #15803d;
  --color-success-soft: #dcfce7;
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 22px rgba(15, 23, 42, 0.04);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --font-xs: 12px;
  --font-sm: 13px;
  --font-md: 14px;
  --font-lg: 16px;
  --font-xl: 20px;
  --font-2xl: 26px;
  --control-height: 34px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-md);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

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

h1 {
  margin-bottom: 0;
  font-size: var(--font-2xl);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: var(--space-1);
  font-size: var(--font-xl);
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: var(--font-lg);
  line-height: 1.3;
}

a {
  color: var(--color-primary);
  font-weight: 750;
}

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-5) 0 var(--space-8);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.cancel-form {
  width: 120px;
}

.logout-form {
  width: 110px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-5);
}

.auth-shell {
  width: min(420px, 100%);
}

.auth-card {
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.auth-brand h1 {
  font-size: var(--font-xl);
}

.auth-form {
  display: grid;
  gap: var(--space-4);
}

.auth-form label {
  display: grid;
  gap: var(--space-1);
  color: var(--color-muted);
  font-size: var(--font-sm);
  font-weight: 800;
}

.auth-form input {
  height: 42px;
  width: 100%;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.auth-error {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-weight: 800;
}

.brand-mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.18);
}

.eyebrow {
  margin-bottom: var(--space-1);
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-source {
  margin: var(--space-1) 0 0;
  color: var(--color-muted);
  font-size: var(--font-sm);
  font-weight: 700;
}

.header-status {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  align-items: center;
  min-width: 260px;
  max-width: 420px;
  padding: 10px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.header-status strong {
  display: block;
  overflow: hidden;
  font-size: var(--font-sm);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-status small {
  display: block;
  color: var(--color-muted);
  font-size: var(--font-xs);
}

.status-content {
  min-width: 0;
}

.status-progress {
  margin-top: 8px;
}

.status-progress[hidden] {
  display: none;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 5px;
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 800;
}

.progress-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #f59e0b;
  transition: width 220ms ease;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--color-success);
}

.header-status.is-running .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.14);
}

.metrics {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.8fr) minmax(260px, 1.1fr) minmax(260px, 1.1fr);
  gap: 10px;
  margin-bottom: var(--space-3);
}

.metric-card {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: 9px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.metric-wide {
  grid-column: span 2;
  display: grid;
  align-content: center;
}

.metric-card span:not(.metric-icon):not(.info) {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  overflow: visible;
  color: var(--color-text);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
}

.metric-card:not(.metric-wide) strong {
  font-variant-numeric: tabular-nums;
}

.metric-date {
  grid-column: auto;
}

.metric-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 900;
}

.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.35fr);
  gap: var(--space-4);
  align-items: start;
  margin-top: var(--space-4);
}

.tools-panel {
  margin-bottom: var(--space-4);
  padding: 0;
  overflow: hidden;
}

.tools-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 13px var(--space-4);
  cursor: pointer;
  list-style: none;
}

.tools-details > summary::-webkit-details-marker {
  display: none;
}

.tools-details > summary span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tools-details > summary strong {
  font-size: var(--font-lg);
  line-height: 1.25;
}

.tools-details > summary small {
  color: var(--color-muted);
  font-size: var(--font-sm);
  font-weight: 750;
  line-height: 1.35;
}

.tools-summary-action {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 6px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: 850;
  text-align: center;
}

.tools-details[open] {
  padding-bottom: var(--space-4);
}

.tools-details[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

.tools-details .control-grid {
  padding: 0 var(--space-4);
}

.settings-panel,
.booking-panel,
.scan-panel,
.alerts,
.deals {
  padding: var(--space-4);
}

.nested-panel {
  box-shadow: none;
}

.booking-panel {
  padding: 0;
  overflow: hidden;
}

.booking-preferences summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 13px var(--space-4);
  cursor: pointer;
  color: var(--color-text);
  font-weight: 900;
}

.booking-preferences summary span {
  display: grid;
  gap: 2px;
}

.booking-preferences summary small {
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 750;
  line-height: 1.35;
}

.booking-preferences-body {
  padding: 0 var(--space-4) var(--space-4);
}

.scan-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.section-title p,
.muted {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: var(--font-sm);
}

.subsection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.technical-note {
  color: var(--color-muted-soft);
  font-size: var(--font-xs);
  font-weight: 650;
}

.form-grid {
  display: grid;
  gap: var(--space-3);
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 800;
}

label small {
  color: var(--color-muted-soft);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  height: var(--control-height);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover {
  border-color: #a9bacb;
}

input:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  outline: 0;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--color-text);
  font-size: var(--font-sm);
}

.boxed-check {
  min-height: var(--control-height);
  align-self: end;
  justify-content: center;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
}

.btn {
  display: inline-grid;
  width: 100%;
  min-height: var(--control-height);
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: var(--font-sm);
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  word-break: keep-all;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--color-primary-hover);
}

.btn.secondary {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-primary);
}

.btn.secondary:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.btn.ghost {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--color-primary);
}

.btn.ghost:hover {
  border-color: var(--color-border);
  background: var(--color-surface);
}

.btn.danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn.danger.subtle {
  min-height: 34px;
  border-color: #fed7c7;
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.btn.danger.subtle:hover {
  border-color: var(--color-danger);
  background: #ffe4da;
}

.btn.mini {
  width: auto;
  min-height: 26px;
  padding: 0 9px;
  font-size: var(--font-xs);
}

.scan-now {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.scan-panel > .scan-now {
  margin-bottom: var(--space-3);
}

.advanced-tools {
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}

.advanced-tools summary {
  width: fit-content;
  cursor: pointer;
  color: var(--color-primary);
  font-size: var(--font-sm);
  font-weight: 850;
}

.advanced-tools[open] summary {
  margin-bottom: var(--space-3);
}

.advanced-tools .scan-now:last-of-type {
  margin-bottom: var(--space-4);
}

.scan-now .check-row {
  margin-bottom: 0;
}

.backfill .form-footer {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: var(--space-3);
  align-items: center;
}

.backfill .form-footer .check-row {
  margin-bottom: 0;
}

.info {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--color-blue-soft);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  cursor: help;
}

.api-warning {
  display: none;
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid #facc15;
  border-radius: var(--radius-md);
  background: var(--color-warning-soft);
  color: var(--color-warning);
  font-size: var(--font-sm);
  font-weight: 750;
}

.api-warning.visible {
  display: block;
}

.suggest-field {
  position: relative;
}

.suggest-field > input {
  width: 100%;
}

.suggest-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.suggest-list[hidden] {
  display: none;
}

.suggest-list button {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: 750;
  text-align: left;
}

.suggest-list button:last-child {
  border-bottom: 0;
}

.suggest-list button:hover,
.suggest-list button.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.alerts,
.deals {
  margin-top: var(--space-4);
}

.deals-refresh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding: 8px 10px;
  border: 1px solid #b6e5df;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: var(--font-sm);
  font-weight: 850;
}

.deals-refresh[hidden] {
  display: none;
}

.deals-update-note {
  min-height: 18px;
  margin: -6px 0 var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-xs);
}

.count {
  display: grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: var(--font-lg);
  font-weight: 900;
}

.alert-list,
.deal-list {
  display: grid;
  gap: var(--space-2);
}

.alert-list.is-collapsed .is-extra-alert {
  display: none;
}

.alert-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px var(--space-3);
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.main-alert-card {
  border-color: #b6e5df;
  background: #f3fffd;
}

.alert-main {
  min-width: 0;
}

.edit-alert {
  grid-column: 1 / -1;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.edit-alert summary {
  display: none;
}

.edit-alert[open] summary {
  display: inline-flex;
  margin-bottom: var(--space-2);
  cursor: pointer;
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: 850;
}

.alert-title-row,
.deal-topline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.alert-title-row h3 {
  margin: 0;
  font-size: var(--font-md);
  line-height: 1.2;
}

.alert-card p,
.deal-card p {
  margin-bottom: 0;
  color: var(--color-muted);
}

.alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin: 0 !important;
  color: var(--color-muted) !important;
  font-size: var(--font-xs);
  line-height: 1.35;
}

.alert-meta span:first-child {
  color: var(--color-text);
  font-weight: 850;
}

.chip-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.chip-list span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: var(--font-xs);
  font-weight: 850;
  line-height: 1.25;
  white-space: nowrap;
}

.chip-list span {
  background: var(--color-blue-soft);
  color: #1d4ed8;
}

.badge.success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge.warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge.neutral {
  background: #eef2f7;
  color: var(--color-muted);
}

.alert-controls {
  display: grid;
  grid-template-columns: auto 76px 58px;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.alert-controls form {
  margin: 0;
}

.alert-controls .btn {
  width: 100%;
  min-height: 28px;
  padding-inline: 8px;
  font-size: var(--font-xs);
}

.switch {
  display: inline-flex;
  margin: 0;
}

.switch input {
  display: none;
}

.switch span {
  position: relative;
  display: block;
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease;
}

.switch input:checked + span {
  background: var(--color-primary);
}

.switch input:checked + span::after {
  transform: translateX(14px);
}

.alerts-toggle {
  margin-top: var(--space-2);
  width: 100%;
  justify-content: center;
}

.weekend-alert-shortcut {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-sm);
}

.weekend-alert-shortcut .btn {
  min-height: 32px;
}

.add-alert {
  margin-top: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.add-alert summary {
  cursor: pointer;
  padding: 12px var(--space-4);
  color: var(--color-text);
  font-size: var(--font-lg);
  font-weight: 900;
}

.new-alert {
  padding: 0 var(--space-4) var(--space-3);
}

.compact-form {
  padding: var(--space-3) 0 0;
}

.alert-edit-actions {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(120px, 160px);
  gap: var(--space-2);
}

.alert-form-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) 104px;
  gap: var(--space-3);
  align-items: end;
}

.airport-picker {
  margin: var(--space-3) 0;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.picker-title {
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: 850;
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.picker-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.airport-groups {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.airport-group h4 {
  margin: 0 0 var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 850;
  text-transform: uppercase;
}

.airport-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.airport-options.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.airport-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  margin-bottom: 0;
  padding: 4px 9px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-xs);
  font-weight: 800;
  line-height: 1.2;
}

.deal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.deal-main h3 {
  margin-bottom: 4px;
}

.alert-name {
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: 850;
}

.info-badge {
  background: var(--color-blue-soft);
  color: #1d4ed8;
}

.deal-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: var(--space-4);
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.deal-filters.is-loading {
  opacity: 0.72;
}

.filter-toggle {
  display: none;
  margin-bottom: var(--space-2);
}

.deal-filters label {
  margin-bottom: 0;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.deal-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.deal-fact,
.deal-price {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.deal-facts span {
  display: block;
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 800;
}

.deal-facts strong {
  display: block;
  margin-top: 2px;
  color: var(--color-text);
  font-size: 12.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.deal-price {
  margin: 0;
  padding: 5px 9px;
  border: 1px solid #b6e5df;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
}

.deal-price span {
  display: block;
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 850;
}

.deal-price strong {
  color: var(--color-primary);
  font-size: 15px;
  line-height: 1.2;
}

.deal-price small {
  display: block;
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.25;
}

.deal-price .live-price-line {
  color: var(--color-text);
}

.deal-secondary-facts {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding-top: 7px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 11.5px;
  line-height: 1.3;
}

.deal-secondary-facts span {
  color: var(--color-muted);
  font-size: 11.5px;
  font-weight: 750;
  text-transform: none;
}

.deal-actions {
  display: flex;
  gap: 6px 10px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.deal-actions form {
  margin: 0;
}

.deal-actions .btn,
.deal-actions form {
  width: auto;
}

.deal-actions .btn {
  min-height: 30px;
  padding-inline: 11px;
}

.deal-actions .btn.ghost {
  padding-inline: 2px;
  border-color: transparent;
  background: transparent;
  font-size: var(--font-xs);
}

.route-title {
  margin-bottom: 3px;
  color: var(--color-text);
  font-size: 16.5px;
  line-height: 1.25;
}

.deal-subtitle {
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 750;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.deal-summary {
  margin-top: 3px;
  color: var(--color-text) !important;
  font-size: 12.5px;
  font-weight: 750;
}

.weather-line {
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.weather-line strong {
  color: var(--color-text);
  font-weight: 850;
}

.flight-times {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-top: 5px;
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.35;
}

.flight-times-title {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.flight-time-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
}

.flight-time-row {
  white-space: nowrap;
}

.flight-time-row strong {
  color: var(--color-text);
  font-weight: 850;
}

.flight-time-row.muted {
  color: var(--color-muted);
}

.deal-inline-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin-top: 5px;
  color: var(--color-muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.deal-inline-facts span {
  min-width: 0;
}

.deal-inline-facts strong {
  color: var(--color-text);
  font-weight: 850;
}

.deal-publication {
  margin-top: 6px;
  font-size: 11px;
}

.deal-publication strong {
  color: var(--color-muted);
  font-weight: 750;
}

.source-details {
  margin-top: 5px;
}

.source-details summary {
  display: inline-flex;
  cursor: pointer;
  color: var(--color-primary);
  font-size: var(--font-xs);
  font-weight: 850;
}

.source-details p {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: var(--font-sm);
  white-space: pre-wrap;
}

.source-panel {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.source-message {
  max-height: 150px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-muted);
  font-size: var(--font-xs);
  line-height: 1.45;
  white-space: pre-wrap;
}

.verification-box {
  display: grid;
  gap: var(--space-1);
  margin-top: 0;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.verification-box strong {
  font-size: var(--font-sm);
}

.verification-box p {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: var(--font-xs);
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.verification-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  color: var(--color-muted);
  font-size: var(--font-xs);
}

.verification-details strong {
  color: var(--color-text);
  font-size: var(--font-xs);
}

.action-link {
  overflow-wrap: anywhere;
}

.source-settings {
  margin-bottom: var(--space-3);
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.source-settings.compact-source {
  margin: var(--space-3) 0;
  padding: 8px 10px;
}

.source-settings summary {
  cursor: pointer;
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: 850;
}

.source-settings label {
  margin-top: var(--space-3);
  margin-bottom: 0;
}

.automation-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.automation-controls span {
  display: block;
  color: var(--color-muted);
  font-size: var(--font-xs);
  font-weight: 850;
  text-transform: uppercase;
}

.automation-controls strong {
  font-size: var(--font-lg);
}

.automation-controls .btn {
  width: auto;
  min-width: 92px;
}

.settings-subhead {
  margin: var(--space-3) 0 var(--space-2);
  color: var(--color-text);
  font-size: var(--font-sm);
  font-weight: 900;
}

.deal-side {
  display: grid;
  width: 100%;
  max-width: 280px;
  gap: 7px;
  align-content: start;
  align-self: start;
  justify-self: end;
  padding: 7px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.deal-side .deal-price {
  width: auto;
}

.deal-side .deal-actions {
  display: block;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
}

.deal-side .deal-actions .btn {
  width: auto;
  min-width: 0;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 5px;
  align-items: center;
}

.primary-actions .btn {
  min-height: 26px;
  padding-inline: 7px;
  font-size: 12px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.primary-actions .btn.primary {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 30px;
}

.primary-actions .btn.secondary {
  width: 100%;
  border-color: var(--color-border);
  background: var(--color-surface);
}

.primary-actions form {
  margin: 0;
}

.primary-actions > .more-actions {
  grid-column: 1 / -1;
  justify-self: end;
  margin: 0;
}

.more-actions {
  flex: 0 0 auto;
  position: relative;
}

.more-actions summary {
  display: inline-grid;
  min-height: 22px;
  place-items: center;
  padding: 0 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font-size: 11.5px;
  font-weight: 850;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
}

.more-actions summary::-webkit-details-marker {
  display: none;
}

.more-actions summary:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.more-actions-menu {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  width: max-content;
  min-width: 205px;
  max-width: 260px;
  gap: 5px;
  margin-top: 6px;
  padding: 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.more-actions-menu a,
.more-actions-menu form,
.more-actions-menu button {
  display: block;
  width: 100%;
}

.more-actions-menu a,
.more-actions-menu button {
  min-height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.more-actions-menu a:hover,
.more-actions-menu button:hover {
  text-decoration: underline;
}

.more-actions-separator {
  height: 1px;
  margin: 3px 0;
  background: var(--color-border);
}

.compact-verification {
  padding: 7px;
}

.empty-state {
  padding: var(--space-5);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-wide {
    grid-column: span 1;
  }

  .metric-date {
    grid-column: span 1;
  }

  .control-grid,
  .deal-card {
    grid-template-columns: 1fr;
  }

  .scan-panel {
    grid-column: auto;
    grid-row: auto;
  }

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

  .deal-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .deal-secondary-facts {
    grid-column: span 2;
  }

  .deal-actions {
    grid-column: auto;
    justify-content: flex-start;
  }

  .deal-side {
    justify-self: start;
    max-width: 320px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: var(--space-5);
  }

  .app-header,
  .section-title,
  .scan-now,
  .backfill .form-footer,
  .alert-card {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .header-status {
    min-width: 0;
    max-width: none;
  }

  .metrics,
  .form-grid.two,
  .form-grid.three,
  .alert-form-grid,
  .airport-options,
  .airport-options.compact,
  .deal-filters,
  .filter-actions,
  .deal-actions {
    grid-template-columns: 1fr;
  }

  .filter-toggle {
    display: grid;
    margin-bottom: var(--space-2);
  }

  .deal-filters {
    margin-bottom: var(--space-3);
  }

  .deal-filters:not(.is-expanded) [data-filter-field]:not([data-filter-compact]) {
    display: none;
  }

  .deal-filters.is-expanded {
    border-color: var(--color-border-strong);
  }

  .alert-list.is-collapsed .alert-card:not(:first-child) {
    display: none;
  }

  .alerts-toggle {
    margin-top: var(--space-2);
  }

  .deal-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deal-secondary-facts {
    grid-column: span 2;
  }

  .deal-actions {
    display: flex;
  }

  .deal-actions .btn,
  .deal-actions form {
    width: auto;
  }

  .btn {
    white-space: normal;
  }

  .deal-actions .btn {
    white-space: nowrap;
  }

  .deal-side {
    max-width: none;
  }

  .deal-side .deal-actions {
    display: flex;
    justify-content: flex-start;
  }

  .primary-actions {
    flex-wrap: wrap;
  }

  .more-actions-menu {
    right: auto;
    left: 0;
  }

  .settings-panel,
  .booking-panel,
  .scan-panel,
  .alerts,
  .deals {
    padding: var(--space-4);
  }

  h1 {
    font-size: 24px;
  }
}

/* Ustawienia kalendarza: lista kalendarzy i chipsy haseł */
.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.calendar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border, #dce3ea);
  border-radius: 8px;
  background: var(--surface-2, #f7f9fb);
}

.calendar-row .check-row {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.calendar-row .check-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.chip-editor {
  border: 1px solid var(--border, #dce3ea);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.chip-list:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 10px;
  border-radius: 999px;
  background: #e8f0ec;
  color: #1e4d3b;
  font-size: 0.85rem;
}

.chip-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  color: inherit;
  opacity: 0.6;
}

.chip-remove:hover {
  opacity: 1;
}

.chip-editor [data-chip-input] {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
  padding: 2px 4px;
}
