/* Island Car Log — Professional UI system
   Visual-only consistency layer. Keeps existing Guernsey palette, page imagery and app logic. */

:root{
  --icl-blue:#1677d2;
  --icl-blue-deep:#0f5fb0;
  --icl-green:#479d68;
  --icl-navy:#071a2d;
  --icl-ink:#111827;
  --icl-muted:#64748b;
  --icl-line:rgba(148,163,184,.34);
  --icl-surface:rgba(255,255,255,.86);
  --icl-surface-soft:rgba(248,250,252,.82);
  --icl-radius-sm:12px;
  --icl-radius:16px;
  --icl-radius-lg:24px;
  --icl-shadow-sm:0 6px 18px rgba(7,26,45,.08);
  --icl-shadow:0 18px 48px rgba(7,26,45,.13);
  --icl-focus:0 0 0 4px rgba(22,119,210,.16);
  --icl-ease:cubic-bezier(.2,.8,.2,1);
}

html{
  -webkit-text-size-adjust:100%;
  text-rendering:optimizeLegibility;
  scroll-padding-top:88px;
}
body{
  line-height:1.55;
  letter-spacing:-.005em;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
button,input,select,textarea{font:inherit}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
img{max-width:100%}

h1,h2,h3,h4{
  text-wrap:balance;
  letter-spacing:-.025em;
}
p{ text-wrap:pretty; }

/* Navigation */
.nav, header{
  min-height:72px;
  padding-left:clamp(16px,4vw,52px)!important;
  padding-right:clamp(16px,4vw,52px)!important;
}
.navlinks{
  align-items:center;
  gap:clamp(18px,2.4vw,32px)!important;
}
.navlinks a,
header .back,
.nav .back{
  border-radius:10px;
  transition:color .18s ease,background .18s ease,opacity .18s ease;
}
.navlinks a:hover{color:var(--icl-blue)}
.navlinks a:focus-visible,
header .back:focus-visible,
.nav .back:focus-visible{
  outline:2px solid rgba(22,119,210,.65);
  outline-offset:4px;
}

/* Cards and surfaces: same geometry and depth throughout, without replacing page artwork. */
.card,
.form,
.garage-access-panel,
.garage-point,
.account-bar,
.docs-card,
.dashboard-stat,
.car-stat,
.modal-inner,
.modal-content,
.panel,
.glass-panel{
  border-radius:var(--icl-radius-lg)!important;
}
.card,
.form,
.garage-access-panel,
.garage-point,
.modal-inner,
.modal-content,
.panel,
.glass-panel{
  box-shadow:var(--icl-shadow)!important;
}
.card,
.form,
.garage-access-panel,
.garage-point{
  transition:transform .22s var(--icl-ease),box-shadow .22s var(--icl-ease),border-color .22s ease;
}
@media (hover:hover) and (pointer:fine){
  .features .card:hover,
  .garage-point:hover{
    transform:translateY(-3px);
    box-shadow:0 22px 54px rgba(7,26,45,.16)!important;
  }
}

/* Controls */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea{
  min-width:0;
  max-width:100%;
  min-height:48px;
  border-radius:var(--icl-radius-sm)!important;
  border:1px solid rgba(148,163,184,.48)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.74),0 3px 10px rgba(7,26,45,.05)!important;
  transition:border-color .18s ease,box-shadow .18s ease,background .18s ease!important;
}
textarea{min-height:112px;resize:vertical}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus{
  outline:none!important;
  border-color:rgba(22,119,210,.78)!important;
  box-shadow:var(--icl-focus),inset 0 1px 0 rgba(255,255,255,.8)!important;
}
input::placeholder,textarea::placeholder{color:#8190a2;opacity:1}
label{
  font-weight:700!important;
  letter-spacing:.005em;
}

/* Action hierarchy */
button:not(.check-engine-light),
a.primary,
a.secondary,
a.cta,
.btn,
.button{
  min-height:46px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border-radius:14px!important;
  font-weight:800!important;
  line-height:1.15;
  transition:transform .18s var(--icl-ease),box-shadow .18s ease,background .18s ease,border-color .18s ease,opacity .18s ease!important;
}
a.primary,a.cta,
button:not(.secondary):not(.danger):not(.delete):not(.check-engine-light):not(.service-edit){
  box-shadow:0 9px 22px rgba(22,119,210,.22),inset 0 1px 0 rgba(255,255,255,.28)!important;
}
a.secondary,.secondary{
  box-shadow:var(--icl-shadow-sm)!important;
}
button:not(.check-engine-light):focus-visible,
a.primary:focus-visible,
a.secondary:focus-visible,
a.cta:focus-visible,
.btn:focus-visible,
.button:focus-visible{
  outline:2px solid rgba(255,255,255,.92)!important;
  outline-offset:3px!important;
  box-shadow:var(--icl-focus),0 10px 24px rgba(7,26,45,.16)!important;
}
@media (hover:hover) and (pointer:fine){
  button:not(.check-engine-light):not(:disabled):hover,
  a.primary:hover,a.secondary:hover,a.cta:hover,.btn:hover,.button:hover{
    transform:translateY(-1px);
  }
}
button:not(.check-engine-light):not(:disabled):active,
a.primary:active,a.secondary:active,a.cta:active,.btn:active,.button:active{
  transform:translateY(0) scale(.985);
}
button:disabled{cursor:not-allowed!important;opacity:.58!important}

/* Keep compact in-card vehicle controls compact. */
.car-card .car-actions button,
.car-card .service-edit{
  min-height:40px!important;
  border-radius:12px!important;
}
.car-card .check-engine-light{
  border-radius:14px!important;
}

/* Content hierarchy */
.section{padding-top:clamp(56px,7vw,84px)!important;padding-bottom:clamp(56px,7vw,84px)!important}
.section-inner{width:min(1180px,100%);margin-inline:auto}
.kicker,.eyebrow{
  font-size:12px!important;
  letter-spacing:.11em!important;
  font-weight:900!important;
}
.note,.muted,.help-text,.form-note,.small,.description,.subtitle{
  line-height:1.55;
}

/* Modals / sheets */
.modal{
  padding:clamp(12px,3vw,28px)!important;
  overscroll-behavior:contain;
}
.modal-inner,.modal-content{
  width:min(100%,980px);
  max-height:min(90dvh,900px);
  overflow:auto;
  border:1px solid rgba(255,255,255,.62)!important;
}
.modal-inner > h2:first-child,
.modal-content > h2:first-child{
  margin-top:0;
}
.modal .grid > *,
.modal [class*="grid"] > *,
.grid > *{
  min-width:0;
}

/* Status messages */
.status,.success,.error{
  border-radius:12px!important;
}
.status{
  border:1px solid rgba(71,157,104,.18);
}
.status.error{
  border-color:rgba(185,44,44,.16);
}

/* Profile / Garage coherence */
#app .profile-card,
#app .garage-card{
  border-radius:26px!important;
  box-shadow:0 22px 56px rgba(0,12,30,.20)!important;
}
#app .account-bar,
#app .dashboard-stat,
#app .car-stat,
#app .docs-card{
  border-radius:15px!important;
}
#app .profile-card h3,
#app .garage-card h2{
  border-radius:11px!important;
}
.cars{gap:18px!important}
.car-card{
  border-radius:22px!important;
  box-shadow:0 18px 42px rgba(0,0,0,.26)!important;
}
.car-card .dashboard-card{border-radius:17px!important}

