:root {
  --ink: #18313b;
  --ink-soft: #526871;
  --navy: #12394a;
  --navy-deep: #0c2a37;
  --teal: #2a7f7a;
  --teal-soft: #dff2ef;
  --orange: #d96b34;
  --orange-soft: #fff0e8;
  --surface: #ffffff;
  --surface-alt: #f3f7f7;
  --line: #d9e3e5;
  --danger: #9e342d;
  --danger-bg: #fff0ee;
  --notice: #215f5b;
  --notice-bg: #e8f7f5;
  --shadow: 0 18px 50px rgba(17, 53, 66, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface-alt);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(42, 127, 122, 0.09), transparent 30rem),
    var(--surface-alt);
}

a {
  color: inherit;
}

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

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
}

.eyebrow {
  margin-bottom: 0.55rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: var(--teal);
}

.muted {
  color: var(--ink-soft);
  line-height: 1.55;
}

.fine-print {
  margin: 1.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.panel {
  border: 1px solid rgba(18, 57, 74, 0.08);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.signin-shell {
  display: grid;
  min-height: 100vh;
}

.hero-card {
  position: relative;
  display: flex;
  min-height: 45vh;
  align-items: flex-end;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(8, 35, 46, 0.2), rgba(8, 35, 46, 0.6)),
    var(--hero-image) center / cover no-repeat;
  color: #fff;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 35, 46, 0.93), rgba(8, 35, 46, 0.08) 65%);
}

.hero-content {
  position: relative;
  width: min(100%, 700px);
  padding: 2rem 1.35rem 2.4rem;
}

.brand-mark,
.app-brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--orange);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(217, 107, 52, 0.35);
}

.hero-content .brand-mark {
  margin-bottom: 1.25rem;
}

.hero-content h1 {
  margin-bottom: 0.8rem;
  font-size: clamp(3rem, 12vw, 5.6rem);
}

.hero-copy {
  max-width: 38rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
  line-height: 1.6;
}

.signin-card {
  align-self: center;
  padding: 2rem 1.35rem 2.5rem;
  background: var(--surface);
}

.stack-form {
  display: grid;
  gap: 0.8rem;
}

.stack-form > div,
.stack-form > fieldset {
  display: grid;
  gap: 0.7rem;
}

label,
legend {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
}

legend span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #bfd0d4;
  border-radius: var(--radius-sm);
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input,
select {
  min-height: 50px;
  padding: 0 0.9rem;
}

textarea {
  min-height: 130px;
  padding: 0.85rem 0.9rem;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(42, 127, 122, 0.14);
}

.primary-button,
.card-action,
.text-button,
.account-popover button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  margin-top: 0.3rem;
  padding: 0.8rem 1.15rem;
  border-radius: 13px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(18, 57, 74, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--navy-deep);
  transform: translateY(-1px);
}

.inline-button {
  width: fit-content;
}

.text-button {
  padding: 0.55rem 0;
  background: transparent;
  color: var(--teal);
  font-weight: 750;
}

.secondary-form {
  margin-top: 0.4rem;
  text-align: center;
}

