/* The portal shares the navy and red identity of the public site. */
[hidden] { display: none !important; }
.portal-page { min-height: 100svh; display: flex; flex-direction: column; background: #f4f7fb; }
.portal-header { flex-wrap: wrap; padding-top: .75rem; padding-bottom: .75rem; }
.portal-header .brand-mark { font-weight: 800; font-size: .9rem; letter-spacing: -.04em; }
.portal-back { margin-left: auto; font-size: .9rem; text-decoration: none; font-weight: 600; }
.header-login { display: inline-flex; gap: .4rem; align-items: center; color: var(--navy); font-size: .9rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.header-login svg { flex-shrink: 0; }
.portal-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5.5rem); padding-top: clamp(2rem, 6vw, 5rem); padding-bottom: 4rem; align-items: center; flex: 1; }
.portal-intro { align-self: stretch; position: relative; overflow: hidden; padding: clamp(1.8rem, 4vw, 3rem); border-radius: 18px; background: var(--navy); color: #e0e6ef; display: flex; flex-direction: column; justify-content: center; min-height: 520px; }
.portal-intro::after { content: ''; position: absolute; width: 240px; height: 240px; right: -150px; top: -100px; border: 40px solid #1b2b50; border-radius: 50%; pointer-events: none; }
.portal-intro::before { content: ''; position: absolute; bottom: 0; left: 0; width: 36%; height: 5px; background: var(--red); }
.portal-intro > * { position: relative; z-index: 1; }
.portal-eyebrow { text-transform: uppercase; letter-spacing: .13em; font-size: .68rem; font-weight: 700; margin-bottom: 2rem; }
.portal-lock { width: 66px; height: 66px; border: 1px solid #536078; border-radius: 16px; display: grid; place-items: center; margin-bottom: 1.6rem; color: #fff; background: #1c2a49; }
.portal-intro h1 { color: #fff; font-size: clamp(2rem, 3.5vw, 2.9rem); line-height: 1.17; }
.portal-intro h1 span { color: #bfcadc; font-weight: 500; }
.portal-intro > p:not(.portal-eyebrow) { color: #dce3ef; max-width: 30ch; }
.portal-intro-note { display: grid; grid-template-columns: 24px 1fr; gap: .85rem; align-items: start; font-size: .82rem; line-height: 1.6; color: #bcc9df; margin-top: 2.5rem; }
.portal-rule { height: 2px; background: var(--red); margin-top: .65rem; }
.portal-card { background: #fff; padding: clamp(1.5rem, 3.5vw, 2.8rem); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 48px #0d1b3e09; }
.portal-card h2 { font-size: clamp(1.6rem, 3vw, 2rem); margin-bottom: .5rem; }
.portal-description { font-size: .91rem; color: var(--ink-soft); margin-bottom: 1.5rem; }
.portal-card fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.portal-card .field { margin-bottom: 1.05rem; }
.portal-card input { width: 100%; min-height: 48px; background: #fbfcfe; }
.portal-card label { font-size: .86rem; }
.portal-card .portal-submit { width: 100%; margin-top: .8rem; justify-content: space-between; border-radius: var(--radius-sm); }
.portal-submit:disabled, .portal-card fieldset:disabled .portal-submit { opacity: .65; cursor: wait; }
.portal-text-button { border: 0; padding: 0; background: none; color: var(--navy-3); font: inherit; font-size: .84rem; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.portal-text-button:hover { color: var(--red); }
.forgot-link { display: block; margin: -.2rem 0 .8rem auto; }
.portal-first-access { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem .6rem; border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.25rem; color: var(--ink-soft); font-size: .84rem; }
.portal-return { display: inline-block; margin-top: 1.5rem; }
.portal-help { margin: .4rem 0 0; font-size: .75rem; color: var(--ink-soft); }
.portal-status { font-size: .9rem; line-height: 1.5; padding: .85rem 1rem; border: 1px solid #ccd8e8; border-radius: var(--radius-sm); background: #f1f5fb; color: var(--navy); overflow-wrap: anywhere; }
.portal-status:empty { display: none; }
.portal-status[data-tone="error"] { color: #9e1820; background: #fff4f4; border-color: #ecc8cb; }
.portal-status[data-tone="success"] { color: #245846; background: #f0f8f4; border-color: #c2dfd0; }
.portal-footer { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.4rem; padding-bottom: 1.4rem; color: var(--ink-soft); font-size: .75rem; }
.private-main { flex: 1; padding-top: clamp(2rem, 5vw, 4rem); padding-bottom: 4rem; }
.private-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.private-heading h1 { margin-bottom: .4rem; }
.private-lead { color: var(--ink-soft); }
.private-badge { display: inline-flex; align-items: center; gap: .55rem; padding: .5rem .9rem; border-radius: 999px; border: 1px solid #c7ddd2; color: #245846; background: #eff7f3; font-weight: 650; font-size: .78rem; white-space: nowrap; }
.private-badge span { width: 7px; height: 7px; border-radius: 50%; background: #397a5d; }
.private-account { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2rem; padding: clamp(1.5rem, 4vw, 2.5rem); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.private-account h2 { font-size: 1.3rem; }
.private-account dl { margin: 0; font-size: .93rem; }
.private-account dt { color: var(--ink-soft); font-size: .8rem; }
.private-account dd { margin: .2rem 0 1rem; color: var(--navy); overflow-wrap: anywhere; }
@media (max-width: 1100px) { .main-nav { display: none; } .header-login { margin-left: auto; } .header-login + .header-call { margin-left: 0; } }
@media (max-width: 720px) {
  .portal-layout { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.5rem; padding-bottom: 2rem; }
  .portal-intro { min-height: 0; padding: 1.5rem; }
  .portal-eyebrow { margin-bottom: 1rem; }
  .portal-intro > .portal-lock, .portal-intro-note { display: none; }
  .portal-intro h1 { font-size: 1.85rem; }
  .portal-intro > p:not(.portal-eyebrow) { max-width: none; margin-bottom: 0; }
  .portal-footer { flex-wrap: wrap; gap: .4rem; }
  .private-heading { align-items: start; flex-direction: column; }
  .private-account { grid-template-columns: 1fr; gap: .75rem; }
}
@media (max-width: 440px) {
  .header-inner { gap: .65rem; }
  .header-login { font-size: .78rem; }
  .header-login svg, .header-call span { display: none; }
  .header-call { padding: .5rem .65rem; font-size: .78rem; }
  .header-inner:has(.header-login) .brand-mark { width: 34px; height: 34px; }
  .header-inner .brand-text strong { font-size: .92rem; }
  .header-inner .brand-text small { font-size: .6rem; }
  .portal-header .btn { font-size: .8rem; padding: .55rem .8rem; }
}
@media (max-width: 360px) { .header-inner:has(.header-login) .brand-text small { display: none; } }

/* ------------------------------------------------------------------ Workspace */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn-small { padding: .45rem .95rem; font-size: .85rem; }
.btn-danger { color: #9e1820; border-color: #ecc8cb; }
.btn-danger:hover { background: #9e1820; border-color: #9e1820; color: #fff; }
.text-danger { color: #9e1820; }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--navy); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; flex-shrink: 0; }
.icon-button:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.private-main .field select, .sheet .field select { padding-right: 2.2rem; background: #fbfcfe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230d1b3e' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right .85rem center; }
.private-main [aria-invalid="true"] { border-color: #c4323a !important; box-shadow: 0 0 0 3px #c4323a22 !important; }

.private-tabs { border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; }
.private-tabs [role="tablist"] { display: flex; gap: .25rem; min-width: max-content; }
.private-tabs [role="tab"] { border: 0; background: none; font: inherit; font-weight: 700; font-size: .95rem; color: var(--ink-soft); padding: .8rem 1.1rem; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.private-tabs [role="tab"]:hover { color: var(--navy); }
.private-tabs [role="tab"][aria-selected="true"] { color: var(--navy); border-bottom-color: var(--red); }
#workspaceStatus { margin-bottom: 1.25rem; }
.workspace-panel[aria-busy="true"] .calendar-grid, .workspace-panel[aria-busy="true"] .stat-row { opacity: .6; transition: opacity .2s; }

.month-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.month-nav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.month-label { margin: 0; min-width: 9.5em; text-align: center; font-size: clamp(1.25rem, 2.6vw, 1.6rem); }

.next-mission { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: center; background: var(--navy); color: #dce3ef; border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; border-left: 5px solid var(--red); }
.next-kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 800; color: #ffb3b7; }
.next-body { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; text-align: left; background: none; border: 0; color: inherit; font: inherit; font-size: .93rem; cursor: pointer; padding: 0; }
.next-body strong { color: #fff; }
.next-body:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.next-route { color: #bcc9df; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: 0 0 1.5rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1.1rem; border-top: 3px solid #c3cddd; }
.stat dt { font-size: .76rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.stat dd { margin: .25rem 0 0; font-size: 1.45rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat.tone-amber { border-top-color: var(--amber); }
.stat.tone-green { border-top-color: #397a5d; }
.stat.tone-navy { border-top-color: var(--navy); }
.stat.tone-red { border-top-color: var(--red); }
.stat.tone-red dd { color: #9e1820; }

/* Status colours shared by chips, pills and cards. */
.status-a_confirmer { --status: #b7791f; --status-bg: #fff6e6; }
.status-confirme { --status: #1e3a6e; --status-bg: #eaf0fa; }
.status-en_cours { --status: #d5222b; --status-bg: #fdeced; }
.status-livre { --status: #2f6e52; --status-bg: #ebf6f0; }
.status-annule { --status: #6b7280; --status-bg: #f1f2f4; }
.status-pill { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 750; color: var(--status); background: var(--status-bg); border: 1px solid color-mix(in srgb, var(--status) 30%, transparent); white-space: nowrap; }
.status-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; list-style: none; padding: 0; margin: 1.2rem 0 0; font-size: .8rem; color: var(--ink-soft); }
.status-legend li::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--status); margin-right: .45rem; vertical-align: -1px; }

.agenda-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.calendar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: .55rem .6rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); background: #f7f9fc; border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: .4rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-weekend { background: #fafbfd; }
.cal-day.is-outside { background: #f4f6f9; }
.cal-day.is-outside .cal-date { color: #a0aabb; }
.cal-day-head { display: flex; justify-content: space-between; align-items: center; }
.cal-date { font-size: .82rem; font-weight: 750; color: var(--navy); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.is-today .cal-date { background: var(--red); color: #fff; }
.cal-add { width: 24px; height: 24px; border: 1px dashed #b5c1d3; border-radius: 6px; background: none; color: var(--navy-3); cursor: pointer; font: inherit; font-weight: 700; line-height: 1; opacity: 0; transition: opacity .15s; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
@media (hover: none) { .cal-add { opacity: .7; } }
.cal-chip { display: flex; gap: .3rem; align-items: baseline; width: 100%; padding: .2rem .4rem; border: 0; border-left: 3px solid var(--status); border-radius: 5px; background: var(--status-bg); color: var(--navy); font: inherit; font-size: .74rem; font-weight: 650; text-align: left; cursor: pointer; overflow: hidden; }
.cal-chip:hover { filter: brightness(.96); }
.cal-chip.status-annule .chip-text { text-decoration: line-through; }
.chip-time { color: var(--status); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.month-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; max-height: 760px; overflow-y: auto; }
.month-list h3 { font-size: 1rem; margin-bottom: .9rem; }
.day-group + .day-group { margin-top: 1rem; }
.day-group h4 { margin: 0 0 .45rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.mission-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.mission-card { width: 100%; display: grid; gap: .2rem; text-align: left; font: inherit; padding: .7rem .8rem; border: 1px solid var(--line); border-left: 4px solid var(--status); border-radius: var(--radius-sm); background: #fff; cursor: pointer; color: var(--ink); }
.mission-card:hover { border-color: #c3cddd; border-left-color: var(--status); box-shadow: var(--shadow-sm); }
.mission-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.mission-time { font-size: .8rem; font-weight: 750; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mission-vehicle { font-weight: 750; color: var(--navy); font-size: .93rem; overflow-wrap: anywhere; }
.mission-route, .mission-meta { font-size: .8rem; color: var(--ink-soft); overflow-wrap: anywhere; line-height: 1.45; }
.status-annule .mission-vehicle { text-decoration: line-through; }
.pv-badges { display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .2rem; }
.pv-badge { font-size: .7rem; color: #8a94a6; }
.pv-badge.is-done { color: #2f6e52; font-weight: 700; }
.empty-state { color: var(--ink-soft); font-size: .9rem; }

/* Dialog sheets */
.sheet { width: min(760px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 24px 70px #0d1b3e40; color: var(--ink); }
.sheet::backdrop { background: #0d1b3e8c; }
.sheet form { display: flex; flex-direction: column; max-height: calc(100dvh - 1.5rem); }
.sheet-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--line); border-top: 4px solid var(--red); }
.sheet-header h2 { margin: 0; font-size: 1.35rem; }
.sheet-subtitle { margin: .2rem 0 0; color: var(--ink-soft); font-size: .88rem; }
.sheet-body { padding: 1.2rem 1.5rem; overflow-y: auto; }
.sheet-body .portal-status { margin-bottom: 1rem; }
.sheet fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.sheet legend { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--red); margin-bottom: .6rem; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .field { margin-bottom: .85rem; }
.field-wide { grid-column: 1 / -1; }
.field-link { display: flex; align-items: center; padding-top: 1.4rem; }
.sheet .field textarea { min-height: 72px; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; color: var(--ink); cursor: pointer; margin-bottom: .85rem; line-height: 1.45; }
.check input { width: 18px; height: 18px; margin: .1rem 0 0; accent-color: var(--red); flex-shrink: 0; }
.checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.checklist .check { margin-bottom: .55rem; }
.inspection-distance { margin: 0 0 1rem; font-size: .88rem; font-weight: 650; color: #2f6e52; }
.inspection-distance[data-tone="error"] { color: #9e1820; }
.inspection-links { border-top: 1px solid var(--line); padding-top: 1rem; }
.inspection-links h3 { font-size: 1rem; }
.inspection-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.inspection-button { display: grid; gap: .15rem; text-align: left; font: inherit; padding: .8rem 1rem; border: 1px dashed #b5c1d3; border-radius: var(--radius-sm); background: #f9fbfd; cursor: pointer; color: var(--ink-soft); font-size: .82rem; }
.inspection-button strong { font-size: .93rem; }
.inspection-button:hover { border-color: var(--navy-3); }
.inspection-button.is-done { border-style: solid; border-color: #c2dfd0; background: #f0f8f4; color: #2f6e52; }
.sheet-footer { display: flex; flex-wrap: wrap; gap: .6rem; padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: #f9fbfd; }
.sheet-footer .btn { padding: .62rem 1.15rem; font-size: .9rem; }
.sheet-spacer { flex: 1; }

/* Expenses */
.panel-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.5rem); margin-bottom: 1.25rem; }
.panel-card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.expenses-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.expense-form .form-actions { margin-top: .4rem; justify-content: flex-end; }
.category-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.category-bars li:not(.empty-state) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .8rem; font-size: .86rem; }
.bar-label { color: var(--navy); font-weight: 650; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }
.bar-track { grid-column: 1 / -1; height: 8px; background: #edf1f6; border-radius: 999px; overflow: hidden; order: 3; }
.bar-fill { display: block; height: 100%; background: var(--navy-3); border-radius: 999px; }
.table-scroll { overflow-x: auto; }
.expense-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.expense-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); padding: .5rem .6rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
.expense-table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.expense-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; color: var(--navy); }
.row-actions { display: flex; gap: .8rem; justify-content: flex-end; white-space: nowrap; }


/* Condition reports */
.panel-title { margin: 0 0 .25rem; font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
.panel-lead { margin: 0; color: var(--ink-soft); font-size: .92rem; max-width: 60ch; }
.pv-section + .pv-section { margin-top: 1.8rem; }
.pv-section h3 { display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; margin-bottom: .35rem; }
.pv-count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem; border-radius: 999px; background: #e8edf5; color: var(--navy); font-size: .78rem; font-weight: 800; }
.pv-help { margin: 0 0 .8rem; color: var(--ink-soft); font-size: .85rem; }
.pv-list { list-style: none; padding: 0; margin: .7rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: .9rem; }
.pv-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--status); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: .8rem; align-content: start; }
.pv-card-head { display: flex; justify-content: space-between; gap: .8rem; align-items: start; }
.pv-card-head p { margin: 0; }
.pv-date { font-size: .78rem; font-weight: 750; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem !important; }
.pv-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.pv-step { display: grid; gap: .2rem; align-content: start; text-align: left; font: inherit; padding: .8rem .9rem; min-height: 96px; border: 1.5px dashed #b5c1d3; border-radius: var(--radius-sm); background: #f9fbfd; color: var(--ink-soft); cursor: pointer; }
.pv-step:hover, .pv-step:focus-visible { border-color: var(--navy); background: #fff; }
.pv-step.is-done { border-style: solid; border-color: #c2dfd0; background: #f0f8f4; }
.pv-step-title { display: flex; align-items: center; gap: .5rem; color: var(--navy); font-size: 1rem; }
.pv-step-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 800; flex-shrink: 0; }
.pv-step.is-done .pv-step-icon { background: #2f6e52; }
.pv-step-state { font-size: .8rem; font-weight: 650; }
.pv-step.is-done .pv-step-state { color: #2f6e52; }
.pv-step-meta { font-size: .76rem; line-height: 1.4; }
.pv-alert { margin: 0; padding: .6rem .8rem; border-radius: var(--radius-sm); background: #fff4f4; border: 1px solid #ecc8cb; color: #9e1820; font-size: .84rem; font-weight: 650; }
.pv-card-actions { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.empty-panel { display: grid; justify-items: start; gap: .8rem; }

.sheet-wide { width: min(980px, calc(100vw - 1.5rem)); }
.fieldset-help { margin: -.2rem 0 .8rem; color: var(--ink-soft); font-size: .84rem; }
.damage-layout { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.damage-diagram { display: grid; gap: .6rem; justify-items: center; }
.car-diagram { width: 100%; max-width: 260px; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.car-body { fill: #eef2f7; stroke: #b5c1d3; stroke-width: 1.5; }
.car-caption { font-size: 9px; font-weight: 800; letter-spacing: .12em; fill: #8a94a6; }
.zone path { fill: #fff; stroke: #8e9bb0; stroke-width: 1.2; transition: fill .12s; }
.zone[role="button"] { cursor: pointer; outline: none; }
.zone[role="button"]:hover path { fill: #e8edf5; }
.zone[role="button"]:focus-visible path { stroke: var(--navy); stroke-width: 3; }
.zone.was-marked path { stroke: #b7791f; stroke-width: 2; stroke-dasharray: 4 3; }
.zone.is-marked path { fill: #fde3e4; stroke: #c4323a; stroke-width: 1.8; stroke-dasharray: none; }
.zone.is-selected path { fill: #ffd0d3; stroke: var(--navy); stroke-width: 3; stroke-dasharray: none; }
.zone text { font-size: 10px; font-weight: 800; fill: #9e1820; pointer-events: none; }
.zone-button { font: inherit; font-size: .85rem; font-weight: 650; padding: .55rem 1rem; border: 1.5px solid #8e9bb0; border-radius: 999px; background: #fff; color: var(--navy); cursor: pointer; min-height: 44px; }
.zone-button.is-marked { background: #fde3e4; border-color: #c4323a; color: #9e1820; }
.zone-button.is-selected { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy); }
.damage-picker { border: 1px solid #ccd8e8; background: #f1f5fb; border-radius: var(--radius-sm); padding: .8rem; margin-bottom: 1rem; }
.damage-picker-title { margin: 0 0 .6rem; font-weight: 750; color: var(--navy); font-size: .92rem; }
.damage-types { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .6rem; }
.damage-type { font: inherit; font-size: .85rem; font-weight: 650; min-height: 44px; padding: .45rem .8rem; border: 1.5px solid #b5c1d3; border-radius: 999px; background: #fff; color: var(--navy); cursor: pointer; }
.damage-type b { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: #e8edf5; font-size: .72rem; }
.damage-type[aria-pressed="true"] { background: #c4323a; border-color: #c4323a; color: #fff; }
.damage-type[aria-pressed="true"] b { background: #fff; color: #9e1820; }
.damage-legend { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .78rem; color: var(--ink-soft); }
.damage-legend b { color: #9e1820; }
.legend-previous { flex-basis: 100%; color: #8a5a12; }
.damage-list-title { font-size: .9rem; margin: 0 0 .4rem; }
.damage-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; font-size: .87rem; }
.damage-list li:not(.empty-state) { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.damage-new { display: inline-block; margin-left: .45rem; padding: .05rem .45rem; border-radius: 999px; background: #c4323a; color: #fff; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

.photo-grid { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.photo-grid[hidden] { display: none; }
.photo-grid-small { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.photo-item { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #e8edf5; border: 1px solid var(--line); }
.photo-item a, .photo-item img { display: block; width: 100%; height: 100%; }
.photo-item img { object-fit: cover; }
.photo-item.is-uploading img { opacity: .45; }
.photo-progress { position: absolute; inset: auto 0 0; padding: .2rem; background: #0d1b3ecc; color: #fff; font-size: .7rem; text-align: center; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #0d1b3ed9; color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.photo-remove:hover { background: #c4323a; }
.photo-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.photo-add { cursor: pointer; min-height: 44px; }
.photo-input:focus-visible + .photo-add { outline: 3px solid var(--navy); outline-offset: 2px; }
.photo-status { margin: .6rem 0 0; font-size: .84rem; color: var(--ink-soft); }
.photo-status:empty { display: none; }
.photo-status[data-tone="error"] { color: #9e1820; }
.photo-status[data-tone="success"] { color: #2f6e52; }

.signature-box { position: relative; border: 1.5px dashed #8e9bb0; border-radius: var(--radius-sm); background: #fff; }
.signature-box[hidden], .signature-saved[hidden] { display: none; }
.signature-pad { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; border-radius: var(--radius-sm); }
.signature-hint { position: absolute; left: 1rem; right: 1rem; bottom: 2.2rem; border-top: 1px solid #c3cddd; padding-top: .3rem; font-size: .75rem; color: #8a94a6; pointer-events: none; }
.signature-box.has-ink .signature-hint { visibility: hidden; }
.signature-box #signatureClear { position: absolute; top: .5rem; right: .7rem; }
.signature-saved { display: grid; gap: .4rem; justify-items: start; padding: .8rem; border: 1px solid #c2dfd0; background: #f0f8f4; border-radius: var(--radius-sm); }
.signature-saved img, .signature-preview { max-width: 280px; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.signature-saved p { margin: 0; color: #245846; font-size: .87rem; font-weight: 650; }

.compare-summary { list-style: none; padding: .8rem 1rem; margin: 0 0 1rem; border-radius: var(--radius-sm); background: #f0f8f4; border: 1px solid #c2dfd0; color: #245846; font-weight: 650; font-size: .9rem; display: grid; gap: .3rem; }
.compare-summary.has-alert { background: #fff4f4; border-color: #ecc8cb; color: #9e1820; }
.compare-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-bottom: 1.2rem; }
.compare-table th, .compare-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); border-bottom-width: 2px; }
.compare-table tbody th { color: var(--ink-soft); font-weight: 650; width: 34%; }
.compare-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.compare-column { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; display: grid; gap: .5rem; align-content: start; }
.compare-column h3 { margin: 0; font-size: 1rem; }
.compare-column h4 { margin: .4rem 0 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.compare-column .car-diagram { max-width: 200px; justify-self: center; }
.compare-text { margin: 0; font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.compare-text.muted { color: var(--ink-soft); }

.print-sheet { display: none; }

@media (max-width: 960px) {
  .agenda-layout { grid-template-columns: 1fr; }
  .month-list { max-height: none; }
  .expenses-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* On phones the day list replaces the month grid, which would be too cramped. */
  .calendar { display: none; }
  .month-list { padding: 1rem; }
  .month-toolbar { align-items: stretch; }
  .month-toolbar > .btn { width: 100%; }
  .month-label { min-width: 0; flex: 1; font-size: 1.15rem; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .stat { padding: .7rem .8rem; }
  .stat dd { font-size: 1.15rem; }
  .private-tabs [role="tab"] { padding: .75rem .7rem; font-size: .9rem; }
  .next-mission { grid-template-columns: 1fr; gap: .4rem; }
  .form-grid, .checklist, .inspection-buttons, .damage-layout, .compare-columns { grid-template-columns: 1fr; }
  .car-diagram { max-width: 230px; }
  .pv-card { padding: .9rem; }
  .pv-steps { gap: .5rem; }
  .pv-step { padding: .7rem; }
  .photo-actions .btn { flex: 1 1 45%; justify-content: center; }
  .field-link { padding-top: 0; margin-bottom: .85rem; }
  .sheet { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; margin: 0; }
  .sheet form { max-height: 100dvh; height: 100dvh; }
  .sheet-header, .sheet-body, .sheet-footer { padding-left: 1rem; padding-right: 1rem; }
  .sheet-spacer { display: none; }
  .sheet-footer .btn { flex: 1 1 40%; }
  .expense-table thead { display: none; }
  .expense-table, .expense-table tbody, .expense-table tr, .expense-table td { display: block; }
  .expense-table tr { padding: .7rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; }
  .expense-table td { border: 0; padding: 0; }
  .expense-table td:nth-child(5) { grid-column: 2; grid-row: 1; }
  .expense-table td:nth-child(3), .expense-table td:nth-child(4) { color: var(--ink-soft); font-size: .82rem; grid-column: 1; }
  .expense-table td:last-child { grid-column: 1 / -1; }
  .row-actions { justify-content: flex-start; margin-top: .3rem; }
}

@media print {
  .portal-page > :not(#printSheet), dialog { display: none !important; }
  .portal-page { background: #fff; display: block; }
  .print-sheet { display: block; font-size: 11pt; color: #000; }
  .print-header { display: flex; justify-content: space-between; border-bottom: 3px solid #000; padding-bottom: 8pt; margin-bottom: 12pt; }
  .print-header div { display: grid; }
  .print-header div:last-child { text-align: right; }
  .print-sheet table { width: 100%; border-collapse: collapse; margin-bottom: 10pt; }
  .print-sheet th, .print-sheet td { border: 1px solid #999; padding: 4pt 6pt; text-align: left; vertical-align: top; }
  .print-sheet th { width: 32%; background: #f2f2f2; }
  .print-sheet h2 { font-size: 13pt; margin: 14pt 0 6pt; color: #000; }
  .print-sheet h3 { font-size: 11pt; margin: 8pt 0 4pt; color: #000; }
  .print-block { break-inside: avoid; }
  .print-checklist { list-style: none; padding: 0; margin: 0 0 6pt; columns: 2; }
  .print-text { white-space: pre-wrap; }
  .print-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 16pt; margin-top: 10pt; }
  .print-signatures p, .print-signatures figure { border: 1px solid #999; min-height: 60pt; padding: 4pt 6pt; margin: 0; font-size: 9pt; }
  .print-signatures figure img { display: block; max-height: 60pt; max-width: 100%; margin-top: 3pt; }
  .print-report { display: grid; grid-template-columns: 1fr 4.2cm; gap: 12pt; align-items: start; }
  .print-diagram { text-align: center; font-size: 7pt; }
  .print-diagram .car-diagram { width: 4cm; height: auto; }
  .print-sheet .car-diagram, .print-sheet .photo-item { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-sheet .photo-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4pt; list-style: none; padding: 0; margin: 0 0 6pt; }
  .print-sheet .photo-item { aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid #999; }
  .print-sheet .photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
}