/* Footer */
.footer{
  padding-top:34px!important;
  padding-bottom:34px!important;
}
.footer-links{
  align-items:center;
  gap:12px 20px!important;
}
.footer-links a{
  border-radius:10px;
  padding:8px 2px;
}

/* Responsive rhythm */
@media(max-width:850px){
  main{padding-left:16px!important;padding-right:16px!important}
  .nav,header{min-height:68px}
  .section{padding-left:18px!important;padding-right:18px!important}
}
@media(max-width:700px){
  .card,.form,.garage-access-panel,.modal-inner,.modal-content{
    border-radius:20px!important;
  }
  .card,.form{padding:20px!important}
  .grid{gap:14px!important}
  .hero-buttons{gap:10px!important}
  .hero-buttons > a{
    min-height:48px;
  }
  .modal{padding:10px!important}
  .modal-inner,.modal-content{
    width:100%!important;
    max-width:100%!important;
    max-height:92dvh;
  }
  .modal .grid,
  .modal [class*="grid"]{
    min-width:0;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select,textarea{
    width:100%;
    max-width:100%;
    box-sizing:border-box;
  }
}
@media(max-width:520px){
  .nav,header{
    padding-left:14px!important;
    padding-right:14px!important;
  }
  .footer{padding-left:18px!important;padding-right:18px!important}
  .footer-inner{gap:18px!important}
  .card,.form{padding:18px!important}
}

/* Motion accessibility */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{
    scroll-behavior:auto!important;
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
}


/* =======================================================================
   Professional product pass — 2026-10-03
   Page-scoped refinements layered over the existing Island Car Log theme.
   ======================================================================= */

:root{
  --icl-page-width:1180px;
  --icl-copy-width:720px;
  --icl-control-radius:13px;
  --icl-card-radius:22px;
  --icl-section-gap:clamp(52px,7vw,88px);
}

/* Public-site navigation/footer alignment */
body.page-home .nav,
body.page-about .nav,
body.page-support .nav{
  min-height:74px!important;
  padding-top:7px!important;
  padding-bottom:7px!important;
}
body.page-home .nav > *,
body.page-about .nav > *,
body.page-support .nav > *{
  flex-shrink:0;
}
body.page-home .navlinks a{
  position:relative;
  padding:9px 2px;
  font-size:15px;
}
body.page-home .navlinks a::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:3px;
  height:2px;
  border-radius:999px;
  background:var(--icl-blue);
  transform:scaleX(0);
  transform-origin:center;
  transition:transform .2s var(--icl-ease);
}
@media (hover:hover) and (pointer:fine){
  body.page-home .navlinks a:hover::after{transform:scaleX(1)}
}
body.page-home .footer-inner,
body.page-about .footer-inner,
body.page-support .footer-inner{
  width:min(var(--icl-page-width),100%);
}

/* Homepage — clearer product-led hero */
body.page-home .hero{
  padding-top:clamp(54px,7vw,88px)!important;
  padding-bottom:clamp(64px,8vw,100px)!important;
}
body.page-home .hero-inner{
  width:min(var(--icl-page-width),100%);
  grid-template-columns:minmax(0,1.03fr) minmax(320px,.97fr)!important;
  gap:clamp(36px,6vw,76px)!important;
}
body.page-home .hero h1{
  max-width:720px;
}
body.page-home .hero h2{
  color:#1f3146;
  letter-spacing:-.03em;
}
body.page-home .hero p{
  max-width:690px;
}
body.page-home .hero-buttons{
  align-items:center;
}
body.page-home .hero-buttons .primary,
body.page-home .hero-buttons .secondary{
  min-height:50px;
  padding-inline:22px!important;
  border-radius:13px!important;
}
body.page-home .local{
  display:inline-flex;
  align-items:center;
  min-height:38px;
  padding:8px 12px;
  border-radius:11px;
  border:1px solid rgba(22,119,210,.14);
  background:rgba(255,255,255,.68);
  box-shadow:0 5px 18px rgba(7,26,45,.06);
  font-size:14px;
}
body.page-home .hero-product{
  position:relative;
  display:flex;
  justify-content:center;
  align-items:center;
  min-width:0;
}
body.page-home .hero-product-glow{
  position:absolute;
  width:min(440px,88%);
  aspect-ratio:1;
  border-radius:50%;
  background:radial-gradient(circle,rgba(22,119,210,.18),rgba(71,157,104,.08) 44%,transparent 70%);
  filter:blur(4px);
  pointer-events:none;
}
body.page-home .hero-device-card{
  position:relative;
  width:min(400px,92%);
  padding:14px 14px 18px;
  border-radius:30px;
  background:linear-gradient(145deg,rgba(255,255,255,.88),rgba(240,247,252,.64));
  border:1px solid rgba(255,255,255,.86);
  box-shadow:0 30px 74px rgba(7,26,45,.18),inset 0 1px 0 rgba(255,255,255,.95);
  backdrop-filter:blur(24px) saturate(145%);
  -webkit-backdrop-filter:blur(24px) saturate(145%);
}
body.page-home .hero-device-top{
  display:flex;
  align-items:center;
  gap:8px;
  padding:3px 4px 11px;
  color:#5b6b7e;
  font-size:10px;
  font-weight:900;
  letter-spacing:.11em;
}
body.page-home .hero-device-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--icl-green);
  box-shadow:0 0 0 4px rgba(71,157,104,.12);
}
body.page-home .hero-device-card img{
  display:block;
  width:100%;
  max-height:510px;
  object-fit:contain;
  object-position:center top;
  border-radius:22px;
}
body.page-home .hero-device-caption{
  padding:13px 8px 1px;
}
body.page-home .hero-device-caption strong,
body.page-home .hero-device-caption span{
  display:block;
}
body.page-home .hero-device-caption strong{
  color:#14253a;
  font-size:15px;
  margin-bottom:3px;
}
body.page-home .hero-device-caption span{
  color:#64748b;
  font-size:12px;
}

