/* Maintenance dialog system. Loaded by all three app shells; panel styles may
   arrive later, so scoped selectors intentionally outrank their compact defaults. */
body { --dialog-accent:#c9002d; --dialog-accent-hover:#ad0027; --dialog-green:#4e7468; --dialog-pad:18px; }
body .modal-wrap, body .kb-help-overlay, body .ff-tour-welcome, body .ff-setup-wrap {
  padding:16px; background:rgba(24,36,47,.32); backdrop-filter:none;
}
body .modal-wrap .ff-dialog, body dialog.cd-dialog, body .kb-help-panel,
body .ff-tour-welcome-card, body .ff-setup-card {
  box-sizing:border-box; border:1px solid var(--stroke); border-radius:6px !important;
  background:var(--panel); color:var(--text); box-shadow:0 12px 36px rgba(12,25,35,.18);
  max-width:calc(100vw - 48px) !important; max-height:calc(100dvh - 48px) !important;
  overflow:hidden; font-size:13px; line-height:1.5;
}
body .modal-wrap .ff-dialog { display:flex; flex-direction:column; }
body .ff-dialog .ff-dialog-header {
  position:relative; flex-shrink:0; display:flex; align-items:center; gap:12px;
  margin:0 var(--dialog-pad); padding:14px 0 !important;
  border-bottom:1px solid var(--stroke); background:var(--panel); color:var(--text-strong);
  font-size:16px; font-weight:700;
}
body .ff-dialog .modal-title { font-size:16px; font-weight:650; line-height:1.25; letter-spacing:-.025em; }
body .ff-dialog .modal-sub { margin-top:4px; font-size:13px; font-weight:400; color:var(--muted); line-height:1.5; }
body .ff-dialog .ff-dialog-header > :is(button,.btn) { margin-left:auto; flex-shrink:0; }
body .ff-dialog .ff-dialog-body {
  min-height:0; padding:16px var(--dialog-pad) !important; overflow:auto;
  max-height:none !important; overscroll-behavior:contain; scrollbar-gutter:stable;
}
body .ff-dialog :is(.ff-dialog-footer,.boat-detail-actions) {
  flex-shrink:0; display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end;
  gap:12px; padding:10px var(--dialog-pad) !important; border-top:1px solid var(--stroke);
  background:var(--surface-2); border-radius:0;
}
body :is(.ff-dialog,.cd-dialog) .btn {
  min-height:34px; padding:6px 12px; border-radius:5px; font:inherit;
  font-size:13px; font-weight:650; gap:6px; box-shadow:none;
}
body :is(.ff-dialog,.cd-dialog) .btn-primary { color:#fff; background:var(--dialog-accent); border:1px solid var(--dialog-accent); }
body :is(.ff-dialog,.cd-dialog) .btn-primary:hover:not(:disabled) { background:var(--dialog-accent-hover); border-color:var(--dialog-accent-hover); }
body :is(.ff-dialog,.cd-dialog) .btn-ghost { background:var(--panel); border:1px solid var(--stroke); color:var(--text); }
body :is(.ff-dialog,.cd-dialog) .btn-ghost:hover:not(:disabled) { background:var(--surface-2); border-color:var(--stroke-strong); }
body :is(.ff-dialog,.cd-dialog) :is(button,input,select,textarea):focus-visible { outline:2px solid color-mix(in srgb, var(--dialog-green) 55%, transparent); outline-offset:2px; }
body :is(.ff-dialog,.cd-dialog) :is(button,input,select,textarea):disabled { opacity:.5; cursor:not-allowed; }
body :is(.ff-dialog,.cd-dialog) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=color]):not([type=range]),select,textarea) {
  box-sizing:border-box; min-height:34px; max-width:100%; border:1px solid var(--stroke);
  border-radius:4px; background:var(--panel); color:var(--text); padding:6px 9px;
  font-family:inherit; font-size:13px; line-height:1.45;
}
body :is(.ff-dialog,.cd-dialog) textarea { min-height:72px; resize:vertical; }
body :is(.ff-dialog,.cd-dialog) input::placeholder, body :is(.ff-dialog,.cd-dialog) textarea::placeholder { color:var(--muted-2,var(--muted)); opacity:1; }
body :is(.ff-dialog,.cd-dialog) input[type=file] { padding:14px; background:var(--surface-2); border-style:dashed; }
body :is(.ff-dialog,.cd-dialog) input::file-selector-button { padding:8px 12px; margin-right:12px; border:1px solid var(--stroke); border-radius:4px; background:var(--panel); color:var(--text); font:inherit; cursor:pointer; }
body .ff-dialog :is(.form-section,.preview-description) { background:var(--panel); padding:0; border:0; border-radius:0; box-shadow:none; }
body .ff-dialog :is(.form-section-title,.edit-label) { color:var(--text-strong); font-size:13px; font-weight:650; letter-spacing:0; text-transform:none; }
body .ff-dialog .form-section-title { margin-bottom:10px; }
body .ff-dialog .edit-label { margin-bottom:5px; }
body .ff-dialog .form-hint { font-size:13px; line-height:1.5; color:var(--muted); margin-top:4px; }
body .ff-dialog :is(.edit-grid,.preview-grid) { gap:16px; }
body .ff-dialog :is(.analysis-body h2,.analysis-body h3) { color:var(--text-strong); letter-spacing:-.02em; }
body .ff-dialog .analysis-body { font-size:13px; line-height:1.7; }
body .ff-dialog .analysis-body h3 { margin-top:24px; }
body .ff-dialog .chip { border-radius:4px; padding:3px 7px; }
body .ff-dialog .icon-btn { width:30px; height:30px; border-radius:4px; }
/* Preserve the distinct information architecture of detailed records. */
body .ff-dialog .job-preview-hero { display:block; }
body .ff-dialog .job-preview-title, body .ff-dialog .boat-detail-title { font-size:18px; letter-spacing:-.025em; color:var(--text-strong); }
body .ff-dialog .job-preview-hero-top { color:var(--muted); }
body .ff-dialog .job-preview-close { background:var(--surface-2); color:var(--muted); border-radius:4px; }
body .ff-dialog .job-preview-boat { color:var(--muted); }
body .ff-dialog .ff-dialog-detail { overflow:auto; min-height:0; }
body .ff-dialog .boat-detail-body { padding:var(--dialog-pad); gap:14px; }
body .ff-dialog .boat-detail-actions { margin:0 calc(-1 * var(--dialog-pad)) calc(-1 * var(--dialog-pad)); }
/* Native Club Drive dialogs use the same shell, with independently scrolling content. */
body dialog.cd-dialog { padding:0; width:min(680px,calc(100vw - 48px)); }
body dialog.cd-dialog::backdrop { background:rgba(24,36,47,.32); backdrop-filter:none; }
body .cd-dialog > form { padding:0; display:flex; flex-direction:column; max-height:calc(100dvh - 50px); gap:0; }
body .cd-dialog .cd-dialog-heading { margin:0 var(--dialog-pad); padding:14px 0; border-bottom:1px solid var(--stroke); font-size:16px; letter-spacing:-.025em; }
body .cd-dialog .cd-dialog-content { padding:16px var(--dialog-pad); overflow:auto; min-height:0; display:grid; gap:12px; }
body .cd-dialog .cd-dialog-content label { display:grid; gap:8px; font-size:13px; }
body .cd-dialog form > .cd-dialog-actions { padding:10px var(--dialog-pad); margin:0; background:var(--surface-2); border-top:1px solid var(--stroke); gap:12px; }
body .cd-dialog .cd-error:empty { display:none; }
body .cd-dialog .cd-error { margin:0; padding:0 var(--dialog-pad) 14px; }
/* Utility dialogs and onboarding keep their existing dismissal/tour behavior. */
body .kb-help-header, body .ff-setup-head { padding:16px; border-bottom:1px solid var(--stroke); background:var(--panel); }
body .kb-help-body { padding:16px; overflow:auto; }
body .kb-help-title, body .ff-setup-head h2 { font-size:16px; color:var(--text-strong); }
body .kb-help-sub, body .kb-help-desc { color:var(--muted); }
body .kb-help-key { background:var(--surface-2); border-color:var(--stroke); color:var(--text); border-radius:7px; }
body .ff-tour-welcome-banner { background:var(--surface-2) !important; color:var(--text-strong); padding:18px; }
body .ff-tour-welcome-banner i { color:var(--dialog-green); }
body .ff-tour-welcome-body { padding:16px; }
body .ff-tour-btn, body .ff-setup-open { min-height:34px; border-radius:5px; }
body .ff-tour-btn-next, body #ffSetupDone { background:var(--dialog-accent) !important; color:white; }
body .ff-setup-icon { background:var(--surface-2) !important; color:var(--dialog-green); border-radius:50%; }
body .ff-setup-foot { padding:18px 24px; background:var(--surface-2); border-top:1px solid var(--stroke); }
body .ff-tour-tooltip { background:var(--panel); color:var(--text); border:1px solid var(--stroke); border-radius:6px; box-shadow:0 16px 48px rgba(12,25,35,.2); }
@media(max-width:640px) {
 body { --dialog-pad:18px; }
 body .modal-wrap, body .kb-help-overlay, body .ff-tour-welcome, body .ff-setup-wrap { padding:10px; }
 body .modal-wrap .ff-dialog, body dialog.cd-dialog, body .kb-help-panel, body .ff-tour-welcome-card, body .ff-setup-card {
   width:calc(100vw - 20px) !important; max-width:calc(100vw - 20px) !important; max-height:calc(100dvh - 20px) !important; border-radius:6px !important;
 }
 body .ff-dialog .ff-dialog-header { padding:12px 0 !important; gap:12px; font-size:16px; }
 body .ff-dialog .ff-dialog-header:not(.job-preview-hero)::before { width:40px; height:40px; flex-basis:40px; font-size:18px; }
 body .ff-dialog .modal-title { font-size:16px; }
 body .ff-dialog .ff-dialog-body { padding:18px !important; }
 body .ff-dialog :is(.edit-grid,.preview-grid,.fleet-editor-grid) { grid-template-columns:minmax(0,1fr); }
 body .ff-dialog .form-section { padding:0; }
 body .ff-dialog :is(.ff-dialog-footer,.boat-detail-actions) { padding:14px 18px !important; gap:8px; }
 body :is(.ff-dialog,.cd-dialog) .btn { padding:10px 14px; }
 body :is(.ff-dialog,.cd-dialog) :is(input,select,textarea) { font-size:16px !important; }
 body .cd-dialog > form { max-height:calc(100dvh - 22px); }
 body .cd-dialog .cd-dialog-heading { font-size:16px; }
}
@media(prefers-reduced-motion:reduce) { body .modal-wrap .modal, body .ff-tour-tooltip { animation:none; transition:none; transform:none; opacity:1; } }
/* Let field groups shrink inside narrow grids instead of clipping their inputs. */
body :is(.ff-dialog,.cd-dialog) :is(.form-section,.form-section > div,.edit-main,.edit-side,label) { min-width:0; }
body .ff-dialog .edit-label { display:block; }
body :is(.ff-dialog,.cd-dialog) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=color]):not([type=range]),select,textarea) { width:100%; min-width:0; }
body .ff-dialog .form-section > div + div { margin-top:8px; }
body .ff-dialog .ff-dialog-header > div { min-width:0; }
body .kb-help-panel { display:flex; flex-direction:column; }
body .kb-help-header { flex-shrink:0; }
body .ff-setup-card, body .ff-tour-welcome-card { overflow:auto; }
html[data-theme=dark] body { --dialog-green:#91baa9; }
@media(max-width:640px) {
 body .ff-dialog .ff-dialog-body [style*="grid-template-columns"] { grid-template-columns:minmax(0,1fr) !important; }
 body .ff-dialog .ff-dialog-body [style*="grid-template-columns"] > * { min-width:0; grid-column:auto !important; }
}

/* Desktop forms use rules and aligned fields, rather than nested cards. */
body .ff-dialog .form-section { box-shadow:none; background:transparent; }
body .ff-dialog .form-section-title { padding-bottom:7px; border-bottom:1px solid var(--stroke); font-size:12px; font-weight:650; }
body .ff-dialog :is(.ff-dialog-footer,.boat-detail-actions), body .cd-dialog form > .cd-dialog-actions { background:var(--panel-2); }
body .ff-dialog :is(.priority-toggle,.priority-toggle label) { border-radius:4px; }
body .ff-dialog .priority-toggle label { padding:6px 10px; font-size:12px; }
body .ff-dialog .priority-toggle input:checked + label { transform:none; box-shadow:0 1px 3px #0001; }
body .ff-dialog .job-create-body { gap:16px; }
body .ff-dialog .job-create-assignment { padding-top:12px; border-top:1px solid var(--stroke); }
body .ff-dialog .fleet-editor-section { border-radius:4px; box-shadow:none; }
body .ff-dialog .preview-description { padding:10px; background:var(--panel-2); }
body .ff-setup-icon, body .ff-tour-welcome-banner > i { display:none; }
body .ff-tour-welcome-banner h2 { font-size:18px; }
body .ff-tour-welcome-banner p, body .ff-tour-welcome-body p { font-size:13px; }
body .ff-tour-welcome-banner { text-align:left; }
body .ff-setup-num { border-radius:4px; }
/* Keep the original request workflow, at the same desktop density. */
body #requestModal { padding:20px; background:rgba(24,36,47,.32); backdrop-filter:none; }
body #requestModal .request-parts-modal { width:min(1080px,96vw); border-radius:6px; font-size:13px; }
body #requestModal .request-header { margin:0 18px; padding:14px 0; gap:12px; }
body #requestModal .request-heading-icon { display:none; }
body #requestModal .request-header h2 { font-size:18px; margin-bottom:4px; }
body #requestModal .request-header p { font-size:13px; }
body #requestModal .request-body { padding:16px 18px; gap:16px; }
body #requestModal .request-intro { gap:24px; }
body #requestModal .request-instructor label { font-size:13px; margin:0 0 6px; }
body #requestModal .request-instructor input { min-height:34px; }
body #requestModal .request-help { padding:12px; border-radius:4px; gap:10px; font-size:13px; background:var(--panel-2); border-left:2px solid var(--stroke-strong); }
body #requestModal .request-help > i { font-size:15px; }
body #requestModal .request-help p { font-size:12px; margin-top:4px; }
body #requestModal .order-catalogue { border-radius:4px; }
body #requestModal .request-search-heading { padding:0 12px; gap:12px; background:var(--panel-2); border-bottom:1px solid var(--stroke); }
body #requestModal .request-search-heading button { font-size:13px; padding:12px 8px; border-radius:0; }
body #requestModal .request-search-heading .request-search-active { background:transparent; box-shadow:0 2px 0 var(--dialog-green); }
body #requestModal .request-search-heading a { font-size:12px; }
body #requestModal .request-search-body { padding:14px; }
body #requestModal .order-catalogue-search :is(input,select) { height:36px; font-size:13px; padding:7px 10px; border-radius:4px; }
body #requestModal .request-query input { padding-left:32px; }
body #requestModal .request-query i { top:12px; left:12px; font-size:13px; }
body #requestModal .request-search-hints { font-size:12px; margin-top:8px; }
body #requestModal .request-items-heading { padding-top:14px; }
body #requestModal .request-items-heading h3 { font-size:15px; }
body #requestModal .request-items-heading h3 i { font-size:14px; margin-right:7px; }
body #requestModal #requestParts .part-row { grid-template-columns:64px minmax(0,2fr) minmax(120px,1fr) 100px 32px; padding:14px; gap:14px; border-radius:4px; }
body #requestModal .part-thumbnail { width:64px; height:64px; border-radius:4px; font-size:22px; }
body #requestModal #requestParts .part-name { font-size:15px; }
body #requestModal #requestParts .part-source { font-size:11px; }
body #requestModal .part-source > span { border-radius:3px; padding:3px 6px; }
body #requestModal #requestParts .part-link { font-size:12px; }
body #requestModal .part-field { padding-left:14px; gap:6px; font-size:12px; }
body #requestModal #requestParts .part-number { font-size:13px; }
body #requestModal #requestParts .part-quantity { padding:7px 9px; font-size:13px; border-radius:4px; }
body #requestModal .part-notes-wrap { border-radius:4px; padding:9px 10px; gap:14px; }
body #requestModal #requestParts .part-notes { min-height:40px; }
body #requestModal .btn { min-height:34px; padding:7px 12px; border-radius:4px; font-size:13px; gap:6px; }
body #requestModal .request-footer { padding:10px 18px; background:var(--panel-2); }
@media(max-width:640px) {
 body #requestModal { padding:8px; }
 body #requestModal .request-header p { display:none; }
 body #requestModal #requestParts .part-row { grid-template-columns:48px minmax(0,1fr) 32px; }
 body #requestModal .part-thumbnail { width:48px; height:48px; }
 body #requestModal .btn { min-height:40px; }
}
