:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --ink: #18202a;
  --muted: #667085;
  --line: #d9e0e8;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --nav: #18313a;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b45309;
  --good: #057a55;
  --bad: #b42318;
  --warn: #b54708;
  --shadow: 0 18px 45px rgba(20, 36, 48, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

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

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #f59e0b;
  color: #17201f;
  font-weight: 900;
  border-radius: 8px;
}

.brand strong, .brand span {
  display: block;
}

.brand span {
  color: rgba(255,255,255,.72);
  font-size: 12px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button, .ghost, .primary, .secondary, .import-label {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

nav button {
  justify-content: flex-start;
  background: transparent;
  color: rgba(255,255,255,.76);
}

nav button.active, nav button:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.nav-icon {
  width: 24px;
  text-align: center;
  color: #fbbf24;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sync-card {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 10px;
}

.sync-card strong, .sync-card span {
  display: block;
}

.user-card {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 10px;
  color: #fff;
  text-align: left;
  width: 100%;
}

.user-card strong, .user-card span {
  display: block;
}

.user-card-button {
  cursor: pointer;
}

.user-card-button:hover {
  background: rgba(255,255,255,.16);
}

.user-card strong {
  font-size: 14px;
}

.user-card span {
  color: rgba(255,255,255,.7);
  font-size: 12px;
  margin-top: 3px;
}

.sync-card strong {
  font-size: 13px;
}

.sync-card span {
  color: rgba(255,255,255,.7);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.full { width: 100%; }

.main {
  padding: 28px;
  min-width: 0;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef7f5 0%, #f7f5ef 52%, #eef2f7 100%);
}

.auth-panel {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-brand {
  color: var(--ink);
  padding: 0;
  margin-bottom: 22px;
}

.auth-brand span {
  color: var(--muted);
}

.form-error {
  margin: 0;
  color: var(--bad);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.profile-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.profile-list p {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.profile-list strong {
  color: var(--ink);
}

.print-only-source {
  display: none;
}

.itinerary-doc {
  color: #111827;
  background: #fff;
  padding: 30px;
}

.itinerary-doc header {
  border-bottom: 2px solid #111827;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.itinerary-doc h1 {
  font-size: 28px;
}

.itinerary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.itinerary-grid div {
  border: 1px solid #d1d5db;
  padding: 12px;
}

.itinerary-grid span {
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 5px;
}

.itinerary-grid strong {
  font-size: 15px;
}

.itinerary-doc footer {
  margin-top: 22px;
  color: #4b5563;
}

@media print {
  body * {
    visibility: hidden;
  }

  #print-itinerary-view, #print-itinerary-view * {
    visibility: visible;
  }

  #print-itinerary-view {
    display: block;
    position: absolute;
    inset: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .itinerary-doc {
    padding: 18mm;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.page-header p {
  margin: 8px 0 0;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover { background: var(--brand-dark); }

.secondary {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.ghost {
  background: #eef4f7;
  color: #264653;
}

.danger-soft {
  background: #fff1f2;
  color: #be123c;
}

.sidebar .ghost, .sidebar .import-label {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.import-label input { display: none; }

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric, .panel, .band, .item-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(12, 18, 28, .03);
}

.metric {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.metric span, .metric em, small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric strong {
  font-size: 22px;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.panel, .band {
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.form {
  display: grid;
  gap: 14px;
}

.form.slim {
  max-width: 520px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .13);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.steps {
  display: grid;
  gap: 12px;
}

.steps span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th {
  text-align: left;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 12px;
  background: #f6f8fb;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td strong, td small {
  display: block;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.status.done { color: var(--good); background: #ecfdf3; }
.status.warn { color: var(--warn); background: #fffaeb; }
.status.bad { color: var(--bad); background: #fff1f3; }
.status.neutral { color: #475467; background: #f2f4f7; }

.good { color: var(--good); font-weight: 700; }
.bad { color: var(--bad); font-weight: 700; }

.warn-text { color: var(--warn); font-weight: 700; }

.important-label {
  color: var(--bad);
  font-weight: 800;
}

.required-label {
  color: var(--bad);
  font-weight: 800;
}

.profile-suggestions {
  min-height: 34px;
  padding: 8px 0 0;
}

.profile-suggestions small {
  color: var(--muted);
}

.passenger-profile-box {
  grid-column: 2 / -1;
  min-height: 24px;
  padding-top: 0;
}

.dynamic-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.dynamic-row {
  display: grid;
  grid-template-columns: 80px repeat(4, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.passenger-row {
  grid-template-columns: 80px repeat(4, minmax(125px, 1fr)) auto;
}

.dynamic-row:first-child {
  border-top: 0;
}

.dynamic-row strong {
  color: var(--ink);
}

.mini-field {
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.mini-field input,
.mini-field select {
  margin-top: 0;
}

.passenger-date-field {
  grid-column: 2;
}

.refund-row {
  background: #fff7f7;
}

.refund-row td {
  border-bottom-color: #fecdd3;
}

.proof-thumb {
  display: block;
  width: 86px;
  height: 54px;
  object-fit: cover;
  border: 1px solid #d8e0e6;
  border-radius: 6px;
  margin-bottom: 6px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: end;
}

.toolbar.filters label {
  min-width: 150px;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.item-card {
  padding: 16px;
}

.settlement-card.is-canceled {
  border-color: #fecdd3;
  background: #fff7f7;
}

.settlement-card.is-done {
  border-color: #bbf7d0;
  background: #f7fef9;
}

.item-card.wide {
  min-height: 190px;
}

.item-card span, .item-card strong {
  display: block;
}

.item-card span {
  color: var(--muted);
  font-size: 12px;
}

.item-card strong {
  font-size: 18px;
  margin-top: 6px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag-row em {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf7f5;
  color: #155e59;
  font-size: 12px;
  font-style: normal;
}

.action-tags {
  margin-top: 4px;
}

.action-tags button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.template-chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.empty {
  padding: 24px 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 23, 32, .48);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 10;
}

.modal {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal.small {
  width: min(520px, 100%);
}

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

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

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 0;
  background: #f2f4f7;
  font-size: 24px;
  line-height: 1;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #16242b;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.invoice-row-pending td {
  background: #fff0f0;
}

.invoice-row-offset td {
  background: #fff8db;
}

.invoice-row-none td {
  background: #eaf4ff;
}

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .main {
    padding: 18px;
  }

  .page-header {
    display: grid;
  }

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

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