/* finesse · register=product · A=existing theme-safe fallbacks · B=cross-browser accounting shell · C=progressive enhancement · D=compatibility-only motion · E=solid readable surfaces · SOUL=5 SPECTACLE=1 DENSITY=8 */
/* Browser compatibility floor: Chrome/Edge/Firefox/Safari and common WeChat WebViews. */
html,body{overflow-x:hidden}
@supports (overflow:clip){html,body{overflow-x:clip}}

html[data-ui-theme="sage"]{background:#edf1ed}
html[data-ui-theme="teal"]{background:#e9eeed}
html[data-ui-theme="cobalt"]{background:#edf0f5}
html[data-ui-theme="glass"]{background:#eaf2f0}
html[data-ui-theme="terminal"]{background:#0b1416}
html[data-ui-theme="celadon"]{background:#f4f1e9}

/* Browsers without native dialog still receive a modal surface and a real backdrop. */
dialog:not([open]){display:none}
dialog.dialog-fallback-open{display:block;position:fixed;z-index:1002;top:50%;left:50%;max-height:calc(100vh - 32px);overflow:auto;transform:translate(-50%,-50%)}
.dialog-fallback-backdrop{position:fixed;z-index:1001;inset:0;background:rgba(8,34,27,.56)}
body.dialog-fallback-active{overflow:hidden}

/* Native select/date controls can differ, but their text must remain readable. */
select,input,textarea,button{font:inherit}
button,a,[role="button"]{-webkit-tap-highlight-color:transparent}

@supports not (color:color-mix(in srgb,rgb(0,0,0) 50%,rgb(255,255,255))){
  body[data-ui-theme] .hero-strip{color:var(--theme-hero-text);background:linear-gradient(122deg,var(--theme-hero-start),var(--theme-hero-end));box-shadow:0 18px 42px rgba(20,64,50,.18)}
  body[data-ui-theme] .hero-strip::after{border-color:rgba(255,255,255,.08)}
  body[data-ui-theme] .progress-panel{background:rgba(255,255,255,.10);border-color:rgba(255,255,255,.16)}
  body[data-ui-theme] .progress-track{background:rgba(255,255,255,.18)}
  body[data-ui-theme] .topbar{background:var(--theme-surface)}
  body[data-ui-theme] .nav-group-title{color:var(--theme-rail-ink)}
  body[data-ui-theme] .nav-link:hover,body[data-ui-theme] .nav-link.active{background:rgba(255,255,255,.10)}
  body[data-ui-theme] .nav-icon,body[data-ui-theme] .sidebar-foot{background:rgba(255,255,255,.08)}
  body[data-ui-theme] input:focus,body[data-ui-theme] select:focus,body[data-ui-theme] textarea:focus{box-shadow:0 0 0 3px rgba(47,107,79,.16)}
  body[data-ui-theme] .data-table tr:hover td{background:var(--theme-accent-soft)}
  body[data-ui-theme] .bar-fill{background:linear-gradient(90deg,var(--theme-accent),var(--theme-accent-2))}
  body[data-ui-theme] .theme-dialog::backdrop{background:rgba(15,45,36,.56)}
  body[data-ui-theme="glass"] .hero-strip,body[data-ui-theme="celadon"] .hero-strip{color:var(--theme-hero-text);background:var(--theme-surface)}
  body[data-ui-theme="glass"] .progress-panel,body[data-ui-theme="celadon"] .progress-panel{background:rgba(32,48,44,.06);border-color:rgba(32,48,44,.14)}
  body[data-ui-theme="glass"] .progress-track,body[data-ui-theme="celadon"] .progress-track{background:rgba(32,48,44,.14)}
  body[data-ui-theme="terminal"] .hero-strip{background:var(--theme-surface);border-color:var(--theme-line)}
  body[data-ui-theme] .full-brand{background:linear-gradient(100deg,var(--card),var(--head))}
  body[data-ui-theme] .full-view-tabs button.active{box-shadow:0 3px 10px rgba(20,80,60,.20)}
  body[data-ui-theme] .full-btn:hover{box-shadow:0 0 0 3px rgba(30,126,93,.14)}
  body[data-ui-theme] .full-stats{background:var(--head)}
  body[data-ui-theme] .full-stat{box-shadow:0 3px 12px rgba(18,44,36,.08)}
  body[data-ui-theme] .editable-cell{background:var(--account-warning-soft)!important}
  body[data-ui-theme] .editable-cell input{border-color:var(--account-warning)}
}

@supports not ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
  body[data-ui-theme="glass"] .sidebar,body[data-ui-theme="glass"] .topbar{background:#f8fbfa}
  body[data-ui-theme="glass"] .hero-strip,body[data-ui-theme="glass"] .card,body[data-ui-theme="glass"] .panel,body[data-ui-theme="glass"] .kpi-card,body[data-ui-theme="glass"] .metric,body[data-ui-theme="glass"] .filter-bar,body[data-ui-theme="glass"] .store-card{background:#f7fbfa;border-color:rgba(43,87,78,.14)}
}

/* :has() is progressive enhancement; checked themes remain identifiable without it. */
.theme-option input:checked~.theme-option-preview{outline:3px solid var(--theme-accent);outline-offset:2px}
.theme-option.is-selected{border-color:var(--theme-accent);background:var(--theme-surface)}

/* Platform console keeps a usable responsive layout when :has() is unavailable. */
body.platform-console-page{background:#f2f6f3;color:#173c31}
body.platform-console-page>.page{width:min(1480px,100%);max-width:none;margin:0 auto;padding:46px clamp(16px,4vw,58px) 64px}
body.platform-console-page section.card{margin-bottom:20px;overflow:hidden;background:#fbfcfa;border:1px solid #dce7e1;border-radius:18px;box-shadow:0 16px 40px rgba(20,60,46,.08)}
body.platform-console-page .form-grid{gap:18px 20px}
body.platform-console-page .table-wrap{overflow-x:auto}
body.platform-console-page dialog{width:min(620px,calc(100% - 28px));max-width:none;padding:0;border:1px solid #d4e3dc;border-radius:18px;background:#fbfcfa;box-shadow:0 30px 90px rgba(13,53,41,.25)}
@media(max-width:680px){body.platform-console-page>.page{padding:28px 14px 42px}body.platform-console-page .form-grid{grid-template-columns:1fr}body.platform-console-page .page-heading{align-items:flex-start;flex-direction:column}body.platform-console-page dialog{max-height:calc(100vh - 24px)}}

@media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
