/** Vehicle Logbook — studio theme v2 + app-specific layout */
@import "./aurastudio-tokens.css";
@import "./aurastudio-tokens-shadcn.css";
@import "./aurastudio-studio.css";

/* iOS Safari zooms focused inputs below 16px — keep touch fields readable */
.input,
select.input,
textarea.input,
.log-form-card select,
.history-filters select,
.history-filters input,
.gap-modal-card .input {
  font-size: max(16px, 0.9rem);
}

:root {
  --nav-h: 68px;
  --fab-offset: calc(var(--nav-h) + 1rem);
}

[hidden],
.hidden {
  display: none !important;
}

/* —— Dashboard hero & toolbar —— */
.card-hero {
  position: relative;
  overflow: hidden;
  background: var(--card-hero);
  box-shadow: var(--card-glow);
}

.card-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--studio-gold-500),
    var(--studio-teal-500),
    var(--studio-navy-600)
  );
}

.dashboard-period-summary {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.log-cancel-edit {
  margin-top: 0.5rem;
}

.help-list {
  margin: 0;
  padding-left: 1.15rem;
}

.help-list li + li {
  margin-top: 0.45rem;
}

.dashboard-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.vehicle-field {
  width: 100%;
}

.vehicle-field label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.dashboard-vehicle-select {
  width: 100%;
  max-width: none;
  margin-bottom: 0;
  font-weight: 600;
}

.stats-block {
  margin-top: 1rem;
}

.business-pct {
  text-align: right;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
}

/* —— Legal pages —— */
.legal-page {
  padding: 0 1rem 6rem;
  max-width: 480px;
  margin: 0 auto;
}

.legal-page h2 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

.legal-page ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.footer-legal {
  font-size: 0.78rem;
  margin-top: 0.35rem;
}

.footer-legal a {
  margin-right: 0.75rem;
}

/* shadcn maps --muted to a background tint; secondary copy uses --muted-foreground */
.muted,
.stat .lbl,
.business-pct,
.vehicle-field label,
.dashboard-period-summary,
.continuing-from-label,
.history-meta,
.history-empty,
.preview-km,
.gap-modal-lead,
.onboarding-step-label,
.plus-feature-hint,
.cloud-consent-hint,
.export-row-field label,
.studio-footer-inner,
.studio-footer-inner p,
.studio-footer-inner .footer-disclaimer,
.nav-btn:not(.active),
label.theme-select-label,
.form-subhead.export-plus-head,
.deduction-card.compact .muted,
.aurastudio-studio .footer-note {
  color: var(--muted-foreground);
}

[data-theme="studio-dark"] .muted,
[data-theme="studio-dark"] .stat .lbl,
[data-theme="studio-dark"] .business-pct,
[data-theme="studio-dark"] .studio-footer-inner,
[data-theme="studio-dark"] .studio-footer-inner p,
[data-theme="studio-dark"] .studio-footer-inner .footer-disclaimer {
  color: var(--muted-foreground);
}

/* —— Studio footer (aligned with StudioAppFooter) —— */
.app-footer.studio-footer {
  margin: 2rem auto calc(var(--nav-h, 68px) + 1rem);
  padding: 0 1rem;
  max-width: 36rem;
}

.studio-footer-inner {
  padding: 1.25rem 0.5rem 1rem;
  border-top: 1px solid var(--card-border);
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.studio-footer-inner p {
  margin: 0 0 0.35rem;
}

.app-footer.studio-footer a {
  color: var(--primary, var(--studio-navy-600));
  font-weight: 600;
  text-decoration: none;
}

.app-footer.studio-footer a:hover {
  text-decoration: underline;
}

.app-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1rem;
  margin: 0.6rem 0 0.45rem;
}

.app-footer .footer-links a {
  margin: 0;
  font-weight: 500;
}

.app-footer .footer-disclaimer {
  font-size: 0.75rem;
  margin: 0.5rem 0 0;
}

.legal-page .app-footer.legal-footer {
  margin-bottom: 1.5rem;
}

/* —— Day-start anchor —— */
.day-start-block {
  margin-bottom: 1rem;
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  background: var(--empty-panel-bg);
  border: 1px solid var(--card-border);
}

.day-start-block[hidden] {
  display: none !important;
}

.day-start-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.day-start-lead {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.day-start-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.day-start-choice {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.day-start-home-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.day-start-home-chip[hidden],
.day-start-prompt[hidden] {
  display: none !important;
}

.day-start-chip-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.day-start-chip-text strong {
  font-size: 0.95rem;
}

.day-start-chip-text .muted {
  font-size: 0.78rem;
}

.leg-location-fields[hidden] {
  display: none !important;
}

#billing-dev-banner {
  margin-bottom: 0.75rem;
}

.banner-backup {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.banner-backup-text {
  margin: 0;
}

.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.banner-leave {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.banner-leave-text {
  margin: 0;
}

.leave-period-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.leave-period-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.leave-period-item:last-child {
  border-bottom: none;
}

.leave-period-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ty-inferred-hint {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
}

.form-error {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md, 12px);
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger, #dc2626);
  font-size: 0.85rem;
}

.form-success {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-lg);
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.35);
  color: var(--studio-teal-500, #0d9488);
  font-size: 0.88rem;
  font-weight: 700;
}

.btn.btn-saved {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  border-color: rgba(13, 148, 136, 0.5);
  color: #fff;
}

.btn.btn-busy {
  opacity: 0.88;
  cursor: wait;
  filter: brightness(0.96);
}

.btn:active:not(:disabled):not(.btn-busy) {
  transform: scale(0.97);
}

.dashboard-log-card {
  margin-top: 1rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  box-shadow: var(--card-glow);
}

.dashboard-log-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.dashboard-log-lead {
  margin: 0 0 0.85rem;
}

.dashboard-log-advanced {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.82rem;
}

.btn-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--studio-teal-500, #0d9488);
  text-decoration: underline;
  cursor: pointer;
}

.btn-link:hover {
  color: var(--studio-teal-600, #0f766e);
}

.btn-save-stop {
  width: 100%;
  margin-top: 0.25rem;
}

.cloud-backup-card h2 {
  margin: 0 0 0.35rem;
}

.cloud-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.cloud-backup-status {
  margin: 0.5rem 0 0;
}

.cloud-consent-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.year-end-checklist {
  margin-top: 1rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(
    135deg,
    rgba(201, 162, 39, 0.08) 0%,
    var(--card-bg, var(--card)) 55%
  );
}

.year-end-checklist h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.year-end-checklist-items {
  margin: 0.75rem 0 1rem;
  padding-left: 1.15rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.year-end-checklist-items li {
  margin-bottom: 0.35rem;
}

.year-end-checklist-items li:last-child {
  margin-bottom: 0;
}

.tax-year-odo-vehicle {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--card-border);
}

.tax-year-odo-vehicle:last-child {
  border-bottom: none;
}

.tax-year-odo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.tax-year-odo-grid label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: block;
  margin-bottom: 0.25rem;
}

.tax-year-odo-status {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.25rem 0 0;
}

.tax-year-odo-status.incomplete {
  color: var(--studio-gold-500);
}

.business-travel-hint {
  font-size: 0.78rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  background: var(--empty-panel-bg);
  border: 1px solid var(--card-border);
}

.business-travel-hint[hidden] {
  display: none !important;
}

.business-travel-hint[hidden] {
  display: none !important;
}

.log-form-card .log-lead {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.log-guide {
  padding: 0.75rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-lg);
  background: var(--empty-panel-bg);
  border: 1px solid var(--card-border);
}

.log-guide-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.log-guide-steps {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted-foreground, var(--muted));
}