.message {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.message.error {
  border: 1px solid rgba(158, 52, 45, 0.22);
  background: var(--danger-bg);
  color: var(--danger);
}

.message.notice {
  border: 1px solid rgba(33, 95, 91, 0.15);
  background: var(--notice-bg);
  color: var(--notice);
}

.narrow-page,
.narrow-app-page {
  width: min(100% - 2rem, 720px);
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.auth-panel,
.form-panel {
  padding: 1.5rem;
}

.mail-icon,
.empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 16px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 1.4rem;
  font-weight: 900;
}

.code-input {
  text-align: center;
  font-size: 1.7rem;
  font-weight: 850;
  letter-spacing: 0.28em;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 70px;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(18, 57, 74, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 900;
  text-decoration: none;
}

.app-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

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

.account-popover {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  display: grid;
  width: min(290px, calc(100vw - 2rem));
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow);
}

.account-popover small {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
}

.account-popover form {
  margin-top: 0.75rem;
}

.account-popover button {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 750;
}

.app-main {
  width: min(100% - 1.25rem, var(--max));
  margin: 0 auto;
  padding: 1.25rem 0 6.5rem;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.welcome-row h1 {
  margin-bottom: 0.35rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  display: flex;
  min-height: 76px;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 0.65rem 0.7rem;
  border: 1px solid rgba(18, 57, 74, 0.08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(17, 53, 66, 0.05);
}

.summary-number {
  overflow: hidden;
  color: var(--navy);
  font-size: clamp(1.05rem, 3.5vw, 1.7rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card.cost-card .summary-number {
  font-size: clamp(0.92rem, 3vw, 1.45rem);
}

.summary-label {
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.15;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem 0 0.7rem;
}

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

.vehicle-grid {
  display: grid;
  gap: 0.7rem;
}

.vehicle-card {
  overflow: hidden;
  border: 1px solid rgba(18, 57, 74, 0.09);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(17, 53, 66, 0.06);
}

.vehicle-card-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  text-decoration: none;
}

.vehicle-icon,
.vehicle-hero-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--orange-soft);
  font-size: 1.2rem;
}

.vehicle-card-copy h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.vehicle-card-copy .eyebrow {
  margin-bottom: 0.15rem;
  font-size: 0.61rem;
}

.vehicle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.65rem;
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.vehicle-cost {
  color: var(--teal);
  font-weight: 800;
}

.chevron {
  color: #8ca0a7;
  font-size: 1.6rem;
  line-height: 1;
}

.vehicle-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--line);
  background: #fbfdfd;
}

.vehicle-card-details > div {
  display: grid;
  gap: 0.15rem;
}

