:root {
  --brand-900: #8e0404;
  --brand-700: #b81818;
  --brand-100: #f8e9e9;
  --ink-900: #1e1f24;
  --ink-700: #3a3f45;
  --ink-500: #5b6168;
  --ink-300: #9098a2;
  --panel-50: #fcfcfc;
  --panel-100: #f5f6f7;
  --panel-200: #ecedef;
  --panel-300: #d8dbe0;
  --panel-800: #585858;
  --panel-900: #4a4a4a;
  --accent-blue: #1f6feb;
  --accent-green: #2baa66;
  --accent-amber: #d6922d;
  --accent-purple: #7a2ba7;
  --radius-card: 10px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-header: 0 1px 0 rgba(0, 0, 0, 0.08);
  --shadow-focus: 0 0 0 3px rgba(184, 24, 24, 0.28);
  --font-sans: "Inter", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, "SFMono-Regular", monospace;
  --app-header-gap: 8px;
  --app-header-height: 64px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--panel-50);
  color: var(--ink-900);
  font-family: var(--font-sans);
}

body {
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  width: 90%;
  max-width: 90vw;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 16px;
}

.app-shell {
  width: min(95vw, 2200px);
  margin: 0 auto;
  padding: calc(var(--app-header-height) + var(--app-header-gap) + 32px) 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-header {
  background: var(--brand-900);
  color: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-header);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: min(95vw, 2200px);
  margin: 0 auto;
  z-index: 1000;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 600;
}

.app-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.last-update {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.mode-chip.dev {
  background: rgba(43, 170, 102, 0.18);
  border-color: rgba(43, 170, 102, 0.4);
}

.mode-chip.prod {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

.primary {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--brand-700);
  color: #fff;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.primary:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.refresh-indicator {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--panel-300);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card--heatmap {
  gap: 20px;
}

.heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.heatmap-header__titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.heatmap-header h2 {
  margin: 0;
}

.heatmap-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-500);
  font-weight: 500;
}

.heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.heatmap-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-200);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-700);
}

.heatmap-legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.heatmap-legend__swatch--in-service {
  background: rgba(43, 170, 102, 0.92);
}

.heatmap-legend__swatch--awaiting {
  background: rgba(214, 146, 45, 0.9);
}

.heatmap-legend__swatch--storage {
  background: rgba(31, 111, 235, 0.9);
}

.heatmap-legend__swatch--maintenance {
  background: rgba(122, 43, 167, 0.92);
}

.heatmap-legend__swatch--transition {
  background: rgba(168, 80, 223, 0.9);
}

.heatmap-legend__swatch--aog {
  background: rgba(142, 4, 4, 0.92);
}

.heatmap-legend__swatch--unknown {
  background: rgba(30, 31, 36, 0.95);
}

.fleet-heatmap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.heatmap-empty {
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed var(--panel-300);
  border-radius: 12px;
  background: var(--panel-100);
  color: var(--ink-500);
  font-weight: 500;
}

.heatmap-region {
  background: var(--panel-100);
  border: 1px solid var(--panel-300);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.heatmap-region__title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-weight: 600;
  color: var(--ink-700);
}