.log-guide-steps li + li {
  margin-top: 0.35rem;
}

.log-context-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.log-context-field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground, var(--studio-navy-600, #243056));
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.log-add-block label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.35rem;
}

.log-context-field .input {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
}

.log-add-block {
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  background: var(--empty-panel-bg);
  border: 1px solid var(--card-border);
}

.log-add-block .form-subhead {
  margin-top: 0;
}

.day-legs-section {
  margin-top: 0.25rem;
}

.day-stop-count {
  font-weight: 700;
  color: var(--studio-teal-500, #0d9488);
}

.banner-inline {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
}

@media (max-width: 360px) {
  .log-context-row {
    grid-template-columns: 1fr;
  }
}

/* —— History —— */
.history-heading {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
}

.history-hint {
  font-size: 0.8rem;
  margin: 0 0 1rem;
  line-height: 1.45;
}

.history-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.history-filter-field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.history-year-select,
.history-vehicle-select {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
}

.history-list {
  margin-top: 0;
}

.history-empty-actions {
  margin-top: 0.75rem;
}

/* —— Onboarding —— */
.onboarding-panel {
  margin-top: 0.75rem;
  padding: 0.25rem 0 0.5rem;
}

.onboarding-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.onboarding-lead {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.demo-block {
  padding: 0.75rem;
  margin: 0.25rem 0 1rem;
  border-radius: var(--radius-lg);
  background: var(--empty-panel-bg);
  border: 1px solid var(--card-border);
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}

.demo-label {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--foreground);
}

.demo-narrative {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
}

.demo-totals {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.onboarding-field-hint {
  font-size: 0.78rem;
  margin: -0.35rem 0 0.75rem;
}

.demo-legs-table {
  font-size: 0.78rem;
}

.demo-leg-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--card-border);
  align-items: baseline;
}

