@charset "UTF-8";
/*
 * Ivory Atelier theme for the shared app screens.
 * Hand-written; loaded after styles.css, map.css, auth.css and the generated atelier.css.
 * The app shell applies html.atelier at document load.
 * Colours, radii, shadows and fonts come from ui/src/tokens.css (also defined in atelier.css).
 *
 * Specificity: styles.css has many layered rules (up to ID selectors such as #invoice-dialog input).
 * Where a visual property must win everywhere, the selector is wrapped as :is(<selector>, #atelier-boost),
 * which raises it to ID specificity without matching anything new. #atelier-boost never exists in the page.
 *
 * What the file enforces (docs/DESIGN_SYSTEM.md, "Composition"):
 *   - two surfaces only: paper and white card. No card inside a card, no shadows except on overlays.
 *   - one solid navy action per view; alternatives are hairline pills; row actions are quiet text.
 *   - gold marks completion. Use semantic status tokens for other states.
 */

/* ---------- Fonts (SIL Open Font License, see fonts/*-OFL.txt) ---------- */
@font-face { font-family: Manrope; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/atelier/fonts/manrope-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: Newsreader; font-style: normal; font-weight: 400; font-display: swap; src: url('/atelier/fonts/newsreader-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Newsreader; font-style: italic; font-weight: 400; font-display: swap; src: url('/atelier/fonts/newsreader-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: Newsreader; font-style: normal; font-weight: 500; font-display: swap; src: url('/atelier/fonts/newsreader-latin-500-normal.woff2') format('woff2'); }

/* ---------- Old variables mapped to Atelier tokens ---------- */
html.atelier {
  --brand-navy: var(--primary);
  --brand-gold: var(--gold);
  --brand-ivory: var(--primary-foreground);
  --brand-gold-dark: var(--gold-ink);
  --brand-bronze-sheen: var(--gold);
  --ink: var(--foreground);
  --line: var(--border);
  --surface: var(--card);
  --surface-soft: var(--muted);
  --green: var(--primary);
  --hairline: var(--border);
  --control-border: var(--input);
  color: var(--foreground);
  background: var(--background);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Manrope everywhere outside the React island (which sets its own fonts). */
html.atelier :not(.atelier-calendar-host *, body .atelier *, svg *) { font-family: var(--font-sans); }
html.atelier body, html.atelier .workspace { background: var(--background); color: var(--foreground); }
html.atelier ::selection { background: var(--accent); color: var(--accent-foreground); }

/* Restore list markers for purchasing content after the shared reset. */
html.atelier :is(.request-item-list, .purchase-history) { list-style: disc; padding-left: 22px; }
:where(html.atelier) fieldset { border: 1px solid var(--border); border-radius: var(--radius-item); }

/* ---------- Focus ---------- */
html.atelier :is(:focus-visible, #atelier-boost) { outline: 2px solid var(--ring); outline-offset: 2px; }
html.atelier .app-ribbon :is(:focus-visible, #atelier-boost),
html.atelier .sidebar-toggle:is(:focus-visible, #atelier-boost) { outline-color: var(--gold-light); outline-offset: 2px; }
html.atelier :is(input, select, textarea):is(:focus-visible, #atelier-boost) { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
html.atelier :is(.attachment-dropzone:focus-within, [data-material-line]:focus-within, .seasonal-check:focus-within, #atelier-boost) { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Typography ---------- */
html.atelier h1:not(.atelier-calendar-host *, body .atelier *) { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.02em; color: var(--primary); }
html.atelier :is(.event-header h2, .invoice-dialog-header h2, .client-editor-header h2, .account-dialog header h2, dialog.activity-dialog h2, .dialog-top h2, .section-heading h2, .property-card h2, .agenda-panel h2, .purchase-group-title, .invoice-dialog-body h3, .sign-in-form h1, #field-workspace h1, .property-title-row h1, .visit-steps .flow-title, .flow-leave .flow-leave-when, .material-flow-detail h2) {
  font-family: var(--font-serif); font-weight: 400; letter-spacing: -.01em; color: var(--primary);
}
html.atelier .calendar-toolbar-title h1 { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.01em; }
html.atelier :is(.eyebrow, .small-label, .nav-label, .pending-detail-label) { color: var(--muted-foreground); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
html.atelier :is(.page-description, .heading-date span, .calendar-toolbar p, .brand small, .property-card p, .count-label, .section-heading p, .calendar-search label) { color: var(--muted-foreground); }
html.atelier :is(.event-section-heading, .event-section-heading h3, .event-section-toggle h3, .attachments-heading h4, .maintenance-panel h4, .event-editor .event-material-area > h4, .comment-block h4, .comment-block > label, #atelier-boost) { color: var(--primary); font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; }
html.atelier :is(.event-editor .event-section-heading, .event-editor .event-section-toggle, #atelier-boost) { border: 0; padding-bottom: 0; }

/* Fixed top navigation and retractable property column. */
html.atelier .app-ribbon { background: var(--primary); border-bottom: 0; box-shadow: none; }
html.atelier .app-ribbon .main-nav button {
  min-height: 40px; padding: 0 12px; border-radius: var(--radius-control);
  color: color-mix(in srgb, var(--primary-foreground) 82%, var(--primary)); font-size: 14px; font-weight: 500; letter-spacing: 0; background: transparent;
  transition: background-color .15s ease, color .15s ease;
}
html.atelier .app-ribbon .main-nav button:hover { background: color-mix(in srgb, var(--primary-foreground) 8%, transparent); color: var(--primary-foreground); filter: none; }
html.atelier .app-ribbon .main-nav button[aria-current="page"] { background: color-mix(in srgb, var(--primary-foreground) 14%, transparent); color: var(--primary-foreground); font-weight: 700; box-shadow: none; }
html.atelier .language-switch button { border-radius: 8px; border: 1px solid var(--border); background: var(--card); }
html.atelier .language-switch [data-language-toggle] { background: transparent; border: 1px solid rgba(250, 248, 244, .28); }
html.atelier .language-menu { border: 1px solid var(--border); border-radius: var(--radius-item); padding: 6px; background: var(--card); box-shadow: var(--shadow-pop); }
html.atelier .account-menu > summary { width: 36px; height: 36px; border: 0; background: rgba(250, 248, 244, .14); color: #faf8f4; font-size: 12px; font-weight: 700; }
html.atelier .account-menu > summary:hover { background: rgba(250, 248, 244, .22); }
html.atelier .account-menu-panel { width: 220px; padding: 6px; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-item); background: var(--card); color: var(--primary); box-shadow: var(--shadow-pop); }
html.atelier .account-menu-panel strong { padding: 10px 12px 0; font-size: 14px; }
html.atelier .account-menu-panel small { padding: 2px 12px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border); color: var(--muted-foreground); }
html.atelier .account-menu-panel button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--primary); font-size: 14px; font-weight: 500; text-align: left; justify-content: flex-start; }
html.atelier .account-menu-panel button:hover { background: var(--background); filter: none; }
html.atelier .skip-link { border-radius: var(--radius-pill); background: var(--primary); color: #fff; border-color: #fff; }

/* Keep the property rail handle compact. */
html.atelier .sidebar-toggle-icon {
  display:block; position:relative; width:17px; height:15px;
  border:1.5px solid currentColor; border-radius:3px;
}
html.atelier .sidebar-toggle-icon::before {
  content:''; position:absolute; inset-block:0; inset-inline-start:5px;
  border-inline-start:1.5px solid currentColor;
}
html.atelier .sidebar-toggle-label { display: none; }
html.atelier .sidebar {
  background: var(--card); color: var(--primary); border: 1px solid var(--border);
  box-shadow: none; padding: 14px; gap: 10px;
}
html.atelier .sidebar .property-nav-head { display:block; }
html.atelier .property-search { min-height: 40px; padding: 0 12px; border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--muted); color: var(--primary); font-size: 14px; }
html.atelier .property-search::placeholder { color: var(--muted-foreground); }
html.atelier .sidebar .property-nav { scrollbar-color: var(--input) transparent; gap: 1px; padding: 0; }
html.atelier .sidebar .property-nav button { min-height: 36px; padding: 7px 12px; border-radius: var(--radius-control); color: var(--text-secondary); font-size: 14px; font-weight: 500; }
html.atelier .sidebar .property-nav button:hover { background: var(--muted); color: var(--primary); filter: none; }
html.atelier .sidebar .property-nav button:is([aria-pressed="true"], #atelier-boost) { background: var(--background); color: var(--primary); font-weight: 600; }
html.atelier .property-search-empty { color: var(--muted-foreground); }
html.atelier .maintenance-marker { border-color: var(--gold); color: var(--gold-ink); }

html.atelier .sidebar-toggle {
  width: 40px;
  padding-inline: 0;
  justify-content: center;
  background: var(--card);
  color: var(--primary);
  border-color: var(--input);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  box-shadow: none;
}
html.atelier .sidebar { border-radius: 0; }
.app-ribbon .main-nav { overflow: visible; min-width: 0; }
@media (max-width: 1280px) {
  .app-ribbon .main-nav button > span { display: none; }
  .app-ribbon nav.main-nav button { justify-content: center; padding-inline: 8px; }
}
@media (max-width: 760px) {
  .app-ribbon .brand { display: none; }
  .app-ribbon .main-nav { flex: 1; gap: 2px; }
  .app-ribbon nav.main-nav button { flex: 1 1 0; min-width: 0; padding-inline: 2px; }
}
@media (max-width: 900px) {
  html.atelier .workspace > :is(main, #atelier-boost) { padding: 16px 16px 40px 52px; }
  html.atelier .workspace > :is(main.map-workspace, #atelier-boost) { padding: 0; }
}

/* ---------- Page framing ---------- */
html.atelier .page-heading { align-items: center; gap: 12px 16px; margin-bottom: 24px; }
html.atelier .page-heading h1 { font-size: 40px; line-height: 1.1; margin: 0; }
html.atelier .pending-page-heading h1 { margin-right: auto; }
html.atelier .property-title-row { flex-direction: column-reverse; align-items: flex-start; gap: 4px; }
html.atelier .page-heading:has(.property-title-row) > div { min-width: 0; overflow-wrap: anywhere; }
html.atelier .page-heading:has(.property-title-row) > [data-action="show-calendar"] { flex-shrink: 0; }
@media (max-width: 600px) {
  html.atelier .page-heading:has(:is(.property-title-row, .stock-page-actions)) { flex-wrap: wrap; justify-content: flex-start; }
  html.atelier .page-heading:has(.property-title-row) > div { flex-basis: 100%; }
  html.atelier .page-heading > .stock-page-actions { min-width: 0; justify-content: flex-start; }
}

html.atelier .heading-date { color: var(--text-secondary); }
html.atelier .empty-state { color: var(--text-secondary); }

/* ---------- Buttons ---------- */
html.atelier :is(.primary-button, #atelier-boost) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius-pill);
  background: var(--primary); color: var(--primary-foreground);
  font-weight: 600; font-size: 14px; letter-spacing: 0; text-decoration: none;
  box-shadow: none;
}
html.atelier :is(.primary-button:hover, #atelier-boost) { background: #0d2944; filter: none; }
html.atelier :is(.secondary-button, .cancel-button, .draft-button, .today-button, .agenda-open-day, .calendar-mode-button, .calendar-date-trigger, .property-parent-button, .password-control button, .auth-language button, .history-related-task > .secondary-button, .add-request-item, .decline-action button, .map-status button, .map-property-popup button, .map-missing button, .subcontractor-directory-actions button, #atelier-boost) {
  min-height: 44px; padding: 0 18px; border: 1px solid var(--control-border); border-radius: var(--radius-pill);
  background: var(--card); color: var(--primary); font-weight: 600; font-size: 14px; letter-spacing: 0;
  box-shadow: none; text-decoration: none;
}
html.atelier :is(.secondary-button, .cancel-button, .draft-button, .today-button, .agenda-open-day, .calendar-mode-button, .calendar-date-trigger, .property-parent-button, .password-control button, .auth-language button):hover { background: var(--muted); border-color: var(--text-secondary); filter: none; }
html.atelier :is(.decline-action button, #atelier-boost) { color: var(--destructive); border-color: #e3b9b4; }
html.atelier :is(.icon-button, .event-close, #atelier-boost) {
  display: inline-grid; place-items: center; min-width: 40px; min-height: 40px;
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-secondary);
}
html.atelier :is(.icon-button, .event-close):hover { background: var(--background); color: var(--primary); filter: none; }
html.atelier :is(.text-button, .history-link, .agenda-date-button) {
  color: var(--primary); font-weight: 600; text-decoration: none; text-underline-offset: 4px; border-radius: 6px;
}
html.atelier :is(.text-button, .history-link, .agenda-date-button):hover { text-decoration: underline; filter: none; }
/* Quiet actions: anything repeated per row, and the way out of a dialog. Text until hovered. */
html.atelier :is(.event-actionbar .history-link, .cancel-button, .stock-row-actions button, .history-details-toggle, .pending-task-actions .text-button, .property-parent-button, .property-clear-filters, .event-editor [data-manage-material], .event-editor [data-manage-material], :is(.invoice-dialog-header, .client-editor-header, .account-dialog header, .dialog-actions) .secondary-button, .material-step-actions .secondary-button:not(:first-child, .primary-button + .secondary-button), #atelier-boost) {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; text-decoration: none;
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--primary); font-size: 14px; font-weight: 600;
}
html.atelier :is(.event-actionbar .history-link, .cancel-button, .stock-row-actions button, .history-details-toggle, .pending-task-actions .text-button, .property-parent-button, .property-clear-filters, :is(.invoice-dialog-header, .client-editor-header, .account-dialog header, .dialog-actions) .secondary-button, .material-step-actions .secondary-button:not(:first-child, .primary-button + .secondary-button)):hover { background: var(--background); text-decoration: none; filter: none; }
html.atelier .property-parent-button { margin-left: -12px; min-height: 28px; font-size: 13px; color: var(--text-secondary); }
html.atelier :is(.event-editor .add-material-controls .text-button, #atelier-boost) {
  min-height: 44px; padding: 0 18px; text-decoration: none;
  border: 1px solid var(--control-border); border-radius: var(--radius-pill); background: var(--card); color: var(--primary); font-size: 14px;
}
html.atelier :is(.event-editor .add-material-controls .text-button:hover, #atelier-boost) { background: var(--muted); border-color: var(--text-secondary); text-decoration: none; }
html.atelier :is(.event-editor .extra-hours-control summary, #atelier-boost) { border: 1px solid var(--control-border); border-radius: var(--radius-pill); background: var(--card); padding: 0 16px; font-weight: 600; }
html.atelier :is(.event-property-location, #atelier-boost) { border: 0; border-radius: 0; padding: 0; background: transparent; color: var(--muted-foreground); font-size: 13px; }
html.atelier :is(.delete-report, #atelier-boost) {
  min-height: 44px; padding: 0 18px; border: 1px solid #e3b9b4; border-radius: var(--radius-pill);
  background: var(--card); color: var(--destructive); font-weight: 600;
}
html.atelier :is(.delete-report:hover, #atelier-boost) { background: var(--danger-soft); filter: none; }
html.atelier button:disabled:not(body .atelier *) { cursor: not-allowed; }
html.atelier :is(.appointment-durations [aria-pressed="true"], #atelier-boost) { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
html.atelier .calendar-date-trigger { min-height: 44px; width: auto; min-width: 190px; gap: 12px; justify-content: space-between; }

/* Event editor action bar: Save is the one solid navy action. */

/* ---------- Form controls ---------- */
html.atelier :is(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="hidden"]), select, textarea, #atelier-boost):not(.atelier-calendar-host *, body .atelier *, .leaflet-container *) {
  border: 1px solid var(--input); border-radius: var(--radius-control);
  background-color: var(--card); color: var(--primary); box-shadow: none;
  font-family: var(--font-sans);
}
html.atelier :is(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="hidden"]), select):not(.atelier-calendar-host *, body .atelier *, .leaflet-container *) { min-height: 44px; height: auto; padding-inline: 14px; font-size: 15px; }
html.atelier select:not(.atelier-calendar-host *, body .atelier *) {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: 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 1.5l5 5 5-5' fill='none' stroke='%23123457' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
html.atelier textarea:not(.atelier-calendar-host *, body .atelier *) { padding: 12px 14px; font-size: 15px; line-height: 1.55; }
html.atelier :is(input[type="file"], #atelier-boost):not(.file-picker) { width: fit-content; max-width: 100%; border: 0; border-radius: 0; background: transparent; color: transparent; padding: 0; min-height: 0; }
html.atelier .selected-file { color: var(--muted-foreground); font-size: 13px; font-weight: 500; }
html.atelier input[type="file"]::file-selector-button { min-height: 40px; margin-right: 0; padding: 0 18px; border: 1px solid var(--input); border-radius: var(--radius-pill); background: var(--card); color: var(--primary); font: 600 14px var(--font-sans); cursor: pointer; }
html.atelier :is(input, textarea)::placeholder { color: var(--muted-foreground); opacity: 1; }
html.atelier :is(input[readonly], #atelier-boost):not([type="checkbox"], [type="radio"]) { background-color: var(--muted); }
html.atelier :is([aria-invalid="true"], #atelier-boost):is(input, select, textarea) { border-color: var(--destructive); }
html.atelier :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--primary); }
html.atelier :is(.event-field > span:first-child, .auth-field > span, .client-editor label, .property-filter-panel legend, .invoice-editor .event-field > span, .property-sort > span) { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
html.atelier :is(.field-error, .auth-error, .client-error) { color: var(--destructive); }
html.atelier .auth-error { border-left: 0; padding: 10px 14px; border-radius: var(--radius-control); background: var(--danger-soft); }

/* Choice chips: outcomes, operators, follow-up reasons, seasonal checks, visit kinds. */
html.atelier :is(.event-editor .outcome-options .outcome-option, .operator-option, .event-editor .follow-up-reasons .check-label, .seasonal-check, .event-editor .material-group > .check-label, #atelier-boost) {
  border: 1px solid var(--input); border-radius: var(--radius-item); background: var(--card); box-shadow: none;
}
html.atelier :is(.event-editor .outcome-options .outcome-option, .operator-option, .event-editor .follow-up-reasons .check-label, .seasonal-check):hover { border-color: var(--text-secondary); background: var(--muted); filter: none; }
html.atelier :is(.operator-option:has(input:checked), .event-editor .follow-up-reasons .check-label:has(input:checked), .seasonal-check:has(input:checked), #atelier-boost) {
  border-color: var(--primary); background: var(--info-soft); box-shadow: 0 0 0 1px var(--primary) inset;
}
html.atelier :is(.event-editor .outcome-option[data-outcome="completed"]:has(input:checked), #atelier-boost) { border-color: var(--success); background: var(--success-soft); box-shadow: 0 0 0 1px var(--success) inset; }
html.atelier :is(.event-editor .outcome-option[data-outcome="needs-work"]:has(input:checked), #atelier-boost) { border-color: var(--gold-ink); background: var(--warning-soft); box-shadow: 0 0 0 1px var(--gold-ink) inset; }
html.atelier :is(.event-editor .outcome-option[data-outcome="unresolved"]:has(input:checked), #atelier-boost) { border-color: var(--destructive); background: var(--danger-soft); box-shadow: 0 0 0 1px var(--destructive) inset; }
html.atelier :is(.event-editor .outcome-option[data-outcome="canceled"]:has(input:checked), #atelier-boost) { border-color: #5f6f80; background: var(--neutral-soft); box-shadow: 0 0 0 1px #5f6f80 inset; }
html.atelier .outcome-option[data-outcome="completed"] input { accent-color: var(--success); }
html.atelier .outcome-option[data-outcome="needs-work"] input { accent-color: var(--gold-ink); }
html.atelier .outcome-option[data-outcome="unresolved"] input { accent-color: var(--destructive); }
html.atelier :is(.appointment-durations button, .calendar-day-options button, .date-picker-month, #atelier-boost) {
  border: 1px solid var(--control-border); border-radius: var(--radius-pill); background: var(--card); color: var(--primary); font-weight: 600;
}
html.atelier :is(.appointment-durations button:hover, .calendar-day-options button:hover, #atelier-boost) { border-color: var(--text-secondary); background: var(--muted); filter: none; }
html.atelier :is(.calendar-day-options button[aria-pressed="true"], .date-picker-month.is-selected, .date-picker-day.is-selected, #atelier-boost) { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
html.atelier :is(.date-picker-day, #atelier-boost) { border-radius: var(--radius-pill); }
html.atelier .date-picker-day:hover { background: var(--background); border-color: transparent; }
html.atelier .date-picker-day.is-today:not(.is-selected), html.atelier .date-picker-month.is-current:not(.is-selected) { box-shadow: inset 0 0 0 1.5px var(--gold); }

/* ---------- Dialogs ---------- */
html.atelier dialog:not(body .atelier *) { border: 0; border-radius: var(--radius-panel); background: var(--card); color: var(--primary); box-shadow: var(--shadow-pop); }
html.atelier dialog::backdrop { background: rgba(18, 52, 87, .38); }
html.atelier :is(dialog.event-editor, dialog.invoice-editor, .client-editor, .account-dialog, #atelier-boost) { border-radius: var(--radius-panel); overflow: hidden; }
html.atelier :is(.event-header, .invoice-dialog-header, .client-editor-header, .account-dialog header, #atelier-boost) { background: var(--card); border-bottom: 1px solid var(--border); color: var(--primary); }
html.atelier :is(.invoice-dialog-header h2, .client-editor-header h2, .account-dialog header h2, .dialog-top h2, dialog.activity-dialog h2, #atelier-boost) { font-size: 22px; line-height: 1.2; margin: 0; }
html.atelier :is(.event-footer, #atelier-boost) { background: var(--card); border-color: var(--border); box-shadow: none; }
html.atelier :is(.invoice-dialog-body, .client-form-body, .account-dialog-body, .stock-popup-body, #atelier-boost) { background: var(--card); }
html.atelier .event-meta, html.atelier #event-subtitle { color: var(--text-secondary); }
/* The visit form: one column, one field height, one label style. */
html.atelier :is(.event-editor .event-header, .event-editor .event-content, #atelier-boost) { padding-inline: 24px; }
html.atelier .event-editor.has-flow .event-actionbar { border-bottom: 0; padding: 12px 12px 0; flex-wrap: wrap; justify-content: space-between; }
html.atelier .event-editor.has-flow .event-toolbar-actions { margin-left: auto; flex: 0 1 auto; width: auto; }
html.atelier .event-editor.has-flow .event-toolbar-actions .cancel-button { flex: 0 0 auto; width: auto; }
html.atelier .event-editor.has-flow .event-actionbar { overflow: visible; }
html.atelier .event-editor.has-flow .event-section-body { border-top: 0; padding-top: 0; }
html.atelier .event-editor input[type="number"]::-webkit-inner-spin-button { appearance: none; -webkit-appearance: none; margin: 0; }
html.atelier .event-editor input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
html.atelier :is(.event-editor .event-field, #atelier-boost) { display: grid; gap: 6px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
html.atelier :is(.event-editor :is(.event-property-field, .event-job-field, .event-schedule, .appointment-times) :is(input, select), #atelier-boost) { height: 44px; min-height: 44px; padding-block: 0; font-size: 15px; font-weight: 500; }
html.atelier .event-editor .event-schedule > .event-field { max-width: 220px; }
html.atelier .appointment-times { align-items: end; gap: 12px; }
html.atelier .event-editor .event-keys-needed { align-self: flex-start; margin: 0; }
html.atelier :is(.event-editor fieldset.operator-picker, .event-editor fieldset.follow-up-reasons, .event-editor .follow-up-reasons fieldset, #atelier-boost) { border: 0; border-radius: 0; padding: 0; margin: 0; }
html.atelier .event-editor .follow-up-reasons legend { padding: 0; margin-bottom: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
html.atelier .event-editor .operator-picker legend { padding: 0; margin-bottom: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
html.atelier .appointment-durations { flex-basis: 100%; gap: 6px; }
html.atelier .appointment-durations button { min-height: 36px; padding: 0 14px; font-size: 13px; }
/* Sections inside a dialog are divided by a hairline, not boxed again. */
html.atelier :is(.event-editor .event-section, #atelier-boost) { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding-inline: 0; background: transparent; }
html.atelier :is(.event-editor .event-content > .event-section:first-of-type, #atelier-boost) { border-top: 0; padding-top: 0; }
html.atelier :is(.event-editor .event-operator-band, #atelier-boost) { height: 4px; }
html.atelier :is(.event-save-feedback, .save-feedback, #atelier-boost) { margin: 0; font-size: 12px; color: var(--muted-foreground); }
html.atelier .event-save-feedback { padding: 0 24px 12px; background: var(--card); }
html.atelier .auth-dialog { width: min(440px, calc(100vw - 32px)); border-radius: var(--radius-panel); padding: 28px; border: 1px solid var(--border); background: var(--card); }
html.atelier .auth-dialog::backdrop { background: var(--primary); }
html.atelier .sign-in-form { display: grid; gap: 16px; }
html.atelier .auth-brand { display: grid; place-items: center; padding: 14px; border-radius: var(--radius-control); background: var(--primary); }
html.atelier .auth-brand img { width: min(100%, 240px); height: auto; }
html.atelier .sign-in-form h1 { margin: 4px 0 0; font-size: 32px; line-height: 1.15; }
html.atelier .sign-in-form p { margin: 0; color: var(--text-secondary); }
html.atelier .sign-in-form small { color: var(--muted-foreground); }
html.atelier .auth-dialog [type=submit] { min-height: 48px; width: 100%; }
html.atelier .auth-dialog .auth-language { padding-top: 12px; border-top: 1px solid var(--border); }
html.atelier .auth-language { gap: 4px; }
html.atelier .auth-language button { min-height: 36px; padding: 0 14px; border: 0; background: transparent; color: var(--text-secondary); }
html.atelier .auth-language button:is([aria-pressed="true"], [aria-current], #atelier-boost) { background: var(--background); color: var(--primary); }
/* Form groups in a dialog: a plain heading and space, not a box. */
html.atelier :is(.client-editor fieldset, .invoice-editor fieldset, .stock-editor fieldset, #atelier-boost) { border: 0; border-radius: 0; padding: 0; margin: 0 0 24px; }
html.atelier :is(.client-editor fieldset > legend, .invoice-editor fieldset > legend, .stock-editor fieldset > legend, #atelier-boost) { padding: 0; margin-bottom: 12px; color: var(--primary); font-size: 15px; font-weight: 600; }
html.atelier .access-toolbar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding-bottom:12px; border-bottom:1px solid var(--border); }
html.atelier .access-toolbar p { flex:1 1 16rem; }
html.atelier .access-list { gap: 0; }
html.atelier .access-list article { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 12px 0; background: transparent; }
html.atelier .access-list article:first-child { border-top: 0; }

html.atelier .access-list small { color: var(--muted-foreground); }
html.atelier .account-dialog header { background:var(--card); border-bottom:1px solid var(--border); }
html.atelier .account-dialog .dialog-actions > [type=submit] { min-width: 100px; }
html.atelier .session-warning { flex-wrap:wrap; }
html.atelier .session-warning { border: 1px solid var(--border); border-radius: var(--radius-item); background: var(--card); box-shadow: var(--shadow-pop); padding: 12px 16px; }

/* ---------- Form dialogs ----------
   One layout for every form dialog: title on top, the form in the middle (it scrolls), Cancel and the
   one navy action at the bottom right. The buttons follow the fields in the markup too, so Tab reaches them last.
   Width follows the content: 560px for a short form, 760px for line editors and lists. */
html.atelier :is(.stock-editor, .account-dialog, #atelier-boost) { width: min(560px, calc(100vw - 32px)); }
html.atelier :is(.stock-editor:has(.stock-order-line), .account-dialog:has(.access-list), dialog.invoice-editor, .client-editor, #atelier-boost):not(#atelier-none) { width: min(760px, calc(100vw - 32px)); }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog):not(#atelier-none) { max-height: calc(100dvh - 48px); overflow: hidden; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100dvh - 48px); overflow: hidden; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > header:not(#atelier-none) { position: static; display: block; padding: 0; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > header > h2:not(#atelier-none) { padding: 22px 24px 18px; font-size: 24px; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > .dialog-actions { position: static; display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; gap: 4px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--card); }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > .dialog-actions > .primary-button:not(#atelier-none) { min-width: 120px; min-height: 44px; margin-left: 8px; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > .dialog-actions > a { margin-right: auto; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > :is(.invoice-dialog-body, .client-form-body, .account-dialog-body):not(#atelier-none) { overflow: auto; padding: 20px 24px 24px; }
/* Confirmation dialog: the question as the title, the consequence below, Cancel and the named action. */
html.atelier .confirm-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; }
html.atelier :is(.confirm-dialog h2, #atelier-boost) { margin: 0; padding: 24px 24px 0; font-family: var(--font-serif); font-size: 22px; font-weight: 400; line-height: 1.25; letter-spacing: -.01em; }
html.atelier .confirm-dialog p { margin: 8px 0 0; padding: 0 24px; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
html.atelier .confirm-dialog .dialog-actions { position: static; display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 24px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--card); }
html.atelier .confirm-dialog .dialog-actions > button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Read-only popups keep a title row with Close on the right. */
html.atelier .stock-popup > header { padding: 18px 16px 14px 24px; }
html.atelier .stock-popup > .stock-popup-body { padding: 20px 24px 24px; }

/* Inside the form: one column of fields with short values side by side. */
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-content: start; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > * { grid-column: 1 / -1; margin: 0; min-width: 0; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > :is(p, small):empty, html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > [hidden] { display: none; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > :is(.event-field, .auth-field):has(> :is(input[type="number"], input[name="initials"], input[type="color"], select[name="department"], select[name="language"], select[name="locationId"], select[name="countType"], select[name="destination"], input[name="quantity"])) { grid-column: span 1; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.event-field, .auth-field) { display: grid; gap: 6px; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.event-field, .auth-field) > span:first-child { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > p:not(.field-error, .auth-error, .client-error) { color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > :is(.field-error, .auth-error, .client-error):not(:empty) { padding: 10px 14px; border-radius: var(--radius-control); background: var(--danger-soft); color: var(--destructive); font-size: 13px; font-weight: 600; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) h3 { margin: 8px 0 0; font-size: 15px; font-weight: 600; }
html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) input[type="color"] { width: 72px; height: 44px; padding: 4px; border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--card); }
html.atelier :is(.stock-order-line, #atelier-boost) { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) 96px 96px auto; gap: 12px; align-items: end; padding: 0 0 16px; border-bottom: 1px solid var(--border); }
html.atelier :is(.stock-order-line > .event-field:nth-child(1), .stock-order-line > .event-field:nth-child(2), #atelier-boost) { grid-column: span 5; }
html.atelier .stock-order-line > .text-button { min-height: 44px; }
html.atelier .client-form-grid { gap: 16px; }
html.atelier .client-form-grid > label:not(:has(input[type="checkbox"])) { display: grid; gap: 6px; }
html.atelier .client-form-grid > label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
html.atelier .client-form-grid > label:has(input[name="name"]) { grid-column: 1 / -1; }
html.atelier .client-form-grid > label:has(:is(input[name="street_address"], input[name="maps_url"])) { grid-column: span 2; }
@media (max-width: 500px) {
  html.atelier .client-form-grid > label:has(:is(input[name="street_address"], input[name="maps_url"])) { grid-column: 1 / -1; }
}

html.atelier .client-editor fieldset p { margin: 0 0 12px; color: var(--muted-foreground); font-size: 13px; }
/* Opening count: material fields in one column, unit and quantity side by side. */
html.atelier .stock-editor .invoice-dialog-body > div:not([class]):has(> .event-field) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
html.atelier .stock-editor .invoice-dialog-body > div:not([class]) > .event-field { grid-column: 1 / -1; }
html.atelier .stock-editor .invoice-dialog-body > div:not([class]) > .event-field:is(:nth-child(5), :nth-child(6)) { grid-column: span 1; }
html.atelier .account-dialog-body > button { justify-self: start; }
html.atelier :is(.invoice-dialog-body, .invoice-dialog-body > div:not([class])) > button { justify-self: start; }
html.atelier .account-dialog-body > .auth-field:has(select[name="language"]) + button { grid-column: span 1; align-self: end; }
html.atelier .stock-popup .stock-head, html.atelier :is(.stock-popup .stock-section .stock-row, #atelier-boost):not(#atelier-none) { grid-template-columns: minmax(0, 1fr) 120px 250px; }
html.atelier .stock-popup .stock-section { margin-top: 16px; }
html.atelier .stock-popup-body > input[type="search"] { width: min(320px, 100%); border-radius: var(--radius-pill); }
html.atelier .access-list small { color: var(--muted-foreground); }
html.atelier .account-dialog header { background:var(--card); border-bottom:1px solid var(--border); }
html.atelier .account-dialog .dialog-actions > [type=submit] { min-width: 100px; }
html.atelier .session-warning { flex-wrap:wrap; }

@media (max-width: 640px) {
  html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) { grid-template-columns: minmax(0, 1fr); }
  html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) :is(.invoice-dialog-body, .client-form-body, .account-dialog-body) > * { grid-column: 1 / -1 !important; }
  html.atelier :is(.stock-order-line, #atelier-boost) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.atelier :is(.stock-order-line > .event-field:nth-child(1), .stock-order-line > .event-field:nth-child(2), .stock-order-line > .event-field:nth-child(3), .stock-order-line > .event-field:nth-child(4), #atelier-boost) { grid-column: 1 / -1; }
  html.atelier :is(.stock-editor, dialog.invoice-editor, .client-editor, .account-dialog) > form > .dialog-actions > :is(.primary-button, button[type="submit"]):not(#atelier-none) { min-height: 48px; }
}

/* ---------- Cards and surfaces ---------- */
html.atelier :is(.calendar-panel, .property-card, .history-panel, .search-results, .agenda-panel .agenda-card, .client-details, .client-import-summary, .purchase-card, .quotation-archive, .job-billing-panel, .advance-totals, .invoice-balance-panel, .invoice-visits, .invoice-dialog-body > details > form, .invoice-history-entry, .stock-worker-card, .protocol-placeholder, .subcontract-visits-section, .property-summary, #atelier-boost) {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: none;
}
html.atelier .property-card:hover { border-color: var(--text-secondary); filter: none; }
html.atelier :is(.job-billing-panel, #atelier-boost) { padding: 18px 20px; }
html.atelier :is(.advance-totals, .invoice-balance-panel) { background: var(--muted); }
/* Request type colours keep their meaning (urgent, next visit, stock) as soft tones with a 1px edge. */
html.atelier :is(.purchase-card.urgent-request, [data-order-category="urgent"]) { --order-border: #e9bcc7; --order-fill: var(--urgent-soft); }
html.atelier :is(.purchase-card.next-request, [data-order-category="next"]) { --order-border: #c5d3e6; --order-fill: var(--info-soft); }
html.atelier .purchase-card.stock-order-card { --order-border: #bfd9c9; --order-fill: var(--success-soft); }
html.atelier :is(.event-editor .material-line:is([data-order-category="urgent"], [data-order-category="next"]), .purchase-line-list > li[data-order-category], .material-line[data-order-category], #atelier-boost) {
  border: 1px solid var(--order-border, var(--border)); border-radius: var(--radius-item); background: var(--order-fill, var(--card)); box-shadow: none;
}
html.atelier :is(.paid-proforma-row, #atelier-boost) { border-left: 0; box-shadow: inset 4px 0 0 var(--success); background: #f6faf7; }
html.atelier :is(.overview-entry, .material-queue-entry, .invoice-queue-row, .search-result, .material-line, .section-file, .installation-item, .stock-usage-entry, #atelier-boost):not(.calendar-panel *, .pending-house *) {
  border-radius: var(--radius-item);
}
html.atelier :is(.overview-entry, .material-line, #atelier-boost) { background: var(--card); border: 1px solid var(--border); }
html.atelier .overview-entry:hover { border-color: var(--input); filter: none; }
html.atelier .overview-list { gap: 10px; }
html.atelier :is(.history-entry, .purchase-line-list li, .activity-facts, .dialog-footer, .decline-action, .request-item-row, .map-filter-row) { border-color: var(--border); }
html.atelier .history-entry:first-child { border-top: 0; }
html.atelier :is(.history-entry, .history-row, #atelier-boost) { border-radius: 0; }
html.atelier .section-heading { border-bottom: 1px solid var(--border); }
html.atelier .property-card > span:last-child { border-top-color: var(--border); }
html.atelier .attachment-dropzone { border: 1px dashed var(--input); border-radius: var(--radius-item); background: var(--muted); }
html.atelier .attachment-dropzone.drag-over { border-color: var(--primary); background: var(--info-soft); }
html.atelier :is(.upload-symbol, .maintenance-heading) { color: var(--text-secondary); }
html.atelier .file-remove-control { border-radius: var(--radius-pill); border-color: var(--input); }
html.atelier :is(.preview-image, .section-file-preview) { border-radius: 14px; }
html.atelier .workflow-status { border-radius: 14px; }
html.atelier :is(.event-editor [data-manage-material], #atelier-boost) { width: fit-content; margin-left: -12px; }
html.atelier :is(.material-return-warning, .materials-waiting, #atelier-boost) { border: 0; border-radius: var(--radius-control); padding: 8px 12px; background: var(--warning-soft); color: var(--warning); font-size: 13px; font-weight: 600; }
html.atelier .workflow-marker { border-color: var(--input); }
html.atelier .active-workflow-stage .workflow-marker { background: var(--gold); border-color: var(--gold-ink); }
html.atelier .highlighted-activity { background: var(--info-soft); }
html.atelier .client-location-note { border-left: 0; border-radius: 0; padding: 0; background: transparent; color: var(--muted-foreground); font-size: 13px; }

/* Billing and Materials share a segmented queue control. */
html.atelier :is(.invoice-queue-row, .material-flow-detail) button { white-space: normal; }
html.atelier :is(.material-queue-tabs, .material-flow-segments, #atelier-boost) {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; max-width: 100%;
  border: 0; border-radius: var(--radius-item); background: var(--secondary);
}
html.atelier :is(.material-queue-tabs button, .material-flow-segments button, #atelier-boost) {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; max-width: 100%; padding: 6px 12px; border: 0; border-radius: var(--radius-control);
  white-space: normal; text-align: start; line-height: 1.25;
  background: transparent; color: var(--text-secondary); font-weight: 600; font-size: 13px;
}
html.atelier :is(.material-queue-tabs, .material-flow-segments) button:hover { color: var(--primary); filter: none; }
html.atelier :is(.material-queue-tabs button[aria-pressed="true"], .material-flow-segments button[aria-pressed="true"], #atelier-boost) {
  background: var(--card); color: var(--primary);
}
html.atelier :is(.material-queue-tabs button span, .material-flow-segments button span, #atelier-boost) {
  flex-shrink: 0; border: 0; background: transparent; color: var(--muted-foreground);
  padding: 0; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---------- Status badges as soft tone pills ---------- */
html.atelier :is(.status, .billing-badge, .purchase-category, .history-overview-status, .outcome-badge, .event-kind, .overview-entry .order-category, .document-type, .property-filter-badge, .history-operator-badge, .holiday-label, .material-readiness, #atelier-boost) {
  border-radius: var(--radius-pill); border: 0; padding: 3px 10px; font-weight: 600; letter-spacing: 0;
}
html.atelier :is(.billing-badge, .history-overview-status, #atelier-boost) { background: var(--neutral-soft); color: var(--text-secondary); }
html.atelier :is(.purchase-category, .event-kind, #atelier-boost) { background: var(--info-soft); color: var(--primary); }
html.atelier :is(.status.planned, .event-kind.maintenance-kind, .overview-entry .order-category, .history-status-ongoing, .billing-badge.advance-pending, .holiday-label, #atelier-boost) { background: var(--warning-soft); color: var(--gold-ink); }
html.atelier :is(.status.completed, .history-status-done, .purchase-ready, .proforma-paid, .billing-badge.proforma-paid, #atelier-boost) { background: var(--success-soft); color: var(--success); border: 0; }
html.atelier :is(.status.unresolved, .billing-badge.overdue, #atelier-boost) { background: var(--danger-soft); color: var(--destructive); }
html.atelier :is(.purchase-category.is-urgent, #atelier-boost) { background: var(--urgent-soft); color: var(--urgent); border: 0; }
html.atelier :is(.status.needs-work, #atelier-boost) { background: var(--warning-soft); color: var(--gold-ink); }
html.atelier :is(.history-status-invoiced, #atelier-boost) { background: var(--info-soft); color: var(--primary); }
html.atelier :is(.history-status-canceled, #atelier-boost) { background: var(--neutral-soft); color: var(--muted-foreground); }
html.atelier :is(.document-type, #atelier-boost) { background: var(--muted); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border); }
html.atelier :is(.contract-badge, #atelier-boost) { border-radius: var(--radius-pill); padding: 4px 12px; }
html.atelier :is(.demo-badge) { border-radius: var(--radius-pill); }

/* ---------- Calendar (shared month and search views) ---------- */
html.atelier .calendar-toolbar, html.atelier .weekdays { background: var(--card); border-color: var(--border); }
html.atelier .calendar-legend { border-color: var(--border); }
html.atelier :is(.calendar-day, .range-day, #atelier-boost) { background: var(--card); border-color: var(--border); }
html.atelier :is(.calendar-day.weekend, .range-day.weekend, .weekend .range-day-header, #atelier-boost) { background: var(--muted); }
html.atelier :is(.calendar-day.weekend.outside-month, #atelier-boost) { background: var(--muted); }
html.atelier :is(.calendar-day.public-holiday, .range-day.public-holiday, .public-holiday .range-day-header, #atelier-boost) { background: var(--accent); }
html.atelier :is(.calendar-day.selected-day, .range-day.range-day-today, #atelier-boost) { box-shadow: inset 0 0 0 1.5px var(--primary); }
html.atelier :is(.range-day-header, #atelier-boost) { background: var(--card); border-color: var(--border); }
html.atelier :is(.range-day-today .range-day-header, #atelier-boost) { background: var(--muted); }
html.atelier :is(.day-number.is-today, .range-today-label, #atelier-boost) { background: var(--primary); color: var(--primary-foreground); border-radius: var(--radius-pill); }
html.atelier .outside-month .day-number { color: var(--muted-foreground); }
html.atelier :is(.weekdays span, #atelier-boost) { background: transparent; }
html.atelier .weekdays span, html.atelier .range-day-weekday { color: var(--muted-foreground); font-weight: 700; letter-spacing: .1em; }
/* Month toolbar mirrors the week island: title left, view switch and paging as quiet controls, one navy action. */
html.atelier .calendar-toolbar-title h1 { font-size: 28px; }
html.atelier :is(.calendar-controls .calendar-mode-button, .calendar-controls .today-button, .calendar-controls .icon-button, #atelier-boost) { border: 0; background: transparent; color: var(--text-secondary); min-height: 36px; padding: 0 14px; }
html.atelier :is(.calendar-controls .calendar-mode-button, .calendar-controls .today-button, .calendar-controls .icon-button):hover { background: var(--background); color: var(--primary); }
html.atelier :is(.calendar-controls .calendar-mode-button.is-active, #atelier-boost) { background: var(--secondary); color: var(--primary); }
html.atelier :is(.calendar-controls [data-action="new-event"], #atelier-boost) { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
html.atelier .calendar-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
html.atelier .calendar-search input { max-width: 320px; border-radius: var(--radius-pill); }
html.atelier :is(.calendar-event, .range-event, .agenda-card, .search-result, #atelier-boost) { border-radius: 10px; }
/* Month grid and search results inside the Atelier calendar: same card as the week, sized for a month cell. */
html.atelier :is(#field-workspace .range-event, #atelier-boost) { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--input); border-radius: 10px; background: var(--card); color: var(--primary); box-shadow: none; }
html.atelier :is(#field-workspace .range-event):hover { border-color: var(--primary); filter: none; }
html.atelier :is(:is(#field-workspace .range-event-time), #atelier-boost) { color: var(--text-secondary); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
html.atelier :is(:is(#field-workspace .range-event-property), #atelier-boost) { color: var(--primary); font-size: 13px; font-weight: 600; line-height: 1.3; }
html.atelier :is(:is(#field-workspace .range-event-job), #atelier-boost) { color: var(--text-secondary); font-size: 12px; line-height: 1.3; }
html.atelier :is(:is(#field-workspace .range-event) .operator-band, #atelier-boost) { position: static; order: 9; display: flex; gap: 3px; width: auto; height: auto; min-height: 0; margin: 4px 0 0; border-radius: 0; overflow: visible; }
html.atelier :is(:is(#field-workspace .range-event) .operator-segment, #atelier-boost) { display: grid; place-items: center; flex: 0 0 20px; width: 20px; min-width: 20px; height: 20px; min-height: 20px; border: 0; border-radius: 999px; background: var(--operator-accent, #5f6f80); color: #fff; font-size: 9px; font-weight: 700; line-height: 1; }
html.atelier :is(:is(#field-workspace .range-event) .materials-waiting, #atelier-boost) { align-self: flex-start; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--urgent-soft); color: var(--urgent); }
/* A completed subcontract visit can carry its billing reminder in the status. */
html.atelier .atelier-calendar-host [data-activity] .bg-success-soft { white-space: normal; line-height: 1.3; }
html.atelier .atelier-calendar-host [data-activity] .bg-success-soft > span { flex-shrink: 0; }
html.atelier .atelier-calendar-host #calendar-search:focus-visible { outline: none; }
html.atelier .atelier-calendar-host label:has(#calendar-search:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
html.atelier .calendar-day-options, html.atelier .calendar-date-popover, html.atelier .property-filter-panel {
  border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-pop);
}
html.atelier .calendar-day-options { padding: 8px; gap: 4px; }
html.atelier .search-result:hover { background: var(--muted); filter: none; }

/* ---------- Materials, stock, invoices ---------- */
html.atelier :is(.stock-row, #atelier-boost) { border-color: var(--border); }
html.atelier .stock-worker-card:hover { border-color: var(--text-secondary); filter: none; }
html.atelier :is(.stock-popup, .stock-editor, #atelier-boost) { border-radius: var(--radius-panel); }
/* Rows of one list share one card and are divided by hairlines. */
html.atelier :is(:is(main, .stock-popup) .stock-section, .pending-house .overview-list, #atelier-boost) { gap: 0; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); overflow: hidden; }
html.atelier :is(:is(main, .stock-popup) .stock-section > :is(h2, h3), #atelier-boost) { margin: 0; padding: 14px 20px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
html.atelier :is(.stock-row, .pending-house .overview-entry, #atelier-boost):not(#atelier-none) { border-radius: 0; }
html.atelier :is(:is(main, .stock-popup) .stock-section .stock-row, .pending-house .overview-entry, #atelier-boost):not(#atelier-none) { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; padding: 12px 20px; }
html.atelier :is(:is(main, .stock-popup) .stock-section > .stock-row:first-child, :is(main, .stock-popup) .stock-section > :is(h2, h3) + .stock-row, .pending-house .overview-entry:first-child, #atelier-boost) { border-top: 0; }
html.atelier .stock-row strong { font-size: 15px; font-weight: 600; }
html.atelier .stock-row small, html.atelier .stock-quantity small { color: var(--muted-foreground); font-weight: 500; }
html.atelier .stock-worker-card { border-radius: var(--radius-pill); padding: 0 16px; min-height: 40px; }
html.atelier .stock-worker-card strong { font-size: 14px; font-weight: 600; }
html.atelier .invoice-selection-bar .primary-button:disabled { background: var(--secondary); color: var(--muted-foreground); }
html.atelier .pending-house > summary { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
html.atelier .pending-task-type { color: var(--muted-foreground); font-size: 12px; }
html.atelier .invoice-total { font-weight: 700; color: var(--primary); }
html.atelier .invoice-preview-note, html.atelier .invoice-editor .event-field small, html.atelier .invoice-visit small { color: var(--text-secondary); }
html.atelier :is(.event-editor .event-material-area, #atelier-boost) { border-color: var(--border); }
html.atelier :is(.event-editor .event-material-area + .event-material-area, #atelier-boost) { border-top-width: 1px; }
html.atelier :is(.history-process-link, #atelier-boost) { border-color: var(--border); border-radius: 14px; }
html.atelier .history-process-link:hover { background: var(--muted); border-color: var(--text-secondary); }
html.atelier :is(.date-picker-period-trigger, #atelier-boost) { border-radius: var(--radius-pill); }

/* ---------- List pages: Stock, Pending Tasks, Property files, Invoices ----------
   A list is a table: a header that names the columns, rows that line up, one main action per row. */
html.atelier :is(.overview-empty, .empty-state, #atelier-boost):not(.material-flow-detail *, dialog *) { margin: 0; padding: 40px 24px; border: 1px dashed var(--input); border-radius: var(--radius-card); background: transparent; color: var(--muted-foreground); font-size: 14px; text-align: center; }

/* Stock */
html.atelier .stock-page-actions { margin: 0; }
html.atelier :is(.stock-page-actions [data-stock-action="new-order"], #atelier-boost) { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
html.atelier .stock-page-actions [data-stock-action="new-order"]:hover { background: #0d2944; }
html.atelier .stock-locations { display: grid; gap: 10px; margin: 0 0 32px; }
html.atelier .stock-locations .small-label { margin: 0; }
html.atelier .stock-worker-cards { margin: 0; gap: 8px; }
html.atelier .stock-inventory-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
html.atelier .stock-inventory-heading h2 { margin: 0; font-family: var(--font-serif); font-size: 24px; font-weight: 400; letter-spacing: -.01em; }
html.atelier .stock-inventory-heading input { width: min(320px, 100%); border-radius: var(--radius-control); }
html.atelier .tools-search { display:flex; flex-wrap:wrap; align-items:center; gap:8px; color:var(--text-secondary); font-size:13px; }
html.atelier .tools-search input { width:min(230px,100%); min-height:36px; border:1px solid var(--input); padding:6px 12px; background:var(--card); }
html.atelier :is(.stock-toolbar, .stock-row-actions) button { white-space: normal; }
html.atelier :is(main, .stock-popup) .stock-section { margin: 0 0 16px; }
html.atelier :is(:is(main, .stock-popup) .stock-section > h2, #atelier-boost) { padding: 16px 20px 12px; font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--primary); }
html.atelier .stock-head, html.atelier :is(:is(main, .stock-popup) .stock-section .stock-row, #atelier-boost):not(#atelier-none) { display: grid; grid-template-columns: minmax(0, 1fr) 120px 430px; align-items: center; gap: 16px; padding: 12px 20px; }
html.atelier .stock-head { padding-block: 8px; border-top: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
html.atelier :is(:is(main, .stock-popup) .stock-section .stock-head + .stock-row, #atelier-boost):not(#atelier-none) { border-top: 1px solid var(--border); }
html.atelier :is(main, .stock-popup) .stock-section .stock-row:hover { background: var(--muted); }
html.atelier .stock-quantity { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
html.atelier .stock-quantity small { display: inline; margin: 0 0 0 2px; font-size: 13px; }
html.atelier .stock-row-actions { justify-content: flex-end; gap: 2px; flex-wrap: nowrap; }
html.atelier :is(.stock-row-actions [data-stock-action="transfer"], #atelier-boost) { margin-right: 6px; border: 1px solid var(--input); background: var(--card); }
html.atelier main > .stock-toolbar { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; }
html.atelier .stock-section > .overview-empty { margin: 0 20px 20px; padding: 24px; }

/* Pending Tasks */
html.atelier .pending-house { margin: 0 0 20px; }
html.atelier .pending-house > summary { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
html.atelier :is(.pending-task-entry, #atelier-boost):not(#atelier-none) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 20px; }
html.atelier .pending-task-entry:hover { background: var(--muted); }
html.atelier :is(.pending-task-open, #atelier-boost) { display: grid; gap: 4px; }
html.atelier .pending-task-type { width: auto; min-width: 0; color: var(--muted-foreground); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
html.atelier .pending-task-open .overview-detail { display: grid; gap: 2px; }
html.atelier .pending-task-open .overview-detail > strong { font-size: 15px; font-weight: 600; }
html.atelier .pending-task-open .overview-detail > span, html.atelier .pending-task-open .overview-detail > small { color: var(--text-secondary); font-size: 13px; }
html.atelier .pending-task-actions { align-items: center; gap: 4px; }
html.atelier :is(.pending-task-actions select, #atelier-boost) { min-height: 36px; height: 36px; width: auto; padding-inline: 12px 34px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; }
html.atelier .pending-page-heading { justify-content: space-between; gap: 12px; }
html.atelier .pending-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-block: 0 16px; }
html.atelier .pending-filters [aria-pressed="true"] { background: var(--secondary); color: var(--foreground); }
html.atelier .pending-task-actions button { white-space: normal; }
html.atelier .pending-task-open:focus-visible { outline-color: var(--ring); }
html.atelier .pending-task-entry[data-priority="urgent"] select { background-color: var(--urgent-soft); color: var(--urgent); }
html.atelier .pending-task-entry[data-priority="normal"] select { background-color: var(--warning-soft); color: var(--warning); }
html.atelier .pending-task-entry[data-priority="low"] select { background-color: var(--neutral-soft); color: var(--text-secondary); }

/* Property files */
html.atelier .property-overview-controls { gap: 8px; }
html.atelier .property-filter-summary { margin: -8px 0 16px; color: var(--muted-foreground); font-size: 13px; }
html.atelier .property-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
html.atelier :is(.property-card, #atelier-boost):not(#atelier-none) { display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "icon name" "icon address" "meta meta"; align-content: start; align-items: start; column-gap: 12px; row-gap: 5px; padding: 16px; border-radius: var(--radius-card); text-align: left; }
html.atelier .property-card > .property-symbol { grid-area: icon; }
html.atelier .property-symbol { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-control); background: var(--muted); color: var(--primary); }
html.atelier :is(.property-card h2, #atelier-boost):not(#atelier-none) { grid-area: name; margin: 0; font-family: var(--font-sans); font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.3; }
html.atelier .property-card p { grid-area: address; margin: 0; font-size: 13px; }
html.atelier .property-card p:empty { display: none; }
html.atelier :is(.property-card > .property-card-meta, #atelier-boost) {
  grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start;
  gap: 4px 8px; border: 0; border-top: 1px solid var(--border); margin: 7px 0 0; padding: 8px 0 0; color: var(--muted-foreground); font-size: 13px;
}
html.atelier .property-card > .property-card-meta:empty { display: none; }
html.atelier .property-card :is(h2, p, .property-card-meta > span) { min-width: 0; overflow-wrap: anywhere; }
html.atelier :is(.client-actions .secondary-button, #atelier-boost) { border: 0; background: transparent; }
@media (max-width: 480px) {
  html.atelier .history-entry-simple .history-main { flex-direction: column; gap: 6px; }
  html.atelier .history-entry-simple .history-date { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
}


/* Invoices */
html.atelier .invoice-selection-bar { margin: 16px 0 8px; gap: 12px; color: var(--text-secondary); font-size: 13px; }
html.atelier main:has(.overview-list > :is(.empty-state, .overview-empty)) .invoice-selection-bar { display: none; }
html.atelier .invoice-preview-note { margin: 0 0 16px; font-size: 13px; }
html.atelier main > .material-queue-tabs { margin-bottom: 8px; }
html.atelier :is(.invoice-queue-row, #atelier-boost) { padding: 14px 20px; }
html.atelier .invoice-queue-row:hover { background: var(--muted); }

@media (max-width: 900px) {
  html.atelier .stock-head { display: none; }
  html.atelier :is(:is(main, .stock-popup) .stock-section .stock-row, #atelier-boost):not(#atelier-none) { grid-template-columns: minmax(0, 1fr) auto; }
  html.atelier .stock-row-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; margin-left: -12px; }
  html.atelier .stock-inventory-heading { flex-wrap: wrap; }
  html.atelier :is(.pending-task-entry, #atelier-boost):not(#atelier-none) { grid-template-columns: minmax(0, 1fr); }
  html.atelier .pending-task-actions { margin-left: -4px; flex-wrap: wrap; }
}

/* ---------- Map chrome ---------- */
html.atelier :is(.map-zoom-controls > button, .map-zoom-pair, .map-notice, .map-status, .map-filter-trigger, .map-missing, .map-surface .map-filter-badge, #atelier-boost) {
  border: 1px solid var(--border); background: rgba(255, 255, 255, .97); color: var(--primary); box-shadow: var(--shadow-raised);
}
html.atelier :is(.map-zoom-pair, .map-filter-trigger, .map-surface .map-filter-badge, .map-zoom-controls > button, #atelier-boost) { border-radius: var(--radius-pill); }
html.atelier :is(.map-notice, .map-status, .map-missing, #atelier-boost) { border-radius: var(--radius-item); }
html.atelier .map-filter-trigger { min-height: 44px; padding: 0 18px; }
html.atelier .map-zoom-pair button + button { border-top-color: var(--border); }
html.atelier .map-filter-panel { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-pop); overflow: hidden auto; }
html.atelier :is(.map-filter-row, .map-filter-panel header, .map-filter-panel footer, .map-missing [data-map-missing-list] > div) { border-color: var(--border); }
html.atelier .map-filter-option, html.atelier .map-contract-option { border-radius: 12px; }
html.atelier .map-filter-option[aria-pressed=true] { background: var(--background); color: var(--primary); font-weight: 600; }
html.atelier :is(.map-filter-panel button:hover, .map-contract-option:hover) { background: var(--muted); }
html.atelier .map-filter-panel footer button { border-radius: var(--radius-pill); border-color: var(--control-border); }
html.atelier .map-pin-dot { background: var(--primary); }
html.atelier .map-pin-cluster > span { background: var(--primary); }
html.atelier .leaflet-popup-content-wrapper { border-radius: var(--radius-item); box-shadow: var(--shadow-pop); }

/* ---------- Field workspace (phones) ---------- */
html.atelier #field-workspace { background: var(--background); color: var(--primary); }
html.atelier :is(.field-work-heading [aria-pressed="true"], #atelier-boost) { background: var(--secondary); border-color: transparent; }

@media (max-width: 760px) {
  html.atelier :is(.event-editor .event-header, .event-editor .event-content, #atelier-boost) { padding-inline: 16px; }
  html.atelier .event-editor.has-flow .event-actionbar { padding: 8px 4px 0; }
  html.atelier .page-heading h1 { font-size: 32px; }
}
@media (max-width: 600px) {
  html.atelier dialog:not(body .atelier *) { border-radius: var(--radius-card); }
  html.atelier :is(dialog.event-editor, dialog.invoice-editor, .client-editor, .account-dialog, .stock-popup, .stock-editor, #atelier-boost) { border-radius: var(--radius-card); }
  html.atelier .auth-dialog { padding: 22px; border-radius: var(--radius-card); }
}
@media (prefers-reduced-motion: reduce) {
  html.atelier *:not(body .atelier *) { transition: none !important; }
}

html.atelier .event-editor [name="reportWorkerId"] { width: 100%; min-width: 0; }

html.atelier #field-workspace {
  font-family:var(--font-sans);
  padding:24px;
}
html.atelier #field-workspace .page-heading { margin-bottom:16px; }
html.atelier .stock-worker-cards {
  display:flex;
  flex-wrap:nowrap;
  overflow-x:auto;
  border-bottom:1px solid var(--border);
  gap:0;
  margin-bottom:20px;
}
html.atelier .stock-worker-cards .stock-worker-card {
  flex:0 0 auto;
  border:0;
  border-bottom:2px solid transparent;
  border-radius:0;
  background:transparent;
  color:var(--text-secondary);
  min-height:44px;
  padding:0 16px;
  box-shadow:none;
}
html.atelier .stock-worker-cards .stock-worker-card:hover {
  border-bottom-color:var(--primary);
  background:var(--muted);
}
html.atelier .stock-inventory-tabs {
  display:flex;
  flex-wrap:wrap;
  border-bottom:1px solid var(--border);
  gap:4px;
  margin-bottom:16px;
}
html.atelier .stock-inventory-tabs button {
  border:0;
  border-bottom:2px solid transparent;
  border-radius:0;
  background:transparent;
  color:var(--text-secondary);
  padding:0 16px;
  min-height:44px;
}
html.atelier .stock-inventory-tabs button[aria-pressed=true] {
  background:transparent;
  border-bottom-color:var(--primary);
  color:var(--primary);
}
html.atelier .event-editor .visit-step-footer button {
  min-height:48px;
}
html.atelier .event-editor .event-actionbar {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:8px 12px;
}
html.atelier .event-editor .event-toolbar-actions {
  flex:1 1 auto;
  width:auto;
  margin-left:auto;
  gap:6px;
}
html.atelier .event-editor .event-actionbar button,
html.atelier .event-editor .event-actionbar select {
  min-height:38px;
  padding:6px 10px;
  font-size:12px;
}
html.atelier .event-editor .event-toolbar-actions button { flex:0 1 auto; }
html.atelier .event-editor .outcome-options > .save-blocker { flex-basis:100%; }
@media(max-width:640px){
  html.atelier #field-workspace { padding:12px; }
}

html.atelier .event-editor .event-visit-controls { gap:6px; }
html.atelier .event-editor:has(.field-visit-header) .event-actionbar :is(select[name=kind],button) {
  min-height: 48px;
}

html.atelier .event-editor .visit-step-footer button:is([data-flow-back],[data-flow-go]) {
  font-size:24px !important;
  font-weight:800;
  line-height:1;
  min-width:56px;
}

html.atelier .stock-worker-cards .stock-worker-card,
html.atelier .stock-inventory-tabs button {
  border-radius:0 !important;
  border:0 !important;
  border-bottom:2px solid transparent !important;
  background:transparent !important;
  box-shadow:none !important;
  color:var(--text-secondary);
}
html.atelier .stock-inventory-tabs button[aria-pressed=true],
html.atelier .stock-worker-cards .stock-worker-card:hover {
  border-bottom-color:var(--primary) !important;
  color:var(--primary);
}
html.atelier .event-editor .outcome-options {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  min-width:0;
}
html.atelier .event-editor .outcome-options > legend {
  width:100%;
  margin-bottom:8px;
}
html.atelier .event-editor .outcome-options > [data-visit-save-error] {
  grid-column:1 / -1;
  margin:0;
  padding:0 0 8px;
  border:0;
  min-height:0;
}
html.atelier .event-editor .outcome-options .outcome-option {
  min-width:0;
  width:auto;
  padding:8px 12px;
  overflow:visible;
}
html.atelier #field-workspace .stock-section > p { padding:20px; margin:0; }
html.atelier #field-workspace .field-work-content {
  height:calc(100dvh - var(--ribbon-height) - 48px);
}

html.atelier #field-workspace .client-details {
  padding:24px;
  max-width:900px;
}
html.atelier #field-workspace .property-cards > button {
  justify-content:flex-start;
  min-height:56px;
  border-radius:var(--radius-card);
  background:var(--card);
  padding:16px 20px;
}
html.atelier #field-workspace :is(.map-canvas,.map-zoom-controls,.map-notice,.map-status) {
  font-family:var(--font-sans);
}

html.atelier #field-workspace.field-map-workspace { padding:0; }
html.atelier #field-workspace.field-map-workspace .field-work-content {
  height:calc(100dvh - var(--ribbon-height));
  overflow:hidden;
}
.field-map-workspace [data-field-map] { height:100%; min-height:0; }
#field-workspace [data-field-calendar] :is([data-action="new-event"],[data-action="toggle-task-tray"]) { display:none; }
/* Native modal dialogs make the background inert. Also stop scroll chaining. */
html:has(dialog:modal), body:has(dialog:modal) { overflow:hidden; overscroll-behavior:none; }
html:has(dialog:modal) :is(.field-work-content,.app-shell):not(:has(dialog:modal)) { overflow:hidden; }
dialog:modal { overscroll-behavior:contain; }
dialog:modal::backdrop { touch-action:none; }

html.atelier :is(.attachment-list,.item-photo-list,.equipment-photos):has(:is(.attachment-media,.preview-image-link,.preview-video)) {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(min(100%,165px),1fr));
  align-items:start;
  gap:12px;
}
html.atelier .attachment-list > :not(.attachment-media) { grid-column:1 / -1; }
html.atelier .attachment-list > .attachment-media { display:block; padding:0; border:0; min-width:0; }
html.atelier :is(.attachment-media .section-file-preview,.item-photo:has(:is(.preview-image-link,.preview-video))) {
  position:relative; display:block; width:100%; min-width:0; margin:0;
}
html.atelier :is(.attachment-media,.item-photo,.equipment-photos) :is(.preview-image,.preview-video) {
  display:block; width:100%; max-width:none; height:auto; max-height:none;
  aspect-ratio:4 / 3; object-fit:contain; background:var(--muted);
}
html.atelier body :is(.attachment-media,.item-photo) .file-remove-control {
  position:absolute; inset:6px 6px auto auto; z-index:1;
  width:44px; height:44px; padding:8px; border:0; border-radius:var(--radius-pill);
  color:var(--destructive); background:var(--card);
}
html.atelier :is(.attachment-media,.item-photo) .file-remove-control circle { fill:var(--destructive); }
html.atelier :is(.attachment-media,.item-photo) .file-remove-control path { stroke:var(--card); }

html.atelier .event-editor .event-schedule {
 display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px;
}
html.atelier .event-editor .event-schedule > .event-field { flex:0 1 180px; }
html.atelier .event-editor .event-schedule .appointment-times { flex:0 0 auto; max-width:100%; min-width:0; }
html.atelier .event-editor .visit-step-footer button:is([data-flow-back],[data-flow-go]) {
 border:0 !important; background:transparent !important; box-shadow:none !important;
 font-size:32px !important; font-weight:800; min-width:48px;
}
html.atelier .event-form .save-validation-message[title],
html.atelier .event-form [data-visit-save-error][title] {
 color:var(--destructive);
}
html.atelier .event-form :is(.save-validation-message[title],.event-error-accessible) {
 position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
 clip-path:inset(50%); white-space:nowrap; border:0;
}
html.atelier .event-form :is([aria-invalid="true"],[data-save-blocked]) {
 border-color:var(--destructive);
 box-shadow:inset 0 0 0 2px var(--destructive);
}
html.atelier .event-form .outcome-option:has(input[aria-invalid="true"]) {
 outline:3px solid var(--operator-red);
 outline-offset:-3px;
}
html.atelier .event-editor .outcome-option input[aria-invalid="true"] { box-shadow:none !important; }
html.atelier .event-editor .event-form :is(textarea,input[type=number])[aria-invalid="true"] {
 outline:3px solid var(--operator-red) !important;
 outline-offset:-3px !important;
 box-shadow:none !important;
}
html.atelier .event-form .save-validation-message[hidden],
html.atelier .event-form [data-visit-save-error][hidden] { display:none; }
html.atelier .property-note-heading { justify-content:space-between; }
html.atelier .property-note-controls { display:flex; gap:8px; flex-wrap:wrap; }
html.atelier [data-property-note-selection],
html.atelier [data-office-note-preview] { color:var(--text-secondary); font-size:14px; line-height:1.6; }

html.atelier .event-editor .event-schedule .event-keys-needed { flex:0 0 auto; }

.calendar-material-pending { color:var(--destructive); }
.calendar-material-received { color:var(--success); }
.workspace .property-equipment-panel,
.workspace .history-panel[data-property-notes],
.workspace .history-panel[aria-labelledby="history-title"] { margin-block:16px; }
.property-section-empty { padding:16px 24px; margin:0; color:var(--text-secondary); }

html.atelier .tool-history-link { white-space: normal; text-align: left; overflow-wrap: anywhere; }
html.atelier .tool-history { margin: 0; padding: 0; list-style: none; }
html.atelier .tool-history > li + li { border-top: 1px solid var(--border); }
html.atelier .tool-editor label { display: grid; gap: 4px; margin-block: 8px; }
html.atelier [data-tools-workspace] .stock-toolbar { margin-block: 12px; }
html.atelier [data-tools-workspace] .stock-row-actions { flex-wrap: wrap; }
html.atelier [data-tools-workspace] .stock-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
html.atelier [data-retired-tools] > summary { padding: 12px 20px; cursor: pointer; }
html.atelier .tool-status {
  justify-self: start;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  background: var(--muted);
  color: var(--text-secondary);
}
html.atelier .tool-status[data-status="available"] { background: var(--success-soft); color: var(--success); }
html.atelier .tool-status[data-status="missing"] { background: var(--urgent-soft); color: var(--foreground); }

/* Procurement forms share the invoice dialog shell. */
html.atelier .invoice-dialog-body > .document-attachment-editor {
  display: grid;
  gap: 12px;
  padding-block-start: 12px;
  border-top: 1px solid var(--border);
}
html.atelier .document-attachment-editor .event-field > label {
  display: grid;
  gap: 6px;
  min-width: 0;
}
html.atelier .document-attachment-editor .selected-file {
  overflow-wrap: anywhere;
}

html.atelier .subcontract-readonly .event-actionbar h2 {
  margin: 0;
  font: 400 24px/1.2 var(--font-serif);
}
html.atelier .subcontract-readonly .event-actionbar button,
html.atelier .collaborator-visit-actions button { min-height: 48px; }
html.atelier .collaborator-visit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block: 16px;
}
html.atelier .subcontract-readonly [data-collaborator-report]:not([hidden]) {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-block: 16px;
}
html.atelier .subcontract-readonly [data-collaborator-report] > button {
  justify-self: end;
}

html.atelier .task-copy-dialog .event-content { padding-block: 16px; }
html.atelier .task-copy-dialog textarea { width: 100%; }
html.atelier .task-copy-dialog [role="status"]:empty { display: none; }

html.atelier .invoice-file-history {
  display: grid;
  gap: 6px;
  padding-block: 8px;
  overflow-wrap: anywhere;
}
html.atelier .invoice-file-history a { text-decoration: underline; text-underline-offset: 3px; }
