/* Chicco Studio ULTIMATE 1.18 — light-theme hardening + mobile-first accessibility */
:root{--ultimate-version:"Ultimate 1.18"}

/* LIGHT THEME: final normalization layer. Loaded after every legacy/module stylesheet. */
html[data-theme="light"] body:not(.graphics-editor-page){background:var(--u-bg,#f4f6f9)!important;color:var(--u-text,#111827)!important}
html[data-theme="light"] body:not(.graphics-editor-page) :is(h1,h2,h3,h4,h5,h6,strong,b,label,legend){color:var(--u-text,#111827)!important}
html[data-theme="light"] body:not(.graphics-editor-page) :is(p,small,.hint,.muted,.help,.sub,.subtitle,.description,.desc,.meta,.caption,.note){color:var(--u-muted,#6b7688)!important}

/* Major UI surfaces. Explicitly exclude creative/artboard previews. */
html[data-theme="light"] body:not(.graphics-editor-page) :is(
  .card,.panel,.box,.section,.pnl,.client-pnl,.item,.tile,.stat,.toolbar,.bar,.row,
  .v10-card,.v10-tool-group,.v10-full-calendar,.v10-day-panel,.v10-list-item,.v10-project,.v10-week-day,
  .client-card,.client-dialog,.project-card,.proposal-card,.proposal-section,.proposal-panel,
  .sw-card,.sw-content,.sw-col,.sw-day,.sw-format-card,.sw-idea,.sw-kpi,.sw-phase,.sw-check,.sw-report-format,.sw-dialog,
  .ps-card,.ps-editor,.ps-context,.ps-import-card,.ps-modal-card,.psi-dialog,.psi-item,
  .adsx-card,.adsx-panel,.adsx-section,.adsx-modal,.adsx-summary,
  .v6-card,.v6-modal,.v6-result,.v6-user-card,.perf-card,.gb-card,.gb-panel,
  fieldset,details,dialog,.modal-content,.v10-modal-card
):not(.canvas):not(.artboard):not(.poster):not(.page-preview):not(.stageWrap):not(#stage):not(#stage *){
  background:var(--u-surface-solid,#fff)!important;
  background-image:none!important;
  color:var(--u-text,#111827)!important;
  border-color:var(--u-line,rgba(15,23,42,.075))!important;
}

/* Secondary surfaces and rows. */
html[data-theme="light"] body:not(.graphics-editor-page) :is(
  .chip,.pill,.badge,.tag,.tab,[role="tab"],summary,
  .v10-filter-pills>button,.v10-create-grid>a,.v10-create-grid>button,.v10-tool-links>a,
  .sw-tab,.sw-view-btn,.sw-format-actions button,.sw-actions button,.sw-actions a,
  .ps-filter,.ps-toggle,.ps-fav,.ps-chip,.ps-tag,
  .adsx-tab,.adsx-btn,.adsx-chip,.adsx-pill,.adsx-filter,
  .v6-toolbtn,.v6-secondary,.v6-tab,.v6-close,
  .client-tab,.client-close,.client-actions a,.client-actions button,
  .file-row,.quick-links a,.custom-font-row
):not(.primary):not(.on):not(.active):not([aria-selected="true"]){
  background:var(--u-surface-2,#f8f9fc)!important;
  background-image:none!important;
  color:var(--u-text,#111827)!important;
  border-color:var(--u-line,rgba(15,23,42,.075))!important;
}

/* Form controls. */
html[data-theme="light"] body :is(input,textarea,select):not([type="color"]):not(.canvas *):not(.artboard *):not(#stage *){
  background:var(--u-surface-2,#f8f9fc)!important;
  background-image:none!important;
  color:var(--u-text,#111827)!important;
  border-color:var(--u-line-strong,rgba(15,23,42,.13))!important;
  caret-color:var(--u-blue,#2468d8)!important;
}
html[data-theme="light"] body :is(input,textarea)::placeholder{color:#8792a3!important;opacity:1!important}
html[data-theme="light"] body :is(input,textarea,select):disabled{background:#edf0f5!important;color:#7d8796!important;opacity:1!important}
html[data-theme="light"] body option{background:#fff!important;color:#111827!important}

/* Buttons: neutral buttons must never inherit a black legacy background in light mode. */
html[data-theme="light"] body:not(.graphics-editor-page) :is(button,.btn,.v10-btn,.filebtn,.lnk):not(.primary):not(.danger):not(.warn):not(.on):not(.active):not([aria-pressed="true"]):not(.plus):not(.canvas *):not(.artboard *):not(#stage *){
  background:var(--u-surface-2,#f8f9fc)!important;
  background-image:none!important;
  color:var(--u-text,#111827)!important;
  border-color:var(--u-line-strong,rgba(15,23,42,.13))!important;
}
html[data-theme="light"] body :is(.primary,.btn.primary,.v10-btn.primary,button.primary,.save,.cta){
  background:linear-gradient(180deg,#4f86ff,#2f6de7)!important;color:#fff!important;border-color:transparent!important;
}
html[data-theme="light"] body :is(.active,.on,[aria-selected="true"],[aria-pressed="true"]):is(.tab,.chip,.pill,.ps-filter,.sw-tab,.sw-view-btn,.v6-tab,.adsx-tab,.v10-filter-pills>button){
  background:color-mix(in srgb,var(--u-blue,#2468d8) 10%,#fff)!important;
  color:var(--u-blue,#2468d8)!important;
  border-color:color-mix(in srgb,var(--u-blue,#2468d8) 30%,var(--u-line))!important;
}

/* All tables: deliberately light, readable, and horizontally scroll-safe. */
html[data-theme="light"] body table:not(.canvas *):not(.artboard *):not(#stage *){
  width:100%;background:#fff!important;background-image:none!important;color:#111827!important;border-color:var(--u-line)!important;border-collapse:separate;border-spacing:0;
}
html[data-theme="light"] body table thead,html[data-theme="light"] body table thead tr{background:#f2f5f9!important;background-image:none!important}
html[data-theme="light"] body table th{background:#f2f5f9!important;background-image:none!important;color:#263244!important;border-color:#dde3eb!important;font-weight:750!important}
html[data-theme="light"] body table td{background:#fff!important;background-image:none!important;color:#263244!important;border-color:#e5e9ef!important}
html[data-theme="light"] body table tbody tr:nth-child(even) td{background:#fafbfd!important}
html[data-theme="light"] body table tbody tr:hover td{background:#f4f8fd!important}
html[data-theme="light"] body :is(.gb-table,.table-wrap,.table-responsive,.proposal-table-wrap,.adsx-table-wrap){background:#fff!important;color:#263244!important;border-color:var(--u-line)!important}

/* Dynamic fallback classes added by ultimate-theme-audit.js. */
html[data-theme="light"] .ultimate-light-surface{background:var(--u-surface-solid,#fff)!important;background-image:none!important;color:var(--u-text,#111827)!important;border-color:var(--u-line)!important}
html[data-theme="light"] .ultimate-light-control{background:var(--u-surface-2,#f8f9fc)!important;background-image:none!important;color:var(--u-text,#111827)!important;border-color:var(--u-line-strong)!important}
html[data-theme="light"] .ultimate-light-text{color:var(--u-text,#111827)!important}

/* Preserve visual outputs and creative previews from UI theme normalization. */
:is(.canvas,.artboard,.poster,.page-preview,.stageWrap,#stage,.scaler,.photo,.veil,.shape,.frame,.carousel-cover-preview,.feed-preview,.design-preview,.creative-preview,.preview-canvas) *,
:is(.canvas,.artboard,.poster,.page-preview,.stageWrap,#stage,.scaler,.photo,.veil,.shape,.frame,.carousel-cover-preview,.feed-preview,.design-preview,.creative-preview,.preview-canvas){--ultimate-preview-guard:1}

/* Smartphone: mobile-first command center and accessible typography. */
.ultimate-mobile-priority,.ultimate-mobile-more,.ultimate-mobile-sheet{display:none}
@media(max-width:760px){
  body.ultimate-home{font-size:15px!important}
  .ultimate-content{padding:18px 15px 92px!important}
  .ultimate-greeting h1{font-size:29px!important}.ultimate-greeting p{font-size:13px!important}
  .ultimate-actions{display:none!important}
  .ultimate-mobile-priority{display:block;margin:0 0 14px}
  .ultimate-mobile-priority-head{display:flex;align-items:end;justify-content:space-between;gap:10px;margin-bottom:9px}
  .ultimate-mobile-priority-head h2{margin:0;color:var(--u-text);font-size:15px;letter-spacing:-.025em}.ultimate-mobile-priority-head p{margin:3px 0 0;color:var(--u-muted);font-size:11.5px}
  .ultimate-mobile-priority-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .ultimate-mobile-quick{min-height:86px;display:grid;grid-template-columns:39px minmax(0,1fr);align-items:center;gap:10px;padding:11px;border:1px solid var(--u-line);border-radius:18px;background:var(--u-surface-solid);color:var(--u-text);text-align:left;box-shadow:0 8px 24px rgba(18,30,54,.045)}
  .ultimate-mobile-quick>i{width:39px;height:39px;display:grid;place-items:center;border-radius:13px;background:color-mix(in srgb,var(--quick-color,var(--u-blue)) 12%,var(--u-surface-2));color:var(--quick-color,var(--u-blue));font-style:normal}.ultimate-mobile-quick svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .ultimate-mobile-quick b{display:block;font-size:12.5px;line-height:1.18}.ultimate-mobile-quick small{display:block;margin-top:4px;color:var(--u-muted);font-size:10.5px;line-height:1.2}
  .ultimate-mobile-more{display:flex;width:100%;min-height:46px;margin:10px 0 2px;align-items:center;justify-content:center;gap:7px;border:1px solid var(--u-line-strong);border-radius:15px;background:var(--u-surface-2);color:var(--u-text);font-size:13px;font-weight:750}
  .ultimate-upcoming-panel{order:2!important}.ultimate-dashboard-grid{display:flex!important;flex-direction:column!important}.ultimate-continue-panel{display:none!important}
  .ultimate-panel{padding:17px 15px!important}.ultimate-panel-head h2{font-size:15px!important}.ultimate-panel-head a,.ultimate-panel-head button{font-size:11.5px!important;min-height:36px!important;display:inline-flex!important;align-items:center!important}
  .ultimate-event-row{min-height:68px!important}.ultimate-event-copy b{font-size:13px!important}.ultimate-event-copy small{font-size:11px!important;line-height:1.25!important}.ultimate-event-row time{font-size:11.5px!important}.ultimate-date-tile{width:42px!important;height:47px!important}.ultimate-date-tile b{font-size:15px!important}.ultimate-date-tile span{font-size:8.5px!important}
  .ultimate-bottom-nav{height:76px!important}.ultimate-bottom-nav a,.ultimate-bottom-nav button{min-height:54px!important;font-size:10px!important;gap:4px!important}.ultimate-bottom-nav svg{width:21px!important;height:21px!important}.ultimate-bottom-nav .plus{width:50px!important;height:50px!important;border-radius:18px!important;font-size:26px!important}

  /* Internal pages: more readable and touch friendly. Editors are excluded. */
  body.ultimate-global-shell:not(.graphics-editor-page){font-size:15px!important;padding-bottom:82px!important}
  body.ultimate-global-shell:not(.graphics-editor-page) :is(h1,.page-title){font-size:30px!important;line-height:1.08!important}
  body.ultimate-global-shell:not(.graphics-editor-page) h2{font-size:21px!important}body.ultimate-global-shell:not(.graphics-editor-page) h3{font-size:17px!important}
  body.ultimate-global-shell:not(.graphics-editor-page) :is(p,.hint,.muted,.help,.desc,.subtitle){font-size:13px!important;line-height:1.45!important}
  body.ultimate-global-shell:not(.graphics-editor-page) label{font-size:12.5px!important}
  body.ultimate-global-shell:not(.graphics-editor-page) :is(input,textarea,select){font-size:16px!important;min-height:46px!important}
  body.ultimate-global-shell:not(.graphics-editor-page) :is(button,.btn,.v10-btn,a.btn){font-size:13px!important;min-height:44px}
  body.ultimate-global-shell:not(.graphics-editor-page) table{font-size:12.5px!important;min-width:620px}
  body.ultimate-global-shell:not(.graphics-editor-page) :is(.table-wrap,.table-responsive,.gb-table-wrap){overflow-x:auto!important;-webkit-overflow-scrolling:touch}

  /* Mobile route guidance: always visible below the top bar. */
  body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar{position:sticky!important;top:62px!important;z-index:38!important;margin:0!important;padding:7px 12px!important;min-height:54px!important;background:color-mix(in srgb,var(--u-surface-solid) 94%,transparent)!important;border-bottom:1px solid var(--u-line)!important;backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
  body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar .crumb{display:block!important;min-width:0!important;flex:1!important;font-size:12px!important}body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar .crumb span{display:none!important}body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar .crumb b{display:block!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:13px!important}
  body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar .spacer{display:none!important}
  body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar button{min-width:68px!important;padding:0 10px!important;font-size:11px!important}
  body.ultimate-global-shell:not(.graphics-editor-page) .v1043-contextbar .next{width:auto!important;max-width:128px!important;padding:0 10px!important;font-size:11px!important;justify-content:center!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}.v1043-contextbar .next::after{display:none!important}
}
@media(max-width:390px){.ultimate-mobile-priority-grid{grid-template-columns:1fr}.ultimate-mobile-quick{min-height:68px}}

/* Mobile action sheet opened from the central + button. */
@media(max-width:760px){
  .ultimate-mobile-sheet{position:fixed;inset:0;z-index:2147483600;display:none;align-items:flex-end;background:rgba(10,16,26,.34);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
  .ultimate-mobile-sheet.on{display:flex}.ultimate-mobile-sheet-card{width:100%;max-height:78dvh;overflow:auto;padding:10px 14px calc(18px + env(safe-area-inset-bottom));border-radius:26px 26px 0 0;background:var(--u-surface-solid);color:var(--u-text);box-shadow:0 -22px 70px rgba(10,20,40,.18)}
  .ultimate-mobile-sheet-handle{width:38px;height:4px;margin:2px auto 13px;border-radius:99px;background:var(--u-line-strong)}.ultimate-mobile-sheet-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}.ultimate-mobile-sheet-head>div{flex:1}.ultimate-mobile-sheet-head h2{margin:0;font-size:19px}.ultimate-mobile-sheet-head p{margin:3px 0 0;color:var(--u-muted);font-size:11.5px}.ultimate-mobile-sheet-head button{width:40px;height:40px;min-height:40px!important;border:1px solid var(--u-line);border-radius:50%;background:var(--u-surface-2);color:var(--u-text);font-size:20px!important}
  .ultimate-mobile-sheet-actions{display:grid;gap:7px}.ultimate-mobile-sheet-actions a,.ultimate-mobile-sheet-actions button{min-height:58px!important;display:grid!important;grid-template-columns:39px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 10px!important;border:1px solid var(--u-line)!important;border-radius:16px!important;background:var(--u-surface-2)!important;color:var(--u-text)!important;text-align:left!important;text-decoration:none!important}.ultimate-mobile-sheet-actions i{width:37px;height:37px;display:grid;place-items:center;border-radius:12px;background:color-mix(in srgb,var(--u-blue) 10%,var(--u-surface-solid));color:var(--u-blue);font-style:normal}.ultimate-mobile-sheet-actions b{display:block;font-size:13px}.ultimate-mobile-sheet-actions small{display:block;margin-top:2px;color:var(--u-muted);font-size:10.5px}.ultimate-mobile-sheet-actions .go{color:var(--u-muted);font-size:18px}
}

/* Module-by-module light-theme fixes discovered during the Ultimate 1.18 page audit. */
html[data-theme="light"] :is(.perf-refresh,.perf-stats>div,.perf-row,.client-modal,.client-tab,.fin-row,.fin-sale-card,.fin-budget-item,.fin-modal,.fin-modal-card,.fin-modal-head,.fin-modal-foot,.fin-type,.fin-chip,.fin-alert,.disc,.sig,.prog,.act,.gb-kpi,.gb-row,.gb-audit-item,.gb-hour,.gb-photo,.gb-shot,.gb-tabs,.gb-toolbar,.sw-toolbar,.sw-content,.sw-col,.sw-day,.sw-dialog,.sw-dialog-head,.sw-format-card,.content-card-editor,.top,.bar,.side,.carousel-tools,.linkbox,.status,.mobileEditorDock,.modal,.mobile-nav):not(.stageWrap):not(#stage):not(#stage *){
  background:var(--u-surface-solid,#fff)!important;background-image:none!important;color:var(--u-text,#111827)!important;border-color:var(--u-line)!important;
}
html[data-theme="light"] :is(.fin-row-icon,.gb-tab,.gb-row button,.gb-row a,.gb-audit-item select,.gb-hour input,.gb-hour select,.sw-tab,.sw-view-btn,.sw-actions button,.sw-actions a,.sw-format-actions button,.mobileEditorDock button,.mobilePanelClose){background:var(--u-surface-2,#f8f9fc)!important;background-image:none!important;color:var(--u-text,#111827)!important;border-color:var(--u-line-strong)!important}
html[data-theme="light"] :is(.fin-table th,.fin-table td){color:var(--u-text,#111827)!important;border-color:#e5e9ef!important}
html[data-theme="light"] .fin-table th{background:#f2f5f9!important}.fin-table td{background:#fff}
html[data-theme="light"] .gb-tabs{background:linear-gradient(var(--u-bg,#f4f6f9) 82%,transparent)!important}.gb-tab.on{background:#eaf2ff!important;color:var(--u-blue,#2468d8)!important;border-color:#bad1f7!important}
html[data-theme="light"] :is(.gb-form input,.gb-form select,.gb-form textarea,.gb-audit-item select,.gb-hour input,.gb-hour select){background:var(--u-surface-2,#f8f9fc)!important;color:var(--u-text,#111827)!important;border-color:var(--u-line-strong)!important}
html[data-theme="light"] .gb-photo-media{background:#eef2f7!important;color:var(--u-muted)!important}
html[data-theme="light"] :is(.toast,.toast-client,.fin-toast,.gb-toast,.sw-toast){background:#fff!important;color:#263244!important;border-color:#cbd7e6!important;box-shadow:var(--u-shadow)!important}
html[data-theme="light"] body.v5-shell-active header{background:color-mix(in srgb,var(--u-surface-solid) 94%,transparent)!important;background-image:none!important;color:var(--u-text)!important;border-color:var(--u-line)!important}
html[data-theme="light"] body.v5-shell-active nav:not(.ultimate-nav):not(.ultimate-favorites):not(.ultimate-bottom-nav){background:color-mix(in srgb,var(--u-bg) 92%,transparent)!important;background-image:none!important;color:var(--u-text)!important;border-color:var(--u-line)!important}

/* Editor chrome stays theme-aware while the actual artwork remains untouched. */
html[data-theme="light"] body.graphics-editor-page :is(.top,.side,.bar,.carousel-tools,.linkbox,.status,.mobileEditorDock,.mobilePanelClose){background:#fff!important;background-image:none!important;color:#111827!important;border-color:#dfe4eb!important}
html[data-theme="light"] body.graphics-editor-page :is(input,textarea,select,.btn,.tool,.field,.layer,.tpl){background:#f8f9fc!important;color:#111827!important;border-color:#dfe4eb!important}
html[data-theme="light"] body.graphics-editor-page:not(.ads-editor-page) :is(.stageWrap,#stage,#stage *,.thumb,.tpl .thumb,.carousel-cover-preview){color:revert!important}

@media(max-width:760px){
  .ultimate-mobile-tools-priority{display:block;margin:12px 0 14px;padding:14px;border:1px solid var(--u-line);border-radius:20px;background:var(--u-surface-solid);box-shadow:var(--u-shadow)}
  .ultimate-mobile-tools-priority h2{margin:0!important;font-size:16px!important}.ultimate-mobile-tools-priority>p{margin:4px 0 11px!important;font-size:11.5px!important;color:var(--u-muted)!important}
  .ultimate-mobile-tools-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.ultimate-mobile-tools-grid a{min-height:68px;display:grid;grid-template-columns:36px minmax(0,1fr);align-items:center;gap:9px;padding:9px;border:1px solid var(--u-line);border-radius:15px;background:var(--u-surface-2);color:var(--u-text);text-decoration:none}.ultimate-mobile-tools-grid i{width:35px;height:35px;display:grid;place-items:center;border-radius:11px;background:#eef4ff;color:var(--u-blue);font-style:normal}.ultimate-mobile-tools-grid svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8}.ultimate-mobile-tools-grid b{display:block;font-size:11.5px}.ultimate-mobile-tools-grid small{display:block;margin-top:2px;color:var(--u-muted);font-size:9.5px}
  .v1043-tools-page>.v1043-tools-featured{display:none!important}
}
@media(max-width:390px){.ultimate-mobile-tools-grid{grid-template-columns:1fr}}
