:root {
  color-scheme: light;
  --navy: #0b1d37;
  --navy-2: #122d50;
  --ink: #15253c;
  --muted: #56677b;
  --line: #e2e8ef;
  --surface: #fff;
  --bg: #f3f5f8;
  --blue: #175a9f;
  --blue-soft: #eaf3ff;
  --green: #1c6047;
  --green-soft: #e6f5ed;
  --red: #a33434;
  --radius: 14px;
  font: 15px/1.48 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
}

button,input,select,textarea {
  font: inherit;
  color: inherit;
}

button,a,input,select,textarea {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--blue);
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .57;
  cursor: wait;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline: 3px solid #318af0;
  outline-offset: 3px;
}

.boot-message {
  padding: 32px;
  color: var(--muted);
}

h1,h2,p {
  margin: 0;
}

h1 {
  font-size: clamp(27px,4.2vw,38px);
  line-height: 1.1;
  letter-spacing: -.035em;
}

h2 {
  font-size: 18px;
  letter-spacing: -.015em;
}

.subtext {
  margin-top: 7px;
  color: var(--muted);
}

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

.numeric {
  font-variant-numeric: tabular-nums;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
  display: inline-block;
}

.icon.small {
  width: 17px;
  height: 17px;
}

.btn,.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  text-decoration: none;
  font-weight: 650;
  white-space: nowrap;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn.primary:hover {
  background: #124c89;
}

.btn:not(.primary):hover,.icon-button:hover {
  background: #f6f8fc;
}

.icon-button {
  width: 44px;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef2f7;
  color: #415369;
  font-weight: 650;
  font-size: 12px;
  white-space: nowrap;
}

.badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warning {
  background: #fff1db;
  color: #805500;
}

.notice {
  border: 1px solid #cbdced;
  border-radius: 10px;
  background: #eff6ff;
  padding: 11px 14px;
  color: #243e5c;
  margin: 0 0 16px;
}

.notice.error {
  background: #fff2f0;
  border-color: #f3c9c4;
  color: #8d2b27;
}

.notice.success {
  background: var(--green-soft);
  border-color: #c4e3d3;
  color: var(--green);
}

.notice[hidden] {
  display: none;
}

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

.sidebar {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 22px;
  letter-spacing: -.04em;
  font-weight: 750;
  text-decoration: none;
}

.brand img {
  width: 37px;
  height: 37px;
  border-radius: 8px;
  display: block;
}

.sidebar .brand {
  margin: 0 9px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  color: #c8d5e7;
  background: none;
  padding: 10px 12px;
  font-weight: 600;
}

.nav-btn:hover {
  background: #183553;
  color: #fff;
}

.nav-btn[aria-current="page"] {
  color: #fff;
  background: #214369;
}

.side-bottom {
  margin-top: auto;
  padding: 0 10px;
  color: #a8bdd7;
  font-size: 13px;
}

.side-bottom strong {
  display: block;
  color: #e6eef8;
  font-weight: 650;
}

.main-panel {
  min-width: 0;
}

.topbar {
  min-height: 70px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 11px clamp(15px,4vw,36px);
}

.topbar .brand {
  display: none;
}

.company-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-weight: 680;
}

.company-picker select {
  min-width: 0;
  max-width: min(56vw,265px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  min-height: 40px;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile {
  position: relative;
}

.profile summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 8px;
  min-height: 42px;
}

.profile summary::-webkit-details-marker {
  display: none;
}

.avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  height: 27px;
  width: 27px;
  background: #e9f1fb;
  color: #184a7b;
  font-size: 12px;
  font-weight: 750;
}

.profile-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 32px #1d345018;
  position: absolute;
  z-index: 4;
  right: 0;
  top: 49px;
  padding: 13px;
  min-width: 185px;
}