/* Homepage feature cards: professional line icons, consistent rhythm */
body.page-home #features .section-inner > h3{
  max-width:760px;
  margin-left:auto;
  margin-right:auto;
}
body.page-home .features{
  align-items:stretch;
}
body.page-home .feature-card{
  display:flex;
  flex-direction:column;
  min-height:250px;
  padding:26px!important;
  border-radius:20px!important;
}
body.page-home .feature-card h4{
  font-size:19px;
  line-height:1.2;
  margin-bottom:10px;
}
body.page-home .feature-card p{
  margin-top:auto;
  padding-top:4px;
}
body.page-home .feature-icon{
  width:52px!important;
  height:52px!important;
  display:grid!important;
  place-items:center!important;
  margin-bottom:22px!important;
  border-radius:14px!important;
  color:var(--icl-blue);
  background:linear-gradient(145deg,#eff7ff,#e4f1fb)!important;
  border:1px solid rgba(22,119,210,.12);
  box-shadow:0 8px 20px rgba(22,119,210,.08);
}
body.page-home .feature-icon svg{
  width:26px;
  height:26px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
body.page-home .garage-point{
  min-height:158px;
}
body.page-home .garage-access-panel{
  border-radius:22px!important;
}
body.page-home .garage-access-badge{
  letter-spacing:.08em!important;
}
body.page-home .beta-grid{
  width:min(var(--icl-page-width),100%);
}
body.page-home .beta .form{
  border-radius:22px!important;
}
body.page-home .beta .form input{
  margin-bottom:10px;
}

/* About + Support — turn content pages into clean customer-service pages */
body.page-about .main,
body.page-support .main{
  width:min(960px,calc(100% - 32px))!important;
  max-width:960px!important;
  margin-inline:auto!important;
  padding-left:0!important;
  padding-right:0!important;
}
body.page-about .main > .eyebrow,
body.page-support .main > .eyebrow{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(22,119,210,.14);
  border:1px solid rgba(255,255,255,.24);
  color:#fff!important;
}
body.page-about .main > h1,
body.page-support .main > h1{
  max-width:760px;
  margin-bottom:18px!important;
  line-height:1.02!important;
}
body.page-about .intro,
body.page-support .intro{
  max-width:var(--icl-copy-width)!important;
  font-size:17px!important;
  line-height:1.7!important;
  margin-bottom:34px!important;
}
body.page-about .grid,
body.page-support .grid{
  gap:16px!important;
  margin-top:26px!important;
}
body.page-about .main .card,
body.page-support .main .card{
  padding:24px!important;
  border-radius:20px!important;
  background:rgba(255,255,255,.90)!important;
  border:1px solid rgba(255,255,255,.78)!important;
  box-shadow:0 16px 38px rgba(7,26,45,.13)!important;
}
body.page-about .main .card h2,
body.page-support .main .card h2{
  color:#14253a!important;
  font-size:20px!important;
  line-height:1.2!important;
  margin-bottom:9px!important;
  text-shadow:none!important;
}
body.page-about .main .card p,
body.page-about .main .card li,
body.page-support .main .card p,
body.page-support .main .card li{
  color:#526174!important;
  line-height:1.65!important;
  text-shadow:none!important;
}
body.page-support .contact{
  margin-top:18px!important;
}
body.page-support .email{
  display:inline-flex!important;
  align-items:center;
  justify-content:center;
  min-height:44px;
  margin-top:8px;
  padding:10px 14px!important;
  border-radius:12px!important;
  color:#fff!important;
  background:linear-gradient(135deg,var(--icl-blue),var(--icl-blue-deep))!important;
  border:1px solid rgba(22,119,210,.22)!important;
  box-shadow:0 8px 20px rgba(22,119,210,.18)!important;
}

/* Logged-in app — tighten hierarchy without changing feature-specific layouts */
body.page-profile main{
  width:min(1120px,100%);
  max-width:1120px!important;
}
body.page-profile .hero{
  margin-bottom:22px!important;
}
body.page-profile .hero h1{
  letter-spacing:-.035em;
}
body.page-profile #app > .account-bar{
  padding:14px 16px!important;
  border-radius:16px!important;
}
body.page-profile #app > .garage-card,
body.page-profile #app > .profile-card{
  padding:24px!important;
}
body.page-profile #app .garage-card > h2,
body.page-profile #app .profile-card > h2{
  letter-spacing:-.02em!important;
}
body.page-profile .car-card{
  padding:10px!important;
}
body.page-profile .car-card .dashboard-image{
  border-radius:14px!important;
}
body.page-profile .car-card .docs-card,
body.page-profile .car-card .service-box{
  border-radius:14px!important;
}
body.page-profile .modal-head{
  gap:16px;
  align-items:flex-start!important;
}
body.page-profile .modal-head h2{
  line-height:1.15!important;
}
body.page-profile .modal .close{
  flex:0 0 auto;
  width:44px!important;
  min-width:44px!important;
  height:44px!important;
  min-height:44px!important;
  margin:0!important;
  padding:0!important;
  border-radius:13px!important;
}
body.page-profile .status{
  font-weight:650;
}
body.page-profile .dashboard-summary{
  gap:12px!important;
}

/* Password reset page — same product language as the main app */
body.page-password{
  padding:24px;
}
body.page-password > .card{
  width:min(460px,100%)!important;
  padding:30px!important;
  border-radius:24px!important;
}
body.page-password > .card .logo{
  margin:0 auto 20px!important;
}
body.page-password > .card h1{
  font-size:30px;
  line-height:1.08;
  margin-bottom:10px;
}
body.page-password > .card p{
  line-height:1.6;
  margin-bottom:20px;
}
body.page-password > .card label{
  margin-top:14px!important;
}
body.page-password > .card button{
  min-height:50px;
  border-radius:13px!important;
}

/* More restrained component geometry site-wide */
body.page-home button,
body.page-home a.primary,
body.page-home a.secondary,
body.page-home a.cta,
body.page-about button,
body.page-support button,
body.page-password button{
  border-radius:13px!important;
}
body.page-profile button:not(.check-engine-light){
  border-radius:12px!important;
}

/* Responsive polish */
@media(max-width:900px){
  body.page-home .hero-inner{
    grid-template-columns:1fr!important;
  }
  body.page-home .hero-product{
    margin-top:10px;
  }
  body.page-home .hero-device-card{
    width:min(390px,86%);
  }
}
@media(max-width:700px){
  body.page-home .hero{
    padding-left:18px!important;
    padding-right:18px!important;
  }
  body.page-home .hero h1{
    font-size:clamp(42px,13vw,58px)!important;
  }
  body.page-home .hero h2{
    font-size:24px!important;
  }
  body.page-home .hero p{
    font-size:17px!important;
  }
  body.page-home .hero-device-card{
    width:min(350px,94%);
    padding:11px 11px 15px;
    border-radius:24px;
  }
  body.page-home .feature-card{
    min-height:0;
    padding:22px!important;
  }
  body.page-about .main,
  body.page-support .main{
    width:min(100% - 28px,960px)!important;
  }
  body.page-about .main .card,
  body.page-support .main .card{
    padding:20px!important;
  }
  body.page-profile main{
    padding-left:12px!important;
    padding-right:12px!important;
  }
  body.page-profile #app > .garage-card,
  body.page-profile #app > .profile-card{
    padding:18px!important;
  }
}
@media(max-width:520px){
  body.page-home .hero-buttons{
    display:grid!important;
    grid-template-columns:1fr!important;
  }
  body.page-home .hero-buttons > a{
    width:100%!important;
  }
  body.page-home .local{
    width:100%;
    justify-content:flex-start;
  }
  body.page-home .hero-device-card{
    width:100%;
  }
  body.page-password{
    padding:14px;
  }
  body.page-password > .card{
    padding:22px!important;
    border-radius:20px!important;
  }
}


/* =======================================================================
   Expenses workspace — fit the complete dashboard into one desktop view.
   The existing data, Chart.js rendering and controls are unchanged.
   ======================================================================= */
