:root {
  color-scheme: light;
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #eef5f7;
  --surface-3: #e4eef2;
  --text: #13242d;
  --muted: #60717a;
  --line: rgba(19, 36, 45, .12);
  --accent: #14b8c6;
  --accent-strong: #0f7e8d;
  --sky: #79d9ff;
  --sun: #ffc857;
  --success: #38a169;
  --warn: #d98f10;
  --danger: #d64545;
  --shadow: 0 16px 40px rgba(35, 64, 75, .10);
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(121, 217, 255, .24), rgba(244, 248, 251, 0) 340px),
    linear-gradient(135deg, rgba(255, 200, 87, .14), rgba(20, 184, 198, .06) 42%, rgba(244, 248, 251, 0) 72%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 74px 0 auto;
  height: 120px;
  pointer-events: none;
  background:
    linear-gradient(110deg, transparent 0 15%, rgba(20, 184, 198, .08) 15% 16%, transparent 16% 100%),
    linear-gradient(110deg, transparent 0 67%, rgba(255, 200, 87, .16) 67% 68%, transparent 68% 100%);
}

a {
  color: var(--accent-strong);
}

.topbar {
  min-height: 74px;
  padding: 12px clamp(18px, 3vw, 32px);
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(19, 36, 45, .10);
  box-shadow: 0 10px 30px rgba(35, 64, 75, .08);
  backdrop-filter: blur(18px);
}

.brand {
  min-width: 164px;
}

.brand strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  letter-spacing: .01em;
}

.brand small,
.user-chip span {
  color: #72828a;
  font-size: 11px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #78f0d0, #81d4ff 64%, #ffc857);
  color: #08252c;
  box-shadow: 0 10px 22px rgba(20, 184, 198, .22);
}

.app-nav {
  justify-content: flex-start;
  gap: 2px;
  overflow: visible;
}

.app-nav a {
  color: #50636b;
  border: 1px solid transparent;
  padding: 8px 9px;
  font-size: 12px;
}

.app-nav a:hover {
  color: #0c6470;
  background: rgba(20, 184, 198, .09);
  border-color: rgba(20, 184, 198, .18);
}

.user-chip {
  min-width: 132px;
  color: var(--text);
  font-weight: 850;
  text-align: right;
}

.shell,
.app-shell,
.guest-shell {
  background: transparent;
}

.main {
  padding: clamp(22px, 3vw, 38px);
}

.hero,
.page-head {
  align-items: center;
  margin-bottom: 24px;
}

h1 {
  margin-bottom: 8px;
  color: #102832;
  font-size: clamp(34px, 4vw, 50px);
  letter-spacing: 0;
}

h2 {
  color: #142e38;
  font-size: 20px;
  letter-spacing: 0;
}

p {
  color: var(--muted);
}

.as-of {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 3px 9px;
  border: 1px solid rgba(20, 184, 198, .22);
  border-radius: 8px;
  background: rgba(20, 184, 198, .10);
  color: #0f6470;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.panel,
.stat,
.status {
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(18px, 2.6vw, 26px);
}

.stats {
  gap: 14px;
}

.stat {
  min-height: 104px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 3px solid rgba(20, 184, 198, .78);
  background: linear-gradient(135deg, rgba(121, 217, 255, .18), transparent 42%);
  pointer-events: none;
}

.stat span,
th {
  color: #687b83;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.stat strong {
  position: relative;
  color: #102832;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
}

.actions {
  align-items: center;
}

.primary,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 850;
  line-height: 1;
}