.demo-leg-row:last-child {
  border-bottom: none;
}

.demo-leg-row .leg-km {
  font-weight: 700;
  color: var(--brand-navy);
  white-space: nowrap;
}

[data-theme="studio-dark"] .demo-leg-row .leg-km {
  color: var(--brand-gold);
}

.demo-note {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
}

.onboarding-signin-block {
  margin: 0 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md, 0.5rem);
  background: color-mix(in srgb, var(--studio-gold-500, #c9a227) 6%, transparent);
}

.onboarding-signin-block .btn-primary {
  width: 100%;
  margin-top: 0.35rem;
}

.demo-section-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
}

.onboarding-signin-block[hidden],
.onboarding-setup.onboarding-setup-locked {
  display: none;
}

.onboarding-signin-status.signed-in {
  color: var(--studio-teal-500, #0d9488);
  font-weight: 600;
}

.advanced-data-export {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

.advanced-data-export summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.advanced-data-export .btn {
  margin-right: 0.5rem;
  margin-top: 0.35rem;
}

.onboarding-setup h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.onboarding-setup-lead {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--foreground);
  margin-bottom: 0.35rem;
}

.field-required {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  color: var(--studio-teal-500, #0d9488);
}

.field-optional {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.onboarding-setup .input,
.onboarding-setup label.field-label + .input {
  margin-bottom: 0;
}

.onboarding-field-hint,
.onboarding-odo-hint {
  margin: 0.25rem 0 0.85rem;
  font-size: 0.82rem;
}

.vehicle-help {
  font-size: 0.82rem;
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.vehicle-switch-btn {
  width: 100%;
  margin-bottom: 0.5rem;
}

.vehicle-list-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--card-border);
}

.vehicle-list-item:last-child {
  border-bottom: none;
}

.vehicle-list-meta {
  font-size: 0.8rem;
}

.vehicle-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.vehicle-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}

.vehicle-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.vehicle-badge.retired {
  background: var(--empty-panel-bg);
  color: var(--muted-foreground);
}

.history-vehicle-select {
  width: 100%;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
  font-size: 0.88rem;
  line-height: 1.4;
  cursor: pointer;
}

.checkbox-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.rand-estimate-options {
  margin-bottom: 0.5rem;
}

.rand-estimate-hint {
  font-size: 0.78rem;
  margin: -0.25rem 0 0.75rem;
}

.gap-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gap-modal[hidden] {
  display: none !important;
}

.gap-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 22, 41, 0.55);
}