.heatmap-region__count {
  font-size: 0.85rem;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.heatmap-operators {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.heatmap-operator {
  flex: 1 1 clamp(260px, 32%, 420px);
  min-width: clamp(240px, 45%, 420px);
  background: #fff;
  border: 1px solid var(--panel-300);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.heatmap-operator__title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
  color: var(--ink-700);
}

.heatmap-operator__count {
  font-size: 0.78rem;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.heatmap-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-flow: dense;
  gap: 12px;
}

.heatmap-tile {
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel-800);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.heatmap-tile:hover:not(.heatmap-tile--disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.heatmap-tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.4);
}

.heatmap-tile--disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.heatmap-tile__line {
  font-size: 0.82rem;
  line-height: 1.25;
}

.heatmap-tile__line--primary {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.heatmap-tile__line--meta {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.heatmap-tile--status-in-service {
  background: rgba(43, 170, 102, 0.92);
}

.heatmap-tile--status-storage {
  background: rgba(31, 111, 235, 0.9);
}

.heatmap-tile--status-aog {
  background: rgba(142, 4, 4, 0.92);
}

.heatmap-tile--status-awaiting,
.heatmap-tile--status-grounded {
  background: rgba(214, 146, 45, 0.9);
  color: var(--ink-900);
}

.heatmap-tile--status-maintenance {
  background: rgba(122, 43, 167, 0.92);
}

.heatmap-tile--status-unknown {
  background: rgba(30, 31, 36, 0.95);
}

.heatmap-tile--status-transition {
  background: rgba(168, 80, 223, 0.9);
}

.admin-card {
  border-left: 4px solid var(--brand-700);
}

.admin-card__header h2 {
  margin-bottom: 4px;
}

.admin-card__header p {
  margin: 0;
  color: var(--ink-500);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#admin-watch-summary,
.admin-watch-summary {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-700);
  background: rgba(31, 111, 235, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
}

#admin-watch-summary[hidden],
.admin-watch-summary[hidden] {
  display: none !important;
}

.admin-task-log {
  background: var(--panel-100);
  border: 1px solid var(--panel-300);
  border-radius: 8px;
  padding: 16px;
  min-height: 80px;
  font-size: 0.9rem;
  color: var(--ink-700);
}

.admin-log__hint {
  margin: 0;
  color: var(--ink-500);
}

.admin-log__error {
  margin: 0;
  color: var(--brand-700);
  font-weight: 600;
}

.admin-log__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-log__item {
  background: #fff;
  border: 1px solid var(--panel-300);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-log__item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.admin-log__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.admin-log__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  background: var(--panel-200);
  color: var(--panel-800);
}

.admin-log__status[data-status="success"],
.admin-log__status[data-status="sent"] {
  background: rgba(43, 170, 102, 0.16);
  color: var(--accent-green);
}

.admin-log__status[data-status="failed"],
.admin-log__status[data-status="error"] {
  background: rgba(184, 24, 24, 0.18);
  color: var(--brand-700);
}

.admin-log__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 16px;
  margin: 0;
}

.admin-log__meta dt {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
}

.admin-log__meta dd {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-700);
  word-break: break-word;
}

.card--table {
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.card h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-900);
}

.card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-500);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.filters__actions {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.filters__actions .primary {
  padding: 10px 18px;
}

.filters input,
.filters select {
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-300);
  background: #fff;
  color: var(--ink-900);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.filters select {
  min-width: 200px;
}

.data-report {
  gap: 20px;
}

.data-report__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.data-report__header h2 {
  margin-bottom: 4px;
}

.data-report__header p {
  color: var(--ink-500);
  font-size: 0.9rem;
}

.data-report__summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--ink-500);
}

.data-report__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.data-report__reliability {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--panel-300);
  border-radius: 12px;
  background: var(--panel-100);
  padding: 16px;
}

.data-report__reliability-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.data-report__reliability-header h3 {
  margin: 0;
}

.data-report__reliability-header p {
  margin: 0;
  color: var(--ink-600);
  font-size: 0.9rem;
}

.data-report__reliability-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.data-report__reliability-item {
  font-size: 0.9rem;
  color: var(--ink-700);
}

.data-report__reliability-item--error {
  color: var(--brand-800);
}

.data-report__reliability-item--warning {
  color: var(--accent-amber-900, #7a4a00);
}

.data-report__reliability-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-report__reliability-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-600);
  font-weight: 500;
}

.data-report__reliability-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--ink-600);
}

.data-report__metric {
  background: var(--panel-100);
  border: 1px solid var(--panel-300);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-report__metric-title {
  font-size: 0.9rem;
  color: var(--ink-500);
  margin: 0;
}

.data-report__metric-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink-900);
}

.data-report__metric-detail {
  font-size: 0.85rem;
  color: var(--ink-500);
  margin: 0;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--brand-700);
  outline: none;
  box-shadow: var(--shadow-focus);
}

.auto-refresh-note {
  font-size: 0.9rem;
  color: var(--ink-500);
  background: var(--panel-100);
  border-radius: 8px;
  padding: 10px 14px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
  font-size: 0.95rem;
  table-layout: auto;
}

.table thead tr {
  background: var(--brand-700);
  color: #fff;
}

.table thead th {
  text-align: center;
  padding: 14px 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  background: var(--brand-700);
  position: sticky;
  top: 0;
  z-index: 5;
}

.table thead th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 32px;
}

.table thead th.sortable::after {
  content: "\2195";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
}

.table thead th.sorted-asc::after {
  content: "\25b2";
}

.table thead th.sorted-desc::after {
  content: "\25bc";
}