.primary {
  background: linear-gradient(135deg, #15c8d5, #7bddff);
  color: #06232b;
  border: 1px solid rgba(15, 126, 141, .18);
  box-shadow: 0 12px 24px rgba(20, 184, 198, .22);
}

.primary:hover {
  color: #06232b;
  filter: saturate(1.08);
  text-decoration: none;
}

.button,
button {
  background: #ffffff;
  color: #19313b;
  border: 1px solid rgba(19, 36, 45, .14);
  box-shadow: 0 8px 18px rgba(35, 64, 75, .07);
}

.button:hover,
button:hover {
  background: #f0fbfd;
  border-color: rgba(20, 184, 198, .24);
  text-decoration: none;
}

.table-wrap {
  border-radius: 8px;
}

.panel.table-wrap {
  max-height: calc(100vh - 210px);
  overflow: auto;
}

table {
  min-width: 720px;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fbfd;
  border-bottom-color: rgba(19, 36, 45, .18);
}

th,
td {
  padding: 13px 12px;
}

td {
  color: #20343d;
}

tbody tr:nth-child(even) {
  background: rgba(20, 184, 198, .035);
}

tbody tr:hover {
  background: rgba(255, 200, 87, .16);
}

.danger-link {
  color: var(--danger);
}

label {
  color: #536871;
}

input,
select,
textarea {
  min-height: 44px;
  border-radius: 8px;
  border-color: rgba(19, 36, 45, .16);
  background: #ffffff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(121, 217, 255, .55);
  outline-offset: 2px;
  border-color: rgba(20, 184, 198, .75);
}

select option {
  background: #ffffff;
  color: var(--text);
}

.auth.panel {
  width: min(100%, 540px);
  padding: clamp(24px, 4vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .88)),
    linear-gradient(135deg, rgba(121, 217, 255, .28), rgba(255, 200, 87, .18));
}

.auth h1 {
  font-size: clamp(34px, 5vw, 48px);
}

.status {
  border-left-width: 4px;
  background: rgba(255, 255, 255, .82);
}

.status strong {
  display: block;
  color: #142e38;
  font-size: 15px;
}

.status.warning {
  border-left-color: var(--warn);
}

.status.expired {
  border-left-color: var(--danger);
}

.status.missing {
  border-left-color: #8fa0a7;
}

.pill {
  background: #ffe29a;
  color: #392908;
}

.sticky-actions {
  margin-top: 18px;
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(244, 248, 251, 0), rgba(244, 248, 251, .94) 30%);
}

.flash {
  color: #16351f;
  border-color: rgba(56, 161, 105, .24);
  background: rgba(56, 161, 105, .11);
}

.flash.warning {
  color: #4d3308;
  border-color: rgba(217, 143, 16, .28);
}

.flash.error {
  color: #5a1616;
  border-color: rgba(214, 69, 69, .28);
}

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

  .app-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 4px;
    padding-top: 4px;
  }
}

@media (max-width: 900px) {
  .user-chip {
    text-align: left;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px 14px;
  }

  .stats,
  .grid.two,
  .status-grid,
  .form-grid,
  .compact-form {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 34px;
  }

  .hero,
  .page-head {
    align-items: stretch;
  }

  .as-of {
    margin: 8px 0 0;
  }
}

/* Option A: Light Systems dashboard and responsive PWA shell */
:root {
  --option-a-navy: #153044;
  --option-a-teal: #12aaa5;
  --option-a-sky: #59c8f2;
  --option-a-mint: #5ad3a5;
  --option-a-amber: #f4b548;
  --option-a-coral: #ed7a68;
}

html {
  min-width: 320px;
  background: #f5f8fb;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
  background:
    linear-gradient(180deg, rgba(89, 200, 242, .13), transparent 310px),
    #f5f8fb;
}

body::before {
  display: none;
}

.topbar {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: calc(70px + env(safe-area-inset-top));
  padding:
    calc(10px + env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    10px
    max(18px, env(safe-area-inset-left));
  gap: 20px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 6px 22px rgba(25, 53, 72, .07);
}

.brand {
  min-width: 188px;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
}

.app-nav {
  display: flex;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 8px 10px;
  color: #536a78;
  border-radius: 7px;
  font-size: 13px;
}

.app-nav a:hover,
.app-nav a.active {
  color: #0b5961;
  background: #e5f7f7;
  border-color: transparent;
  text-decoration: none;
}

.app-nav a.active {
  box-shadow: inset 0 -2px var(--option-a-teal);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--option-a-navy);
  background: #fff;
  border: 1px solid #d4e0e8;
  font-size: 23px;
  line-height: 1;
  box-shadow: none;
}

.user-chip {
  min-width: 140px;
}

.app-shell > .main {
  width: 100% !important;
  max-width: 1480px !important;
  padding: clamp(24px, 3vw, 42px) !important;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--option-a-teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-hero {
  align-items: flex-end;
  margin-bottom: 20px;
}

.dashboard-hero h1 {
  max-width: 760px;
  margin-bottom: 10px;
  color: var(--option-a-navy);
  font-size: clamp(38px, 5vw, 64px);
  line-height: .98;
}

.dashboard-hero p {
  margin: 0;
  font-size: 16px;
}

.dashboard-hero .as-of {
  margin: 12px 0 0;
}

.dashboard-hero .actions {
  justify-content: flex-end;
}

.dashboard-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 18px;
}

