/* iPhone-first concept: native typography, grouped surfaces and clear thumb navigation. */
html:root,
html:root[data-theme="dark"],
html:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f2f7;
  --sidebar: #fff;
  --panel: #fff;
  --panel-2: #f7f7fa;
  --line: #e5e5ea;
  --line-strong: #d1d1d6;
  --text: #1c1c1e;
  --muted: #636366;
  --muted2: #8e8e93;
  --lime: #007aff;
  --blue: #007aff;
  --violet: #5856d6;
  --coral: #ff3b30;
  --orange: #ff9500;
  --shadow: 0 8px 25px #20202a0d;
  --radius: 17px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100dvh; color: var(--text); background: var(--bg); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; letter-spacing: -.012em; }
button, input, select, textarea { font-family: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #007aff55; outline-offset: 2px; }
.preview-ribbon { position: relative; z-index: 20; display: flex; min-height: 26px; align-items: center; justify-content: center; gap: 7px; padding: 4px 12px; background: #1c1c1e; color: #fff; font-size: 8px; font-weight: 650; letter-spacing: .11em; text-align: center; }
.preview-ribbon span { width: 6px; height: 6px; border-radius: 50%; background: #ff3b30; }
.app-shell { grid-template-columns: 232px minmax(0,1fr); min-height: calc(100vh - 26px); }
.sidebar { padding: 24px 13px 16px; background: #fff; border-color: var(--line); }
.brand { gap: 11px; padding: 0 10px 34px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: #1c1c1e; color: white; box-shadow: none; font-size: 18px; }
.brand b { color: #1c1c1e; font-size: 17px; font-weight: 650; letter-spacing: -.45px; }
.brand small { color: #8e8e93; font-family: inherit; font-size: 8px; font-weight: 600; line-height: 1.2; letter-spacing: .11em; }
.side-label, .eyebrow, .micro-label { color: #8e8e93; font-family: inherit; font-size: 9px; font-weight: 620; letter-spacing: .08em; }
.side-nav { gap: 3px; }
.nav-link { height: 42px; border-radius: 10px; color: #636366; font-size: 12px; }
.nav-link.active { color: #007aff; background: #edf5ff; font-weight: 650; }
.nav-link.active:before { display: none; }
.nav-link.active .nav-icon, .nav-icon { color: #8e8e93; }
.nav-link.active .nav-icon { color: #007aff; }
.nav-link em { border-radius: 99px; background: #fff0ef; color: #ff3b30; }
.bike-mini { border: 1px solid var(--line); border-radius: 13px; background: #fafafd; }
.bike-mini-icon { color: #007aff; background: #edf5ff; }
.offline-chip i, .sync-status i { background: #34c759; box-shadow: none; }
.offline-chip { color: #8e8e93; }
.main-area { min-width: 0; background: var(--bg); }
.topbar { top: 26px; height: 57px; padding: 0 clamp(22px,4vw,56px); border-color: #e5e5eacc; background: #f8f8fbe8; backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); }
.crumb { gap: 8px; color: #8e8e93; font-family: inherit; font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: .04em; }
.crumb strong { color: #1c1c1e; font-size: 12px; font-weight: 650; }
.icon-button, .top-avatar { width: 36px; height: 36px; border-radius: 50%; border-color: var(--line); background: #fff; color: #636366; font-size: 15px; }
.top-avatar { color: #007aff; background: #edf5ff; border-color: transparent; }
.view { width: min(1180px, 100%); padding: 36px clamp(22px,4vw,56px) 72px; }
.page-heading { align-items: flex-start; margin-bottom: 25px; gap: 20px; }
.page-heading .eyebrow { font-size: 10px; letter-spacing: .04em; text-transform: none; }
.page-heading h1 { margin: 2px 0 4px; color: #1c1c1e; font-size: clamp(32px,3.5vw,42px); font-weight: 700; line-height: 1.08; letter-spacing: -.055em; }
.page-heading p { margin: 6px 0 0; color: #636366; font-size: 14px; line-height: 1.45; }
.heading-actions { gap: 8px; }
.button { min-height: 42px; padding: 10px 16px; border-radius: 99px; font-size: 13px; font-weight: 620; letter-spacing: -.01em; }
.button.primary { color: #fff; background: #007aff; box-shadow: none; }
.button.primary:hover { background: #006be0; filter: none; }
.button.secondary { color: #007aff; background: #fff; border-color: #d1d1d6; }
.button.secondary:hover, .button.quiet:hover { background: #f5f9ff; border-color: #b4d4ff; }
.button.quiet { width: 100%; border-radius: 99px; color: #007aff; background: #fff; border-color: var(--line); }
.text-button { min-height: 38px; color: #007aff; font-size: 12px; }

.stats-grid { gap: 1px; margin: 0 0 27px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--line); }
.stat-card { min-height: 84px; gap: 0; padding: 14px 16px; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
.stat-icon { display: none; }
.stat-card span { color: #8e8e93; font-family: inherit; font-size: 9px; font-weight: 620; line-height: 1.35; letter-spacing: .055em; white-space: normal; }
.stat-card b { margin: 6px 0 0; color: #1c1c1e; font-size: 22px; font-weight: 650; letter-spacing: -.045em; }
.stat-card b small { color: #636366; font-size: 11px; font-weight: 450; }
.stat-card em { color: #8e8e93; font-size: 10px; font-style: normal; white-space: normal; }
.section-title-row { margin: 0 0 12px; }
.section-title-row h2 { color: #1c1c1e; font-size: 21px; font-weight: 650; letter-spacing: -.035em; }
.bike-grid { gap: 13px; }
.bike-card { padding: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 2px 8px #17171c08; }
.bike-card:before { display: none; }
.bike-card-top { gap: 13px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f3; }
.bike-visual { display: none !important; }
.bike-title { min-width: 0; }
.bike-name-row { gap: 8px; }
.bike-title h2, .garage-bike h2 { color: #1c1c1e; font-size: 21px; font-weight: 650; letter-spacing: -.045em; }
.bike-title p, .garage-bike-head p { margin-top: 3px; color: #8e8e93; font-size: 11px; }
.year-chip { border: 0; border-radius: 99px; background: #f2f2f7; color: #636366; font-family: inherit; font-size: 9px; font-weight: 600; line-height: 1; }
.bike-actions-inline { gap: 7px; margin-top: 9px; }
.bike-actions-inline button, .record-actions button { min-height: 34px; padding: 7px 11px; border: 1px solid #d1d1d6; border-radius: 99px; background: #fff; color: #007aff; font-size: 10px; font-weight: 600; }
.bike-actions-inline button:hover, .record-actions button:hover { background: #f5f9ff; }
.odo-row { padding: 13px 0 10px; border-top: 0; }
.odo-row span, .garage-odo > span { color: #8e8e93; font-family: inherit; font-size: 9px; font-weight: 620; line-height: 1.3; letter-spacing: .06em; }
.odo-row strong { color: #1c1c1e; font-size: 18px; font-weight: 650; }
.next-row { gap: 12px; padding: 13px 0; }
.next-row b { max-width: 260px; color: #1c1c1e; font-size: 12px; font-weight: 620; }
.next-row small { color: #8e8e93; font-size: 10px; }
.progress-ring { width: 43px; height: 43px; border-color: #d1d1d6; color: #1c1c1e; }
.progress-ring b { font-size: 13px; }
.progress-ring small { color: #8e8e93; font-size: 7px; }
.prediction-row { padding-top: 10px; color: #8e8e93; font-size: 10px; }
.prediction-row button { color: #007aff; font-size: 10px; font-weight: 620; }
.bike-spend-row { gap: 7px; padding-top: 11px; border-color: #f0f0f3; }
.bike-spend-row span { color: #8e8e93; font-family: inherit; font-size: 8px; font-weight: 600; line-height: 1.25; letter-spacing: .03em; }
.bike-spend-row b { color: #1c1c1e; font-size: 11px; font-weight: 620; }

.lower-grid { gap: 13px; margin-top: 16px; }
.panel, .settings-card, .schedule-row, .service-card, .component-card, .empty-state, .note-panel { border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 2px 8px #17171c08; }
.panel { padding: 18px; }
.panel-heading h3, .panel h3 { color: #1c1c1e; font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.panel p, .insight-panel p { color: #636366; font-size: 12px; line-height: 1.55; }
.action-list { border-color: #f0f0f3; }
.action-row { min-height: 57px; border-color: #f0f0f3; }
.icon-tile { width: 35px; height: 35px; border-radius: 11px; background: #f2f2f7; color: #007aff; }
.action-copy b { color: #1c1c1e; font-size: 12px; }
.action-copy small { color: #8e8e93; font-size: 10px; }
.status-pill { min-height: 23px; border: 0; border-radius: 99px; background: #f2f2f7; color: #636366; font-size: 9px; }
.status-overdue, .status-due { color: #b42318; background: #fff0ef; }
.status-upcoming, .status-inspect { color: #0066cc; background: #edf5ff; }
.insight-panel { background: #fff; }
.insight-panel .spark { color: #007aff; }
.insight-bottom { border-color: #f0f0f3; }
.insight-bottom span { font-family: inherit; }
.empty-inline { color: #8e8e93; }
.empty-inline > span { color: #007aff; }
.empty-inline b { color: #636366; }
.demo-banner { border: 1px solid #e5e5ea; border-radius: 14px; background: #fff; }
.demo-banner > span, .demo-banner button { color: #636366; }
.demo-banner small { color: #8e8e93; }
.more-tile, .settings-card, .note-panel, .warning-note { border-color: var(--line); border-radius: 15px; background: #fff; }
.more-tile > span, .settings-icon { background: #edf5ff; color: #007aff; }
.more-tile > b { color: #1c1c1e; }
.more-tile > small, .more-tile > i { color: #8e8e93; }
.field input, .field textarea, .field select, .bike-select, select, input, textarea { min-height: 44px; border-color: #d1d1d6; border-radius: 11px; background: #fff; color: #1c1c1e; font-size: 15px; }
.field > span { color: #636366; }
.modal { border-color: var(--line); border-radius: 22px; background: #fff; color: #1c1c1e; }
.modal-head { background: #fff; border-color: var(--line); }
.modal-head h2 { color: #1c1c1e; font-weight: 650; }
.modal::backdrop { background: #17171c55; backdrop-filter: blur(7px); }
.modal-actions { border-color: var(--line); }
.toast { border: 0; border-radius: 99px; background: #1c1c1e; color: #fff; }
table th { color: #8e8e93; }
table td { color: #636366; }

@media (max-width: 1050px) and (min-width: 761px) {
  .app-shell { grid-template-columns: 210px minmax(0,1fr); }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat-card:nth-child(2) { border-right: 0; }
}
@media (max-width: 760px) {
  .preview-ribbon { min-height: 24px; font-size: 7px; }
  .app-shell, .main-area { min-height: calc(100dvh - 24px); }
  .topbar { top: 24px; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; background: #f8f8fbe8; }
  .crumb span, .crumb > b { display: none; }
  .crumb strong { color: #1c1c1e; font-size: 16px; font-weight: 650; letter-spacing: -.025em; }
  .icon-button, .top-avatar { width: 40px; height: 40px; }
  .view { display: flex; flex-direction: column; padding: 24px 16px calc(112px + env(safe-area-inset-bottom)); }
  .page-heading { gap: 9px; margin-bottom: 20px; }
  .page-heading .eyebrow { font-size: 10px; }
  .page-heading h1 { margin: 1px 0 0; font-size: 34px; font-weight: 700; letter-spacing: -.055em; }
  .page-heading p { margin-top: 5px; font-size: 14px; }
  .heading-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .button { min-height: 46px; padding: 10px 12px; font-size: 13px; }
  .stats-grid { order: 4; grid-template-columns: 1fr 1fr; gap: 1px; margin: 1px 0 21px; border-radius: 15px; }
  .stat-card { min-height: 83px; padding: 12px; }
  .stat-card span { font-size: 8px; line-height: 1.35; letter-spacing: .04em; }
  .stat-card b { margin: 6px 0 1px; font-size: 21px; }
  .stat-card em { font-size: 9px; line-height: 1.3; }
  .section-title-row { order: 2; align-items: center; margin: 0 0 10px; }
  .section-title-row h2 { margin-top: 3px; font-size: 20px; font-weight: 650; }
  .section-title-row .text-button { min-height: 40px; padding: 7px 0; font-size: 11px; }
  .bike-grid { order: 3; grid-template-columns: 1fr; gap: 11px; }
  .bike-card { padding: 15px; border-radius: 16px; }
  .bike-card-top { gap: 0; padding-bottom: 12px; }
  .bike-title h2 { font-size: 21px; }
  .bike-title p { font-size: 11px; }
  .bike-actions-inline { gap: 7px; margin-top: 9px; }
  .bike-actions-inline button { min-height: 36px; padding: 7px 10px; font-size: 10px; }
  .odo-row { padding: 12px 0 9px; }
  .next-row { padding: 12px 0; }
  .bike-spend-row { gap: 5px; }
  .bike-spend-row span { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 8px; }
  .bike-spend-row b { font-size: 11px; }
  .lower-grid { order: 5; grid-template-columns: 1fr; gap: 11px; margin-top: 15px; }
  .panel { padding: 16px 14px; border-radius: 15px; }
  .panel-heading h3, .panel h3 { font-size: 15px; }
  .panel p, .insight-panel p { font-size: 13px; }
  .action-row { min-height: 60px; }
  .demo-banner { order: 6; padding: 12px; }
  .mobile-nav { height: calc(72px + env(safe-area-inset-bottom)); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: #fafafce8; border-top: 1px solid #dedee4; box-shadow: 0 -5px 20px #17171c0a; backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); }
  .mobile-nav button { min-width: 0; min-height: 52px; padding: 5px 2px; border-radius: 13px; color: #8e8e93; }
  .mobile-nav button span { color: inherit; font-size: 20px; }
  .mobile-nav button.active { color: #007aff; background: #eaf3ff; }
  .mobile-nav button.active span { transform: none; }
  .mobile-nav button small { font-size: 9px; font-weight: 550; }
  .more-grid { grid-template-columns: 1fr; gap: 9px; }
  .more-tile { min-height: 76px; border-radius: 14px; }
  .settings-card, .schedule-row, .service-card, .component-card { border-radius: 15px; }
  .schedule-row { gap: 10px; padding: 13px; }
  .schedule-title h3 { font-size: 14px; }
  .schedule-row p, .schedule-meta { font-size: 11px; }
  .field input, .field select, .field textarea { min-height: 48px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* Keep the appearance preference functional while retaining the iOS visual system. */
html:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1c1e;
  --sidebar: #242426;
  --panel: #2c2c2e;
  --panel-2: #38383a;
  --line: #3a3a3c;
  --line-strong: #545458;
  --text: #f5f5f7;
  --muted: #b4b4ba;
  --muted2: #8e8e93;
  background: var(--bg);
  color: var(--text);
}
html:root[data-theme="dark"] body,
html:root[data-theme="dark"] .main-area { background: #1c1c1e; color: #f5f5f7; }
html:root[data-theme="dark"] .sidebar,
html:root[data-theme="dark"] .bike-mini,
html:root[data-theme="dark"] .stat-card,
html:root[data-theme="dark"] .bike-card,
html:root[data-theme="dark"] .panel,
html:root[data-theme="dark"] .settings-card,
html:root[data-theme="dark"] .schedule-row,
html:root[data-theme="dark"] .service-card,
html:root[data-theme="dark"] .component-card,
html:root[data-theme="dark"] .empty-state,
html:root[data-theme="dark"] .note-panel,
html:root[data-theme="dark"] .demo-banner,
html:root[data-theme="dark"] .more-tile,
html:root[data-theme="dark"] .warning-note { background: #2c2c2e; border-color: #3a3a3c; color: #f5f5f7; }
html:root[data-theme="dark"] .topbar,
html:root[data-theme="dark"] .mobile-nav { background: #242426ed; border-color: #3a3a3c; }
html:root[data-theme="dark"] .page-heading h1,
html:root[data-theme="dark"] .section-title-row h2,
html:root[data-theme="dark"] .bike-title h2,
html:root[data-theme="dark"] .garage-bike h2,
html:root[data-theme="dark"] .odo-row strong,
html:root[data-theme="dark"] .next-row b,
html:root[data-theme="dark"] .stat-card b,
html:root[data-theme="dark"] .bike-spend-row b,
html:root[data-theme="dark"] .panel-heading h3,
html:root[data-theme="dark"] .panel h3,
html:root[data-theme="dark"] .action-copy b,
html:root[data-theme="dark"] .more-tile > b,
html:root[data-theme="dark"] .crumb strong,
html:root[data-theme="dark"] .brand b { color: #f5f5f7; }
html:root[data-theme="dark"] .page-heading p,
html:root[data-theme="dark"] .panel p,
html:root[data-theme="dark"] .insight-panel p,
html:root[data-theme="dark"] .bike-title p,
html:root[data-theme="dark"] .garage-bike-head p { color: #b4b4ba; }
html:root[data-theme="dark"] .bike-card-top { border-color: #3a3a3c; }
html:root[data-theme="dark"] .button.secondary,
html:root[data-theme="dark"] .button.quiet,
html:root[data-theme="dark"] .bike-actions-inline button,
html:root[data-theme="dark"] .record-actions button,
html:root[data-theme="dark"] .icon-button { background: #2c2c2e; border-color: #545458; color: #72b7ff; }
html:root[data-theme="dark"] .top-avatar { background: #303a48; color: #72b7ff; }
html:root[data-theme="dark"] .year-chip,
html:root[data-theme="dark"] .icon-tile,
html:root[data-theme="dark"] .more-tile > span,
html:root[data-theme="dark"] .settings-icon { background: #38383a; color: #72b7ff; }
html:root[data-theme="dark"] .progress-ring { border-color: #545458; color: #f5f5f7; }
html:root[data-theme="dark"] .action-list,
html:root[data-theme="dark"] .action-row,
html:root[data-theme="dark"] .insight-bottom,
html:root[data-theme="dark"] .odo-row,
html:root[data-theme="dark"] .bike-spend-row { border-color: #3a3a3c; }
html:root[data-theme="dark"] .field input,
html:root[data-theme="dark"] .field textarea,
html:root[data-theme="dark"] .field select,
html:root[data-theme="dark"] .bike-select,
html:root[data-theme="dark"] input,
html:root[data-theme="dark"] select,
html:root[data-theme="dark"] textarea { background: #2c2c2e; border-color: #545458; color: #f5f5f7; }
html:root[data-theme="dark"] .modal,
html:root[data-theme="dark"] .modal-head { background: #2c2c2e; color: #f5f5f7; border-color: #3a3a3c; }
html:root[data-theme="dark"] .mobile-nav button { color: #8e8e93; }
html:root[data-theme="dark"] .mobile-nav button.active { color: #72b7ff; background: #26394c; }
html:root[data-theme="dark"] .demo-banner small { color: #b4b4ba; }