@media(min-width:701px){
  body.page-profile #dashboardModal{
    padding:16px!important;
    align-items:center!important;
    justify-content:center!important;
  }

  body.page-profile #dashboardModal .dashboard-modal{
    width:min(1180px,calc(100vw - 32px))!important;
    max-width:1180px!important;
    height:calc(100dvh - 32px)!important;
    max-height:calc(100dvh - 32px)!important;
    min-height:0!important;
    margin:auto!important;
    padding:22px 24px!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
  }

  body.page-profile #dashboardModal .modal-head{
    flex:0 0 auto!important;
    margin-bottom:10px!important;
  }

  body.page-profile #dashboardModal .modal-head h2{
    margin-bottom:2px!important;
  }

  body.page-profile #dashboardModal #dashboardModalSummary{
    margin-top:2px!important;
  }

  body.page-profile #dashboardModal .dashboard-summary{
    flex:0 0 auto!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:12px!important;
    margin-top:8px!important;
    margin-bottom:0!important;
  }

  body.page-profile #dashboardModal .dashboard-stat{
    min-height:74px!important;
    padding:12px 14px!important;
  }

  body.page-profile #dashboardModal .dashboard-stat span{
    margin-bottom:3px!important;
  }

  body.page-profile #dashboardModal .dashboard-stat strong{
    font-size:clamp(18px,2vw,24px)!important;
  }

  body.page-profile #dashboardModal .chart-toggle{
    flex:0 0 auto!important;
    margin:10px 0!important;
    gap:8px!important;
  }

  body.page-profile #dashboardModal .chart-toggle button{
    width:auto!important;
    min-width:112px!important;
    min-height:40px!important;
    margin:0!important;
    padding:9px 16px!important;
  }

  /* The Valuation module nests Expenses in its own tab. Bound that flex child,
     otherwise canvas measurements can grow beyond the desktop window. */
  body.page-profile #dashboardModal #expenseDashboardSection:not([hidden]){
    display:flex!important;
    flex:1 1 auto!important;
    flex-direction:column!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  body.page-profile #dashboardModal #expenseDashboardSection .chart-wrap{
    flex:1 1 auto!important;
    min-height:0!important;
    max-height:360px!important;
    height:100%!important;
    width:min(100%,850px)!important;
    align-self:center!important;
    margin-inline:auto!important;
    padding:12px!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  body.page-profile #dashboardModal #expenseDashboardSection .chart-wrap canvas{
    display:block!important;
    width:100%!important;
    height:100%!important;
    max-width:100%!important;
    max-height:100%!important;
    box-sizing:border-box!important;
  }

  body.page-profile #dashboardModal #dashboardStatus{
    flex:0 0 auto!important;
    margin-top:8px!important;
  }
}

/* Short laptop displays: keep everything visible rather than introducing a modal scrollbar. */
@media(min-width:701px) and (max-height:720px){
  body.page-profile #dashboardModal .dashboard-modal{
    padding:14px 18px!important;
  }
  body.page-profile #dashboardModal .modal-head{
    margin-bottom:5px!important;
  }
  body.page-profile #dashboardModal .dashboard-summary{
    gap:8px!important;
    margin-top:4px!important;
  }
  body.page-profile #dashboardModal .dashboard-stat{
    min-height:60px!important;
    padding:8px 11px!important;
  }
  body.page-profile #dashboardModal .dashboard-stat strong{
    font-size:18px!important;
  }
  body.page-profile #dashboardModal .chart-toggle{
    margin:6px 0!important;
  }
  body.page-profile #dashboardModal .chart-toggle button{
    min-height:36px!important;
    padding:7px 13px!important;
  }
  body.page-profile #dashboardModal .chart-wrap{
    padding:8px!important;
  }
}

/* Phones remain a normal responsive modal; use the available screen before scrolling. */
@media(max-width:700px){
  body.page-profile #dashboardModal .dashboard-modal{
    width:100%!important;
    max-width:100%!important;
    max-height:calc(100dvh - 20px)!important;
    padding:18px!important;
  }
  body.page-profile #dashboardModal .chart-wrap{
    height:min(320px,42dvh)!important;
  }
}


/* =======================================================================
   New Car desktop workspace — show the complete Add Car form at once.
   Applies only to carModal.new-car-mode so Edit Car / Service Settings
   keep their established layout and behaviour.
   ======================================================================= */
@media(min-width:901px){
  body.page-profile #carModal.new-car-mode{
    padding:16px!important;
    align-items:center!important;
    justify-content:center!important;
    overflow:hidden!important;
  }

  body.page-profile #carModal.new-car-mode .modal-inner{
    width:min(1100px,calc(100vw - 32px))!important;
    max-width:1100px!important;
    height:auto!important;
    max-height:calc(100dvh - 32px)!important;
    margin:auto!important;
    padding:20px 22px!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }

  body.page-profile #carModal.new-car-mode .modal-head{
    margin-bottom:10px!important;
    align-items:center!important;
  }

  body.page-profile #carModal.new-car-mode .modal-head h2{
    margin:0!important;
    font-size:26px!important;
    line-height:1.1!important;
  }

  body.page-profile #carModal.new-car-mode .car-form{
    display:flex!important;
    flex-direction:column!important;
    gap:12px!important;
    min-height:0!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-grid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:10px 14px!important;
    width:100%!important;
    min-width:0!important;
  }

  body.page-profile #carModal.new-car-mode .car-identity-fields{
    display:contents!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field{
    display:flex!important;
    flex-direction:column!important;
    min-width:0!important;
    gap:5px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field label{
    display:block!important;
    margin:0!important;
    padding:0!important;
    min-height:18px!important;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
    font-size:12px!important;
    line-height:1.25!important;
    color:#111827!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field label span{
    color:#64748b!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field input{
    width:100%!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px!important;
    margin:0!important;
    padding:9px 11px!important;
    box-sizing:border-box!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-actions{
    display:flex!important;
    justify-content:flex-end!important;
    gap:10px!important;
    margin-top:2px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-actions button{
    width:auto!important;
    min-width:130px!important;
    min-height:42px!important;
    margin:0!important;
    padding:9px 18px!important;
  }

  body.page-profile #carModal.new-car-mode #carStatus{
    margin-top:8px!important;
  }
}

/* Narrower desktop / landscape tablet: keep it fully visible with two columns. */
@media(min-width:701px) and (max-width:900px){
  body.page-profile #carModal.new-car-mode{
    padding:12px!important;
    overflow:hidden!important;
  }

  body.page-profile #carModal.new-car-mode .modal-inner{
    width:min(820px,calc(100vw - 24px))!important;
    max-width:820px!important;
    max-height:calc(100dvh - 24px)!important;
    margin:auto!important;
    padding:16px 18px!important;
    overflow:hidden!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px 12px!important;
  }

  body.page-profile #carModal.new-car-mode .car-identity-fields{
    display:contents!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field{
    min-width:0!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field label{
    display:block!important;
    margin:0 0 4px!important;
    padding:0!important;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
    font-size:11px!important;
    line-height:1.2!important;
    color:#111827!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field label span{
    color:#64748b!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field input{
    width:100%!important;
    min-width:0!important;
    min-height:39px!important;
    height:39px!important;
    margin:0!important;
    padding:8px 10px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-actions{
    display:flex!important;
    justify-content:flex-end!important;
    gap:8px!important;
    margin-top:10px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-actions button{
    width:auto!important;
    min-width:120px!important;
    min-height:40px!important;
    margin:0!important;
  }
}

/* Short desktop screens: compress vertical chrome before allowing scrolling. */
@media(min-width:701px) and (max-height:700px){
  body.page-profile #carModal.new-car-mode .modal-inner{
    padding-top:12px!important;
    padding-bottom:12px!important;
  }

  body.page-profile #carModal.new-car-mode .modal-head{
    margin-bottom:6px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form{
    gap:8px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-grid{
    row-gap:6px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field{
    gap:3px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-field input{
    min-height:36px!important;
    height:36px!important;
    padding-top:6px!important;
    padding-bottom:6px!important;
  }

  body.page-profile #carModal.new-car-mode .car-form-actions button{
    min-height:36px!important;
    padding-top:7px!important;
    padding-bottom:7px!important;
  }
}

/* Phones keep the existing single-column scrollable form. */
@media(max-width:700px){
  body.page-profile #carModal .car-form-grid{
    display:block!important;
  }

  body.page-profile #carModal .car-form-field{
    display:block!important;
  }

  body.page-profile #carModal .car-form-actions{
    display:block!important;
  }

  body.page-profile #carModal .car-form-actions button{
    width:100%!important;
  }
}


