:root {
  --ink: #101513;
  --muted: #555a56;
  --paper: #f6f8f8;
  --rule: #dce2e3;
  --action: #101513;
  --action-hover: #303937;
  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
  font: 400 16px/1.5 var(--body, Manrope, Arial, sans-serif);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, p, dd { margin: 0; }
h1, h2 { font-family: var(--display, Manrope, Arial, sans-serif); font-weight: 700; }
h1 { font-size: clamp(1.85rem, 3.4vw, 2.7rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.35rem; line-height: 1.3; letter-spacing: -.03em; }
.frame { width: min(calc(100% - 3rem), 69rem); margin-inline: auto; }
.masthead { background: #080a09; color: white; }
.masthead-inner { display: flex; align-items: center; gap: 1.35rem; min-height: 4.5rem; }
.masthead .brand { color: white; text-decoration: none; }
.masthead-label { color: #dae1df; border-left: 1px solid #54605c; padding-left: 1.35rem; font-size: .92rem; }
.sign-out, .portal-nav-link { margin-left: auto; }
.portal-nav-link { color: white; font-size: .92rem; font-weight: 650; text-decoration: none; }
.portal-nav-link:hover { text-decoration: underline; text-underline-offset: .2em; }
.skip-link { position: absolute; left: .75rem; top: -8rem; z-index: 1; padding: .6rem 1rem; background: white; color: var(--ink); }
.skip-link:focus { top: .5rem; }

button, select, input, textarea { color: var(--ink); font: inherit; }
button, select, .button {
  min-height: 2.85rem;
  border: 1px solid #bdc2bb;
  border-radius: 7px;
  background: white;
  padding: .65rem 1rem;
  color: var(--ink);
  cursor: pointer;
  font-size: .94rem;
  font-weight: 650;
  line-height: 1.3;
}
button:hover:enabled, select:hover { border-color: var(--ink); }
.primary { color: white; background: var(--action); border-color: var(--action); }
button.primary:hover:enabled, a.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.masthead :focus-visible { outline-color: #eaf5fa; }
.sign-out { min-height: 2.5rem; padding: .45rem .85rem; font-size: .875rem; color: white; border-color: #5e6864; background: transparent; }
.sign-out:hover:enabled { background: #303937; border-color: white; }
input, textarea {
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: .65rem .85rem;
  background: white;
  border: 1px solid #a7ada6;
  border-radius: 7px;
}
input:hover, textarea:hover { border-color: #6a716a; }
input[readonly] { background: var(--paper); }
label { font-size: .9375rem; font-weight: 650; }

main { padding-block: clamp(2.25rem, 5vw, 4.75rem); }
.login-card {
  max-width: 28rem;
  margin: clamp(1rem, 6vh, 4.75rem) auto;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: white;
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.login-card h1 { font-size: clamp(1.75rem, 3vw, 2.2rem); }
.login-card p, .workspace-heading p { color: var(--muted); margin-top: .45rem; }
#login-form { display: grid; gap: .5rem; margin-top: 1.55rem; }
#login-form button { margin-top: .5rem; }

.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.workspace-actions, .invite-link-row { display: flex; align-items: center; gap: .6rem; }
#invite-panel { margin-top: 1.5rem; padding: 1.2rem; background: white; border: 1px solid var(--rule); border-radius: 8px; }
#invite-panel p { margin: .25rem 0 .75rem; color: var(--muted); }
.invite-link-row input { min-width: 0; }
.invite-link-row button { flex-shrink: 0; }
#count { margin-left: auto; color: var(--muted); font-size: .9rem; }
#bookings { display: grid; gap: 1rem; }
#more { margin-top: 1rem; }
.appointment-card { display: grid; grid-template-columns: minmax(10rem, 21%) 1fr; background: white; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.appointment-time { background: #eaf5fa; padding: 1.5rem; }
.date { display: block; font-size: .95rem; font-weight: 600; }
.hour { display: block; margin-top: .2rem; font-size: 1.75rem; line-height: 1.2; letter-spacing: -.045em; }
.duration { display: block; margin-top: .3rem; color: var(--muted); font-size: .875rem; }
.appointment-details { padding: 1.5rem; overflow-wrap: anywhere; }
.status { display: inline-block; font-size: .825rem; font-weight: 650; color: var(--muted); }
[data-status="requested"] .status { color: #775000; }
[data-status="accepted"] .status, [data-status="completed"] .status { color: #306247; }
.service { margin: .25rem 0; }
.vehicle, dt, .email { color: var(--muted); }
dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; margin: 1.05rem 0 0; }
dt { margin-bottom: .15rem; font-weight: 600; font-size: .82rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.actions:empty { display: none; }
.empty { text-align: center; padding: 2.75rem 1.25rem; background: white; border: 1px solid var(--rule); border-radius: 8px; color: var(--muted); }
.message { margin: 0 auto 1rem; padding: .85rem 1rem; background: #eaf5fa; border-radius: 7px; }
.message[data-error] { background: #fceee9; color: #822d20; }

@media (max-width: 38rem) {
  .frame { width: calc(100% - 2rem); }
  .masthead-inner { gap: .7rem; min-height: 3.75rem; }
  .masthead-label { font-size: .8rem; padding-left: .7rem; }
  .workspace-heading { align-items: flex-start; flex-direction: column; }
  .login-card { margin-top: .5rem; }
  .appointment-card { grid-template-columns: 1fr; }
  .appointment-time { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 1rem; }
  .appointment-time time { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
  .hour { margin: 0; font-size: 1.25rem; }
  .duration { margin: 0; }
  .appointment-details { padding: 1rem; }
}
.parking-notes { white-space: pre-line; overflow-wrap: anywhere; }

.workspace-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.workspace-nav button { background: transparent; border-color: transparent; }
.workspace-nav button[aria-pressed="true"] { background: var(--ink); color: white; }
.workspace-nav a { margin-left: auto; color: var(--muted); font-size: .9rem; padding: .65rem 0; }
.studio-form { max-width: 45rem; margin-top: 2rem; }
.studio-form fieldset { padding: 0; margin: 0 0 2rem; border: 0; min-width: 0; }
.studio-form legend { font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; }
.studio-form label { display: grid; gap: .4rem; margin-bottom: 1rem; min-width: 0; }
.studio-form .hint { font-size: .9rem; color: var(--muted); margin-bottom: 1rem; }
.studio-form textarea { resize: vertical; }
.studio-package { padding: 1.2rem; margin-bottom: 1rem; background: white; border: 1px solid var(--rule); border-radius: 8px; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.studio-form .checkbox-label { display: flex; align-items: center; gap: .65rem; margin-bottom: 0; }
.checkbox-label input { width: 1.1rem; min-height: 1.1rem; margin: 0; accent-color: var(--ink); }
.studio-hour { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; align-items: end; gap: .65rem; margin-bottom: 1rem; }
.studio-hour label { margin: 0; }
.studio-hour select { width: 100%; min-height: 3rem; }
#settings-result { margin-bottom: 1rem; }
#settings-result[data-error] { color: #822d20; }
@media (max-width: 38rem) {
  .studio-hour { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 1rem; border: 1px solid var(--rule); border-radius: 8px; background: white; }
  .studio-hour label:first-child { grid-column: 1 / -1; }
  .studio-hour button { grid-column: 1 / -1; justify-self: start; }
  .workspace-nav a { margin-left: 0; }
}

.booking-link-panel { margin-bottom: 1.75rem; padding: 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: white; }
.booking-link-panel > p { margin: .5rem 0 1rem; color: var(--muted); max-width: 46rem; }
.booking-link-panel > p:last-child:empty { display: none; }
.booking-link-panel .button { flex-shrink: 0; display: inline-flex; align-items: center; text-decoration: none; }
.actions .button { display: inline-flex; align-items: center; text-decoration: none; font-size: .9rem; }
.sample-label { margin-left: .65rem; font-size: .8rem; color: var(--muted); }
@media (max-width: 48rem) {
  .booking-link-panel .invite-link-row { flex-wrap: wrap; }
  .booking-link-panel input { flex-basis: 100%; }
  .booking-link-panel .button { width: 100%; justify-content: center; }
}

.booking-link-panel summary { font-weight: 700; cursor: pointer; }
.booking-link-panel:has(summary) { margin-bottom: 1rem; }
.appointment-views { display: flex; gap: .4rem; }
.appointment-views button[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.calendar-toolbar > div { display: flex; gap: .4rem; }
.calendar-toolbar h2 { font-size: 1.15rem; }
#calendar-result { color: var(--muted); font-size: .9rem; margin-bottom: .75rem; }
#calendar-result:empty { display: none; }
.calendar-scroll { overflow: auto; max-height: 43rem; border: 1px solid var(--rule); border-radius: 8px; background: white; }
#calendar { min-width: 850px; }
.calendar-header, .calendar-body { display: grid; grid-template-columns: 64px repeat(7, minmax(0, 1fr)); }
.calendar-header { position: sticky; top: 0; z-index: 3; background: white; border-bottom: 1px solid var(--rule); }
.calendar-header > span { padding: .8rem .3rem; font-size: .85rem; font-weight: 650; text-align: center; }
.calendar-header [aria-current] { background: #eaf5fa; color: #244b3c; }
.calendar-zone { position: sticky; left: 0; background: white; z-index: 4; }
.calendar-hours { position: sticky; left: 0; z-index: 2; background: white; }
.calendar-hours span { position: absolute; left: 0; width: 100%; padding: .2rem .35rem; color: var(--muted); font-size: .72rem; text-align: right; white-space: nowrap; }
.calendar-column { position: relative; border-left: 1px solid var(--rule); background: repeating-linear-gradient(to bottom, transparent 0, transparent 59px, #e8ecea 59px, #e8ecea 60px); }
.calendar-event { position: absolute; display: flex; flex-direction: column; align-items: flex-start; min-height: 0; padding: 3px 5px; border: 1px solid #57816b; border-left-width: 3px; border-radius: 4px; background: #e5f2e9; text-align: left; font-size: .78rem; font-weight: 400; line-height: 1.15; overflow: hidden; }
.calendar-event > * { flex-shrink: 0; display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-event strong { font-size: .76rem; }
.calendar-event small { font-size: .7rem; }
.calendar-event-short > span:nth-of-type(2) { display: none; }
.calendar-event[data-status="requested"] { border-color: #aa853b; background: #fff4d9; }
.calendar-event[data-status="completed"] { border-color: #60869a; background: #eaf5fa; }
.calendar-event[data-status="declined"] { border-color: #adb4b0; background: #f2f3f2; color: #626963; }
.calendar-event[data-status="declined"] > span { text-decoration: line-through; }
.calendar-event:hover:enabled { filter: brightness(.96); z-index: 1; }
#appointment-dialog { width: min(calc(100% - 2rem), 46rem); max-height: 90vh; padding: 1rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); color: var(--ink); }
#appointment-dialog::backdrop { background: rgb(0 0 0 / .4); }
#close-appointment { display: block; margin: 0 0 .75rem auto; }
@media (max-width: 38rem) {
  .calendar-toolbar { align-items: flex-start; }
  .calendar-toolbar > div { width: 100%; justify-content: space-between; }
}

#upcoming-panel { margin-top: 1.5rem; padding: 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: white; }
.upcoming-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; }
#upcoming-appointments { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
#upcoming-appointments li:first-child { grid-column: 1 / -1; }
.upcoming-appointment { display: grid; gap: .25rem; width: 100%; padding: .9rem 1rem; text-align: left; font-size: .9rem; font-weight: 400; overflow-wrap: anywhere; }
.upcoming-appointment strong { font-size: .94rem; }
.upcoming-appointment small { font-size: .8rem; color: var(--muted); }
.next-appointment { border-color: #719086; background: #edf5f8; }
.next-appointment strong { font-size: 1.1rem; }
#upcoming-empty { color: var(--muted); margin-top: .8rem; }
@media (max-width: 38rem) {
  #upcoming-appointments { grid-template-columns: 1fr; }
}

.appointment-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 1.25rem; }
.filter-wrap { position: relative; }
#filter-toggle { display: inline-flex; align-items: center; gap: .5rem; }
#filter-toggle[aria-expanded="true"] { border-color: var(--ink); }
#filter-active { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; color: white; background: var(--ink); font-size: .75rem; }
#filter-panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 5; width: 16.5rem; max-width: calc(100vw - 2rem); padding: .75rem; border: 1px solid var(--rule); border-radius: 8px; background: white; box-shadow: 0 8px 24px rgb(0 0 0 / .1); }
#filter { padding: 0; margin: 0; border: 0; min-width: 0; }
#filter legend { padding: .35rem .5rem .6rem; font-size: .8rem; font-weight: 650; color: var(--muted); }
#filter label { display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; padding: .5rem; border-radius: 5px; cursor: pointer; font-size: .88rem; font-weight: 500; }
#filter label:hover, #filter label:has(:checked) { background: #edf5f8; }
#filter input { width: 1rem; min-height: 1rem; margin: 0; accent-color: var(--ink); }
@media (max-width: 38rem) {
  .appointment-toolbar { gap: .5rem; }
  .filter-wrap { margin-left: auto; }
  #count { order: 3; flex-basis: 100%; font-size: .85rem; }
}

.apply-link { font-size: .88rem; }
.apply-link a { color: inherit; text-underline-offset: .2em; }
#application-list { display: grid; gap: 1rem; margin-top: 1.5rem; }
.application-card { padding: 1.5rem; background: white; border: 1px solid var(--rule); border-radius: 8px; overflow-wrap: anywhere; }
.application-card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.application-status, .application-date { color: var(--muted); font-size: .85rem; }
.application-date { margin-top: .3rem; }
.application-about { white-space: pre-line; margin: 1rem 0; }
.application-card > a { display: block; color: inherit; margin-bottom: 1rem; }
.application-card > button, #more-applications { margin-top: 1rem; }

.payment-setup { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; padding: 1.5rem; margin: 1.75rem 0; border: 1px solid var(--rule); background: white; border-radius: 8px; }
.payment-setup p { margin-top: .6rem; font-size: .92rem; color: var(--muted); max-width: 38rem; }
.payment-setup button { margin-top: 1rem; }
.payments-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 2rem; align-items: start; }
.quote-compose { background: white; border: 1px solid var(--rule); border-radius: 8px; padding: 1.5rem; }
.quote-compose > p { margin-top: .5rem; }
.quote-compose .studio-form { margin-top: 1.5rem; }
.fee-breakdown { display: block; border-top: 1px solid var(--rule); padding-top: .7rem; }
.fee-breakdown div { display: flex; gap: 1rem; justify-content: space-between; margin: .65rem 0; }
.fee-breakdown dt { font-weight: 500; font-size: .9rem; }
.fee-breakdown dd { text-align: right; font-weight: 650; }
.quote-card { padding: 1.2rem; border: 1px solid var(--rule); background: white; border-radius: 8px; margin-top: 1rem; overflow-wrap: anywhere; }
.quote-card-heading { display: flex; align-items: start; gap: 1rem; justify-content: space-between; }
.quote-card h3 { margin: .4rem 0; font-size: 1rem; font-weight: 700; }
.quote-card-heading > strong { margin-top: .4rem; white-space: nowrap; }
.quote-state { font-size: .8rem; font-weight: 700; color: #306247; }
.quote-card .hint { margin-top: .4rem; }
#quote-share-dialog { width: min(32rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); border: 0; border-radius: 10px; padding: 1.5rem; overflow-y: auto; }
#quote-share-dialog::backdrop { background: #10151380; }
#quote-share-dialog p { margin: 1rem 0; color: var(--muted); font-size: .9rem; }
#quote-share-dialog label { display: grid; gap: .5rem; }
#quote-qr { display: block; max-width: 100%; height: auto; margin: 1rem auto; }
@media(max-width: 50rem) { .payments-layout, .payment-setup { grid-template-columns: 1fr; gap: 1.5rem; } }

.setup-card { background:white; border:1px solid var(--rule); border-radius:12px; padding:1.5rem; margin:1.5rem 0; }
.setup-card .workspace-heading { margin:0 0 1rem; }
.setup-card h2 { font-size:1.35rem; }
.setup-card ol { padding:0; list-style:none; display:grid; gap:.65rem; margin:1.2rem 0; }
.setup-card li { display:flex; align-items:center; gap:.7rem; }
.setup-card li::before { content:'○'; color:var(--muted); font-size:1.3rem; }
.setup-card li[data-complete]::before { content:'✓'; color:#245c43; }
.setup-card .hint, .portal-footer { color:var(--muted); font-size:.875rem; line-height:1.6; }
.portal-footer { margin:3rem 0; }
#login details { margin:1.25rem 0; }
#login summary { cursor:pointer; padding:.5rem 0; }

.studio-form select { width: 100%; min-width: 0; }

/* Service checklist: whole rows are touch targets, prices stay readable. */
.quote-service-fieldset { border:0; padding:0; margin:0; min-width:0; }
.quote-service-fieldset legend { font-weight:650; margin-bottom:.75rem; }
.quote-service-list { display:grid; gap:.6rem; }
.studio-form .quote-service { display:flex; align-items:center; gap:.8rem; min-height:64px; padding:.85rem; border:1px solid var(--rule); border-radius:8px; cursor:pointer; }
.quote-service:has(input:checked) { border-color:#306247; background:#edf6ef; }
.studio-form .quote-service input { width:22px; height:22px; margin:0; flex:0 0 22px; accent-color:#306247; }
.quote-service > span { flex:1; min-width:0; overflow-wrap:anywhere; }
.quote-service small { display:block; color:var(--muted); font-size:.75rem; font-weight:400; margin-top:.2rem; }
.quote-service strong { flex-shrink:0; font-variant-numeric:tabular-nums; }
.studio-form .booked-service { background:#edf6ef; cursor:default; }
.quote-submit-bar { position:sticky; bottom:0; z-index:2; background:white; border-top:1px solid var(--rule); padding:.75rem 0 max(.75rem, env(safe-area-inset-bottom)); }
.quote-submit-bar > p { margin:0 0 .65rem; font-weight:700; }
.quote-submit-bar button { min-height:48px; }
.service-prices-editor { border-top:1px solid var(--rule); margin-top:1rem; padding-top:1rem; }
.service-prices-editor summary { cursor:pointer; min-height:44px; padding:.5rem 0; font-weight:650; }
.extra-service-row { display:grid; grid-template-columns:minmax(0, 1fr) minmax(6rem, .5fr); gap:.75rem; padding:1rem 0; border-bottom:1px solid var(--rule); }
.extra-service-row button { justify-self:start; min-height:44px; }
.quote-item-summary { padding-left:1.2rem; color:var(--muted); font-size:.85rem; }
#quote-share-dialog input { width:100%; min-width:0; }
@media (max-width:30rem) {
  .quote-compose { padding:1rem; }
  .quote-compose .field-pair { grid-template-columns:1fr; }
  .quote-submit-bar .actions { display:grid; }
  .quote-submit-bar button { width:100%; }
  #quote-share-dialog { padding:1rem; }
  #quote-share-dialog .workspace-heading { flex-wrap:wrap; gap:.5rem; }
  #quote-share-dialog .actions { display:grid; }
  #quote-share-dialog .actions > * { justify-content:center; min-height:44px; }
}
