:root {
  --blue: #1e73be;
  --blue-dark: #155a96;
  --green: #6ab165;
  --green-dark: #4f914a;
  --ink: #15171a;
  --muted: #65707c;
  --line: #dfe6ee;
  --soft: #f5f8fb;
  --soft-blue: #eaf4ff;
  --warning: #f4b942;
  --danger: #b83232;
  --white: #fff;
  --shadow: 0 14px 38px rgba(21, 42, 68, 0.12);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Nunito", system-ui, sans-serif;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 132px;
  height: auto;
  flex: 0 0 auto;
}

.brand-title {
  display: grid;
  gap: 1px;
}

.brand-title strong {
  font-size: 1.05rem;
  line-height: 1.1;
}

.brand-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tab-button,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  line-height: 1;
}

.tab-button {
  background: transparent;
  color: var(--ink);
}

.tab-button.active {
  background: var(--blue);
  color: var(--white);
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

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

.secondary-button {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

.secondary-button:hover {
  background: var(--green-dark);
}

.ghost-button {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff5f5;
  border-color: #f0c6c6;
  color: var(--danger);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
  font-size: 1.15rem;
}

.main {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar,
.panel,
.summary-panel,
.receipt-drop,
.admin-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(21, 42, 68, 0.04);
}

.sidebar {
  position: sticky;
  top: 96px;
  padding: 18px;
}

.progress {
  display: grid;
  gap: 8px;
}

.step-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 6px;
  color: var(--muted);
}

.step-item.active {
  background: var(--soft-blue);
  color: var(--ink);
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--line);
  color: var(--ink);
  font-weight: 900;
}

.step-item.active .step-number {
  background: var(--blue);
  color: var(--white);
}

.step-item.done .step-number {
  background: var(--green);
  color: var(--white);
}

.panel {
  padding: 26px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--blue);
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 6px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 2.4vw, 2.35rem);
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  line-height: 1.55;
}

.hint,
.small-note {
  color: var(--muted);
  margin: 7px 0 0;
}

.small-note {
  font-size: 0.9rem;
}

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

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #28313b;
  font-weight: 800;
  font-size: 0.93rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cfd9e4;
  border-radius: 6px;
  background: var(--white);
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(30, 115, 190, 0.18);
  border-color: var(--blue);
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

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

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

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 16px;
  background: #fff;
}

.item-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.82rem;
  background: var(--soft-blue);
  color: var(--blue-dark);
}

.pill.green {
  background: #ecf7ec;
  color: #356d31;
}

.pill.yellow {
  background: #fff6dc;
  color: #755407;
}

.pill.red {
  background: #fff0f0;
  color: var(--danger);
}

.receipt-drop {
  padding: 14px;
  display: grid;
  gap: 8px;
  background: #fbfdff;
}

.receipt-drop input {
  border: 0;
  padding: 0;
  min-height: auto;
}

.totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.total-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.total-box span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.total-box strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
}

.summary-panel {
  padding: 18px;
}

.summary-list {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.summary-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.notice {
  border-left: 4px solid var(--warning);
  background: #fff9e8;
  border-radius: 6px;
  padding: 14px 16px;
  margin: 18px 0;
}

.success {
  border-left-color: var(--green);
  background: #f0faf0;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr);
  gap: 18px;
}

.admin-box {
  padding: 18px;
}

.invoice-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.invoice-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: #fff;
  text-align: left;
}

.invoice-row.active {
  border-color: var(--blue);
  background: #f7fbff;
}

.invoice-main strong,
.invoice-main span {
  display: block;
}

.invoice-main span {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.admin-controls {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.detail-block {
  margin-top: 18px;
}

.compensation-review {
  margin: 20px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.compensation-review h4 {
  margin: 0;
  font-size: 1rem;
}

.compensation-review .check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.compensation-review .check-row input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  margin: 3px 0 0;
  accent-color: var(--blue);
}

.compensation-review select {
  white-space: normal;
  min-width: 0;
}

.compensation-review .secondary-button {
  margin-bottom: 16px;
}

.version-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.version-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #fbfdff;
}

.file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-links a {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 32px;
  padding: 6px 10px;
  background: var(--white);
  color: var(--blue-dark);
  font-weight: 800;
}

.empty {
  border: 1px dashed #bdc9d6;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: #fbfdff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.mobile-only {
  display: none;
}

.additional-info { margin-top: 24px; }
.multiline-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.place-control { position: relative; min-width: 0; }
.place-options { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; background: white; border: 1px solid #cbd5e1; border-radius: 4px; box-shadow: 0 6px 18px #0002; max-height: 310px; overflow-y: auto; }
.place-options[hidden] { display: none; }
.place-options button { display: block; width: 100%; padding: 10px 12px; background: white; border: 0; border-bottom: 1px solid #e5e7eb; text-align: left; color: #20252a; cursor: pointer; white-space: normal; overflow-wrap: anywhere; }
.place-options button:hover, .place-options button[aria-selected="true"] { background: #eaf4ff; }
.place-options button strong, .place-options button span { display: block; }
.place-options button span { font-size: 13px; color: #626c76; }
.google-attribution { font: 400 13px Arial, sans-serif; color: #5e5e5e; white-space: nowrap; }
.place-options > .google-attribution { display: block; padding: 8px 12px; text-align: right; }
.place-empty { display: block; padding: 12px; font-size: 14px; color: #626c76; }
.route-stop { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.route-stop .place-control { flex: 1; }
.route-stops { gap: 10px; }
.route-stops > button { align-self: flex-start; }
.route-calculation { padding: 12px 0; gap: 8px; }
.route-error { color: #a32b21; overflow-wrap: anywhere; }
.maps-choice { flex-wrap: wrap; margin-bottom: 16px; font-size: 14px; }
.maps-choice input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.route-calculation .inline-row { flex-wrap: wrap; }
.legal-page { max-width: 760px; margin: 40px auto; padding: 0 20px; line-height: 1.6; }

@media (max-width: 900px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .workspace,
  .summary-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 680px) {
  .main,
  .topbar-inner {
    width: min(100% - 20px, 1180px);
  }

  .brand {
    align-items: flex-start;
  }

  .brand img {
    width: 112px;
  }

  .panel {
    padding: 18px;
  }

  .panel-head,
  .item-card-head,
  .invoice-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid,
  .form-grid.three,
  .totals,
  .progress {
    grid-template-columns: 1fr;
  }

  .summary-line {
    flex-direction: column;
    gap: 4px;
  }
}
