/* Shared LABS primitives, identical in KR/GLOBAL. Role variants preserve layout and behavior. */
:root {
  --labs-radius-control:10px; --labs-radius-inner:6px; --labs-radius-panel:10px; --labs-radius-track:2px;
  --labs-control-height:48px; --labs-control-height-compact:40px;
  --labs-control-font-size:13px; --labs-control-font-weight:600;
  --labs-label-size:13px; --labs-label-weight:500;
  --labs-dialog-title-size:24px; --labs-dialog-title-weight:600;
  --labs-dialog-padding:28px; --labs-dialog-backdrop:rgb(0 0 0 / .52);
  --labs-dialog-motion:180ms; --labs-focus-width:2px; --labs-focus-offset:3px;
  --labs-primary-ink:#fff;
  --labs-display-size:clamp(40px,6vw,88px); --labs-display-weight:400;
  --labs-marketing-title-size:clamp(36px,4.25vw,64px); --labs-marketing-title-weight:600;
  --labs-page-title-size:clamp(32px,3.2vw,44px); --labs-page-title-weight:600;
  --labs-section-title-size:clamp(24px,2.5vw,32px); --labs-section-title-weight:600;
}
/* Shared geometry, including GLOBAL's older literal squircle declarations. */
html:root :is(.app-card,.pricing-plan-card,.search-box input,.pricing-tabs,.tior-detail-mode,.app-dialog,.global-search-dialog,.enterprise-field input,.proposal-field input,.proposal-dialog,.tior-project-dialog) {
  border-radius:var(--labs-radius-control); corner-shape:round;
}
html:root :is(.pricing-tab,.tior-detail-mode span) { border-radius:var(--labs-radius-inner); corner-shape:round; }
.labs-icon { display:block; width:20px; height:20px; flex:none; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
/* Media overlays keep white controls over the image in both themes. */
html:root body .tior-image-zoom__controls .labs-icon-button { color:#fff!important; background:transparent!important; }
html:root body .tior-image-zoom__controls .labs-icon-button:hover:not(:disabled) { background:rgb(255 255 255 / .14)!important; }
html:root body .flow-action-tooltip { display:none; }
/* Slider track thickness is separate from its 44px interaction target. */
html:root body .merge-editor input[type="range"] {
  appearance:none; -webkit-appearance:none; height:44px; min-height:44px;
  padding:0; border:0; border-radius:0; background:transparent; accent-color:var(--labs-primary); cursor:pointer;
}
html:root body .merge-editor input[type="range"]::-webkit-slider-runnable-track { height:3px; border:0; border-radius:var(--labs-radius-track); background:color-mix(in srgb,var(--text) 32%,var(--surface)); }
html:root body .merge-editor input[type="range"]::-moz-range-track { height:3px; border:0; border-radius:var(--labs-radius-track); background:color-mix(in srgb,var(--text) 32%,var(--surface)); }
html:root body .merge-editor input[type="range"]::-moz-range-progress { height:3px; border:0; border-radius:var(--labs-radius-track); background:var(--labs-primary); }
html:root body .merge-editor input[type="range"]::-webkit-slider-thumb { appearance:none; -webkit-appearance:none; width:14px; height:14px; margin-top:-5.5px; border:0; border-radius:50%; background:var(--labs-primary); box-shadow:none; }
html:root body .merge-editor input[type="range"]::-moz-range-thumb { width:14px; height:14px; border:0; border-radius:50%; background:var(--labs-primary); box-shadow:none; }
@media(forced-colors:active) {
  html:root body .merge-editor input[type="range"]::-webkit-slider-runnable-track { background:CanvasText; }
  html:root body .merge-editor input[type="range"]::-moz-range-track { background:CanvasText; }
  html:root body .merge-editor input[type="range"]::-webkit-slider-thumb { background:Canvas; border:1px solid CanvasText; }
  html:root body .merge-editor input[type="range"]::-moz-range-thumb { background:Canvas; border:1px solid CanvasText; }
}

/* Primary/default, compact, and secondary are roles, not page-specific recipes. */
html:root body :is(.labs-button,.tior-credit-dialog__actions > :is(a,button),.proposal-button,.usage-policy-button,.enterprise-secondary,.kr-landing-button,.gl-button,.kr2-primary,.global-primary,.global-header-cta,.primary-link,.secondary-link,.tior-projects-button,.tior-workspace__primary,.tior-workspace__secondary,.flow-review-actions button,.flow-execution-actions button,.action-btn) {
  min-height:var(--labs-control-height); box-sizing:border-box;
  border-radius:var(--labs-radius-control); corner-shape:round;
  font-family:var(--font-ui); font-size:var(--labs-control-font-size); font-weight:var(--labs-control-font-weight);
  line-height:18px; letter-spacing:.07em; text-transform:uppercase!important;
}
html:root body :is(.labs-button--compact,.proposal-button--compact) { min-height:var(--labs-control-height-compact); }
html:root body :is(.labs-button--primary,.proposal-button,.usage-policy-button:not(.is-secondary)) {
  background:var(--labs-primary); border-color:var(--labs-primary); color:var(--labs-primary-ink);
}
html:root body :is(.labs-button--primary,.proposal-button,.usage-policy-button:not(.is-secondary)):hover:not(:disabled) {
  background:var(--labs-primary-hover); border-color:var(--labs-primary-hover); color:var(--labs-primary-ink);
}
/* Explicit dismiss/cancel variants override old all-orange selectors, never active/disabled state. */
html:root body :is(.labs-button--secondary,.usage-policy-button.is-secondary) {
  --action-primary-fill:var(--surface); --action-primary-foreground:var(--text); --action-primary-border:var(--line-strong);
  --action-primary-hover-fill:color-mix(in srgb,var(--text) 6%,var(--surface)); --action-primary-hover-border:var(--text);
  --action-primary-disabled-fill:var(--surface); --action-primary-disabled-foreground:var(--muted);
  background:var(--surface)!important; color:var(--text)!important; border:1px solid var(--line-strong)!important;
}
html:root body :is(.labs-button--secondary,.usage-policy-button.is-secondary):hover:not(:disabled) {
  background:color-mix(in srgb,var(--text) 6%,var(--surface))!important; border-color:var(--text)!important;
}
html:root body .labs-button--secondary:disabled { color:var(--muted)!important; opacity:.55; cursor:not-allowed; }
/* CTA text casing is visual only. Never uppercase typed values or saved item names. */
html:root body .library-bulk button:not([data-library-clear]) { text-transform:uppercase!important; }
html:root body :is(.hero-cta,.hero-mosaic__action,.app-card__open,.kr2-topnav__cta,.global-header-cta,.global-button,.kr-landing-button,.kr-service-page__actions a,.global-service-page__actions a,.pricing-plan-card__cta,.tior-credit-dialog__actions > button,.tior-workspace__dialog-done,.tior-workspace__text-action,.tior-workspace__add-product,.tior-workspace__product-add-tile,.merge-media-actions > button,.merge-source-drop strong,.flow-run > button,.account-subscriptions__manage,.gl-text-link,.kr-landing-text-link,.gl-uses__copy > b,.tior-product-picker__checkout,.tior-product-picker__view-cart,.tior-credit-dialog__actions a,.flow-header-actions > button:not(.flow-icon)) { text-transform:uppercase!important; }

/* Static utility/upload action copy only: never filenames, field labels, or user content. */
html:root body :is(
  .tior-workspace__product-image [data-product-image-placeholder] strong,
  .tior-workspace__file-control strong[data-file-action-label].is-file-action,
  .tior-workspace__info > span,
  .tior-workspace__recent-toggle > span:first-child,
  .tior-workspace__setup-help,
  .tior-workspace__floor-references [data-floor-reference-slot] .tior-workspace__file-control strong,
  .flow-resource-buttons > button[data-input] > span,
  .flow-inspector button[data-disconnect],
  .flow-inspector button[data-edge-order],
  .flow-inspector button[data-split-edge]
) { text-transform:uppercase!important; }
html:root body .tior-workspace__setup-help::after { text-transform:none; }
html:root body .tior-workspace__file-control strong[data-file-action-label]:not(.is-file-action) { text-transform:none!important; }

/* Shared close/icon control: preserve DOM positions and existing handlers. */
html:root body :is(.labs-icon-button,.labs-dialog-close,.app-dialog__close,.global-search-dialog__close,.tior-credit-dialog__close) {
  display:inline-flex; align-items:center; justify-content:center; flex:none;
  width:44px!important; height:44px!important; min-width:44px; min-height:44px; padding:0!important;
  border:1px solid transparent!important; border-radius:var(--labs-radius-control)!important; corner-shape:round!important;
  background:transparent!important; color:var(--text)!important; box-shadow:none!important; cursor:pointer;
}
html:root body :is(.labs-icon-button,.labs-dialog-close,.app-dialog__close,.global-search-dialog__close,.tior-credit-dialog__close):hover:not(:disabled) { background:color-mix(in srgb,var(--text) 7%,var(--surface))!important; }
html:root body :is(.labs-icon-button,.labs-dialog-close) svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
html:root body :is(.labs-icon-button,.labs-dialog-close):disabled { opacity:.45; cursor:not-allowed; }
html:root body :is(.labs-button,.labs-icon-button,.labs-dialog-close,[class*="kr-landing"] a,[class*="kr-service-page"] a,.global-landing a,.proposals-page button,.proposals-page a,.enterprise-page button,.enterprise-page a,.usage-policy-button):focus-visible,
html:root body :is(button,a,input,select,textarea,[tabindex]):focus-visible {
  outline:var(--labs-focus-width) solid var(--focus-ring)!important; outline-offset:var(--labs-focus-offset)!important;
}
/* The floating tooltip shares its implementation across menus and toolbars. */
.labs-tooltip { position:fixed; z-index:2147483647; pointer-events:none; max-width:min(280px,calc(100vw - 24px)); padding:7px 10px; border:1px solid var(--line-strong); border-radius:var(--labs-radius-inner); background:var(--text); color:var(--surface); font:400 12px/1.45 var(--font-ui); letter-spacing:0; text-transform:none; overflow-wrap:anywhere; box-shadow:0 4px 16px rgb(0 0 0 / .16); }
html:root body :is(.flow-icon,.labs-icon-button,.labs-dialog-close)[data-tooltip]::after { display:none; }

/* DialogShell: widths/content structure remain local; shared typography and motion do not. */
html:root body :is(.labs-dialog,.app-dialog,.global-search-dialog,.usage-policy-dialog,.tior-project-dialog,.proposal-dialog,.tior-credit-dialog,.merge-library,.flow-review-dialog,.flow-execution-dialog,.tior-workspace__product-editor,.tior-workspace__setup-dialog) {
  border-radius:var(--labs-radius-panel); corner-shape:round;
  max-height:calc(100dvh - 32px); max-width:calc(100vw - 32px);
}
html:root body :is(.labs-dialog:not(.labs-dialog--media),.app-dialog,.global-search-dialog,.usage-policy-dialog,.tior-project-dialog,.proposal-dialog,.tior-credit-dialog,.merge-library,.flow-review-dialog,.flow-execution-dialog,.tior-workspace__product-editor,.tior-workspace__setup-dialog)::backdrop { background:var(--labs-dialog-backdrop); backdrop-filter:blur(4px); }
html:root body :is(.labs-dialog:not(.labs-dialog--media),.app-dialog,.global-search-dialog,.usage-policy-dialog,.tior-project-dialog,.proposal-dialog,.tior-credit-dialog,.merge-library,.flow-review-dialog,.flow-execution-dialog,.tior-workspace__product-editor,.tior-workspace__setup-dialog)[open] { animation:labs-dialog-in var(--labs-dialog-motion) ease-out both; }
html:root body :is(.app-dialog__body > h2,.global-search-dialog > header h2,.global-search-dialog > h2,.usage-policy-dialog > form > header > h2,.tior-project-dialog > form > header h2,.proposal-dialog > [data-proposal-dialog-content] > header > h2,.tior-credit-dialog__header > h2,.labs-dialog:not(.labs-dialog--media) > form > header h2,.labs-dialog:not(.labs-dialog--media) > header > h2,.merge-library > header h2,.flow-review-dialog > h2,.tior-workspace__dialog-shell > header h2,.tior-workspace__setup-dialog-shell > header h2) { font-family:var(--font-ui); font-size:var(--labs-dialog-title-size); font-weight:var(--labs-dialog-title-weight); line-height:1.3; letter-spacing:-.02em; }
html:root body :is(.app-dialog__body,.global-search-dialog,.tior-credit-dialog,.proposal-dialog,.library-dialog,.tior-project-dialog > form) { padding:var(--labs-dialog-padding); }
html:root body .global-search-dialog h2 { padding-right:44px; }
html:root body :is(.merge-library,.flow-review-dialog,.tior-workspace__setup-dialog-shell) { padding:var(--labs-dialog-padding); }
html:root body .tior-workspace__dialog-shell { padding:0; }
html:root body .tior-workspace__product-editor :is(.tior-workspace__dialog-shell > header,.tior-workspace__manual-product-grid,.tior-workspace__dialog-shell > footer) { padding:var(--labs-dialog-padding); }
html:root body :is(.merge-library,.flow-review-dialog,.tior-project-dialog,.tior-workspace__product-editor,.tior-workspace__setup-dialog) { overflow:auto; }
@keyframes labs-dialog-in { from { opacity:0; translate:0 6px; } to { opacity:1; translate:0 0; } }

/* Form Field / FileUpload: keep native validation and file selection. */
html:root body :is(.enterprise-field,.proposal-field,.kr-service-page__calculator-fields label,.global-calculator-fields label) { font-size:var(--labs-label-size); font-weight:var(--labs-label-weight); }
html:root body :is(.enterprise-field,.proposal-field) > span:not(.labs-file-upload) { font-size:var(--labs-label-size); font-weight:var(--labs-label-weight); line-height:18px; }
html:root body :is(.enterprise-field,.proposal-field,.kr-service-page__calculator-fields,.global-calculator-fields) :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea) {
  min-height:var(--labs-control-height); border:1px solid var(--line); border-radius:var(--labs-radius-control); corner-shape:round; font-family:var(--font-ui); font-size:14px; font-weight:400;
}
html:root body .labs-field--dense :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select) { min-height:var(--labs-control-height-compact); font-size:13px; }
.labs-file-upload { position:relative; display:flex; align-items:center; gap:12px; width:100%; min-width:0; min-height:var(--labs-control-height); padding:6px 12px; border:1px solid var(--line); border-radius:var(--labs-radius-control); background:var(--input-fill,var(--surface)); color:var(--text); }
html:root body .labs-file-upload > .labs-file-upload__input { position:absolute; inset:0; width:100%; height:100%; min-height:0; margin:0; padding:0; opacity:0; cursor:pointer; z-index:1; }
.labs-file-upload__button { display:inline-flex; align-items:center; gap:8px; flex:none; font:600 13px/18px var(--font-ui); text-transform:uppercase; }
.labs-file-upload__button svg { width:18px; height:18px; }
.labs-file-upload__name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font:400 13px/18px var(--font-ui); }
.labs-file-upload:has(input:focus-visible) { outline:var(--labs-focus-width) solid var(--focus-ring); outline-offset:var(--labs-focus-offset); }
.labs-file-upload:has(input:disabled) { opacity:.55; }
.labs-file-upload:has(input:disabled) input { cursor:not-allowed; }

