:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --ink: #18202a;
  --muted: #647384;
  --line: #d6dde5;
  --nav: #17212f;
  --nav-ink: #dfe8f2;
  --blue: #2463eb;
  --teal: #0f766e;
  --amber: #b7791f;
  --red: #b42318;
  --green: #137333;
  --shadow: 0 16px 32px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(23, 33, 47, 0.92), rgba(15, 118, 110, 0.72)),
    var(--bg);
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(214, 221, 229, 0.9);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(12, 18, 27, 0.28);
}

.login-panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.login-brand {
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  color: var(--ink);
  border-bottom-color: var(--line);
}

.login-brand span {
  color: var(--muted);
}

.login-brand .avintra-logo {
  width: 176px;
  height: 70px;
}

.login-brand .operator-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}

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

.sidebar {
  background: var(--nav);
  color: var(--nav-ink);
  display: flex;
  flex-direction: column;
  padding: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo,
.operator-logo {
  display: block;
  object-fit: contain;
}

.avintra-logo {
  width: 142px;
  height: 58px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(214, 221, 229, 0.75);
  padding: 2px;
}

.operator-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(214, 221, 229, 0.75);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #9fb0c4;
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 24px;
}

.nav-list a {
  color: #c7d3e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav-list a:hover,
.nav-list a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.operator-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-footer span,
.sidebar-footer strong {
  display: block;
}

.sidebar-footer span {
  color: #9fb0c4;
  font-size: 0.8rem;
}

.workspace {
  padding: 24px;
  display: grid;
  gap: 20px;
}

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

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-user {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.search {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

input[type="file"] {
  padding: 6px 10px;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 180px;
}

.search input {
  min-width: min(320px, 60vw);
}

.compact-control select {
  min-width: 170px;
}

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

.button {
  padding: 8px 13px;
  font-weight: 700;
}

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

.button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.compact-button {
  min-height: 32px;
  padding: 5px 10px;
}

.icon-button {
  width: 38px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 700;
}

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

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

.metric {
  padding: 16px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 2rem;
  line-height: 1;
}

.metric.warning strong {
  color: var(--red);
}

.grid {
  display: grid;
  gap: 20px;
}

.dashboard-home {
  display: grid;
  gap: 20px;
}

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

.dashboard-widgets {
  align-items: start;
}

.profile-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-grid div {
  display: grid;
  grid-template-columns: minmax(88px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.profile-grid div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.profile-grid dt,
.profile-grid dd {
  margin: 0;
}

.profile-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.profile-grid dd {
  color: var(--ink);
  font-weight: 800;
}

.module-card-grid,
.favorite-options,
.history-list {
  display: grid;
  gap: 10px;
}

.module-card,
.history-item,
.favorite-option {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
}

.module-card,
.history-item {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.module-card:hover,
.history-item:hover {
  border-color: var(--teal);
  background: #f1fbf9;
}

.module-card strong,
.module-card span,
.history-item strong,
.history-item span {
  display: block;
}

.module-card span,
.history-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.favorite-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-weight: 800;
}

.favorite-option input {
  min-height: 0;
}

.two-column {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

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

.module-group {
  grid-template-columns: minmax(0, 1fr);
}

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

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

.panel h2 {
  font-size: 1.1rem;
}

.period-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #304153;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td small {
  display: block;
  color: var(--muted);
}

.registry-header {
  align-items: center;
}

.registry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.registry-table {
  min-width: 1040px;
}

.inquiry-form {
  display: grid;
  gap: 14px;
  margin: 14px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

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

.inquiry-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.wide-field {
  grid-column: span 2;
}

.inquiry-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.inquiry-actions span {
  color: var(--muted);
  font-size: 0.86rem;
}

.inquiry-actions div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control-notice {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 700;
}

.parts-table {
  min-width: 1200px;
}

.inventory-table {
  min-width: 1360px;
}

.engineering-table {
  min-width: 1320px;
}

.config-tree-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.45fr);
  gap: 18px;
  align-items: stretch;
}

.aircraft-schematic {
  position: relative;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.94), rgba(245, 249, 255, 0.78) 45%, rgba(236, 244, 255, 0.88) 100%),
    #f8fbff;
}

.aircraft-tree-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 10px 18px;
  object-fit: contain;
  opacity: 0.96;
}

.tree-hotspots {
  position: absolute;
  inset: 0;
}

.tree-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 150px;
  min-height: 78px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(22, 32, 42, 0.1);
  text-align: left;
}

.tree-hotspot:hover,
.tree-hotspot.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 99, 235, 0.16);
}

.tree-hotspot.installed {
  border-color: rgba(19, 115, 51, 0.45);
  background: #f0fbf3;
}

.tree-hotspot strong,
.tree-hotspot span {
  display: block;
}

.tree-hotspot strong {
  font-size: 1.24rem;
  line-height: 1.1;
}

.tree-hotspot span {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-detail {
  border-left: 1px solid var(--line);
  padding: 6px 0 6px 18px;
}

.tree-detail h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.muted-copy {
  color: var(--muted);
  margin: 0 0 10px;
}

.tree-data {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0 0 12px;
}

.tree-data dt {
  color: var(--muted);
  font-weight: 700;
}

.tree-data dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.access-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7f5ea;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.access-pill.locked {
  background: #edf2f7;
  color: var(--muted);
}

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
}

.status.serviceable,
.status.active,
.status.available,
.status.new,
.status.overhauled,
.status.applicable,
.status.complied,
.status.closed,
.status.low {
  color: var(--green);
  background: #e7f5ea;
}

