html[data-accent="champagne-soft"] { --accent-primary: #796440; --accent-hover: #635032; --accent-soft: #f5efe3; --accent-border: #d6c7aa; --accent-text: #665233; --accent-line: #796440; --focus-ring: #796440; }
html[data-theme="dark"][data-accent="champagne-soft"] { --accent-primary: #796440; --accent-hover: #635032; --accent-soft: #322c23; --accent-border: #8e7e60; --accent-text: #e5d6b9; --accent-line: #e5d6b9; --focus-ring: #e5d6b9; }
.pref-swatch[data-accent="champagne-soft"] .pref-swatch-dot { background: #d6c7aa; }
.pref-custom-controls { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; align-items: center; }
.pref-custom-controls[hidden] { display: none; }
.pref-custom-controls input { min-width: 0; min-height: 44px; width: 100%; }
.pref-custom-controls input[type="color"] { height: 44px; padding: 4px; }
.pref-custom-controls label, .pref-custom-controls .pref-note { grid-column: 1 / -1; }
.pref-custom-controls label { color: var(--text-main); font-size: 13px; }
.pref-custom-controls input[aria-invalid="true"] { border-color: var(--status-warn-text); }
.pref-custom-controls #prefCustomReset { grid-column: 1 / -1; min-height: 44px; white-space: nowrap; justify-self: start; margin: 0; padding: 8px; border-color: transparent; border-radius: 8px; background: transparent; color: var(--text-secondary); font-weight: 400; }
.preferences-panel #prefReset { border-top: 1px solid var(--border-color); margin-top: 8px; }
.preferences-panel .theme-menu-btn::after { content: none; }
.preferences-panel #themeMenu { width: 100%; }
.preferences-panel #themeMenu .theme-menu-item { flex: 1 1 0; min-width: 0; min-height: 44px; padding-inline: 8px; }
.pref-wallpaper-choice { display: grid; gap: 8px; font-size: 13px; color: var(--text-main); }
.pref-wallpaper-choice select { width: 100%; min-height: 44px; }
.preferences-panel .pref-row #prefWallpaper { width: auto; min-width: 88px; }
.pref-custom-controls { padding: 8px; border: 1px solid var(--border-color); border-radius: 8px; }
.preferences-panel .appearance-control { flex: 0 0 auto; margin: 0; }
.preferences-panel .theme-menu-btn { display: inline-flex; align-items: center; gap: 8px; width: auto; min-width: 44px; min-height: 44px; padding-inline: 8px; }
.preferences-panel .theme-menu-btn[hidden] { display: none; }
.preferences-panel .theme-menu-caption { font-size: 13px; color: var(--text-main); }
.preferences-panel .pref-swatch { padding-inline: 8px; gap: 6px; }
.preferences-panel .pref-group > legend { margin-bottom: 4px; }
.pref-custom-controls #prefCustomHex { height: 44px; }
.pref-custom-controls .pref-note { margin: 0; }
.phone-workflow-dock, .phone-card-details, .phone-edit-btn, .phone-guest-entry, .phone-guest-link { display: none; }

@media (max-width: 600px) {
  body { padding-bottom: calc(var(--phone-nav-height, 0px) + var(--keyboard-inset, 0px)); }
  .app-header, html:not([data-wallpaper="on"]) .app-header { padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); background: var(--bg-app); border-bottom: 1px solid var(--border-color); }
  .app-header .header-card { backdrop-filter: none; }
  .app-header .header-card {
    grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "brand prefs" "font font";
    gap: 0; padding: 0 0 8px; border: 0; align-items: center;
    background: transparent; border-radius: 0; box-shadow: none;
  }
  html[data-theme="dark"] .app-header .header-card { background: transparent; }
  .app-header #brandHomeBtn { width: 44px; height: 44px; min-height: 44px; padding: 4px; }
  .app-header #brandHomeBtn, .app-header #headerPrefsSlot #preferencesBtn { display: inline-flex; align-items: center; justify-content: center; }
  .app-header #brandHomeBtn:focus-visible, .app-header #headerPrefsSlot #preferencesBtn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
  .app-header #headerPrefsSlot { justify-self: end; }
  .app-header #headerPrefsSlot #preferencesBtn {
    width: auto; min-width: 44px; height: 44px; min-height: 44px; flex-direction: row;
    gap: 8px; padding: 8px; border-radius: 8px; font-size: 12px;
  }
  .app-header #headerPrefsSlot #preferencesBtn span { font-size: 12px; }
  .phone-workflow-dock {
    display: block; position: fixed; inset-inline: 0; bottom: var(--keyboard-inset, 0px);
    padding: 8px max(16px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--bg-surface); border-top: 1px solid var(--border-color); z-index: 40;
  }
  #phoneWorkflowDock #mainStepNav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; padding: 0; margin: 0; border: 0; background: transparent; border-radius: 0; }
  #phoneWorkflowDock .step-tab {
    display: flex; flex-direction: column; position: relative; align-items: center; justify-content: center;
    gap: 4px; min-width: 0; min-height: 56px; width: 100%; margin: 0; padding: 8px 0;
    border: 1px solid transparent; border-radius: 8px; box-shadow: none; color: var(--text-secondary); background: transparent;
  }
  #phoneWorkflowDock .step-tab.hidden { display: flex !important; }
  #phoneWorkflowDock .step-tab:disabled { color: var(--text-muted); cursor: not-allowed; }
  #phoneWorkflowDock .step-tab .step-label-short { display: inline; color: inherit; font-size: 12px; line-height: 1.2; white-space: nowrap; }
  #phoneWorkflowDock .step-icon { width: 20px; height: 20px; }
  #phoneWorkflowDock .step-tab.active { background: #f3e5e8; color: #732139; border-color: #d4a8b7; }
  html[data-theme="dark"] #phoneWorkflowDock .step-tab.active { background: #38252a; color: #f2c0ce; border-color: #a56a7b; }
  #phoneWorkflowDock .step-tab::after { display: none; }
  #phoneWorkflowDock .step-tab:focus-visible { outline: 3px solid var(--text-main); outline-offset: 2px; }
  #phoneWorkflowDock #navIssueBadge { position: absolute; top: 5px; right: calc(50% - 40px); display: flex; align-items: center; justify-content: center; width: auto; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; font-size: 0; background: var(--bg-subtle); color: var(--text-main); border: 1px solid var(--border-color); }
  #phoneWorkflowDock #navIssueBadge::after { content: attr(data-count); font-size: 10px; line-height: 1; }
  #phoneWorkflowDock #navIssueBadge[data-count="0"] { display: none; }
  .workspace-grid { gap: 16px; padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
  .workspace-grid[data-step="staff"], .workspace-grid[data-step="staff"][data-sheet="open"] { padding-bottom: 16px; }
  .phone-guest-link:has(#simClientBanner:not(.hidden)) { display: block; grid-column: 1 / -1; border-bottom: 1px solid var(--border-color); }
  .phone-guest-link > summary { display: flex; align-items: center; min-height: 44px; color: var(--text-secondary); font-size: 12px; cursor: pointer; }
  .workspace-grid .preview-card-sticky { display: flex; flex-direction: column; gap: 8px; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .workspace-grid .canvas-stage-wrapper { order: 1; min-height: 0; padding: 8px 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; display: flex; justify-content: center; }
  .workspace-grid #invitationCanvas { box-shadow: 0 8px 24px rgba(32, 26, 21, 0.15); }
  .workspace-grid .preview-guest-bar { order: 2; padding: 0; min-height: 44px; background: transparent; border: 0; }
  .preview-toolbar-left { display: none; }
  .workspace-grid .preview-toolbar { order: 6; padding: 0; border: 0; min-height: 0; background: transparent; }
  .workspace-grid .preview-zoom-bar { order: 7; }
  .workspace-grid .preview-quick-actions { position: static; display: grid; grid-template-columns: minmax(0, 1fr); order: 3; width: 100%; gap: 8px; margin: 0; padding: 8px 0; border: 0; }
  .workspace-grid[data-step="staff"] .preview-quick-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .workspace-grid[data-step="staff"] #phoneEditBtn { display: inline-flex; justify-content: center; min-height: 48px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main); border-radius: 8px; }
  .workspace-grid #quickDownloadJpegBtn { position: static; inset: auto; width: 100%; min-height: 48px; margin: 0; box-shadow: none; border-radius: 8px; }
  .workspace-grid #quickDownloadPdfBtn { display: none; }
  /* Download step: the quick Download PNG under the card is the one primary on the first screen; the panel keeps the other formats */
  .workspace-grid[data-step="export"] #panelExport #downloadSingleJpegBtn { display: none; }
  #canvasDragHint { order: 4; padding: 0 0 8px; background: transparent; border: 0; font-size: 11px; }
  .phone-card-details { display: block; order: 5; border-block: 1px solid var(--border-color); }
  .phone-card-details > summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--text-secondary); font-size: 12px; }
  .phone-card-details > summary::after { content: "+"; font-size: 18px; }
  .phone-card-details[open] > summary::after { content: "−"; }
  .phone-card-details #previewDiagnostics { border: 0; padding: 0 0 8px; background: transparent; }
  .workspace-grid[data-step="staff"] .tool-rail { display: none; }
  .workspace-grid[data-step="staff"][data-sheet="open"] .tool-rail { position: static; display: flex; inset: auto; width: 100%; height: auto; padding: 8px; gap: 4px; margin: 0; visibility: visible; pointer-events: auto; border-radius: 12px 12px 0 0; box-shadow: none; z-index: auto; }
  .workspace-grid[data-step="staff"][data-sheet="open"] .tool-rail .rail-btn { flex: 1 1 0; min-height: 48px; }
  .workspace-grid[data-step="staff"][data-sheet="open"] .studio-sections,
  html.keyboard-visible .workspace-grid[data-step="staff"][data-sheet="open"] .studio-sections { position: static; inset: auto; width: 100%; height: auto; max-height: none; overflow: visible; margin: 0; padding: 0 12px 12px; border-radius: 0 0 12px 12px; box-shadow: none; z-index: auto; }
  .workspace-grid[data-step="staff"][data-sheet="open"] .sheet-bar { position: static; margin-bottom: 8px; }
  .workspace-grid[data-step="staff"][data-sheet="open"] #invitationCanvas { max-height: var(--phone-canvas-max, 560px); }
  #panelStaff > .panel-header { display: none; }
  .workspace-context { padding: 8px 0; background: transparent; border: 0; border-top: 1px solid var(--border-color); border-radius: 0; box-shadow: none; }
  html[data-theme="dark"] .workspace-context { background: transparent; }
  .workspace-context-wrap { margin: 0; }
  .workspace-grid[data-step="client"] { gap: 8px; padding-top: 8px; }
  .workspace-grid[data-step="client"] #panelClient > .panel-header { padding: 0 0 8px; margin: 0; }
  #panelClient #clientHeading, #panelExport #exportHeading { font-size: 22px; line-height: 1.2; }
  #panelClient .guest-review-section { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  #panelClient .guest-review-section > .section-title-row { margin: 0 0 8px; }
  #panelClient .guest-review-section .section-help { margin: 0; font-size: 12px; }
  #panelClient .guest-search-tools { margin-bottom: 8px; }
  #panelClient .review-filter-bar { margin-bottom: 8px; }
  #panelClient .guest-table-wrap { border-radius: 0; border-inline: 0; }
  #panelClient .guest-table tr { border-radius: 0; }
  #panelClient .phone-guest-entry { display: block; order: 0; border-block: 1px solid var(--border-color); }
  #panelClient .phone-guest-entry > summary { display: flex; align-items: center; min-height: 48px; font-size: 13px; cursor: pointer; }
  #panelClient .phone-guest-entry .guest-add-section { border: 0; padding: 8px 0; background: transparent; box-shadow: none; }
  #panelExport > .panel-header { padding: 0 0 16px; margin: 0; border-bottom: 1px solid var(--border-color); }
  #panelExport .export-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  #panelExport #openDeliveryBtn { width: 100%; min-height: 48px; margin-top: 16px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); }
  #panelExport .export-options, #panelExport .export-box { margin: 0 0 16px; padding: 16px; border-radius: 8px; box-shadow: none; }
  #panelExport .export-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
  #panelExport .export-btn-row .btn { flex: 0 0 auto; min-height: 44px; }
  #panelExport :is(.export-box, .export-journal) { min-width: 0; overflow-wrap: anywhere; }
  .preferences-panel { position: static; inset: auto; width: 100%; max-height: min(82dvh, calc(var(--visual-height, 100dvh) - var(--phone-nav-height, 0px) - 16px)); padding: 8px 12px 12px; gap: 8px; border-radius: 12px; overscroll-behavior: contain; }
  .preferences-panel .preferences-head { top: -8px; }
  .preferences-panel .preferences-close { min-width: 44px; min-height: 44px; }
  .preferences-panel .pref-swatches { gap: 8px; }
  .preferences-panel .pref-reset { min-height: 44px; }
  html:has(#workspaceGrid) { scroll-padding-block: 8px calc(var(--phone-nav-height, 0px) + var(--keyboard-inset, 0px) + 8px); }
  :is(input, select, textarea, button) { scroll-margin-block: 8px; }
}