/* Typography roles retain marketing display vs task-page density. */
html:root body .pricing-hero h1 { font-size:var(--labs-display-size); font-weight:var(--labs-display-weight); }
html:root body :is(.kr-service-page__hero h1,.gl-service-page__hero h1) { font-size:var(--labs-marketing-title-size); font-weight:var(--labs-marketing-title-weight); }
html:root body :is(.enterprise-heading h1,.proposal-page-heading h1,.usage-policy-page h1) { font-size:var(--labs-page-title-size); font-weight:var(--labs-page-title-weight); }
html:root body :is(.enterprise-pricing h2,.proposal-section h2) { font-size:var(--labs-section-title-size); font-weight:var(--labs-section-title-weight); }
/* Hidden actions must remain hidden, including checkout recovery and gated controls. */
html:root body [hidden] { display:none!important; }
@media(max-width:600px) {
  :root { --labs-dialog-padding:20px; --labs-dialog-title-size:22px; }
  html:root body :is(.kr-service-page__hero h1,.gl-service-page__hero h1) { font-size:clamp(36px,10vw,55px); }
  .labs-file-upload { flex-wrap:wrap; gap:6px 12px; }
  .labs-file-upload__name { flex-basis:100%; }
}
html[data-labs-market="KR"] .app-dialog__guide h3 { font-family:var(--font-ui); font-style:normal; font-size:16px; font-weight:500; }
@media(prefers-reduced-motion:reduce) { html:root body :is(.labs-dialog,.app-dialog,.global-search-dialog,.usage-policy-dialog,.tior-project-dialog,.proposal-dialog,.tior-credit-dialog,.merge-library,.flow-review-dialog,.flow-execution-dialog,.tior-workspace__product-editor,.tior-workspace__setup-dialog)[open] { animation:none; } }
@media(forced-colors:active) {
  html:root body :is(button,a,input,select,textarea,[tabindex]):focus-visible { outline-color:Highlight!important; }
  .labs-file-upload { border-color:ButtonText; }
  .labs-tooltip { background:Canvas; color:CanvasText; border-color:CanvasText; }
}
@media(prefers-reduced-transparency:reduce) { html:root body dialog::backdrop { backdrop-filter:none; background:var(--page-canvas); } }
