/* Original Content Studio layout is retained. These styles add tools and theme. */
body.studio-enhanced { --studio-header-height:88px; --studio-toolbar-height:80px; }
body.studio-enhanced #admin-view { --st-bg:#f4f7fb; --st-panel:#fff; --st-text:#20344f; --st-muted:#576b83; --st-border:#c8d3e0; --st-accent:#203f66; --st-on-accent:#fff; --st-focus:#1379c0; --st-soft:#edf2f8; }
body.studio-enhanced #admin-view[data-studio-theme="dark"] { --st-bg:#101925; --st-panel:#192637; --st-text:#edf3fc; --st-muted:#b2c2d7; --st-border:#40536a; --st-accent:#a4c8fa; --st-on-accent:#14273f; --st-focus:#87c9ff; --st-soft:#213146; background:var(--st-bg); color:var(--st-text); color-scheme:dark; }
body.studio-enhanced #admin-view [hidden] { display:none!important; }
body.studio-enhanced #admin-view :is(button,input,select,textarea,a,summary):focus-visible { outline:3px solid var(--st-focus); outline-offset:3px; }
body.studio-enhanced #admin-view :is(.admin-workspace-nav,.page-text-field,.studio-form,.page-editor) { scroll-margin-top:calc(var(--studio-header-height) + var(--studio-toolbar-height) + 24px); }
body.studio-enhanced #admin-view .studio-toolbar { position:sticky; top:var(--studio-header-height); z-index:35; display:flex; align-items:flex-end; flex-wrap:wrap; gap:10px; padding:14px; margin:20px 0 10px; background:var(--st-panel); border:1px solid var(--st-border); border-radius:10px; }
body.studio-enhanced #admin-view .studio-search { position:relative; flex:1; min-width:230px; }
body.studio-enhanced #admin-view .studio-search>label { display:block; margin-bottom:5px; color:var(--st-muted); font-size:14px; font-weight:650; }
body.studio-enhanced #admin-view #studio-control-search { box-sizing:border-box; width:100%; min-height:44px; margin:0; padding:10px 14px; border:1px solid var(--st-border); border-radius:7px; background:var(--st-panel); color:var(--st-text); font:inherit; }
body.studio-enhanced #admin-view .studio-search-results { position:absolute; top:calc(100% + 7px); left:0; right:0; z-index:60; max-height:min(420px,60vh); overflow:auto; padding:6px; background:var(--st-panel); border:1px solid var(--st-border); border-radius:9px; box-shadow:0 16px 38px #0003; }
body.studio-enhanced #admin-view .studio-search-results button { display:block; width:100%; margin:0; padding:12px; text-align:left; border:0; border-radius:5px; background:transparent; color:var(--st-text); font:inherit; cursor:pointer; }
body.studio-enhanced #admin-view .studio-search-results button:hover { background:var(--st-soft); }
body.studio-enhanced #admin-view .studio-search-results :is(small,span) { display:block; color:var(--st-muted); font-size:13px; }
body.studio-enhanced #admin-view .studio-search-results p { margin:8px 10px; color:var(--st-muted); }
body.studio-enhanced #admin-view :is(.studio-theme-button,.studio-preview-button,.studio-nav-toggle,.studio-quick-links button,.studio-preview-panel button) { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:9px 13px; border:1px solid var(--st-border); border-radius:7px; background:var(--st-panel); color:var(--st-text); font:600 14px/1.35 "Segoe UI",sans-serif; cursor:pointer; }
body.studio-enhanced #admin-view :is(.studio-theme-button,.studio-preview-button,.studio-nav-toggle,.studio-quick-links button,.studio-preview-panel button):hover { background:var(--st-soft); }
body.studio-enhanced #admin-view .studio-location { margin:8px 0; color:var(--st-muted); font-size:14px; }
body.studio-enhanced #admin-view .studio-quick-links { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 18px; }
body.studio-enhanced #admin-view .studio-save-state { padding:10px 14px; background:var(--st-soft); color:var(--st-text); border-left:3px solid var(--st-accent); }
body.studio-enhanced #admin-view .studio-field-help { display:block; margin-top:6px; color:var(--st-muted); font-size:14px; font-weight:400; line-height:1.5; }
body.studio-enhanced #admin-view .studio-field-found { outline:3px solid var(--st-focus); outline-offset:4px; }
/* Theme changes color only; original sizing, totals, tab rows and forms stay intact. */
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.studio-form,.page-editor,.admin-list-panel,.admin-workspace-nav,.page-overview,.page-quick-card,.persistence-status,.donor-admin,.sponsor-admin,.admin-summary a,.board-portrait-uploader,.board-save-bar,.admin-editor-panel,.donor-record-dialog) { background:var(--st-panel); border-color:var(--st-border); color:var(--st-text); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(h1,h2,h3,h4,label,legend,summary,.admin-summary strong,.admin-workspace-nav a) { color:var(--st-text); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(p,.admin-summary span,.admin-summary small,.admin-form-note,.section-eyebrow,.page-kicker) { color:var(--st-muted); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(input,select,textarea) { background:var(--st-soft); color:var(--st-text); border-color:var(--st-border); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.admin-workspace-nav a.active,.navy-button,.portrait-file-button) { background:var(--st-accent); color:var(--st-on-accent); border-color:var(--st-accent); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.admin-table,.report-table,.donor-admin table) :is(th,td) { color:var(--st-text); background:var(--st-panel); border-color:var(--st-border); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.board-portrait-controls,.page-image-comparison figure,.page-text-field,.status-pill) { background:var(--st-soft); color:var(--st-text); border-color:var(--st-border); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] a { color:var(--st-accent); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] .admin-shell { background:var(--st-bg); color:var(--st-text); }
/* Keep every editor's foreground and surface paired in dark mode. */
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.sponsor-banner-editor,.sponsor-entry-form,.donor-panel,.donor-stat,.users-manager,.users-page-card,.users-mobile-card,.users-dialog,.users-grid-dialog,.users-account-form>header,.users-account-footer,.users-save-bar,.date-time-pair,dialog .admin-editor-header,.donor-dialog-header) {
  background:var(--st-panel); color:var(--st-text); border-color:var(--st-border);
}
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.users-configuration,.donor-notice,.donor-editor-guide,.sponsor-empty,.sponsor-entry-row [data-remove-confirm]) {
  background:var(--st-soft); color:var(--st-text);
}
body.studio-enhanced #admin-view[data-studio-theme="dark"] .users-manager {
  --users-navy:var(--st-accent); --users-muted:var(--st-muted); --users-line:var(--st-border);
}
body.studio-enhanced #admin-view[data-studio-theme="dark"] .users-table :is(th,td) {
  background:var(--st-panel); color:var(--st-text); border-color:var(--st-border);
}
body.studio-enhanced #admin-view[data-studio-theme="dark"] .users-table tbody tr:hover :is(th,td) { background:var(--st-soft); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.page-text-field span,.field-help,[data-logo-url-panel] small,.donor-admin small,.sponsor-preview-heading span,.sponsor-entry-copy span,.users-column-help,.users-email,.users-you,.users-permission-value,.users-column-count,.users-empty,.users-field-help) { color:var(--st-muted); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.users-person>strong,.users-public-summary) { color:var(--st-text); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(input,textarea)::placeholder { color:var(--st-muted); opacity:1; }
/* Text actions have transparent surfaces; primary and outlined actions do not. */
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.admin-table-action button,.additional-attendee-title button,.add-attendee-button,.users-name-button,.report-table th button) { background:transparent; color:var(--st-accent); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.admin-table-action button,.additional-attendee-title button,.add-attendee-button,.users-name-button,.report-table th button):hover { color:var(--st-text); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(button.quiet-link,.quiet-button,.record-editor-actions .quiet-link,.users-secondary,.users-text-button,.donor-admin button,.donor-link,.sponsor-entry-actions button,.sponsor-entry-row [data-remove-confirm] button,.report-switcher button,.report-download-actions button,.report-email-control>button,.report-pagination>button,.report-row-action button) {
  background:var(--st-panel); color:var(--st-text); border-color:var(--st-border);
}
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(button.quiet-link,.quiet-button,.record-editor-actions .quiet-link,.users-secondary,.users-text-button,.donor-admin button,.donor-link,.sponsor-entry-actions button,.sponsor-entry-row [data-remove-confirm] button,.report-switcher button,.report-download-actions button,.report-email-control>button,.report-pagination>button,.report-row-action button):hover:not(:disabled) { background:var(--st-soft); border-color:var(--st-accent); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] .admin-workspace-nav a:hover { background:var(--st-soft); color:var(--st-text); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.navy-button,.portrait-file-button,.users-primary,.donor-admin button[type="submit"],.donor-admin button[aria-pressed="true"],.report-switcher button.active,.report-switcher button[aria-pressed="true"],.admin-workspace-nav a.active) {
  background:var(--st-accent); color:var(--st-on-accent); border-color:var(--st-accent);
}
/* The upload label's base style sets its text with !important. */
body.studio-enhanced #admin-view[data-studio-theme="dark"] .portrait-file-button { color:var(--st-on-accent)!important; }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.navy-button,.portrait-file-button,.users-primary,.donor-admin button[type="submit"],.donor-admin button[aria-pressed="true"],.report-switcher button.active,.report-switcher button[aria-pressed="true"],.admin-workspace-nav a.active):hover:not(:disabled) { background:var(--st-text); color:var(--st-on-accent); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.portrait-file-button:focus-within,.page-switch input:focus-visible+.page-switch-track) { outline-color:var(--st-focus); }
/* Status words remain readable and retain their success/error distinction. */
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.page-status-on,.donor-message,.users-message,.users-dialog-message,.zip-lookup-status[data-status="confirmed"]) { color:#9ee2bb; }
body.studio-enhanced #admin-view[data-studio-theme="dark"] .page-editor-status { color:#9ee2bb!important; }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.page-status-off,.board-portrait-status,.zip-lookup-status) { color:var(--st-muted); }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.donor-message.error,.users-message.is-error,.users-dialog-message[role="alert"],.board-portrait-status.error,.sponsor-banner-editor .error,.zip-lookup-status[data-status="error"],.donor-contact-actions [data-contact-action="remove"]) { color:#ffb4b4; }
body.studio-enhanced #admin-view[data-studio-theme="dark"] :is(.page-editor-status.error,.page-overview .error) { color:#ffb4b4!important; }

/* Device preview opens separately without relocating any editor. */
body.studio-enhanced #admin-view .studio-preview-panel { position:fixed; z-index:50; top:var(--studio-header-height); right:0; bottom:0; display:flex; flex-direction:column; width:min(48vw,760px); min-width:360px; background:var(--st-panel); color:var(--st-text); border-left:1px solid var(--st-border); box-shadow:-14px 0 40px #0003; }
body.studio-enhanced #admin-view .studio-preview-header { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px; border-bottom:1px solid var(--st-border); }
body.studio-enhanced #admin-view .studio-preview-header h2 { margin:0; font:700 20px/1.3 "Segoe UI",sans-serif; color:var(--st-text); }
body.studio-enhanced #admin-view .studio-preview-header p { margin:4px 0 0; font-size:13px; color:var(--st-muted); }
body.studio-enhanced #admin-view .studio-preview-controls { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:14px; border-bottom:1px solid var(--st-border); }
body.studio-enhanced #admin-view #studio-preview-page { flex:1; width:auto; min-width:160px; margin:0; padding:9px; color:var(--st-text); background:var(--st-panel); border:1px solid var(--st-border); border-radius:6px; font-size:14px; }
body.studio-enhanced #admin-view .studio-preview-controls [role="group"] { display:flex; gap:5px; }
body.studio-enhanced #admin-view .studio-preview-controls button[aria-pressed="true"] { background:var(--st-accent); color:var(--st-on-accent); }
body.studio-enhanced #admin-view .studio-preview-controls a { color:var(--st-accent); font-size:14px; }
body.studio-enhanced #admin-view #studio-preview-size { width:100%; margin:0; color:var(--st-muted); font-size:13px; }
body.studio-enhanced #admin-view .studio-preview-canvas { flex:1; min-height:0; overflow:auto; padding:20px; background:var(--st-bg); }
body.studio-enhanced #admin-view .studio-preview-device { position:relative; margin:auto; overflow:hidden; border:1px solid var(--st-border); border-radius:10px; background:#fff; }
body.studio-enhanced #admin-view .studio-preview-device iframe { display:block; border:0; background:#fff; transform-origin:top left; }
@media(min-width:1800px) { body.studio-enhanced #admin-view.studio-preview-open .admin-shell { margin-right:760px; } }
@media(max-width:760px) {
  body.studio-enhanced #admin-view .studio-search { flex-basis:100%; min-width:0; }
  body.studio-enhanced #admin-view .studio-toolbar { position:relative; top:auto; }
  body.studio-enhanced #admin-view .studio-preview-panel { width:100%; min-width:0; top:0; z-index:70; }
  body.studio-enhanced #admin-view .studio-preview-canvas { padding:12px; }
}
@media(prefers-reduced-motion:reduce) { body.studio-enhanced #admin-view * { scroll-behavior:auto!important; transition:none!important; animation:none!important; } }
@media print { body.studio-enhanced #admin-view :is(.studio-toolbar,.studio-preview-panel,.studio-quick-links,.studio-location,.studio-save-state) { display:none!important; } }

/* Compact theme action in the existing sticky staff header. */
body.studio-enhanced #admin-view .staff-header .studio-theme-button { flex:0 0 44px; width:44px; height:44px; min-height:44px; padding:10px; border-radius:50%; background:transparent; color:#edf3fc; border-color:#76879f; }
body.studio-enhanced #admin-view .staff-header .studio-theme-button:hover { background:#314564; color:#fff; }
body.studio-enhanced #admin-view .staff-header .studio-theme-button:focus-visible { outline-color:#87c9ff; }
body.studio-enhanced #admin-view .staff-header .studio-theme-button svg { display:block; flex:none; }