.table tbody tr {
  background: #fff;
  border-bottom: 1px solid var(--panel-200);
  transition: background 0.2s ease;
}

.table tbody tr:nth-child(even) {
  background: var(--panel-100);
}

.table tbody tr {
  scroll-margin-top: 96px;
}

.table tbody tr:hover {
  background: rgba(184, 24, 24, 0.08);
}

.table td {
  padding: 16px;
  vertical-align: top;
  color: var(--ink-900);
  text-align: left;
}

.table th.col-msn,
.table td.col-msn,
.table th.col-registration,
.table td.col-registration,
.table th.col-operator,
.table td.col-operator,
.table th.col-owner,
.table td.col-owner,
.table th.col-status,
.table td.col-status,
.table th.col-time,
.table td.col-time,
.table th.col-location,
.table td.col-location,
.table th.col-next-flight,
.table td.col-next-flight,
.table th.col-tam,
.table td.col-tam,
.table th.col-on-watch,
.table td.col-on-watch {
  text-align: center;
}

.table th.col-msn,
.table td.col-msn {
  min-width: 72px;
  max-width: 90px;
}

.table th.col-registration,
.table td.col-registration {
  min-width: 100px;
  max-width: 130px;
}

.table th.col-operator,
.table td.col-operator {
  min-width: 130px;
  max-width: 160px;
}

.table th.col-owner,
.table td.col-owner {
  min-width: 130px;
  max-width: 170px;
}

.table th.col-status,
.table td.col-status {
  min-width: 130px;
  max-width: 170px;
}

.table th.col-time,
.table td.col-time {
  min-width: 110px;
  max-width: 150px;
}

.table th.col-location,
.table td.col-location {
  min-width: 150px;
  max-width: 190px;
}

.table th.col-next-flight,
.table td.col-next-flight {
  min-width: 110px;
  max-width: 140px;
}

.table th.col-tam,
.table td.col-tam {
  min-width: 110px;
  max-width: 150px;
}

.on-watch-toggle {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.registration-stack,
.status-stack,
.time-stack,
.location-stack,
.next-flight-stack,
.tam-stack,
.links-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.registration-stack,
.status-stack,
.time-stack,
.location-stack,
.next-flight-stack,
.tam-stack {
  align-items: center;
  text-align: center;
}

.tam-stack__header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tam-stack__error-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand-700);
  box-shadow: 0 0 0 1px rgba(142, 4, 4, 0.35);
  flex-shrink: 0;
}

.tam-stack--error .tam-stack__error-indicator {
  background: var(--brand-900);
  box-shadow: 0 0 0 1px rgba(142, 4, 4, 0.6);
}

.links-stack {
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.on-watch-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.on-watch-state {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(125, 133, 144, 0.18);
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.on-watch-state--active {
  background: rgba(43, 170, 102, 0.18);
  color: var(--accent-green);
}

.on-watch-state--inactive {
  background: rgba(125, 133, 144, 0.18);
  color: var(--ink-500);
}

.on-watch-meta {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-600);
  max-width: 220px;
}

.on-watch-meta__line {
  display: block;
}

.on-watch-debug {
  width: 100%;
  max-width: 220px;
  font-size: 0.68rem;
  color: var(--ink-700);
  text-align: left;
}

.on-watch-debug summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 2px;
}