.gap-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.gap-modal-msg {
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

.gap-modal-hint {
  font-size: 0.78rem;
  margin: 0.35rem 0 0.75rem;
}

.gap-modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gap-modal-actions .btn {
  flex: 1;
  min-width: 7rem;
}

.dashboard-vehicle-summaries {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--card-border);
}

.vehicle-summary-line {
  margin: 0.25rem 0;
  font-size: 0.78rem;
  line-height: 1.4;
}

/* —— Empty state —— */
.dashboard-empty {
  text-align: center;
  padding: 1.25rem 0.75rem 0.5rem;
  margin-top: 0.75rem;
  border-radius: var(--radius-xl);
  background: var(--empty-panel-bg);
  border: 1px dashed var(--card-border);
}

.empty-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 8px rgba(30, 42, 90, 0.15));
}

.dashboard-empty h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--foreground);
}

.dashboard-empty .muted {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.empty-actions .btn {
  width: auto;
  min-width: 8.5rem;
}

/* —— Stats grid —— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

@media (min-width: 340px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 400px) {
  .stats-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

[data-theme="studio"] .stat,
:root:not([data-theme="studio-dark"]) .stat {
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  border: 1px solid var(--stat-border-glow);
}

[data-theme="studio-dark"] .stat {
  box-shadow: var(--shadow-card);
}

.bar-track {
  background: var(--muted-subtle);
  height: 10px;
  border-radius: 999px;
  margin-top: 1rem;
}

/* —— Pro card: full vs compact —— */
.deduction-card .deduction-inner h2 {
  margin: 0 0 0.35rem;
}

.deduction-card .val {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
}

.deduction-card.compact {
  padding: 0.75rem 1rem;
  margin-bottom: 4.5rem;
}

.deduction-card.compact .deduction-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.deduction-card.compact h2 {
  font-size: 0.8rem;
  margin: 0;
  flex: 1 1 100%;
}

.deduction-card.compact.locked .val {
  display: none;
}

.deduction-card.compact .val {
  font-size: 1rem;
}

.deduction-card.compact .muted {
  font-size: 0.8rem;
  margin: 0;
  flex: 1 1 100%;
  line-height: 1.4;
}

.deduction-card:not(.compact) {
  margin-bottom: 1.5rem;
}

.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.toggle-group label {
  margin: 0;
}

.toggle-group input {
  display: none;
}

.toggle-group span {
  display: block;
  text-align: center;
  padding: 0.7rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--input-border);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--toggle-off-bg);
  color: var(--foreground);
  transition: all 0.2s;
}

.toggle-group input:checked + span {
  background: linear-gradient(135deg, #1e2a5a, #243056);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(15, 22, 41, 0.25);
}

.tab-panel[hidden] {
  display: none !important;
}

.history-item {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--history-item-bg);
  backdrop-filter: blur(8px);
}

.history-item summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  font-size: 0.8rem;
}

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

.day-leg-summary {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.day-leg-summary li {
  margin: 0;
}

.history-leg-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.35rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.history-leg-row:hover,
.history-leg-row:focus-visible {
  background: var(--muted-subtle);
  outline: 2px solid var(--studio-gold-500);
  outline-offset: 1px;
}

.history-leg-dest {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-leg-edit-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--studio-gold-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 420px) {
  .history-leg-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "num dest edit"
      "odo vehicle km";
  }

  .history-leg-num {
    grid-area: num;
  }

  .history-leg-dest {
    grid-area: dest;
  }

  .history-leg-edit-label {
    grid-area: edit;
    justify-self: end;
  }

  .history-leg-odo {
    grid-area: odo;
  }

  .history-leg-vehicle {
    grid-area: vehicle;
  }

  .history-leg-km {
    grid-area: km;
    justify-self: end;
  }

  .history-leg-row .badge-business,
  .history-leg-row .badge-private {
    display: none;
  }
}