.status.limited,
.status.reserved,
.status.installed,
.status.planned,
.status.partially-applicable,
.status.medium,
.status.recommended,
.status.optional,
.status.information-only {
  color: var(--amber);
  background: #fff4d6;
}

.status.grounded,
.status.overdue,
.status.inactive,
.status.unserviceable,
.status.quarantine,
.status.quarantined,
.status.scrapped,
.status.below-min,
.status.not-applicable,
.status.high,
.status.critical,
.status.mandatory {
  color: var(--red);
  background: #fee4e2;
}

.status.open,
.status.under-review,
.status.engineering-control {
  color: #1d4ed8;
  background: #dbeafe;
}

.status.not-applicable {
  color: var(--muted);
  background: #edf2f7;
}

.chart {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(7, minmax(22px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 12px 4px 0;
  border-bottom: 1px solid var(--line);
}

.bar {
  min-height: 28px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #2f80ed, #0f766e);
  position: relative;
}

.bar span {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.76rem;
}

.aircraft-map {
  margin-top: 44px;
  position: relative;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.12), rgba(36, 99, 235, 0.08)),
    repeating-linear-gradient(135deg, rgba(24, 32, 42, 0.06) 0, rgba(24, 32, 42, 0.06) 1px, transparent 1px, transparent 16px);
}

.runway-line {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 54%;
  border-top: 2px dashed rgba(24, 32, 42, 0.35);
}

.aircraft-symbol {
  position: absolute;
  width: 138px;
  height: 58px;
  left: calc(50% - 69px);
  top: calc(54% - 29px);
}

.aircraft-symbol .body,
.aircraft-symbol .wing {
  position: absolute;
  background: #17212f;
}

.aircraft-symbol .body {
  width: 120px;
  height: 12px;
  left: 9px;
  top: 23px;
  border-radius: 999px;
}

.aircraft-symbol .body::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 8px;
  right: -4px;
  top: 2px;
  background: #17212f;
  transform: skewX(-25deg);
}

.aircraft-symbol .body::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 10px;
  left: 0;
  top: -13px;
  background: #17212f;
  transform: skewX(28deg);
}

.aircraft-symbol .wing {
  width: 58px;
  height: 12px;
  left: 42px;
  border-radius: 4px;
}

.aircraft-symbol .wing-left {
  top: 11px;
  transform: rotate(-22deg);
}

.aircraft-symbol .wing-right {
  top: 36px;
  transform: rotate(22deg);
}

.map-labels {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  color: #304153;
  font-size: 0.78rem;
  font-weight: 700;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-strong);
}

.list-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.list-item strong,
.list-item span,
.list-item small {
  display: block;
}

.list-item span,
.list-item small {
  color: var(--muted);
}

.reliability-board {
  display: grid;
  gap: 10px;
}

.ata-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
}

.ata-code {
  font-weight: 800;
}

.risk-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.risk-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
}

.audit-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.audit-list li {
  padding-left: 4px;
}

.audit-list strong,
.audit-list span {
  display: block;
}

.audit-list span {
  color: var(--muted);
  font-size: 0.86rem;
}

.modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.modal form {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.modal-header,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.modal label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

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

.checkbox-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}

.checkbox-panel legend {
  color: var(--muted);
  font-weight: 700;
  padding: 0 6px;
}

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

.checkbox-option {
  display: grid;
  grid-template-columns: auto minmax(64px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.checkbox-option input {
  min-height: 0;
}

.checkbox-option span {
  color: var(--ink);
  font-weight: 800;
}

.checkbox-option small {
  color: var(--muted);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

.migration-summary {
  min-height: 20px;
  margin: 0;
  color: var(--green);
  font-weight: 800;
}

.migration-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 220px;
  overflow: auto;
  background: var(--surface-strong);
}

.migration-details strong {
  display: block;
  padding: 10px 12px 4px;
}

.migration-details table {
  min-width: 620px;
  font-size: 0.86rem;
}

.migration-details th,
.migration-details td {
  padding: 8px 10px;
}

#aircraftModal,
#publicationModal,
#partModal,
#partMigrationModal,
#stockMigrationModal,
#stockItemModal {
  width: min(760px, calc(100vw - 32px));
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 6px;
}

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

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

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

  .sidebar-footer {
    display: none;
  }

  .two-column,
  .three-column,
  .status-strip,
  .dashboard-grid,
  .config-tree-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar {
    display: grid;
  }

  .topbar-actions,
  .search,
  .search input,
  .compact-control select,
  .button {
    width: 100%;
  }

  .nav-list,
  .two-column,
  .three-column,
  .status-strip,
  .dashboard-grid,
  .config-tree-layout {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
  }

  .registry-actions,
  .form-grid,
  .inquiry-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .inquiry-actions {
    display: grid;
  }

  .inquiry-actions div {
    justify-content: stretch;
  }

  .registry-actions {
    justify-content: stretch;
  }

  .aircraft-schematic {
    min-height: 460px;
  }

  .tree-hotspot {
    width: 118px;
    min-height: 62px;
    padding: 9px 10px;
  }

  .tree-hotspot strong {
    font-size: 1rem;
  }

  .tree-hotspot span {
    font-size: 0.78rem;
  }

  .tree-detail {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 14px 0 0;
  }

  .access-pill {
    justify-content: center;
    width: 100%;
  }

  .map-labels {
    display: none;
  }
}