.on-watch-debug > pre {
  margin: 0;
  padding: 6px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  overflow: auto;
  max-height: 140px;
  font-family: var(--font-mono, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace);
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-action {
  border: 1px solid var(--panel-300);
  background: var(--panel-100);
  color: var(--ink-700);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.status-action:hover:not(:disabled) {
  background: var(--panel-200);
}

.status-action:disabled,
.status-action[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-action--refresh {
  background: rgba(31, 111, 235, 0.12);
  border-color: rgba(31, 111, 235, 0.4);
  color: var(--accent-blue);
}

.status-action--refresh:hover:not(:disabled) {
  background: rgba(31, 111, 235, 0.2);
}

.comment-stack {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: flex-start;
}

.comment-text-column {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  justify-content: flex-start;
  justify-self: end;
  min-width: 36px;
}

.table td[data-label="Comments"],
.table th[data-sort-key="comments"] {
  min-width: 520px;
}

.table td[data-label="Next flight scheduled"],
.table th[data-sort-key="nextFlight"] {
  text-align: center;
  min-width: 160px;
}

.table td[data-label="Status"],
.table th[data-sort-key="status"] {
  text-align: center;
}

.registration-main {
  font-weight: 600;
  font-size: 1rem;
}

.registration-meta {
  color: var(--ink-500);
  font-size: 0.85rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.status-chip.success {
  background: var(--accent-green);
}

.status-chip.info {
  background: var(--accent-blue);
}

.status-chip.warning {
  background: var(--accent-amber);
  color: #1e1f24;
}

.status-chip.alert {
  background: var(--brand-700);
}

.status-chip.danger {
  background: var(--brand-900);
}

.status-chip.muted {
  background: var(--panel-200);
  color: var(--ink-700);
}

.status-phase {
  font-weight: 600;
  color: var(--ink-700);
}

.status-route,
.status-meta,
.status-error,
.time-meta,
.location-meta,
.tam-meta,
.tam-previous {
  font-size: 0.85rem;
  color: var(--ink-500);
}

.status-reliability {
  margin-top: 8px;
  border-left: 4px solid var(--panel-400);
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.status-reliability__title {
  font-weight: 600;
  margin: 0;
}

.status-reliability__list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-reliability__instruction {
  margin: 0;
  color: var(--ink-600);
}

.status-reliability--warning {
  border-color: var(--accent-amber, #f7b740);
  color: var(--accent-amber-900, #7a4a00);
}

.status-reliability--error {
  border-color: var(--brand-700);
  color: var(--brand-800);
}

.status-error {
  color: var(--brand-700);
}

.time-value {
  font-weight: 600;
}

.time-value.time-value-critical {
  color: var(--brand-800);
}

.location-main {
  font-weight: 500;
}

.next-flight-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--panel-200);
  color: var(--ink-700);
}

.next-flight-chip.next-flight-chip--yes {
  background: rgba(25, 135, 84, 0.18);
  color: var(--accent-green);
}

.next-flight-chip.next-flight-chip--no {
  background: rgba(184, 24, 24, 0.15);
  color: var(--brand-800);
}

.next-flight-meta {
  font-size: 0.82rem;
  color: var(--ink-500);
}

.tam-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-900);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
}

.tam-chip.tam-chip--empty {
  background: var(--panel-200);
  color: var(--ink-700);
}

.tam-chip--status-in-service {
  background: var(--accent-green);
  color: #fff;
}

.tam-chip--status-storage {
  background: var(--accent-blue);
  color: #fff;
}

.tam-chip--status-aog {
  background: var(--brand-900);
  color: #fff;
}

.tam-chip--status-unknown {
  background: var(--ink-900);
  color: #fff;
}

.tam-chip--status-awaiting {
  background: var(--accent-amber);
  color: #1e1f24;
}

.tam-chip--status-transition {
  background: #b78ce5;
  color: #1e1f24;
}

.tam-chip--status-maintenance {
  background: var(--accent-purple);
  color: #fff;
}

.tam-stack.tam-stack--empty {
  min-height: 30px;
}

.tam-select {
  padding: 8px 12px;
  border: 1px solid var(--panel-300);
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ink-700);
}
.tam-select:focus {
  outline: none;
  border-color: var(--brand-700);
  box-shadow: var(--shadow-focus);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--panel-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--brand-700);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

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

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--brand-700);
  background: var(--brand-100);
}

.link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-300);
  background: var(--panel-100);
  color: var(--brand-700);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  min-width: 48px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  line-height: 1;
  will-change: transform;
}

.link-pill:hover {
  background: var(--panel-200);
  border-color: var(--brand-700);
  transform: translateY(-1px);
}

.link-pill[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.links-empty {
  font-size: 0.85rem;
  color: var(--ink-500);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comment-line {
  font-size: 0.92rem;
  color: var(--ink-900);
  line-height: 1.45;
}

.comment-meta {
  font-size: 0.8rem;
  color: var(--ink-500);
}

.dialog-manual-status {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--panel-300);
  border-radius: 10px;
  background: var(--panel-100);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-manual-status__header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialog-manual-status__header p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-500);
}

.dialog-manual-status input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-300);
  font-size: 0.95rem;
  font-family: var(--font-sans);
}

.comment-placeholder {
  font-size: 0.85rem;
  color: var(--ink-500);
}

.note-entry {
  font-size: 0.9rem;
  color: var(--accent-blue);
}

