:root {
  --bg: #111418;
  --panel: #1b2027;
  --panel-2: #242a33;
  --text: #eef2f5;
  --muted: #aab4bf;
  --line: #333b46;
  --accent: #2f80ed;
  --ok: #28a36a;
  --paper: #ffffff;
  --ink: #111111;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}
a { color: #82b7ff; text-decoration: none; }
h1, h2, h3 { margin: 0 0 16px; letter-spacing: 0; }
input, select, textarea, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #101318;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
button, .primary {
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  border-radius: 6px;
  padding: 11px 14px;
}
.danger {
  border: 0;
  background: #d14b4b;
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  border-radius: 6px;
  padding: 11px 14px;
}
.inline { display: inline-block; width: auto; }
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.table-actions form {
  margin: 0;
}
.table-actions .inline {
  min-height: 0;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
}
.table-actions .danger {
  background: #d14b4b;
}
.reset-password-form {
  display: flex;
  gap: 6px;
  align-items: center;
}
.reset-password-form input {
  width: 150px;
  min-height: 0;
  padding: 6px 8px;
  font-size: 13px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: #0b0e12;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
}
.brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-align: center;
}
.logo {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
}
.brand-logo {
  display: block;
  width: 130px;
  height: auto;
  object-fit: contain;
}
.brand-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar a {
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
}
.sidebar a:hover { background: var(--panel); }
.app-main { margin-left: 240px; padding: 28px; min-height: 100vh; }
.login-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.login-panel { width: min(460px, 100%); }
.approval-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.danger-form h2 {
  color: #ffd1d1;
}
.login-panel h1 {
  text-align: center;
}
.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.login-brand-logo {
  display: block;
  width: min(100%, 320px);
  height: auto;
  object-fit: contain;
}
.hint, small { color: var(--muted); }
code, pre {
  background: #0f1217;
  color: #eef2f5;
  border: 1px solid var(--line);
  border-radius: 6px;
}
code { padding: 2px 5px; }
pre {
  padding: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
}
.setup-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
}
.setup-box p { margin: 6px 0; }
.flash {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  background: var(--panel-2);
}
.flash.success { border-left: 4px solid var(--ok); }
.flash.error { border-left: 4px solid #e05252; }
.form-grid, .doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.doc-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stats article, .action, .filters a {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.stats span { display: block; font-size: 34px; font-weight: 800; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.calendar-nav a {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
}
.calendar-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-swatch.is-travel-order {
  background: #2f80ed;
}
.legend-swatch.is-trip-ticket {
  background: #27ae60;
}
.calendar-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-weekdays span {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.calendar-cell {
  min-height: 138px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}
.calendar-cell:nth-child(7n) { border-right: 0; }
.calendar-cell.is-muted { background: #161a20; color: #697381; }
.calendar-cell.is-today .calendar-date {
  background: var(--accent);
  color: white;
}
.calendar-date {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.calendar-events {
  display: grid;
  align-content: start;
  gap: 6px;
}
.calendar-event {
  background: rgba(47, 128, 237, 0.16);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--text);
}
.calendar-event.is-travel-order {
  background: rgba(47, 128, 237, 0.16);
  border-left-color: #2f80ed;
}
.calendar-event.is-trip-ticket {
  background: rgba(39, 174, 96, 0.16);
  border-left-color: #27ae60;
}
.calendar-event b,
.calendar-event span {
  display: block;
}
.calendar-event b {
  font-size: 12px;
}
.calendar-event small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #d6e6ff;
}
.calendar-event span {
  font-size: 12px;
  color: var(--muted);
}
.dashboard-lower {
  margin-top: 22px;
}
.upcoming-list {
  display: grid;
  gap: 12px;
}
.upcoming-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
}
.upcoming-card strong {
  font-size: 15px;
}
.upcoming-card span {
  color: var(--muted);
  font-size: 13px;
}
.upcoming-card small,
.upcoming-card em {
  color: var(--muted);
  font-style: normal;
}
.upcoming-card.is-travel-order {
  border-left: 4px solid #2f80ed;
}
.upcoming-card.is-trip-ticket {
  border-left: 4px solid #27ae60;
}
.reports-filter {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.metric-bars {
  display: grid;
  gap: 12px;
}
.metric-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr 50px;
  gap: 12px;
  align-items: center;
}
.metric-label {
  color: var(--text);
  font-size: 14px;
}
.metric-track {
  height: 12px;
  background: #101318;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.metric-fill {
  height: 100%;
  border-radius: 999px;
  background: #2f80ed;
}
.metric-fill.is-travel-order {
  background: #2f80ed;
}
.metric-fill.is-trip-ticket {
  background: #27ae60;
}
.metric-fill.is-status {
  background: #9b7bff;
}
.metric-value {
  text-align: right;
  font-weight: 700;
  color: var(--text);
}
.report-print {
  display: grid;
  gap: 18px;
}
.report-row {
  align-items: start;
}
.report-card,
.report-stats article {
  break-inside: avoid;
  page-break-inside: avoid;
}
.report-table-card table {
  break-inside: auto;
}
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 18px; }
.action { color: var(--text); font-size: 22px; font-weight: 800; min-height: 130px; display: grid; place-items: center; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters a.active { background: var(--accent); color: white; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.toolbar button { width: auto; }
.document {
  background: var(--paper);
  color: var(--ink);
  width: min(100%, 920px);
  margin: 0 auto 20px;
  padding: 34px;
  border-radius: 4px;
  border: 1px solid #d9d9d9;
}
.form-doc { margin-left: 0; }
.document input, .document select, .document textarea {
  background: white;
  color: #111;
  border-color: #777;
}
.document label { color: #111; }
.doc-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  border-bottom: 2px solid #111;
  padding-bottom: 16px;
  margin-bottom: 18px;
}
.doc-header-centered {
  flex-direction: column;
  gap: 14px;
}
.doc-header h2 { font-size: 19px; margin-bottom: 4px; }
.doc-header h3 { font-size: 22px; margin: 0; }
.doc-logo {
  display: block;
  width: 320px;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
}
.document p {
  margin: 0;
  min-height: 42px;
  border-bottom: 1px solid #999;
  padding: 6px 0;
}
.document p b { display: block; font-size: 12px; text-transform: uppercase; }
.document p span { white-space: pre-wrap; }
.checks {
  border: 1px solid #777;
  margin: 16px 0;
  display: grid;
  gap: 8px;
}
.checks label { display: flex; align-items: center; gap: 8px; }
.checks input { width: auto; }
.trip-header h4,
.trip-section h4,
.trip-passenger-box h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}
.trip-topline {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}
.trip-topline label {
  min-width: 220px;
}
.trip-topline-view {
  margin-bottom: 18px;
  font-weight: 700;
}
.trip-section {
  margin-bottom: 18px;
}
.trip-lines,
.trip-fuel-lines {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.trip-lines label,
.trip-fuel-lines label,
.trip-log-grid label {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 12px;
  color: #111;
}
.trip-lines label span,
.trip-fuel-lines label span,
.trip-log-grid label span {
  font-weight: 600;
}
.trip-approval-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: #444;
  text-align: right;
}
.trip-stage-note {
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px dashed #999;
  background: #f7f7f7;
  color: #333;
}
.trip-stage-note-view {
  text-align: center;
}
.panel .trip-lines label,
.panel .trip-fuel-lines label,
.panel .trip-log-grid label,
.panel .trip-lines label span,
.panel .trip-fuel-lines label span,
.panel .trip-log-grid label span {
  color: var(--text);
}
.trip-log-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px 12px;
  margin-top: 10px;
}
.trip-log-grid .unit-field {
  grid-template-columns: 70px minmax(0, 1fr);
}
.trip-log-grid .unit-field input {
  text-align: center;
}
.total-row span {
  text-transform: uppercase;
}
.trip-passenger-box {
  margin: 22px 0 10px;
}
.passenger-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 14px;
}
.passenger-lines div {
  border-bottom: 1px solid #999;
  min-height: 36px;
}
.trip-lines-view,
.trip-log-view {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.trip-lines-view p,
.trip-log-view p {
  min-height: 34px;
}
.certification, .receipt {
  border: 1px solid #111;
  padding: 14px;
  margin-top: 14px;
}
.approval-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.approval-grid div {
  border: 1px solid #111;
  min-height: 120px;
  padding: 10px;
  display: grid;
  gap: 6px;
}
.doc-footer {
  display: flex;
  justify-content: space-between;
  border-top: 2px solid #111;
  margin-top: 20px;
  padding-top: 10px;
  font-weight: 700;
}
.attachments { display: flex; flex-wrap: wrap; gap: 10px; }
.attachments a { background: var(--panel-2); padding: 8px 10px; border-radius: 6px; }
.attachment-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.attachment-card,
.attachment-file {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.attachment-item {
  display: grid;
  gap: 8px;
  align-content: start;
}
.attachment-item form {
  margin: 0;
}
.attachment-card {
  display: grid;
  color: var(--text);
}
.attachment-card img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #0f1217;
}
.attachment-card span,
.attachment-file {
  padding: 10px 12px;
  word-break: break-word;
}
.attachment-file {
  display: block;
  color: #82b7ff;
}
.attachment-file.is-heic {
  display: grid;
  gap: 4px;
  color: var(--text);
}
.attachment-file.is-heic span {
  color: var(--muted);
  font-size: 13px;
}
.print-attachments h2 {
  margin-bottom: 14px;
}

@media (max-width: 860px) {
  body { font-size: 15px; }
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  input, select, textarea, button {
    min-height: 44px;
    font-size: 16px;
  }
  .sidebar {
    position: static;
    width: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
    margin-bottom: 12px;
  }
  .brand-logo { width: 84px; }
  .sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .sidebar a {
    flex: 0 0 auto;
    padding: 9px 11px;
    white-space: nowrap;
    background: var(--panel);
  }
  .app-main { margin-left: 0; padding: 14px; }
  .login-main { padding: 16px; align-items: start; }
  .login-panel, .panel { padding: 16px; border-radius: 8px; }
  .login-brand-logo { width: min(100%, 240px); }
  .two-col,
  .form-grid,
  .doc-grid,
  .doc-grid.four,
  .stats,
  .action-grid,
  .approval-actions,
  .approval-grid,
  .passenger-lines {
    grid-template-columns: 1fr;
  }
  .toolbar,
  .reports-filter,
  .trip-topline,
  .doc-header,
  .doc-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar button,
  .inline {
    width: 100%;
  }
  .stats span { font-size: 28px; }
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  th, td { padding: 10px; }
  .calendar-head { align-items: start; flex-direction: column; }
  .calendar-grid,
  .calendar-weekdays { grid-template-columns: 1fr; }
  .calendar-weekdays { display: none; }
  .calendar-cell {
    min-height: auto;
    border-right: 0;
  }
  .calendar-cell:nth-child(7n) { border-right: 0; }
  .document {
    padding: 18px;
    overflow-x: auto;
  }
  .doc-header { gap: 10px; }
  .doc-logo { width: min(100%, 240px); }
  .trip-lines label,
  .trip-fuel-lines label,
  .trip-log-grid label,
  .trip-log-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }
  .trip-log-grid .unit-field {
    grid-template-columns: 1fr;
  }
  .trip-topline label {
    min-width: 0;
  }
  .trip-approval-note {
    text-align: left;
  }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: white; color: black; }
  .sidebar, .no-print, .flash, body > aside { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .report-print {
    display: block;
    color: black;
  }
  .report-print h1,
  .report-print h2,
  .report-print h3,
  .report-print .metric-label,
  .report-print .metric-value,
  .report-print .hint,
  .report-print small,
  .report-print label {
    color: black !important;
  }
  .report-print .panel,
  .report-print .stats article {
    background: white !important;
    color: black !important;
    border: 1px solid #999 !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px;
  }
  .report-print .report-row {
    display: block;
    margin-top: 0;
  }
  .report-print .report-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-print .report-table-card {
    break-inside: auto;
    page-break-inside: auto;
  }
  .report-print .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 12px;
  }
  .report-print .metric-track {
    background: white;
    border-color: #999;
  }
  .report-print .metric-fill {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .report-print table {
    background: white;
    color: black;
  }
  .report-print th,
  .report-print td {
    color: black;
    border-bottom: 1px solid #999;
  }
  .document {
    width: 100%;
    margin: 0 0 8mm;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .print-attachments {
    display: block !important;
    page-break-before: auto;
    break-before: auto;
    background: white;
    color: black;
    border: 0;
    padding: 0;
    margin: 0;
    min-height: 0;
  }
  .print-attachments:empty { display: none !important; }
  .print-attachments .attachment-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
  }
  .print-attachments .attachment-card,
  .print-attachments .attachment-file {
    background: white;
    color: black;
    border: 1px solid #999;
  }
  .print-attachments .attachment-card img {
    height: 220px;
    object-fit: contain;
    background: white;
  }
  a { color: black; }
}