.dashboard-stats .stat {
  min-height: 122px;
}

.dashboard-stats .stat:nth-child(2)::before {
  border-top-color: var(--option-a-mint);
}

.dashboard-stats .stat:nth-child(3)::before {
  border-top-color: var(--option-a-sky);
}

.dashboard-stats .stat:nth-child(4)::before {
  border-top-color: var(--option-a-amber);
}

.dashboard-stats .stat:nth-child(5)::before {
  border-top-color: var(--option-a-coral);
}

.dashboard-stats .stat:nth-child(6)::before {
  border-top-color: #7b8cf5;
}

.dashboard-grid {
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  align-items: start;
  margin-bottom: 24px;
}

.panel-head,
.section-head,
.status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2,
.section-head h2 {
  margin-bottom: 0;
}

.panel-head > a,
.section-head > a {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 850;
}

.currency-panel,
.recent-panel {
  min-height: 100%;
}

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

.status-list .status {
  margin: 0;
  padding: 15px 16px;
  border-left: 0;
  border-top: 1px solid var(--line);
  box-shadow: none;
}

.status-list .status.current {
  border-left: 4px solid var(--success);
}

.status-list .status.warning {
  border-left: 4px solid var(--option-a-amber);
}

.status-list .status.expired {
  border-left: 4px solid var(--danger);
}

.status-list .status.missing {
  border-left: 4px solid #8799a4;
}

.status-head {
  align-items: center;
}

.status-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #256943;
  background: #e8f8ef;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.status.warning .status-badge {
  color: #78520b;
  background: #fff3d7;
}

.status.expired .status-badge {
  color: #8b2929;
  background: #fdeaea;
}

.status.missing .status-badge {
  color: #52636d;
  background: #edf1f4;
}

.status p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-recent-table {
  min-width: 620px;
}

.dashboard-recent-table .route {
  color: #173b4f;
  white-space: nowrap;
}

.experience-section {
  padding-top: 4px;
}

.section-head {
  align-items: flex-end;
  margin-bottom: 14px;
}

.experience-stats {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 0;
}

.experience-stats .stat {
  min-height: 96px;
}

.experience-stats .stat strong {
  font-size: clamp(26px, 3vw, 34px);
}

@media (max-width: 1400px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .app-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .user-chip {
    grid-column: 2;
    grid-row: 1;
  }

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

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

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .nav-toggle {
    display: inline-grid;
    place-items: center;
    grid-column: 2;
    grid-row: 1;
  }

  .app-nav {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid #e1e8ee;
  }

  .app-nav.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .app-nav a {
    justify-content: flex-start;
    min-height: 44px;
    padding: 10px 12px;
  }

  .app-nav a:last-child {
    color: #a33d3d;
  }

  .user-chip {
    display: none !important;
  }

  .dashboard-hero {
    align-items: flex-start;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .currency-panel {
    order: 1;
  }

  .recent-panel {
    order: 2;
  }
}

@media (max-width: 620px) {
  .app-shell > .main {
    padding:
      20px
      max(14px, env(safe-area-inset-right))
      28px
      max(14px, env(safe-area-inset-left)) !important;
  }

  .brand {
    min-width: 0;
  }

  .mark {
    width: 40px;
    height: 40px;
  }

  .dashboard-hero h1 {
    font-size: 39px;
  }

  .dashboard-hero .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .dashboard-hero .actions .primary {
    grid-column: 1 / -1;
  }

  .dashboard-hero .actions a {
    width: 100%;
    min-height: 46px;
  }

  .dashboard-stats,
  .experience-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-stats .stat {
    min-height: 106px;
  }

  .stat {
    padding: 14px;
  }

  .stat strong {
    font-size: 31px;
  }

  .panel {
    padding: 18px 16px;
  }

  .panel-head {
    align-items: flex-end;
  }

  .dashboard-recent-table {
    min-width: 0;
  }

  .dashboard-recent-table thead {
    display: none;
  }

  .dashboard-recent-table,
  .dashboard-recent-table tbody,
  .dashboard-recent-table tr,
  .dashboard-recent-table td {
    display: block;
    width: 100%;
  }

  .dashboard-recent-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    padding: 14px 0;
    border-bottom: 1px solid #e4ebf0;
  }

  .dashboard-recent-table td {
    padding: 0;
    border: 0;
  }

  .dashboard-recent-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #748792;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .dashboard-recent-table td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .dashboard-recent-table td:nth-child(4) {
    text-align: right;
  }

  .dashboard-recent-table td:nth-child(4)::before {
    text-align: right;
  }
}