.comment-add {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--panel-300);
  background: #fff;
  color: var(--brand-700);
  font-size: 1.2rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  align-self: flex-end;
}
.comment-add:hover {
  background: var(--panel-100);
  border-color: var(--brand-700);
}

.comment-debug {
  min-width: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-300);
  background: var(--panel-100);
  color: var(--ink-700);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.comment-debug:hover {
  background: var(--panel-200);
  border-color: var(--brand-700);
  transform: translateY(-1px);
}

.comment-debug[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.6;
}

.comment-debug-meta {
  font-size: 0.75rem;
  color: var(--ink-500);
  text-align: center;
}

.flightaware-debug {
  grid-column: 1 / -1;
  background: var(--panel-100);
  border: 1px solid var(--panel-300);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}

.flightaware-debug__header {
  font-size: 0.85rem;
  color: var(--ink-500);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.flightaware-debug__record {
  background: #fff;
  border: 1px solid var(--panel-200);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-700);
}

.flightaware-debug__record pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow: auto;
}

.flightaware-debug__error {
  color: var(--brand-700);
  font-weight: 600;
}

.flightaware-debug__empty {
  color: var(--ink-500);
  font-size: 0.85rem;
}

.dialog-history {
  margin-top: 18px;
  border-top: 1px solid var(--panel-200);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog-history__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.dialog-history__header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dialog-history__header p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-500);
}

.dialog-history__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialog-history__empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-500);
}

.history-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-200);
  background: var(--panel-100);
  position: relative;
}

.history-row__primary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-900);
}

.history-row__meta {
  font-size: 0.78rem;
  color: var(--ink-500);
}

.history-row__delete {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--ink-500);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.history-row__delete:hover {
  color: var(--brand-700);
}

body.modal-open {
  overflow: hidden;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(19, 21, 29, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dialog-backdrop[hidden] {
  display: none !important;
}

.dialog-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  width: min(760px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.dialog-card--wide {
  width: min(960px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0 24px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.dialog-close {
  background: transparent;
  border: none;
  color: var(--ink-500);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.dialog-close:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px 24px;
  overflow-y: auto;
}

.dialog-grid {
  display: grid;
  gap: 16px;
}

.dialog-grid--details {
  margin-top: 4px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dialog-grid--form {
  margin-top: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.dialog-grid--history {
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.dialog-field input,
.dialog-field select,
.dialog-column textarea {
  width: 100%;
}

.dialog-column--primary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-operator-new {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.dialog-field--operator > select {
  width: 100%;
}

@media (max-width: 860px) {
  .dialog-grid--form {
    grid-template-columns: minmax(0, 1fr);
  }
  .dialog-grid--history {
    grid-template-columns: minmax(0, 1fr);
  }
}

.debug-dialog-body {
  padding: 24px;
}

.debug-dialog-content {
  max-height: 70vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-detail__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 24px;
  margin: 0;
}

.status-detail__term {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 0;
}

.status-detail__value {
  font-size: 0.95rem;
  margin: 0;
  color: var(--ink-900);
}

.status-detail__heading {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-500);
}

.status-detail__section {
  padding: 12px;
  background: var(--panel-100);
  border-radius: 10px;
  border: 1px solid var(--panel-200);
}

.status-detail__timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.status-detail__meta {
  font-size: 0.85rem;
  color: var(--ink-500);
}

.status-detail__error {
  padding: 12px;
  background: rgba(184, 24, 24, 0.08);
  border: 1px solid rgba(184, 24, 24, 0.2);
  border-radius: 10px;
  color: var(--brand-700);
  font-weight: 600;
}

.status-detail pre {
  max-height: 320px;
  overflow: auto;
  background: #111;
  color: #eaeaea;
  padding: 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin: 0;
}

.dialog-label {
  font-weight: 600;
  color: var(--ink-700);
}

.dialog-aircraft {
  margin: 0;
  font-weight: 600;
  color: var(--ink-800);
}

#comment-dialog-status,
#comment-dialog-comment {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--panel-300);
  padding: 12px 14px;
  font-size: 1rem;
}

#comment-dialog-comment {
  resize: vertical;
  min-height: 120px;
}

#comment-dialog-status:focus,
#comment-dialog-comment:focus {
  outline: none;
  border-color: var(--brand-700);
  box-shadow: var(--shadow-focus);
}

.dialog-hint {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.9rem;
}

.dialog-error {
  margin: 0;
  color: var(--brand-800);
  font-weight: 600;
  font-size: 0.95rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 24px 24px;
  border-top: 1px solid var(--border-muted);
  background: #fff;
  position: sticky;
  bottom: 0;
  z-index: 1;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-200);
  color: var(--ink-700);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ghost {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.85);
}

.login-shell {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1200;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: rgba(245, 245, 250, 0.96);
  padding: 32px;
  overflow-y: auto;
}

.login-shell[hidden] {
  display: none !important;
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, 100%);
}

.login-card h1 {
  margin: 0;
  font-size: 1.8rem;
}

.login-card p {
  margin: 0;
  color: var(--ink-600);
}

.login-label {
  font-weight: 600;
  color: var(--ink-700);
}

.login-card input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-300);
  font-size: 1rem;
}

.login-card input:focus {
  outline: none;
  border-color: var(--brand-700);
  box-shadow: var(--shadow-focus);
}

.login-card button {
  margin-top: 8px;
}

.login-error {
  min-height: 20px;
  color: var(--brand-700);
  font-weight: 600;
}

.empty-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 999px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 0.9rem;
  font-weight: 600;
}