/* =======================================================================
   Timeline desktop fit — keep the complete timeline centred in one view.
   ======================================================================= */
@media(min-width:701px){
  body.page-profile #timelineModal{
    padding:14px 16px!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    align-items:flex-start!important;
    justify-content:center!important;
  }

  body.page-profile #timelineModal .timeline-modal{
    width:min(1500px,calc(100vw - 32px))!important;
    max-width:1500px!important;
    height:auto!important;
    max-height:none!important;
    margin:14px auto!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }

  body.page-profile #timelineModal .timeline-track{
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    overflow-x:clip!important;
    overflow-y:visible!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }

  body.page-profile #timelineModal .timeline-months{
    min-height:108px!important;
    height:auto!important;
    align-items:flex-start!important;
  }

  body.page-profile #timelineModal .timeline-month{
    height:auto!important;
    overflow:visible!important;
  }

  body.page-profile #timelineModal .timeline-month-detail.open{
    display:flex!important;
    max-height:none!important;
    overflow:visible!important;
  }

  body.page-profile #timelineModal .timeline-months{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    padding-left:6px!important;
    padding-right:6px!important;
    box-sizing:border-box!important;
    justify-content:center!important;
    margin-left:auto!important;
    margin-right:auto!important;
  }

  body.page-profile #timelineModal .timeline-month{
    width:var(--timeline-month-width)!important;
    flex:0 0 var(--timeline-month-width)!important;
    min-width:0!important;
    box-sizing:border-box!important;
    padding-left:3px!important;
    padding-right:3px!important;
  }

  body.page-profile #timelineModal .timeline-month-label{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    overflow:visible!important;
    font-size:var(--timeline-label-size,11px)!important;
    line-height:1.1!important;
    text-align:center!important;
    white-space:nowrap!important;
  }

  body.page-profile #timelineModal .timeline-track.year-mode .timeline-months{
    justify-content:center!important;
  }
}

/* Extra-tight desktop timelines keep all labels readable without horizontal drift. */
@media(min-width:701px) and (max-width:1100px){
  body.page-profile #timelineModal .timeline-modal{
    padding-left:14px!important;
    padding-right:14px!important;
  }

  body.page-profile #timelineModal .timeline-track{
    padding-left:5px!important;
    padding-right:5px!important;
  }

  body.page-profile #timelineModal .timeline-month{
    padding-left:1px!important;
    padding-right:1px!important;
  }
}


/* =======================================================================
   Desktop full-view workspaces — Documents, Logs, Edit Car, Fuel, Health.
   Keep controls visible together; only long history lists scroll locally.
   ======================================================================= */