@media (max-width: 390px) {
  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 10px;
  }

  .dashboard-stats,
  .experience-stats {
    gap: 10px;
  }

  .stat strong {
    font-size: 27px;
  }
}

@media print {
  .nav-toggle {
    display: none !important;
  }
}

/* Pilot Flight Log workbook import */
.import-head {
  max-width: 820px;
}

.import-head p {
  max-width: 720px;
  margin-bottom: 0;
}

.import-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  align-items: start;
  margin-bottom: 18px;
}

.pilot-import-panel,
.batch-panel {
  min-width: 0;
}

.format-pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: #225b65;
  background: #e4f5f7;
  font-size: 11px;
  font-weight: 900;
}

.pilot-log-import {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.file-drop {
  min-height: 132px;
  align-content: center;
  padding: 18px;
  border: 2px dashed #9ccbd2;
  border-radius: 8px;
  color: #294b59;
  background: #f5fbfc;
  cursor: pointer;
}

.file-drop:hover {
  border-color: var(--option-a-teal);
  background: #eefafa;
}

.file-drop input[type="file"] {
  min-height: 46px;
  margin-top: 8px;
  padding: 8px;
  border-style: solid;
  background: #fff;
  cursor: pointer;
}

.file-drop span {
  color: #6a7c85;
  font-size: 12px;
  font-weight: 700;
}

.import-feedback {
  padding: 12px 14px;
  border: 1px solid #d7e2e8;
  border-radius: 8px;
  color: #5c707b;
  background: #f8fafb;
  font-size: 13px;
  line-height: 1.45;
}

.import-feedback.working {
  color: #155b67;
  border-color: #aedce2;
  background: #edf9fa;
}

.import-feedback.success {
  color: #256943;
  border-color: #bfe1cc;
  background: #eef9f2;
}

.import-feedback.error {
  color: #8b2929;
  border-color: #ecc3c3;
  background: #fff2f2;
}

.import-preview {
  overflow: hidden;
  border: 1px solid #dbe5eb;
  border-radius: 8px;
  background: #fff;
}

.import-preview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #dbe5eb;
}

.import-preview-stats div {
  padding: 14px;
  border-right: 1px solid #dbe5eb;
}

.import-preview-stats div:last-child {
  border-right: 0;
}

.import-preview-stats span {
  display: block;
  color: #6c7f89;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.import-preview-stats strong {
  display: block;
  margin-top: 5px;
  color: var(--option-a-navy);
  font-size: 20px;
}

.import-preview table {
  min-width: 620px;
}

.pilot-log-import > .primary {
  width: 100%;
  min-height: 48px;
}

.pilot-log-import > .primary:disabled {
  color: #71818a;
  background: #e3eaee;
  border-color: #d4dde2;
  box-shadow: none;
  cursor: not-allowed;
}

.batch-panel {
  max-height: 700px;
}

.csv-panel {
  margin-top: 0;
}

.csv-panel summary {
  color: var(--option-a-navy);
  font-size: 16px;
  font-weight: 850;
  cursor: pointer;
}

.csv-panel[open] summary {
  margin-bottom: 14px;
}

.compact-import {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

@media (max-width: 980px) {
  .import-grid {
    grid-template-columns: 1fr;
  }

  .batch-panel {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .import-head h1 {
    font-size: 39px;
  }

  .import-preview-stats {
    grid-template-columns: 1fr 1fr;
  }

  .import-preview-stats div {
    border-bottom: 1px solid #dbe5eb;
  }

  .import-preview-stats div:nth-child(2) {
    border-right: 0;
  }

  .import-preview-stats div:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .compact-import {
    grid-template-columns: 1fr;
  }
}