.history-detail {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.history-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.history-actions button {
  font-size: 0.75rem;
  border: none;
  background: none;
  color: var(--studio-gold-500);
  font-weight: 700;
  cursor: pointer;
}

.history-actions .danger {
  color: var(--danger);
}

.badge-business {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-weight: 700;
}

[data-theme="studio-dark"] .badge-business {
  color: var(--studio-teal-400);
}

.badge-private {
  background: var(--muted-subtle);
  color: var(--muted);
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-weight: 600;
}

/* Bottom nav — align with main column (480px), always centered */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h, 68px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: stretch;
  box-sizing: border-box;
  z-index: 50;
}

.nav-btn {
  flex: none;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
}

@media (min-width: 481px) {
  .bottom-nav {
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }
}

#vehicle-list button {
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  cursor: pointer;
  font-weight: 600;
  color: var(--foreground);
}

#vehicle-list button.danger {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.3);
}

.field-hint {
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0.35rem 0 0.75rem;
}

.settings-field-wrap {
  margin-top: 0.5rem;
}

.settings-tax-year-select {
  width: 100%;
  max-width: 100%;
}

.export-monthly-head {
  margin-top: 1.25rem;
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.export-row-field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.export-row-field .input {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
}

@media (max-width: 360px) {
  .export-row {
    grid-template-columns: 1fr;
  }
}

.deduction-card h2 {
  color: var(--studio-gold-500);
}

.btn-sm {
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  width: auto;
}

.tax-badge {
  align-self: flex-start;
  box-shadow: 0 2px 12px rgba(30, 42, 90, 0.2);
}

/* —— Readable help copy (mobile) —— */
.help-text {
  color: var(--foreground);
  opacity: 0.82;
  font-size: 0.9rem;
  line-height: 1.45;
}

.onboarding-lead,
.onboarding-field-hint,
.demo-narrative,
.demo-totals,
.demo-note,
.log-lead,
.day-start-lead,
.field-hint,
.history-hint {
  color: var(--foreground);
  opacity: 0.82;
  font-size: 0.9rem;
  line-height: 1.45;
}

.log-guide-steps {
  font-size: 0.88rem;
  color: var(--foreground);
  opacity: 0.88;
}

/* —— Journey preview —— */
.preview-km {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.88rem;
  color: var(--foreground);
  opacity: 0.75;
  line-height: 1.4;
  min-height: 1.25rem;
}

.preview-km.preview-km-active {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--studio-teal-500, #0d9488);
  opacity: 1;
}

[data-theme="studio-dark"] .preview-km.preview-km-active {
  color: var(--studio-teal-400, #2dd4bf);
}

/* —— Continuing from card —— */
.continuing-from-card {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-lg);
  background: var(--empty-panel-bg);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--studio-teal-500, #0d9488);
}

.continuing-from-compact {
  margin-bottom: 0.75rem;
}

.continuing-from-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground, var(--studio-navy-600, #243056));
}

.continuing-from-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
}

.continuing-from-place {
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
}

.continuing-from-odo {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--studio-teal-500, #0d9488);
}

