:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #101d2e;
  --panel-2: #14263a;
  --text: #edf6ff;
  --muted: #9fb3c8;
  --line: rgba(255,255,255,.11);
  --accent: #6ee7ff;
  --accent-2: #8bdc9b;
  --warn: #ffd166;
  --danger: #ff7a7a;
  --shadow: 0 18px 45px rgba(0,0,0,.24);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(110,231,255,.12), transparent 28rem), var(--bg);
  color: var(--text);
  letter-spacing: 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(7,17,31,.82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand small, .user-chip span { display: block; color: var(--muted); font-size: 12px; }
.mark {
  width: 42px; height: 42px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6ee7ff, #8bdc9b);
  color: #07111f; font-weight: 900;
}
.shell { display: grid; min-height: calc(100vh - 72px); }
.app-shell { grid-template-columns: 240px 1fr; }
.guest-shell { grid-template-columns: minmax(0, 1fr); }
.sidebar {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(10,25,42,.64);
}
.sidebar a {
  display: block;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.sidebar a:hover { color: var(--text); background: rgba(255,255,255,.06); text-decoration: none; }
.main { width: 100%; max-width: 1360px; padding: clamp(18px, 4vw, 34px); }
.guest-shell .main {
 max-width: 760px;
 justify-self: center;
 align-self: center;
}
.solo { max-width: 760px; margin: auto; }
.hero, .page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
h1, h2 { margin: 0 0 12px; line-height: 1.05; }
h1 { font-size: clamp(32px, 5vw, 58px); }
h2 { font-size: 22px; }
p { color: var(--muted); line-height: 1.55; }
.panel, .stat, .status {
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: clamp(16px, 3vw, 24px); }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat { padding: 16px; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { font-size: clamp(28px, 4vw, 46px); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .button, button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 11px 15px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.primary { background: var(--accent); color: #07111f; }
.button, button { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.danger-link { color: var(--danger); }
.flash {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: rgba(139,220,155,.12);
}
.flash.error { background: rgba(255,122,122,.14); }
.flash.warning { background: rgba(255,209,102,.14); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
textarea { resize: vertical; }
.form-grid, .compact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.compact-form button, .compact-form textarea, .compact-form .checks { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.flight-checks { margin: 14px 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.checks label { display: flex; align-items: center; gap: 8px; }
.checks input { width: auto; min-height: auto; }
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(7,17,31,.9);
  padding: 14px 0 0;
  display: flex;
  gap: 10px;
}
.status { padding: 14px; margin-bottom: 10px; border-left: 4px solid var(--accent-2); }
.status.warning { border-left-color: var(--warn); }
.status.expired { border-left-color: var(--danger); }
.status.missing { border-left-color: var(--muted); }
.status p { margin: 6px 0 0; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.status.big { margin: 0; min-height: 120px; }
.pill { display: inline-block; color: #07111f; background: var(--warn); border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800; }
.auth { width: min(100%, 560px); margin: 0 auto; }
.auth form { display: grid; gap: 14px; }
.auth .primary { width: 100%; }
blockquote { margin: 0 0 16px; color: var(--text); border-left: 3px solid var(--accent); padding-left: 14px; }
.signature-pad { width: 100%; max-width: 100%; height: 220px; background: #f8fafc; border-radius: 8px; touch-action: none; }
.nav-toggle { display: none; }

@media (prefers-color-scheme: light) {
  body.light {
    --bg: #eef5fb;
    --panel: #ffffff;
    --panel-2: #e7eef6;
    --text: #102033;
    --muted: #53657a;
    --line: rgba(16,32,51,.14);
  }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 30;
    top: 72px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 72px);
    overflow: auto;
  }
  .sidebar.open { display: block; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .user-chip { display: none; }
  .hero, .page-head { flex-direction: column; }
  .grid.two, .stats, .status-grid, .form-grid, .compact-form { grid-template-columns: 1fr; }
  .flight-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 36px; }
}

@media print {
  .topbar, .sidebar, .actions, .button, .primary, .sticky-actions { display: none !important; }
  body { background: #fff; color: #111; }
  .shell { display: block; }
  .main { max-width: none; padding: 0; }
  .panel, .stat, .status { box-shadow: none; border-color: #ddd; }
}

/* Desktop app layout hotfix 2026-07-01 */
@media screen and (min-width: 761px) {
 .app-shell {
   display: grid !important;
    grid-template-columns: 220px minmax(0, 1fr) !important;
    align-items: start !important;
  }
 .app-shell > .sidebar {
   display: block !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 220px !important;
    min-height: calc(100vh - 72px) !important;
    position: sticky !important;
    top: 72px !important;
  }
 .app-shell > .main {
   grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    max-width: 1360px !important;
  }
}
@media screen and (max-width: 760px) {
 .app-shell { grid-template-columns: 1fr !important; }
 .app-shell > .main { grid-column: 1 !important; grid-row: 1 !important; }
}