.profile-panel p {
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.mobile-nav {
  display: none;
}

.content {
  max-width: 1170px;
  margin: 0 auto;
  padding: 28px clamp(15px,4vw,36px) 44px;
}

.page-head {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 21px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric,.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  min-width: 0;
}

.metric {
  padding: 14px 17px;
}

.metric p {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -.025em;
  margin-top: 4px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 62px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head .subtext {
  font-size: 13px;
  margin-top: 3px;
}

.filter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.filter input {
  max-width: 200px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: #f8fafc;
  color: #516178;
  font-size: 12px;
  font-weight: 700;
}

th,td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

td strong {
  font-weight: 700;
}

.row-action {
  text-align: right;
  width: 1%;
}

.route {
  font-weight: 700;
  white-space: nowrap;
}

.route span {
  color: #7788a0;
  margin: 0 4px;
}

.flight-cards {
  display: none;
}

.empty {
  color: var(--muted);
  padding: 25px 16px;
}

.panel-stack {
  display: grid;
  gap: 16px;
}

.aircraft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(250px,100%),1fr));
  gap: 13px;
}

.aircraft-card {
  padding: 17px;
}

.aircraft-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
  margin-top: 7px;
}

.document-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.document-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.document-list li:last-child {
  border-bottom: 0;
}

.doc-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.doc-text strong {
  display: block;
}

.doc-text span {
  font-size: 13px;
  color: var(--muted);
}

.document-list .numeric {
  font-weight: 700;
}

.receipt-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.receipt-form input {
  flex: 1;
  min-width: min(100%,190px);
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-weight: 620;
  font-size: 13px;
}

.field input,.field textarea,.field select,.filter input {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 450;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

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

.span-two {
  grid-column: 1/-1;
}

.field input[type=checkbox] {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

.check-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

#passenger-fields, .passenger-editor {
  display: grid;
  gap: 8px;
}

.passenger-editor[hidden] {
  display: none;
}

#passenger-fields h3 {
  margin: 0;
  font-size: 1rem;
}

.passenger-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.passenger-search .btn {
  min-height: 44px;
}

.passenger-suggestions, .passenger-selected {
  display: grid;
  gap: 5px;
}

.passenger-suggestions:empty, .passenger-selected:empty, [data-passenger-status]:empty {
  display: none;
}

.passenger-suggestions .btn, .passenger-selected li {
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  overflow-wrap: anywhere;
}

.passenger-suggestions .muted, .passenger-selected .muted {
  display: block;
  font-size: .85rem;
}

.passenger-selected {
  list-style: none;
  margin: 0;
  padding: 0;
}

.passenger-selected li {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.fieldset {
  padding: 0;
  margin: 0;
  border: 0;
  display: grid;
  gap: 12px;
}

.fieldset legend {
  margin-bottom: 8px;
  font-weight: 700;
}

.dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0;
  width: min(100% - 22px,565px);
  max-height: calc(100dvh - 22px);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 20px 70px #08192c45;
}

.dialog::backdrop {
  background: #091c36a8;
}