.detail-label {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vehicle-card-details strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.vehicle-card-details small {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.card-action {
  display: block;
  padding: 0.6rem 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
}

.empty-state {
  padding: 2rem;
  text-align: center;
}

.empty-state .empty-icon {
  margin-right: auto;
  margin-left: auto;
}

.bottom-nav {
  position: fixed;
  z-index: 15;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0.45rem max(0.5rem, env(safe-area-inset-right)) calc(0.45rem + env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
  border-top: 1px solid rgba(18, 57, 74, 0.1);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.bottom-nav a,
.bottom-nav > span {
  display: grid;
  min-height: 52px;
  place-items: center;
  align-content: center;
  gap: 0.1rem;
  border-radius: 11px;
  color: #71868e;
  text-decoration: none;
}

.bottom-nav a.active {
  background: var(--teal-soft);
  color: var(--teal);
}

.bottom-nav span:first-child,
.bottom-nav a span {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-nav small {
  font-size: 0.68rem;
  font-weight: 750;
}

.bottom-nav .disabled {
  opacity: 0.45;
}

.vehicle-hero {
  padding: 1rem;
}

.vehicle-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.vehicle-hero-top h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.55rem, 5vw, 2.7rem);
  line-height: 1.08;
}

.vehicle-hero-mileage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.45rem;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.vehicle-hero-mileage span:last-child {
  color: var(--teal);
  font-weight: 850;
}

.vehicle-hero-icon {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  font-size: 1.4rem;
}

.due-banner {
  display: grid;
  gap: 0.1rem;
  margin: 0.85rem 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--notice);
}

.due-banner span {
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vehicle-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}

.vehicle-specs div {
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  background: var(--surface-alt);
}

.vehicle-specs dt {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 750;
}

.vehicle-specs dd {
  margin: 0.3rem 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.vehicle-comments {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  line-height: 1.55;
}

.pill {
  flex: 0 0 auto;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: #e7edef;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0.65rem;
  padding-left: 1rem;
}

.timeline::before {
  position: absolute;
  top: 0.45rem;
  bottom: 0.45rem;
  left: 0.35rem;
  width: 2px;
  background: #cbd9dc;
  content: "";
}

.timeline-entry {
  position: relative;
}

.timeline-dot {
  position: absolute;
  z-index: 1;
  top: 1.05rem;
  left: -1rem;
  width: 12px;
  height: 12px;
  border: 3px solid var(--surface-alt);
  border-radius: 50%;
  background: var(--orange);
}

.timeline-card {
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(18, 57, 74, 0.08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(17, 53, 66, 0.05);
}

.timeline-card time {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.timeline-card h3 {
  margin-bottom: 0.35rem;
}

.timeline-meta,
.timeline-notes,
.next-due-line {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.timeline-meta {
  margin-bottom: 0;
}

.next-due-line,
.timeline-notes {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.form-panel h1 {
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.maintenance-form {
  gap: 1.2rem;
  margin-top: 1.3rem;
}

.maintenance-form fieldset {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.money-input {
  position: relative;
  display: flex;
  align-items: center;
}

.money-input span {
  position: absolute;
  left: 0.85rem;
  color: var(--ink-soft);
  pointer-events: none;
}

.money-input input {
  padding-left: 1.8rem;
}

@media (min-width: 700px) {
  .signin-shell {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  }

  .hero-card {
    min-height: 100vh;
  }

  .hero-content {
    padding: 3.5rem;
  }

  .signin-card {
    padding: 3rem;
  }

  .auth-panel,
  .form-panel,
  .vehicle-hero {
    padding: 2rem;
  }

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

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

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

  .app-header {
    padding-right: max(2rem, calc((100vw - var(--max)) / 2));
    padding-left: max(2rem, calc((100vw - var(--max)) / 2));
  }
}

@media (min-width: 1000px) {
  .vehicle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-nav {
    right: 1.5rem;
    bottom: 1.5rem;
    left: auto;
    width: 330px;
    padding: 0.45rem;
    border: 1px solid rgba(18, 57, 74, 0.1);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 520px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}


/* Patch 003: administrator backup tool */
.account-menu-link {
  display: block;
  margin: 0.75rem -0.85rem 0;
  padding: 0.75rem 0.85rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.account-menu-link:hover,
.account-menu-link:focus-visible {
  background: var(--teal-soft);
}

.admin-page {
  padding-bottom: 7rem;
}

.admin-tool-panel {
  padding: 1.25rem;
}

.admin-tool-panel h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
}

.backup-location {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.backup-location span {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.backup-location code,
.backup-warning code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.82rem;
}

.backup-create-form {
  display: grid;
}

.backup-create-form .primary-button {
  width: 100%;
}

.backup-create-form .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.backup-warning {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.backup-heading {
  margin-top: 1.4rem;
}

.backup-list-panel {
  overflow: hidden;
  padding: 0;
}

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

.backup-item,
.backup-empty {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}

.backup-item:last-child,
.backup-empty:last-child {
  border-bottom: 0;
}

.backup-item > div,
.backup-empty {
  min-width: 0;
}

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

.backup-item strong {
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-item div span,
.backup-empty span {
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.backup-size {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.backup-empty {
  align-items: flex-start;
  flex-direction: column;
}

@media (min-width: 700px) {
  .admin-tool-panel {
    padding: 1.7rem;
  }

  .backup-create-form .primary-button {
    width: auto;
    justify-self: start;
  }
}

/* Patch 005: planned maintenance, To Do, and service summaries */
.secondary-button,
.small-button,
.text-link {
  text-decoration: none;
}

.secondary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.05rem;
  border: 1px solid #aac3c7;
  border-radius: 13px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
}

.text-link {
  color: var(--teal);
  font-weight: 800;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.card-actions .card-action {
  border-top: 0;
  text-align: center;
}

.card-actions .card-action + .card-action {
  border-left: 1px solid var(--line);
}

.vehicle-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.vehicle-actions .report-link {
  padding: 0.65rem 0.2rem;
  font-size: 0.84rem;
}

.planned-list {
  display: grid;
  gap: 0.65rem;
}

.compact-empty {
  padding: 1rem;
}

.compact-empty p {
  margin-bottom: 0.3rem;
}

.todo-page,
.reports-page,
.report-preview-page {
  padding-bottom: 7rem;
}

.todo-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.todo-section {
  margin-top: 1rem;
}

.todo-card {
  padding: 0.85rem;
  border: 1px solid rgba(18, 57, 74, 0.09);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(17, 53, 66, 0.05);
}

.todo-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.todo-card-top h3,
.todo-card-top p {
  margin-bottom: 0;
}

.todo-card-top .eyebrow {
  margin-bottom: 0.2rem;
  font-size: 0.62rem;
}

.status-badge {
  flex: 0 0 auto;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #e7edef;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-badge.ready {
  background: var(--teal-soft);
  color: var(--notice);
}

.status-badge.waiting {
  background: #fff4d8;
  color: #795b13;
}

.status-badge.deferred {
  background: #eee9f5;
  color: #5c4970;
}

.status-badge.canceled {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-badge.auto {
  background: var(--orange-soft);
  color: #9a4c25;
}

.todo-due,
.todo-notes {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.todo-notes {
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.todo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.small-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
  border: 1px solid #c2d1d4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.small-button.primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.check-row {
  display: flex !important;
  min-height: 48px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.7rem !important;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-alt);
  cursor: pointer;
}

.check-row input,
.select-item input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}

.report-choice-grid {
  display: grid;
  gap: 0.75rem;
}

.report-choice-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
}

.report-choice-card h2,
.report-choice-card p {
  margin-bottom: 0;
}

.compact-meta {
  margin-top: 0.35rem !important;
  font-size: 0.82rem;
}

.report-builder-form {
  gap: 1rem;
  margin-top: 1.2rem;
}

.selection-fieldset {
  position: relative;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.selection-tools {
  display: flex;
  gap: 0.75rem;
  margin: -0.2rem 0 0.5rem;
}

.text-button.compact {
  padding: 0.2rem 0;
  font-size: 0.76rem;
}

.selection-list {
  display: grid;
  gap: 0.45rem;
}

.select-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

.select-item strong,
.select-item small {
  display: block;
}

.select-item strong {
  font-size: 0.86rem;
}

.select-item small {
  margin-top: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.select-item:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.empty-selection {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.label-note {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 500;
}

.report-screen-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.report-screen-actions .back-link,
.report-screen-actions .primary-button {
  margin: 0;
}

.service-summary-document {
  overflow: hidden;
  padding: 1.1rem;
}

.report-document-header {
  display: grid;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--navy);
}

.report-brand {
  margin-bottom: 0.3rem;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.report-document-header h1 {
  margin-bottom: 0.3rem;
  font-size: clamp(1.8rem, 7vw, 3rem);
}

.report-document-header h2 {
  margin-bottom: 0;
  color: var(--teal);
}

.report-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
}

.report-metadata div {
  padding: 0.55rem;
  border-radius: 9px;
  background: var(--surface-alt);
}

.report-metadata dt {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-metadata dd {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  font-weight: 750;
}

.report-intro {
  margin-top: 1rem;
  padding: 0.8rem;
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  line-height: 1.55;
}

.report-document-section {
  margin-top: 1.2rem;
}

.report-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

.report-section-heading h2 {
  margin-bottom: 0;
}

.report-section-heading > strong {
  color: var(--teal);
  font-size: 0.82rem;
  white-space: nowrap;
}

.report-line-list {
  display: grid;
}

.report-line-item {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.report-line-main time {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
}

.report-line-main h3 {
  margin: 0.2rem 0;
}

.report-line-main p,
.report-item-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.45;
}

.report-item-note {
  margin-top: 0.45rem;
}

.report-cost-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.report-cost-breakdown span {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: 0.65rem;
}

.report-cost-breakdown strong {
  color: var(--ink);
  font-size: 0.76rem;
}

.report-estimate {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.report-estimate strong {
  color: var(--teal);
}

.report-total {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.8rem;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

.report-document-footer {
  margin-top: 1.4rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.68rem;
  text-align: center;
}

@media (min-width: 700px) {
  .report-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-choice-card {
    align-items: end;
  }

  .service-summary-document {
    padding: 2rem;
  }

  .report-document-header {
    grid-template-columns: 1.3fr 0.7fr;
    align-items: start;
  }

  .report-line-item {
    grid-template-columns: minmax(0, 1fr) 270px;
    align-items: start;
  }
}

@media (max-width: 420px) {
  .vehicle-actions .primary-button,
  .vehicle-actions .secondary-button {
    width: 100%;
  }

  .report-screen-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .report-screen-actions .primary-button {
    width: 100%;
  }
}

@media print {
  @page {
    margin: 0.55in;
  }

  html,
  body {
    background: #fff !important;
  }

  .app-header,
  .bottom-nav,
  .report-screen-actions {
    display: none !important;
  }

  .report-preview-page {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .service-summary-document {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }

  .report-line-item,
  .report-document-section {
    break-inside: avoid;
  }

  .status-badge,
  .report-metadata div,
  .report-cost-breakdown span,
  .report-total,
  .report-intro {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Patch 006: vehicle lifecycle and stale To Do cleanup */
.former-vehicles-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  color: var(--ink);
  text-decoration: none;
}

.former-vehicles-link span:first-child {
  display: grid;
  gap: 0.12rem;
}

.former-vehicles-link small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.former-count {
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--teal);
  font-weight: 900;
}

.former-page {
  padding-bottom: 7rem;
}

.former-vehicle-list {
  display: grid;
  gap: 0.7rem;
}

.former-vehicle-card {
  overflow: hidden;
}

.former-vehicle-card > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  text-decoration: none;
}

.former-vehicle-card h2,
.former-vehicle-card p {
  margin-bottom: 0.15rem;
}

.fleet-status-banner {
  display: grid;
  gap: 0.12rem;
  margin: 0.85rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #eef1f3;
  color: var(--ink-soft);
}

.fleet-status-banner span {
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fleet-status-banner strong {
  color: var(--ink);
}

.fleet-status-banner small {
  line-height: 1.4;
}

.old-work-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0.85rem 0;
  padding: 0.85rem;
}

.old-work-note > div {
  display: grid;
  gap: 0.15rem;
}

.old-work-note small {
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.4;
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.inline-action-form .small-button {
  cursor: pointer;
}

.status-badge.former {
  background: #eef1f3;
  color: var(--ink-soft);
}

.report-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.report-title-row .eyebrow {
  margin-bottom: 0;
}

@media (min-width: 700px) {
  .former-vehicle-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .old-work-note {
    align-items: stretch;
    flex-direction: column;
  }

  .old-work-note .small-button {
    width: 100%;
  }
}

/* Patch 007: tighter vehicle detail layout and table-style maintenance history */
.vehicle-detail-page {
  gap: 0.9rem;
}

.vehicle-summary {
  padding: 0.9rem;
}

.vehicle-summary-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.vehicle-summary-title h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 4.6vw, 2.35rem);
  line-height: 1.08;
}

.vehicle-hero-icon.small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 1.15rem;
}

.compact-specs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.compact-specs div {
  padding: 0.5rem 0.55rem;
  border-radius: 9px;
}

.compact-specs dt {
  font-size: 0.66rem;
}

.compact-specs dd {
  margin-top: 0.18rem;
  font-size: 0.86rem;
  line-height: 1.2;
}

.compact-actions {
  gap: 0.4rem;
}

.compact-actions .inline-button {
  padding: 0.65rem 0.8rem;
  border-radius: 11px;
  font-size: 0.9rem;
}

.compact-actions .report-link {
  padding: 0.45rem 0.15rem;
}

.compact-comments {
  margin-bottom: 0.65rem;
  padding-top: 0.65rem;
  font-size: 0.88rem;
}

.compact-status {
  margin-bottom: 0.65rem;
}

.compact-heading {
  margin-top: 0.55rem;
  margin-bottom: 0.45rem;
}

.compact-heading h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.table-panel {
  overflow: hidden;
  padding: 0;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.maintenance-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.84rem;
}

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

.maintenance-table th {
  background: #f7fafb;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.maintenance-table tbody tr:last-child td {
  border-bottom: 0;
}

.maintenance-table tbody tr:hover td {
  background: #fbfdfd;
}

.maintenance-table .date-cell {
  width: 6.8rem;
  color: var(--teal);
  font-weight: 850;
  white-space: nowrap;
}

.maintenance-table .description-cell {
  min-width: 13rem;
}

.maintenance-table .description-cell strong {
  display: block;
  line-height: 1.22;
}

.maintenance-table .number-cell {
  text-align: right;
  white-space: nowrap;
}

.maintenance-table .action-cell {
  width: 4.5rem;
  text-align: right;
  white-space: nowrap;
}

.maintenance-table .action-cell a {
  display: inline-block;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 850;
  text-decoration: none;
}

.planned-table .action-cell a + a {
  margin-left: 0.55rem;
}

.row-subtext {
  display: block;
  margin-top: 0.22rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.row-details {
  margin-top: 0.25rem;
}

.row-details summary {
  display: inline-block;
  cursor: pointer;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
}

.row-details p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.38;
}

.service-table-panel {
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .vehicle-summary {
    border-radius: 18px;
  }

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

  .compact-actions .inline-button {
    flex: 1 1 9rem;
    text-align: center;
  }

  .maintenance-table {
    min-width: 500px;
    font-size: 0.8rem;
  }

  .maintenance-table th,
  .maintenance-table td {
    padding: 0.5rem 0.5rem;
  }

  .maintenance-table .date-cell {
    width: 5.8rem;
  }
}
