:root {
  color-scheme: light;
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-soft: #fdfbf6;
  --ink: #1f2933;
  --muted: #687481;
  --line: #d9d6ca;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --coral: #c9553d;
  --amber: #b7791f;
  --green: #2f855a;
  --blue: #2563eb;
  --shadow: 0 18px 42px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button,
label,
select,
input {
  min-width: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px;
  background: #23211d;
  color: #fffaf0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid rgba(255, 250, 240, 0.22);
  background: #c9553d;
  border-radius: 8px;
  font-weight: 800;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.brand-block p,
.source-panel span,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.brand-block p {
  color: rgba(255, 250, 240, 0.68);
}

.view-nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(255, 250, 240, 0.82);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(255, 250, 240, 0.18);
  background: rgba(255, 250, 240, 0.08);
  color: #fffaf0;
}

.source-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 250, 240, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.07);
}

.source-panel strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.source-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: var(--amber);
}

.workspace {
  display: grid;
  gap: 18px;
  align-content: start;
  width: 100%;
  max-width: 1480px;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h2 {
  margin: 3px 0 0;
  font-size: 26px;
  line-height: 1.12;
}

.topbar-actions,
.capture-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  padding: 0 15px;
  color: #ffffff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  text-decoration: none;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: #b9b4a4;
}

.icon-button {
  display: grid;
  width: 40px;
  padding: 0;
  place-items: center;
  background: var(--surface);
  border-color: var(--line);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.control-band,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.field-group,
.form-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  min-height: 230px;
  padding: 12px;
  line-height: 1.4;
}

.view {
  display: none;
  gap: 18px;
}

.view.active {
  display: grid;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid,
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h3 {
  margin: 3px 0 0;
  font-size: 18px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.route-map {
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    #fbfaf4;
  background-size: 28px 28px;
  overflow: hidden;
}

.route-map svg {
  display: block;
  width: 100%;
  height: 340px;
}

.route-label {
  fill: var(--ink);
  font-size: 3px;
  font-weight: 700;
}

.best-list,
.alert-matches,
.alerts-list {
  display: grid;
  gap: 10px;
}

.offer-row,
.alert-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.offer-row-top,
.alert-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offer-title {
  font-weight: 800;
}

.offer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: #f8f6ef;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.source-tag.demo,
.source-tag.manual-demo {
  color: #81580d;
  border-color: #f1d38b;
  background: #fff8df;
}

.source-tag.manual {
  color: #0f5b4e;
  border-color: #a6d9cc;
  background: #e9fbf5;
}

.source-tag.amadeus_live {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.value-good {
  color: var(--green);
  font-weight: 800;
}

.value-mid {
  color: var(--amber);
  font-weight: 800;
}

.value-low {
  color: var(--coral);
  font-weight: 800;
}

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

.form-submit {
  align-self: end;
}

.settings-panel {
  max-width: 880px;
}

.text-link {
  color: var(--teal-dark);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #23211d;
  color: #fffaf0;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .view-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-button {
    text-align: center;
  }

  .control-band,
  .metric-grid,
  .dashboard-grid,
  .split-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .sidebar {
    gap: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .view-nav,
  .control-band,
  .metric-grid,
  .dashboard-grid,
  .split-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .view-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 112px;
    text-align: left;
    white-space: nowrap;
  }

  .route-map,
  .route-map svg {
    min-height: 280px;
    height: 280px;
  }
}
