/* AeroMainX design tokens — gold + cyan aviation enterprise identity.
   Operational apps load via /tokens.css. Legacy short names alias to these tokens. */

:root {
  /* Brand palette */
  --aeromainx-navy-950: #031425;
  --aeromainx-navy-900: #061b2d;
  --aeromainx-navy-800: #0b2940;
  --aeromainx-gold-700: #9b7217;
  --aeromainx-gold-600: #b88a20;
  --aeromainx-gold-500: #d4af37;
  --aeromainx-gold-400: #e1be55;
  --aeromainx-gold-300: #f0d47a;
  --aeromainx-cyan-600: #078ead;
  --aeromainx-cyan-500: #12afcf;
  --aeromainx-cyan-400: #29c2df;
  --aeromainx-cyan-300: #62d4e8;

  /* Surfaces & typography */
  --surface-primary: #ffffff;
  --surface-secondary: #f6f8fa;
  --surface-tertiary: #edf2f5;
  --text-primary: #10202d;
  --text-secondary: #52616d;
  --text-on-dark: #e8eef2;
  --text-on-dark-muted: #a8c4d0;
  --border-default: #d8e0e6;
  --border-strong: #b8c5ce;

  /* Semantic operational colors — do not replace with brand gold/cyan */
  --status-success: #21725a;
  --status-success-bg: #e7f5ee;
  --status-warning: #c9922e;
  --status-warning-bg: #fbf3e0;
  --status-warning-border: #f1d59a;
  --status-warning-text: #694a06;
  --status-danger: #a83b32;
  --status-danger-bg: #f8e8e8;
  --status-info: #078ead;
  --status-info-bg: #e6f7fb;
  --status-quarantine: #a83b32;
  --status-offline: #a83b32;
  --status-sync-pending: #c9922e;
  --status-sync-conflict: #a83b32;

  /* Shell */
  --shell-sidebar-bg: var(--aeromainx-navy-900);
  --shell-sidebar-hover: var(--aeromainx-navy-800);
  --shell-sidebar-active-bg: var(--aeromainx-navy-800);
  --shell-sidebar-accent: var(--aeromainx-gold-500);
  --shell-header-bg: var(--surface-primary);
  --shell-header-accent: var(--aeromainx-gold-500);
  --shell-appbar-bg: var(--aeromainx-navy-900);

  /* Depth & focus */
  --shadow-sm: 0 1px 2px rgba(3, 20, 37, 0.06);
  --shadow-md: 0 12px 30px rgba(3, 20, 37, 0.09);
  --shadow-lg: 0 24px 48px rgba(3, 20, 37, 0.14);
  --focus-ring-gold: 0 0 0 3px rgba(212, 175, 55, 0.45);
  --focus-ring-cyan: 0 0 0 3px rgba(18, 175, 207, 0.35);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Legacy aliases (propagate globally without touching every reference) */
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --navy: var(--aeromainx-navy-900);
  --blue: var(--aeromainx-cyan-600);
  --cyan: var(--aeromainx-cyan-300);
  --paper: var(--surface-secondary);
  --white: var(--surface-primary);
  --amber: var(--aeromainx-gold-500);
  --red: var(--status-danger);
  --green: var(--status-success);
  --line: var(--border-default);
  --shadow: var(--shadow-md);
  --gold: var(--aeromainx-gold-600);
  --gold-text: var(--aeromainx-navy-950);

  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: var(--surface-secondary);
}

html.locale-am,
html.locale-am body {
  font-family: "Noto Sans Ethiopic", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --amx-theme-ready: 1;
  }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--aeromainx-cyan-600); }
a:hover { color: var(--aeromainx-cyan-500); }

/* Buttons */
.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.72rem 1rem;
  font-weight: 700;
  background: var(--aeromainx-gold-700);
  color: var(--aeromainx-navy-950);
  box-shadow: var(--shadow-sm);
  transition: background 160ms ease, box-shadow 160ms ease;
}
.btn:hover { background: var(--aeromainx-gold-600); }
.btn:active { background: var(--aeromainx-gold-700); }
.btn.secondary {
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  box-shadow: none;
}
.btn.secondary:hover {
  border-color: var(--aeromainx-gold-600);
  background: var(--surface-secondary);
}
.btn.tech,
.btn-cyan {
  background: var(--aeromainx-cyan-600);
  color: var(--surface-primary);
}
.btn.tech:hover,
.btn-cyan:hover { background: var(--aeromainx-cyan-500); }
.btn.danger,
.danger.btn { background: var(--status-danger); color: #fff; }
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-gold);
}

/* Forms */
.field { display: grid; gap: 0.35rem; }
.field label { font-size: 0.8rem; font-weight: 800; color: var(--text-primary); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.72rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-primary);
  color: var(--text-primary);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--aeromainx-gold-600);
  box-shadow: var(--focus-ring-gold);
}
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--surface-tertiary);
  color: var(--text-secondary);
}