@media(min-width:901px){

  /* ---------- Shared large modal shell ---------- */
  body.page-profile #documentationModal,
  body.page-profile #logHistoryModal,
  body.page-profile #fuelModal,
  body.page-profile #carHealthModal,
  body.page-profile #carModal.edit-car-mode{
    padding:16px!important;
    overflow:hidden!important;
  }

  body.page-profile #documentationModal .modal-inner,
  body.page-profile #logHistoryModal .modal-inner,
  body.page-profile #fuelModal .modal-inner,
  body.page-profile #carHealthModal .modal-inner,
  body.page-profile #carModal.edit-car-mode .modal-inner{
    width:min(1180px,calc(100vw - 32px))!important;
    max-width:1180px!important;
    height:calc(100dvh - 32px)!important;
    max-height:calc(100dvh - 32px)!important;
    margin:auto!important;
    padding:20px 22px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  body.page-profile #documentationModal .modal-head,
  body.page-profile #logHistoryModal .modal-head,
  body.page-profile #fuelModal .modal-head,
  body.page-profile #carHealthModal .modal-head,
  body.page-profile #carModal.edit-car-mode .modal-head{
    margin-bottom:10px!important;
  }

  /* ---------- Edit Car ---------- */
  body.page-profile #carModal.edit-car-mode .car-form{
    display:flex!important;
    flex-direction:column!important;
    gap:12px!important;
    min-height:0!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-grid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:10px 14px!important;
    width:100%!important;
    min-width:0!important;
  }

  body.page-profile #carModal.edit-car-mode .car-identity-fields{
    display:contents!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field{
    display:flex!important;
    flex-direction:column!important;
    min-width:0!important;
    gap:5px!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field label{
    display:block!important;
    margin:0!important;
    padding:0!important;
    min-height:18px!important;
    background:transparent!important;
    border:0!important;
    box-shadow:none!important;
    font-size:12px!important;
    line-height:1.25!important;
    color:#111827!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field label span{
    color:#64748b!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field input{
    width:100%!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px!important;
    margin:0!important;
    padding:9px 11px!important;
    box-sizing:border-box!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-actions{
    display:flex!important;
    justify-content:flex-end!important;
    gap:10px!important;
    margin-top:2px!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-actions button{
    width:auto!important;
    min-width:130px!important;
    min-height:42px!important;
    margin:0!important;
    padding:9px 18px!important;
  }

  /* ---------- Document History ---------- */
  body.page-profile #documentationModal .docs-modal{
    display:grid!important;
    grid-template-columns:minmax(320px,.78fr) minmax(0,1.42fr)!important;
    grid-template-rows:auto auto auto minmax(0,1fr)!important;
    gap:12px 18px!important;
  }

  body.page-profile #documentationModal .modal-head{
    grid-column:1 / -1!important;
    grid-row:1!important;
  }

  body.page-profile #documentationModal .docs-upload{
    grid-column:1!important;
    grid-row:2!important;
    margin-top:0!important;
    padding:13px!important;
    min-width:0!important;
    overflow:hidden!important;
  }

  body.page-profile #documentationModal .docs-grid{
    grid-template-columns:1fr!important;
    gap:8px!important;
  }

  body.page-profile #documentationModal .docs-upload label{
    margin-top:6px!important;
    margin-bottom:4px!important;
  }

  body.page-profile #documentationModal .docs-upload input,
  body.page-profile #documentationModal .docs-upload select{
    min-height:39px!important;
    padding:8px 10px!important;
    box-sizing:border-box!important;
  }

  body.page-profile #documentationModal #docUploadButton{
    width:100%!important;
    min-height:40px!important;
    margin:8px 0 6px!important;
  }

  body.page-profile #documentationModal .doc-filter-section{
    grid-column:1!important;
    grid-row:3!important;
    margin-top:0!important;
    padding:11px!important;
    min-width:0!important;
  }

  body.page-profile #documentationModal #documentationList{
    grid-column:2!important;
    grid-row:2 / 5!important;
    min-width:0!important;
    min-height:0!important;
    margin-top:0!important;
    overflow:auto!important;
    padding-right:5px!important;
    align-self:stretch!important;
  }

  body.page-profile #documentationModal #documentationStatus{
    grid-column:1!important;
    grid-row:4!important;
    min-height:0!important;
    overflow:auto!important;
  }

  body.page-profile #documentationModal .doc-item:first-child{
    margin-top:0!important;
  }

  /* ---------- Log History ---------- */
  body.page-profile #logHistoryModal .modal-inner{
    display:flex!important;
    flex-direction:column!important;
    min-height:0!important;
  }

  body.page-profile #logHistoryModal .log-history-filter-card{
    flex:0 0 auto!important;
    margin-top:6px!important;
    padding:12px 14px!important;
  }

  body.page-profile #logHistoryModal .log-history-filter-grid{
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto!important;
    gap:10px!important;
  }

  body.page-profile #logHistoryModal #logList{
    flex:1 1 auto!important;
    min-height:0!important;
    margin-top:12px!important;
    overflow:auto!important;
    padding-right:5px!important;
  }

  /* ---------- Fuel Economy ---------- */
  body.page-profile #fuelModal .modal-inner{
    display:grid!important;
    grid-template-columns:minmax(0,1.12fr) minmax(360px,.88fr)!important;
    grid-template-rows:auto auto auto minmax(0,1fr)!important;
    gap:10px 18px!important;
  }

  body.page-profile #fuelModal .modal-head{
    grid-column:1 / -1!important;
    grid-row:1!important;
  }

  body.page-profile #fuelModal #fuelStats{
    grid-column:1!important;
    grid-row:2!important;
    margin-top:0!important;
    gap:8px!important;
  }

  body.page-profile #fuelModal #fuelHealthBox{
    grid-column:1!important;
    grid-row:3!important;
    margin-top:0!important;
    padding:10px 12px!important;
  }

  body.page-profile #fuelModal .fuel-add-card{
    grid-column:1!important;
    grid-row:4!important;
    margin-top:0!important;
    padding:12px!important;
    min-height:0!important;
    overflow:hidden!important;
  }

  body.page-profile #fuelModal .fuel-add-card h3{
    margin-bottom:6px!important;
  }

  body.page-profile #fuelModal .fuel-add-card .grid{
    gap:8px!important;
  }

  body.page-profile #fuelModal .fuel-add-card label{
    margin-top:5px!important;
    margin-bottom:3px!important;
    font-size:12px!important;
  }

  body.page-profile #fuelModal .fuel-add-card input,
  body.page-profile #fuelModal .fuel-add-card select,
  body.page-profile #fuelModal .fuel-add-card textarea{
    min-height:38px!important;
    padding:7px 9px!important;
    box-sizing:border-box!important;
  }

  body.page-profile #fuelModal .fuel-add-card textarea{
    min-height:52px!important;
    height:52px!important;
    resize:none!important;
  }

  body.page-profile #fuelModal .fuel-add-card button{
    width:auto!important;
    min-height:38px!important;
    margin:8px 8px 0 0!important;
    padding:8px 14px!important;
  }

  body.page-profile #fuelModal .fuel-history-panel{
    grid-column:2!important;
    grid-row:2 / 5!important;
    min-width:0!important;
    min-height:0!important;
    margin-top:0!important;
    padding:12px!important;
    border:1px solid #dbe5ec!important;
    border-radius:16px!important;
    background:#f8fbfd!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  body.page-profile #fuelModal .fuel-history-head{
    flex:0 0 auto!important;
    margin-bottom:8px!important;
  }

  body.page-profile #fuelModal #fuelList{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow:auto!important;
    padding-right:4px!important;
  }

  /* ---------- Vehicle Health ---------- */
  body.page-profile #carHealthModal .modal-inner{
    display:flex!important;
    flex-direction:column!important;
    min-height:0!important;
  }

  body.page-profile #carHealthModal .health-dashboard{
    flex:1 1 auto!important;
    min-height:0!important;
    padding:8px 12px 12px!important;
    overflow:hidden!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
  }

  body.page-profile #carHealthModal .health-cluster{
    flex:1 1 auto!important;
    min-height:0!important;
    justify-content:center!important;
  }

  body.page-profile #carHealthModal .reference-speedometer{
    width:min(720px,68vw,calc((100dvh - 300px)*1.82))!important;
    max-width:100%!important;
    margin:0 auto -8px!important;
  }

  body.page-profile #carHealthModal .health-result{
    flex:0 0 auto!important;
    margin-top:-4px!important;
  }

  body.page-profile #carHealthModal .health-result strong{
    font-size:34px!important;
  }

  body.page-profile #carHealthModal .health-result small{
    margin-top:6px!important;
    padding:7px 14px!important;
    font-size:14px!important;
  }

  body.page-profile #carHealthModal .health-factors{
    flex:0 0 auto!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:8px!important;
    margin-top:9px!important;
  }

  body.page-profile #carHealthModal .health-factor{
    min-width:0!important;
    padding:9px 8px!important;
  }

  body.page-profile #carHealthModal > .modal-inner > div:last-child{
    flex:0 0 auto!important;
    margin-top:8px!important;
    text-align:right!important;
  }

  body.page-profile #carHealthModal > .modal-inner > div:last-child button{
    width:auto!important;
    min-height:40px!important;
  }
}

/* Shorter desktop screens get a denser version before any scrolling is needed. */
@media(min-width:901px) and (max-height:760px){
  body.page-profile #documentationModal .modal-inner,
  body.page-profile #logHistoryModal .modal-inner,
  body.page-profile #fuelModal .modal-inner,
  body.page-profile #carHealthModal .modal-inner,
  body.page-profile #carModal.edit-car-mode .modal-inner{
    padding:12px 16px!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-grid{
    row-gap:6px!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field{
    gap:3px!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field input{
    min-height:36px!important;
    height:36px!important;
    padding-top:6px!important;
    padding-bottom:6px!important;
  }

  body.page-profile #fuelModal .fuel-add-card input,
  body.page-profile #fuelModal .fuel-add-card select{
    min-height:34px!important;
    height:34px!important;
  }

  body.page-profile #fuelModal .fuel-add-card textarea{
    min-height:42px!important;
    height:42px!important;
  }

  body.page-profile #carHealthModal .reference-speedometer{
    width:min(620px,62vw,calc((100dvh - 265px)*1.82))!important;
  }

  body.page-profile #carHealthModal .health-factors{
    gap:6px!important;
    margin-top:5px!important;
  }
}

/* 701–900px keeps desktop-like two-column layouts without cramming three columns. */
@media(min-width:701px) and (max-width:900px){
  body.page-profile #carModal.edit-car-mode{
    padding:12px!important;
    overflow:hidden!important;
  }

  body.page-profile #carModal.edit-car-mode .modal-inner{
    width:min(820px,calc(100vw - 24px))!important;
    max-width:820px!important;
    max-height:calc(100dvh - 24px)!important;
    margin:auto!important;
    padding:16px 18px!important;
    overflow:hidden!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px 12px!important;
  }

  body.page-profile #carModal.edit-car-mode .car-identity-fields{
    display:contents!important;
  }

  body.page-profile #carModal.edit-car-mode .car-form-field input{
    width:100%!important;
    min-width:0!important;
  }

  body.page-profile #documentationModal .modal-inner,
  body.page-profile #logHistoryModal .modal-inner,
  body.page-profile #fuelModal .modal-inner,
  body.page-profile #carHealthModal .modal-inner{
    width:calc(100vw - 24px)!important;
    max-width:none!important;
    margin:12px auto!important;
  }

  body.page-profile #documentationModal .docs-modal{
    grid-template-columns:300px minmax(0,1fr)!important;
  }

  body.page-profile #fuelModal .modal-inner{
    grid-template-columns:minmax(0,1fr) minmax(300px,.85fr)!important;
  }

  body.page-profile #carHealthModal .health-factors{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
  }
}

