.system-page:has(#pilot-workspace:not([hidden])) .system-auth-header,
.system-auth:has(#pilot-login[hidden]):has(#pilot-config-notice[hidden]) {
  display: none;
}

.system-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  min-height: 100dvh;
}

.system-sidebar .nav-button[aria-current="page"],
.system-sidebar .nav-button:focus-visible {
  color: #fff;
  background: var(--nav-soft);
  outline: 2px solid #f7c85f;
  outline-offset: 0;
}

.system-workspace {
  min-width: 0;
  padding: clamp(12px, 2vw, 24px);
}

.system-toolbar {
  min-height: 72px;
}

.system-toolbar h1 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
}

.system-view {
  margin-top: 14px;
}

.system-view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.system-view-header h2 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
}

.system-view h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.system-cover {
  min-height: min(70vh, 640px);
  grid-template-columns: minmax(0, .9fr) minmax(0, 1fr);
  padding: clamp(18px, 4vw, 36px);
}

.system-cover .cover-copy h2 {
  max-width: 380px;
  font-size: clamp(1.7rem, 4vw, 2.75rem);
}

.system-cover .cover-card {
  min-height: 92px;
  padding: 12px 16px;
}

.system-cover .cover-card strong {
  font-size: 1.25rem;
}

.system-cover .cover-card span {
  margin-top: 4px;
  font-size: .95rem;
}

.system-metrics {
  flex-wrap: wrap;
  min-height: 0;
  max-width: 100%;
}

.system-metrics span {
  white-space: normal;
}

.system-table-panel {
  display: block;
}

.system-table-heading {
  flex-wrap: wrap;
}

.system-area-switch button {
  min-width: 74px;
  min-height: 44px;
}

.system-area-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent-strong);
}

.system-area-switch button:focus-visible {
  position: relative;
  outline-offset: -3px;
  outline-color: var(--ink);
}

.system-table-panel .legend,
.system-table-map,
.system-table-panel .pilot-message:not(:empty) {
  margin-top: 12px;
}

.system-table-map {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(220px, auto);
  overflow: visible;
  padding: 0;
}

.system-table-map:empty {
  margin-top: 0;
}

.system-table-map .system-table {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #080e12;
  text-align: center;
  overflow-wrap: anywhere;
}

.system-table .table-number {
  font-size: clamp(2rem, 4vw, 3rem);
}

.system-table-status {
  font-weight: 800;
}

.system-table-meta {
  font-size: .875rem;
  font-weight: 650;
}

.system-history-filters {
  grid-template-columns: repeat(2, minmax(0, 190px)) auto;
  justify-content: start;
}

.system-history-filters :is(input, select) {
  min-width: 0;
  width: 100%;
}

.system-history-filters button,
.system-history-table button {
  padding: 8px 14px;
}

.system-history-totals {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.system-history-totals:empty {
  display: none;
}

.system-history-table {
  margin-top: 14px;
}

.system-history-table .data-table {
  min-width: 410px;
}

.system-history-table .data-table :is(th, td):last-child {
  text-align: right;
}

.system-staff-layout {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1.15fr);
  align-items: start;
  gap: 12px;
}

.system-staff-layout .pilot-staff-form {
  max-width: none;
  margin-top: 0;
}

.system-people-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
}

.people-panel .pilot-message:not(:empty) {
  margin-top: 12px;
}

.system-orders-layout {
  margin-top: 0;
}

.system-draft-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #e7f3f1;
  color: var(--ink);
  font-weight: 700;
}

.system-draft-total output {
  font-variant-numeric: tabular-nums;
}

.system-receipt {
  width: min(calc(100% - 24px), 640px);
  max-height: calc(100% - 24px);
  padding: clamp(14px, 4vw, 22px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: auto;
}

.system-receipt::backdrop {
  background: rgba(16, 35, 49, .64);
}

.system-receipt-header,
.system-receipt-footer,
.system-receipt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.system-receipt-header {
  justify-content: space-between;
}

.system-receipt-footer,
.system-receipt-actions {
  justify-content: end;
  margin-top: 12px;
}

.system-receipt :is(.secondary, .primary) {
  padding: 8px 12px;
}

.system-receipt-body {
  min-width: 0;
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.system-receipt-body table {
  width: 100%;
  margin-block: 12px;
  border-collapse: collapse;
}

.system-receipt-body :is(th, td) {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: start;
}

.system-receipt-body :is(th, td):last-child {
  text-align: end;
}

@media (max-width: 1050px) {
  .system-table-map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(190px, auto);
  }
}

@media (max-width: 760px) {
  .system-sidebar {
    display: block;
    min-height: 0;
    padding: 6px 8px;
  }

  .system-sidebar .brand {
    display: flex;
    justify-content: center;
    min-height: 0;
    margin-bottom: 5px;
  }

  .system-sidebar .brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    font-size: 15px;
  }

  .system-sidebar .brand div:last-child {
    display: block;
  }

  .system-sidebar .brand span {
    display: none;
  }

  .system-sidebar .nav-stack {
    grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
    gap: 3px;
  }

  .system-sidebar .nav-button {
    min-height: 46px;
    padding-inline: 2px;
  }

  .system-sidebar .nav-icon {
    font-size: 18px;
  }

  .system-sidebar .nav-button span:last-child {
    font-size: clamp(.65rem, 2.7vw, .75rem);
  }

  .system-cover,
  .system-staff-layout {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .system-cover .cover-copy img {
    width: min(210px, 65%);
    margin-bottom: 12px;
  }

  .system-table-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(138px, auto);
  }
}

@media (max-width: 480px) {
  .system-history-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-history-filters button {
    grid-column: 1 / -1;
  }

  .system-view-header .export-button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    font-size: .9rem;
  }
}

@media print {
  .system-page .system-auth-header,
  .system-page > main,
  .system-receipt::backdrop,
  .system-receipt-header button,
  .system-receipt-actions,
  .system-receipt-footer {
    display: none !important;
  }

  .system-receipt[open] {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
}