/* Cards & panels */
.card,
.panel,
.section,
.metric {
  background: var(--surface-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.muted { color: var(--text-secondary); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 99px;
  background: var(--aeromainx-cyan-300);
  color: var(--aeromainx-navy-950);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-gold {
  background: var(--aeromainx-gold-300);
  color: var(--aeromainx-navy-950);
}
.badge-tech { background: var(--status-info-bg); color: var(--aeromainx-cyan-600); }
.badge-success { background: var(--status-success-bg); color: var(--status-success); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-danger { background: var(--status-danger-bg); color: var(--status-danger); }

/* Operational warnings — semantic amber, not brand gold */
.warning,
.disclaimer {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  border: 1px solid var(--status-warning-border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
}

/* Records / tables */
.record-list { display: grid; }
.record {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-default);
}
.record:last-child { border: 0; }
.record:hover { background: var(--surface-secondary); }
.record strong { display: block; color: var(--text-primary); }
.record small { display: block; color: var(--text-secondary); margin-top: 0.25rem; }
.record.selected,
.record.is-active {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--aeromainx-gold-500);
  padding-left: 0.65rem;
}

.empty {
  color: var(--text-secondary);
  padding: 1.2rem;
  text-align: center;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
}

/* Shared shell — mobile, portal, compact surfaces */
.appbar {
  background: var(--shell-appbar-bg);
  color: var(--text-on-dark);
  padding: 1rem 1.1rem;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--aeromainx-gold-600);
}
.appbar small { display: block; color: var(--text-on-dark-muted); margin-top: 0.2rem; }
.bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  background: var(--surface-primary);
  border-top: 1px solid var(--border-default);
  box-shadow: 0 -4px 16px rgba(3, 20, 37, 0.06);
}
.bottom button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 800;
  min-height: 44px;
}
.bottom button.active { color: var(--aeromainx-gold-700); }
.bottom button:hover { color: var(--aeromainx-cyan-600); }

.hero {
  background: linear-gradient(135deg, var(--aeromainx-navy-900), var(--aeromainx-navy-800));
  color: var(--text-on-dark);
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--aeromainx-gold-500);
}
.hero h1 { font-size: 1.45rem; margin: 0.6rem 0; }

.brand-logo { display: block; height: auto; max-width: 100%; }
.brand-logo--on-dark {
  mix-blend-mode: lighten;
  border-radius: 0;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.35));
}
.brand-logo--hero {
  width: min(100%, 240px);
  margin: 0;
}
.brand-logo--auth {
  width: min(100%, 200px);
  margin: 0;
}
.brand-logo--nav {
  width: min(100%, 168px);
  margin-bottom: 0.35rem;
}
.brand-logo--inline {
  width: 28px;
  height: 28px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.35rem;
  object-fit: contain;
  border-radius: 6px;
}

/* Authentication brand panel */
.auth-brand,
.mobile-logo,
.portal-logo {
  display: grid;
  justify-items: start;
  gap: 0;
  max-width: 34rem;
}
.auth-brand-lockup,
.mobile-logo .auth-brand-lockup,
.portal-logo .auth-brand-lockup {
  display: block;
  line-height: 0;
  margin-bottom: 0.85rem;
}
.auth-brand-lockup::after,
.mobile-logo .auth-brand-lockup::after,
.portal-logo .auth-brand-lockup::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin-top: 1rem;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--aeromainx-gold-500), var(--aeromainx-cyan-500));
}
.auth-slogan {
  display: block;
  margin: 0 0 1rem;
  max-width: 16rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.015em;
  color: var(--aeromainx-gold-300);
}
.auth-lede {
  margin: 0 0 1.5rem;
  max-width: 28rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text-on-dark-muted);
}
/* Approved auth regulatory boundary (glass + gold accent) — locked visual */
.auth-boundary {
  display: grid;
  gap: 0.35rem;
  margin-top: 0;
  padding: 0.95rem 1.05rem;
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-left: 4px solid var(--aeromainx-gold-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(6px);
}
.auth-boundary strong {
  color: var(--text-on-dark);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-boundary span {
  color: var(--text-on-dark-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* AI / digital intelligence surfaces */
.surface-ai,
.panel-ai {
  border: 1px solid rgba(18, 175, 207, 0.25);
  background: linear-gradient(180deg, var(--surface-primary), var(--status-info-bg));
}
.surface-ai .badge,
.panel-ai .badge { background: var(--aeromainx-cyan-300); }
.ai-citation {
  border-left: 3px solid var(--aeromainx-cyan-500);
  padding-left: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}
.ai-abstain {
  border: 1px dashed var(--aeromainx-cyan-600);
  background: var(--status-info-bg);
  color: var(--aeromainx-navy-900);
}

.stack { display: grid; gap: 1rem; }
.loading { opacity: 0.55; pointer-events: none; }