/* Phones keep the established stacked/scrollable layouts. */
@media(max-width:700px){
  body.page-profile #documentationModal .modal-inner,
  body.page-profile #logHistoryModal .modal-inner,
  body.page-profile #fuelModal .modal-inner,
  body.page-profile #carHealthModal .modal-inner,
  body.page-profile #carModal.edit-car-mode .modal-inner{
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
  }

  body.page-profile #fuelModal .fuel-history-panel{
    display:block!important;
  }
}


/* =======================================================================
   Vehicle Health status placement + uniform Document History actions.
   ======================================================================= */

/* Put the dynamic Poor/Bad/Normal/Good/Healthy title inside the speedometer. */
body.page-profile #carHealthModal .reference-speedometer{
  position:relative!important;
}

body.page-profile #carHealthModal .health-gauge-status{
  position:absolute!important;
  left:50%!important;
  top:57%!important;
  transform:translate(-50%,-50%)!important;
  z-index:12!important;
  display:block!important;
  min-width:180px!important;
  margin:0!important;
  padding:0!important;
  text-align:center!important;
  font-size:clamp(28px,3.2vw,42px)!important;
  line-height:1!important;
  font-weight:900!important;
  letter-spacing:-.025em!important;
  color:#111827!important;
  text-shadow:0 1px 0 rgba(255,255,255,.6)!important;
  pointer-events:none!important;
}

body.page-profile #carHealthModal .health-gauge-status.health-poor{color:#e91e25!important}
body.page-profile #carHealthModal .health-gauge-status.health-bad{color:#f4511e!important}
body.page-profile #carHealthModal .health-gauge-status.health-normal{color:#d6a800!important}
body.page-profile #carHealthModal .health-gauge-status.health-good{color:#69b72f!important}
body.page-profile #carHealthModal .health-gauge-status.health-healthy{color:#25a83a!important}

body.page-profile #carHealthModal .health-result{
  margin-top:0!important;
  text-align:center!important;
}

body.page-profile #carHealthModal .health-result small{
  margin-top:4px!important;
}

/* Document History: Preview / Edit / Delete always align as one uniform row on desktop. */
@media(min-width:701px){
  body.page-profile #documentationModal .doc-item{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:14px!important;
    min-width:0!important;
  }

  body.page-profile #documentationModal .doc-item > div:first-child{
    min-width:0!important;
  }

  body.page-profile #documentationModal .doc-actions{
    display:grid!important;
    grid-template-columns:repeat(3,88px)!important;
    gap:7px!important;
    align-items:center!important;
    justify-content:end!important;
    width:auto!important;
    min-width:278px!important;
    flex-wrap:nowrap!important;
  }

  body.page-profile #documentationModal .doc-actions button{
    width:88px!important;
    min-width:88px!important;
    max-width:88px!important;
    min-height:38px!important;
    margin:0!important;
    padding:8px 6px!important;
    box-sizing:border-box!important;
    white-space:nowrap!important;
    text-align:center!important;
  }
}

/* Slightly tighter desktop sizing without allowing the row to wrap. */
@media(min-width:701px) and (max-width:980px){
  body.page-profile #documentationModal .doc-actions{
    grid-template-columns:repeat(3,78px)!important;
    min-width:248px!important;
  }

  body.page-profile #documentationModal .doc-actions button{
    width:78px!important;
    min-width:78px!important;
    max-width:78px!important;
    font-size:12px!important;
  }
}

/* Keep the established stacked mobile document actions. */
@media(max-width:700px){
  body.page-profile #documentationModal .doc-actions{
    display:flex!important;
    flex-wrap:wrap!important;
    width:100%!important;
  }

  body.page-profile #documentationModal .doc-actions button{
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
  }

  body.page-profile #carHealthModal .health-gauge-status{
    top:58%!important;
    min-width:140px!important;
    font-size:clamp(24px,8vw,34px)!important;
  }
}


/* =======================================================================
   Timeline edge breathing room — keep expanded logs clear of screen edges.
   ======================================================================= */
@media(min-width:701px){
  body.page-profile #timelineModal .timeline-months{
    padding-left:38px!important;
    padding-right:38px!important;
  }

  body.page-profile #timelineModal .timeline-track.year-mode .timeline-months{
    padding-left:56px!important;
    padding-right:56px!important;
  }

  body.page-profile #timelineModal .timeline-month-detail.open{
    position:relative!important;
    box-sizing:border-box!important;
    max-width:min(220px,calc(100vw - 110px))!important;
  }

  /* Pull edge detail cards toward the centre rather than letting them clip. */
  body.page-profile #timelineModal .timeline-month:first-child .timeline-month-detail.open{
    transform:translateX(24px)!important;
  }

  body.page-profile #timelineModal .timeline-month:last-child .timeline-month-detail.open{
    transform:translateX(-24px)!important;
  }

  body.page-profile #timelineModal .timeline-event{
    max-width:100%!important;
    box-sizing:border-box!important;
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
  }
}

@media(min-width:701px) and (max-width:1100px){
  body.page-profile #timelineModal .timeline-months{
    padding-left:28px!important;
    padding-right:28px!important;
  }

  body.page-profile #timelineModal .timeline-track.year-mode .timeline-months{
    padding-left:42px!important;
    padding-right:42px!important;
  }

  body.page-profile #timelineModal .timeline-month:first-child .timeline-month-detail.open{
    transform:translateX(18px)!important;
  }

  body.page-profile #timelineModal .timeline-month:last-child .timeline-month-detail.open{
    transform:translateX(-18px)!important;
  }
}


/* =======================================================================
   Compact Timeline labels for long ownership histories.
   ======================================================================= */
@media(min-width:701px){
  body.page-profile #timelineModal .timeline-event.timeline-event-compact{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:26px!important;
    padding:4px 7px!important;
    border-radius:7px!important;
    font-size:8.5px!important;
    line-height:1!important;
    text-align:center!important;
    overflow:hidden!important;
  }

  body.page-profile #timelineModal .timeline-event.timeline-event-compact strong{
    display:block!important;
    width:100%!important;
    margin:0!important;
    font-size:8.5px!important;
    line-height:1.05!important;
    font-weight:850!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  body.page-profile #timelineModal .timeline-event.timeline-event-compact small{
    display:none!important;
  }

  body.page-profile #timelineModal .timeline-month-detail.open{
    gap:4px!important;
  }

  body.page-profile #timelineModal .timeline-year-node .timeline-month-label{
    letter-spacing:0!important;
    font-variant-numeric:tabular-nums!important;
  }
}

@media(max-width:700px){
  body.page-profile #timelineModal .timeline-event.timeline-event-compact{
    padding:5px 7px!important;
  }

  body.page-profile #timelineModal .timeline-event.timeline-event-compact strong{
    margin:0!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  body.page-profile #timelineModal .timeline-event.timeline-event-compact small{
    display:none!important;
  }
}


/* =======================================================================
   Mechanical Quality desktop workspace — form + history in one viewport.
   Desktop only; phone/tablet behaviour remains the established layout.
   ======================================================================= */