.dialog-header,.dialog-footer {
  padding: 14px 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.dialog-header {
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  padding: 15px 17px;
}

.dialog-footer {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.dialog-body .notice {
  margin-bottom: 13px;
}

.dialog-body h3 {
  margin: 9px 0 0;
  font-size: 15px;
}

.dialog-body .fields + .fields {
  margin-top: 12px;
}

.login {
  min-height: 100dvh;
  background: var(--navy);
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-box {
  width: min(100%,435px);
  padding: 28px 25px;
  border-radius: 18px;
  background: #fff;
}

.login-box .brand {
  color: var(--ink);
  margin-bottom: 22px;
}

.login-box h1 {
  font-size: 30px;
}

.login-box form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-box .btn {
  width: 100%;
}

.login-box .notice {
  margin: 12px 0 0;
}

.login-box a {
  display: inline-block;
  margin-top: 15px;
}

.login-box .subtext {
  margin-bottom: 12px;
}

.login-box form .subtext {
  margin: 0;
}

.text-button {
  justify-self: start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 620;
  text-align: left;
}

.setup-exit {
  margin-top: 10px;
}

.agreement-box {
  width: min(100%,570px);
}

.agreement-text {
  max-height: min(40dvh, 380px);
  overflow: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agreement-text:focus-visible {
  outline: 3px solid #318af0;
  outline-offset: 3px;
}

.agreement-box .check-field {
  align-items: start;
  gap: 10px;
}

.agreement-box .check-field input {
  flex: none;
  margin-top: 1px;
}

@media(max-width:760px) {
  .shell {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .topbar {
    min-height: 60px;
    padding: 8px 14px;
    gap: 10px;
  }
  .topbar .brand {
    display: flex;
    color: var(--ink);
    font-size: 19px;
    gap: 7px;
  }
  .topbar .brand img {
    width: 29px;
    height: 29px;
  }
  .company-picker {
    flex: 1;
    justify-content: flex-end;
  }
  .company-picker>.icon {
    display: none;
  }
  .company-picker select {
    font-size: 13px;
    max-width: min(43vw,225px);
    min-height: 39px;
  }
  .top-controls {
    gap: 4px;
  }
  .profile summary {
    padding: 5px;
    min-height: 39px;
  }
  .profile-label {
    display: none;
  }
  .content {
    padding: 22px 14px calc(86px + env(safe-area-inset-bottom));
  }
  .mobile-nav {
    display: flex;
    justify-content: space-around;
    gap: 3px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 6px 8px max(7px,env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .mobile-nav .nav-btn {
    flex: 1;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    color: var(--muted);
    min-height: 48px;
    font-size: 12px;
    padding: 4px;
  }
  .mobile-nav .nav-btn[aria-current="page"] {
    background: var(--blue-soft);
    color: #124b88;
  }
  .metrics {
    gap: 7px;
  }
  .metric {
    padding: 10px;
  }
  .metric p {
    font-size: 11px;
  }
  .metric strong {
    font-size: 20px;
  }
  .page-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 15px;
  }
  .page-actions .btn {
    padding: 8px 10px;
    font-size: 13px;
  }
  .flight-table {
    display: none;
  }
  .flight-cards {
    display: block;
  }
  .flight-card {
    width: 100%;
    text-align: left;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 4px 10px;
    background: #fff;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 11px 13px;
    min-height: 62px;
  }
  .flight-card:last-child {
    border-bottom: 0;
  }
  .flight-card .meta {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  .flight-card .end {
    text-align: right;
  }
  .panel-head {
    padding: 10px 13px;
  }
  .filter input {
    max-width: 145px;
  }
  .receipt-form,.document-list li {
    padding: 11px 13px;
  }
}

@media(max-width:370px) {
  .topbar .brand span {
    display: none;
  }
  .company-picker select {
    max-width: 58vw;
  }
  .metrics .metric {
    padding: 8px;
  }
  .fields {
    gap: 9px;
  }
  .dialog-body,.dialog-header,.dialog-footer {
    padding-left: 12px;
    padding-right: 12px;
  }
  .page-actions .btn .icon {
    display: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

[hidden] {
  display: none!important;
}

#meter-fields:not(:empty) h3 {
  margin: 0 0 7px;
}

#receipt-status:empty {
  display: none;
}

.invoice-dialog {
  width: min(100% - 22px,720px);
}

.invoice-paper {
  padding: 22px clamp(14px,4vw,27px);
}

.invoice-heading,.invoice-parties {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.invoice-heading h2 {
  font-size: 26px;
}

.invoice-heading p {
  color: var(--muted);
  margin-top: 3px;
}

.invoice-heading .badge {
  align-self: flex-start;
}

.invoice-party {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.invoice-party p,.invoice-notes {
  white-space: pre-wrap;
}

.invoice-paper h3 {
  font-size: 14px;
  margin: 13px 0 5px;
}

.invoice-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.invoice-lines li,.invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.invoice-lines .numeric,.invoice-totals dd {
  flex: none;
  margin: 0;
}

.invoice-totals {
  max-width: 260px;
  margin: 15px 0 15px auto;
}

.invoice-totals .grand-total {
  font-weight: 750;
  font-size: 17px;
  border-bottom: 0;
}

.invoice-receipts ul {
  margin: 0;
  padding-left: 17px;
}

@media print {
  body {
    background: #fff;
  }
  #app {
    display: none;
  }
  body>dialog.invoice-dialog[open] {
    position: static;
    display: block;
    width: 100%;
    max-width: none;
    max-height: none;
    border: none;
    box-shadow: none;
    margin: 0;
    overflow: visible;
  }
  .invoice-controls,.invoice-receipts {
    display: none;
  }
  .invoice-paper {
    padding: 0;
  }
  .invoice-paper h3 {
    break-after: avoid;
  }
  .invoice-party,.invoice-lines li,.invoice-totals {
    break-inside: avoid;
  }
}