.error-state {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(142, 4, 4, 0.12);
  border: 1px solid rgba(142, 4, 4, 0.35);
  color: var(--brand-900);
  font-size: 0.85rem;
}

.error-state strong {
  font-weight: 600;
}

.dev-console {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.dev-console.active {
  display: flex;
}

.dev-log-stream {
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--panel-100);
  border: 1px solid var(--panel-300);
}

.dev-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--panel-400);
  background: var(--panel-50);
}

.dev-tools__header h3 {
  margin: 0;
  font-size: 1rem;
}

.dev-tools__header p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--ink-600);
}

.dev-tools__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dev-tools__controls button {
  border-radius: 999px;
  border: 1px solid var(--panel-300);
  background: #fff;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.dev-tools__controls button:hover:not(:disabled) {
  background: var(--panel-200);
}

.dev-tools__controls button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dev-tools__controls button.active {
  background: rgba(31, 111, 235, 0.15);
  border-color: rgba(31, 111, 235, 0.4);
  color: var(--accent-blue);
}

.dev-tools__actions {
  display: flex;
  justify-content: flex-end;
}

.dev-tools__output {
  max-height: 260px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--panel-300);
  background: #fff;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-700);
}

.dev-tools__output pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.dev-tools__output .dev-table-summary {
  font-weight: 600;
  margin-bottom: 8px;
}

.dev-tools__output .dev-table-placeholder {
  color: var(--ink-500);
}

.dev-tools__output .dev-table-error {
  color: var(--brand-800);
  font-weight: 600;
}

.dev-tools__output .dev-table-hint {
  margin-top: 6px;
  color: var(--ink-500);
}

.dev-tools__guide {
  border-top: 1px solid var(--panel-300);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dev-tools__guide h4 {
  margin: 0;
  font-size: 0.95rem;
}

.dev-tools__guide p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-600);
}

.dev-tools__guide ol {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--ink-700);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--panel-200);
  padding: 6px 0;
  color: var(--ink-500);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry time {
  font-family: var(--font-mono);
  color: var(--ink-700);
}

.skeleton-row .skeleton-pill {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(208, 214, 222, 0.2), rgba(208, 214, 222, 0.6), rgba(208, 214, 222, 0.2));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    padding: calc(var(--app-header-height) + var(--app-header-gap) + 24px) 16px 32px;
  }

  .filters input,
  .filters select {
    min-width: 180px;
  }

  .card--table {
    padding: 0 16px 16px;
    max-height: min(calc(100vh - 320px), 620px);
  }
}

@media (max-width: 860px) {
  .card--table {
    padding: 0 12px 12px;
    max-height: none;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    align-self: stretch;
    justify-content: space-between;
  }

  .table {
    min-width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: block;
    margin-bottom: 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--panel-300);
    overflow: hidden;
  }

  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-300);
  }

  .table tbody td:last-child {
    border-bottom: none;
  }

  .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--ink-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 16px;
  }

  .table tbody td > * {
    max-width: 60%;
  }

  .comment-actions {
    flex-direction: row;
    justify-content: flex-start;
  }

  .flightaware-debug {
    max-height: 260px;
  }
}

@media (max-width: 560px) {
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters input,
  .filters select {
    width: 100%;
    min-width: 100%;
  }

  .header-actions {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
}