[data-theme="studio-dark"] .continuing-from-odo {
  color: var(--studio-teal-400, #2dd4bf);
}

.continuing-from-meta {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

.continuing-from-arrow {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 1.1rem;
  color: var(--studio-teal-500, #0d9488);
  line-height: 1;
}

/* —— Dashboard recent stops —— */
.dashboard-recent-card {
  margin-top: 1rem;
}

.dashboard-stats-card,
#dashboard-stats-block.card {
  margin-top: 1rem;
}

.dashboard-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.dashboard-recent-header h2 {
  margin: 0;
  font-size: 1rem;
}

.dashboard-recent-hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
}

.dashboard-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.recent-leg-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: var(--history-item-bg);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.recent-leg-row:hover,
.recent-leg-row:focus-visible {
  border-color: var(--studio-teal-500, #0d9488);
  outline: none;
}

.recent-leg-date {
  grid-row: 1 / 3;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 3.5rem;
}

.recent-leg-journey {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
}

.recent-leg-from {
  color: var(--foreground);
  opacity: 0.85;
}

.recent-leg-to {
  color: var(--foreground);
}

.recent-leg-arrow {
  color: var(--studio-teal-500, #0d9488);
  font-weight: 700;
}

.recent-leg-odo {
  grid-column: 2;
  font-size: 0.78rem;
}

.recent-leg-km {
  grid-column: 3;
  grid-row: 1;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--studio-teal-500, #0d9488);
}

.recent-leg-row .badge-business,
.recent-leg-row .badge-private {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  font-size: 0.68rem;
}

.recent-leg-vehicle {
  grid-column: 2 / 4;
  font-size: 0.72rem;
  color: var(--muted);
}

.day-leg-journey {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.day-leg-meta {
  display: block;
  font-size: 0.82rem;
}

/* —— Toast —— */
.toast-container {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 4.25rem);
  transform: translateX(-50%);
  z-index: 300;
  width: min(440px, calc(100% - 1.5rem));
  pointer-events: none;
}

.toast {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-lg);
  background: var(--studio-navy-900, #0f1629);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-elevated), 0 0 0 2px rgba(201, 162, 39, 0.35);
  animation: toast-in 0.22s ease-out;
}

.toast-success {
  background: linear-gradient(135deg, #1e2a5a 0%, #243056 100%);
  border: 1px solid rgba(201, 162, 39, 0.45);
}

.toast-error {
  background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
  border: 1px solid rgba(220, 38, 38, 0.55);
}

[data-theme="studio-dark"] .toast {
  background: var(--card-solid, #1a2238);
  border: 1px solid var(--card-border);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plus-trial-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}

.plus-card .plus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.plus-pricing-line {
  font-weight: 700;
  font-size: 1rem;
  margin: 0.5rem 0;
}

.plus-gated.plus-locked {
  opacity: 0.72;
}

/* —— Auth & paywall —— */
.auth-gate,
.paywall-gate {
  margin: 0 0 1rem;
  border: 1px solid rgba(201, 162, 39, 0.4);
}

.auth-gate h2,
.paywall-gate h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.auth-gate-lead {
  margin: 0 0 0.75rem;
}

.auth-gate-pricing,
.paywall-pricing {
  margin: 0 0 1rem;
  font-weight: 600;
}

.paywall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.app-content-gated .tab-panel {
  opacity: 0.55;
}

.auth-gate,
.paywall-gate {
  position: relative;
  z-index: 2;
}

#app-nav {
  pointer-events: auto;
  z-index: 100;
}

.gap-modal:not([hidden]) {
  pointer-events: auto;
}

.merge-choice-lead {
  margin: 0 0 1rem;
}

.merge-choice-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.merge-choice-option {
  padding: 0.85rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--empty-panel-bg, rgba(0, 0, 0, 0.03));
}

.merge-choice-option-device {
  border-color: rgba(201, 162, 39, 0.45);
}

.merge-choice-option-label {
  margin: 0 0 0.2rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.merge-choice-option-meta {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
}

.merge-choice-option-hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
}

.merge-choice-option .btn {
  width: 100%;
}

.merge-choice-backdrop {
  pointer-events: none;
}

.cloud-sync-status {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.plus-gated.plus-locked::after {
  content: " · Plus";
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--studio-gold-500, #c9a227);
}

.export-checklist-warnings {
  margin: 0.75rem 0 1rem;
  padding-left: 1.15rem;
}

.export-plus-head {
  margin-top: 1.25rem;
}
