:root {
  --navy: #002b5b;
  --navy-deep: #001a38;
  --navy-soft: #073f76;
  --orange: #ff6600;
  --orange-dark: #d95000;
  --sky: #2ba8ea;
  --paper: #fcfbf8;
  --warm: #f6f1e9;
  --white: #ffffff;
  --ink: #17202d;
  --muted: #5c6675;
  --border: rgba(23, 32, 45, 0.14);
  --shadow: 0 24px 60px rgba(0, 25, 57, 0.14);
  --danger: #a42f27;
  --success: #1f6f4a;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(43, 168, 234, 0.78);
  outline-offset: 3px;
}

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

h1,
h2,
h3 {
  line-height: 1.12;
  letter-spacing: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: var(--navy-deep);
  background: var(--white);
  border-radius: var(--radius);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  display: grid;
  width: min(calc(100% - 40px), 1180px);
  align-items: center;
  gap: 34px;
  padding: 42px 0 30px;
  margin-inline: auto;
  grid-template-columns: 120px minmax(0, 1fr);
}

.app-header img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.app-header h1 {
  max-width: 820px;
  margin-bottom: 16px;
  color: var(--navy-deep);
  font-size: clamp(2.35rem, 5vw, 4.6rem);
}

.app-header p:not(.eyebrow) {
  max-width: 790px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--orange-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.app-shell {
  width: min(calc(100% - 40px), 1180px);
  padding-bottom: 70px;
  margin-inline: auto;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(0, 25, 57, 0.08);
}

.tab {
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  color: var(--navy);
  background: transparent;
  border-radius: 6px;
  font-weight: 800;
}

.tab.is-active {
  color: var(--white);
  background: var(--navy);
}

.tab-panel {
  padding: 38px 0 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin-bottom: 14px;
  color: var(--navy-deep);
  font-size: clamp(2rem, 4vw, 3.25rem);
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
}

.filter-bar,
.entity-form {
  display: grid;
  gap: 16px;
}

.filter-bar {
  align-items: end;
  padding: 20px;
  margin-bottom: 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  grid-template-columns: 1fr 1.2fr auto;
}

label {
  display: grid;
  gap: 7px;
  color: var(--navy-deep);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(0, 43, 91, 0.2);
  color: var(--ink);
  background: #fff;
  border-radius: 6px;
  outline: none;
}

input,
select {
  height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(43, 168, 234, 0.12);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--orange);
  color: var(--white);
  background: var(--orange);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover,
.button:focus-visible {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
  transform: translateY(-1px);
}

.button-secondary {
  color: var(--navy);
  background: var(--white);
  border-color: rgba(0, 43, 91, 0.22);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  color: var(--navy-deep);
  background: #eef7fc;
  border-color: rgba(43, 168, 234, 0.35);
}

.button-danger {
  color: var(--white);
  background: var(--danger);
  border-color: var(--danger);
}

.button-full {
  width: 100%;
}

.notice {
  padding: 18px 20px;
  margin-bottom: 22px;
  background: #eaf6fc;
  border: 1px solid rgba(43, 168, 234, 0.22);
  border-radius: var(--radius);
}

.notice-warning {
  margin-bottom: 0;
  background: #fff8f2;
  border-color: rgba(217, 80, 0, 0.22);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
}

.notice p {
  margin: 0;
  color: var(--muted);
}

.availability-list,
.entity-list {
  display: grid;
  gap: 14px;
}

.departure-card,
.entity-card,
.empty-state {
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 25, 57, 0.07);
}

.departure-card {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.card-title {
  margin-bottom: 8px;
  color: var(--navy-deep);
  font-size: 1.35rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--navy);
  background: #eef7fc;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.pill-warning {
  color: var(--orange-dark);
  background: #fff2e8;
}

.pill-muted {
  color: var(--muted);
  background: #f2f2f2;
}

.operations-toolbar {
  display: grid;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.operations-grid {
  display: grid;
  gap: 22px;
  margin-bottom: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operations-grid-wide {
  align-items: start;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
}

.panel {
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.panel-heading h3 {
  margin-bottom: 0;
  color: var(--navy-deep);
  font-size: 1.55rem;
}

.panel-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.entity-form {
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

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

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.form-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions-wide {
  grid-column: 1 / -1;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.form-status.is-error {
  color: var(--danger);
}

.form-status.is-success {
  color: var(--success);
  font-weight: 800;
}

.entity-card {
  display: grid;
  gap: 14px;
}

.entity-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.entity-card h4 {
  margin: 0 0 6px;
  color: var(--navy-deep);
  font-size: 1.08rem;
}

.entity-card p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.detail-overlay[hidden] {
  display: none;
}

.detail-overlay {
  position: fixed;
  z-index: 900;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 16, 35, 0.72);
}

.detail-card {
  position: relative;
  width: min(100%, 540px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 34px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.32);
}

.detail-card h2 {
  margin-bottom: 12px;
  color: var(--navy-deep);
  font-size: 2rem;
}

.detail-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0 0 22px;
  list-style: none;
}

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.detail-list span {
  color: var(--muted);
}

.detail-list strong {
  color: var(--navy);
  text-align: right;
}

.icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 50%;
  font-size: 1.65rem;
}

@media (max-width: 920px) {
  .app-header,
  .filter-bar,
  .operations-toolbar,
  .operations-grid,
  .operations-grid-wide,
  .departure-card,
  .departure-form {
    grid-template-columns: 1fr;
  }

  .operations-toolbar .button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-header,
  .app-shell {
    width: min(calc(100% - 28px), 1180px);
  }

  .app-header {
    padding-top: 30px;
    grid-template-columns: 1fr;
  }

  .app-header img {
    width: 96px;
    height: 96px;
  }

  .tabs {
    flex-direction: column;
  }

  .panel,
  .departure-card,
  .entity-card,
  .detail-card {
    padding: 20px;
  }

  .detail-list li {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .detail-list strong {
    text-align: left;
  }
}