@media(min-width:901px){
  body.page-profile #mechanicalQualityModal{
    padding:16px!important;
    overflow:hidden!important;
    align-items:center!important;
    justify-content:center!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-modal{
    width:min(1180px,calc(100vw - 32px))!important;
    max-width:1180px!important;
    height:calc(100dvh - 32px)!important;
    max-height:calc(100dvh - 32px)!important;
    margin:auto!important;
    padding:20px 22px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    display:grid!important;
    grid-template-columns:minmax(360px,.9fr) minmax(0,1.1fr)!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    gap:14px 18px!important;
  }

  body.page-profile #mechanicalQualityModal .modal-head{
    grid-column:1 / -1!important;
    grid-row:1!important;
    margin:0!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel{
    grid-column:1!important;
    grid-row:2!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    padding:14px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    align-self:start!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel h3{
    margin:0 0 7px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel label{
    display:block!important;
    margin-top:6px!important;
    margin-bottom:3px!important;
    font-size:12px!important;
    line-height:1.2!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel input,
  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel select,
  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel textarea{
    width:100%!important;
    min-width:0!important;
    min-height:39px!important;
    margin:0!important;
    padding:8px 10px!important;
    box-sizing:border-box!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel textarea{
    height:58px!important;
    min-height:58px!important;
    resize:none!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel .grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
    margin:0!important;
  }

  body.page-profile #mechanicalQualityModal #mechanicalSaveButton{
    width:auto!important;
    min-width:145px!important;
    min-height:40px!important;
    margin:10px 0 0!important;
    padding:8px 15px!important;
  }

  body.page-profile #mechanicalQualityModal #mechanicalStatus{
    margin-top:7px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-history-panel{
    grid-column:2!important;
    grid-row:2!important;
    display:flex!important;
    flex-direction:column!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    padding:14px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    border:1px solid #d7e5f1!important;
    border-radius:14px!important;
    background:#f8fbfd!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-history-panel > h3{
    flex:0 0 auto!important;
    margin:0 0 8px!important;
  }

  body.page-profile #mechanicalQualityModal #mechanicalList{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    padding-right:5px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-log:first-child{
    margin-top:0!important;
  }
}

@media(min-width:901px) and (max-height:720px){
  body.page-profile #mechanicalQualityModal .mechanical-quality-modal{
    padding:12px 16px!important;
    gap:8px 14px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel,
  body.page-profile #mechanicalQualityModal .mechanical-quality-history-panel{
    padding:10px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel label{
    margin-top:4px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel input,
  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel select{
    min-height:34px!important;
    height:34px!important;
    padding-top:6px!important;
    padding-bottom:6px!important;
  }

  body.page-profile #mechanicalQualityModal .mechanical-quality-form-panel textarea{
    height:44px!important;
    min-height:44px!important;
  }

  body.page-profile #mechanicalQualityModal #mechanicalSaveButton{
    min-height:35px!important;
    margin-top:7px!important;
  }
}


/* =======================================================================
   Timeline phone-landscape override.
   professional-ui.css normally treats widths >=701px as desktop. iPhones
   exceed that width in landscape, so explicitly restore a real horizontal
   scroll strip and keep the Timeline modal centred within the viewport.
   ======================================================================= */
@media (orientation:landscape) and (max-height:700px) and (max-width:1200px){
  body.page-profile #timelineModal.timeline-landscape-track-scroll{
    display:block!important;
    padding:8px!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
    align-items:initial!important;
    justify-content:initial!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-modal{
    display:block!important;
    width:calc(100vw - 16px)!important;
    max-width:calc(100vw - 16px)!important;
    min-width:0!important;
    height:calc(100dvh - 16px)!important;
    max-height:calc(100dvh - 16px)!important;
    margin:0 auto!important;
    padding:12px!important;
    box-sizing:border-box!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .modal-head,
  body.page-profile #timelineModal.timeline-landscape-track-scroll #timelineContent{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-track{
    display:block!important;
    position:relative!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin-left:0!important;
    margin-right:0!important;
    padding-left:8px!important;
    padding-right:8px!important;
    box-sizing:border-box!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-x:contain!important;
    touch-action:pan-x!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-months,
  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-track.year-mode .timeline-months{
    display:flex!important;
    width:max-content!important;
    min-width:max-content!important;
    max-width:none!important;
    min-height:108px!important;
    height:auto!important;
    padding-left:8px!important;
    padding-right:8px!important;
    box-sizing:border-box!important;
    justify-content:flex-start!important;
    align-items:flex-start!important;
    margin-left:0!important;
    margin-right:0!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-month{
    width:var(--timeline-month-width)!important;
    min-width:var(--timeline-month-width)!important;
    flex:0 0 var(--timeline-month-width)!important;
    height:auto!important;
    overflow:visible!important;
    box-sizing:border-box!important;
    padding-left:3px!important;
    padding-right:3px!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-month-label{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    white-space:nowrap!important;
    text-align:center!important;
    font-size:var(--timeline-label-size,10px)!important;
  }

  body.page-profile #timelineModal.timeline-landscape-track-scroll .timeline-month-detail.open{
    display:flex!important;
    max-height:none!important;
    overflow:visible!important;
  }
}


/* =======================================================================
   Desktop car-section modal scrolling.
   These five workspaces must grow naturally and scroll at the modal layer
   instead of trapping content inside fixed-height viewport shells.
   Mobile <=700px keeps its existing behaviour.
   ======================================================================= */
@media(min-width:701px){
  body.page-profile #carModal.edit-car-mode,
  body.page-profile #documentationModal,
  body.page-profile #logHistoryModal,
  body.page-profile #fuelModal,
  body.page-profile #timelineModal{
    overflow-x:hidden!important;
    overflow-y:auto!important;
    align-items:flex-start!important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-y:contain;
  }

  body.page-profile #carModal.edit-car-mode .modal-inner,
  body.page-profile #documentationModal .modal-inner,
  body.page-profile #logHistoryModal .modal-inner,
  body.page-profile #fuelModal .modal-inner,
  body.page-profile #timelineModal .timeline-modal{
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
    margin-top:16px!important;
    margin-bottom:16px!important;
  }

  /* Let the full histories contribute to modal height so the outer modal
     provides one predictable desktop scrollbar from top to bottom. */
  body.page-profile #documentationModal .docs-modal{
    grid-template-rows:auto auto auto auto!important;
  }
  body.page-profile #documentationModal #documentationList,
  body.page-profile #documentationModal #documentationStatus,
  body.page-profile #logHistoryModal #logList,
  body.page-profile #fuelModal .fuel-history-panel,
  body.page-profile #fuelModal #fuelList{
    max-height:none!important;
    overflow:visible!important;
  }

  body.page-profile #fuelModal .modal-inner{
    grid-template-rows:auto auto auto auto!important;
  }

  body.page-profile #fuelModal .fuel-history-panel{
    align-self:start!important;
  }

  /* Timeline circles containing one or more real records are exactly 25%
     larger than empty circles, while preserving their centre point. */
  body.page-profile #timelineModal .timeline-month.has-entries .timeline-month-dot{
    width:25px!important;
    height:25px!important;
    top:-2.5px!important;
  }
}


/* =======================================================================
   New Car scroll fix — the desktop/tablet workspace can exceed the viewport
   as vehicle fields are added. Keep the modal shell fixed and make the form
   panel the vertical scroll container.
   ======================================================================= */
@media(min-width:701px){
  body.page-profile #carModal.new-car-mode .modal-inner{
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;
    touch-action:pan-y;
    scrollbar-gutter:stable;
  }
}
