/* ============================================================================
   STUDIO UI 2.0 — Catalogue Studio edition
   The same macOS-style design system as the MH-ERP Studio: identical tokens,
   type scale, radii, materials and component states, mapped onto this app's
   classes (.ks shell, .btn, .fld, .tbl, .dlg, .bdg, .seg …).

   Loaded LAST on every admin page (admin/_layout.php), the sign-in page and
   the buyer-facing viewer. Pure presentation: routes, forms, permissions,
   storage and the PDF render/export engine are untouched.
   Roll back: remove the studio-ui.css <link> lines.

   1 Tokens · 2 Base · 3 Shell · 4 Controls · 5 Content · 6 Data
   7 Overlays · 8 Screens · 9 Sign-in & viewer · 10 A11y & motion · 11 Responsive
   ========================================================================== */

/* =========================================================== 1 TOKENS */
/* Light. Declared on :root and re-declared on body because older layers
   set tokens on body.ks / body.studio-login. */
:root:not(.studio-x),
:root:not(.studio-x) body:is(.ks,.studio-login,.vw,.vw-plain,.studio-message,.studio-policy){
  color-scheme:light;
  --sf-text:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro",system-ui,"Inter","Segoe UI",Roboto,sans-serif;
  --sf-display:-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro",system-ui,"Inter","Segoe UI",sans-serif;
  --ui:var(--sf-text); --display:var(--sf-display);
  --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;

  --bg:#F2F2F5; --canvas:#F2F2F5; --stage:#E9E9ED;
  --panel:#FFFFFF; --surface:#FFFFFF; --panel2:#F7F7F9; --elevated:#FFFFFF;
  --fill:#EEEEF1; --fill2:#F4F4F6; --fill3:#E3E3E8;
  --label:#1D1D1F; --label2:#5B5B62; --label3:#737379; --label-disabled:#B4B4BA;
  --sep:rgba(0,0,0,.10); --sep2:rgba(0,0,0,.07); --sep-strong:rgba(0,0,0,.17);
  --hover:rgba(0,0,0,.045); --pressed:rgba(0,0,0,.08);

  --tint:#0071E3; --tint-hover:#0064CC; --tint-active:#0058B5; --tint-fill:#0071E3; --tint-fill-hover:#0064CC;
  --tint-soft:rgba(0,113,227,.09); --tint-soft-2:rgba(0,113,227,.16); --link:#0062C4; --on-tint:#FFFFFF;
  --selection:rgba(0,113,227,.12);
  --focus-ring:0 0 0 3.5px rgba(0,113,227,.30);

  --red:#E5383B; --red-text:#C0262A; --danger:#C0262A; --danger-soft:rgba(229,56,59,.10);
  --green:#28A745; --green-text:#1E7A35; --green-soft:rgba(40,167,69,.11);
  --orange:#F59E0B; --orange-text:#8F5A00; --orange-soft:rgba(245,158,11,.14);
  --indigo:#5E5CE6; --purple-soft:rgba(142,91,216,.11); --purple-text:#6E3EB8;

  --material:rgba(246,246,249,.74); --material-heavy:rgba(252,252,253,.86); --glass-edge:rgba(255,255,255,.65);
  --glass-blur:saturate(180%) blur(28px);
  --shadow:0 0 0 .5px rgba(0,0,0,.05),0 1px 2px rgba(0,0,0,.04);
  --shadow-2:0 0 0 .5px rgba(0,0,0,.06),0 4px 12px rgba(0,0,0,.06);
  --pop-shadow:0 0 0 .5px rgba(0,0,0,.10),0 10px 30px rgba(0,0,0,.13),0 2px 6px rgba(0,0,0,.05);
  --sheet-shadow:0 0 0 .5px rgba(0,0,0,.10),0 28px 70px rgba(0,0,0,.20),0 6px 16px rgba(0,0,0,.06);
  --side-shadow:0 0 0 .5px rgba(0,0,0,.06),0 8px 28px rgba(0,0,0,.06);
  --control-shadow:0 0 0 .5px rgba(0,0,0,.12),0 .5px 1.5px rgba(0,0,0,.10);

  --r-xs:4px; --r-sm:8px; --r:10px; --r-lg:12px; --r-xl:18px; --r-side:16px;
  --control-h:32px; --control-h-sm:28px; --control-h-lg:38px;
  --studio-ease:cubic-bezier(.25,.1,.25,1); --ease-out:cubic-bezier(.2,.8,.2,1); --ease-spring:cubic-bezier(.32,.72,0,1);

  --side-bg:rgba(246,246,249,.74); --side-text:#1D1D1F; --side-muted:#6E6E73; --side-icon:var(--tint);
  --side-hover:rgba(0,0,0,.05); --side-active:rgba(0,0,0,.075);

  /* legacy aliases used across older screens */
  --ink:var(--label); --ink2:var(--label2); --muted:var(--label2); --line:var(--sep); --line-2:var(--sep); --line2:var(--sep2);
  --focus:var(--tint); --brass:var(--tint); --ok:var(--green-text); --warn:var(--orange-text);
  accent-color:var(--tint);
}
/* Dark — appearance.js resolves System/Light/Dark into data-color-scheme before paint */
:root:not(.studio-x)[data-color-scheme="dark"],
:root:not(.studio-x)[data-color-scheme="dark"] body:is(.ks,.studio-login,.vw,.vw-plain,.studio-message,.studio-policy){
  color-scheme:dark;
  --bg:#18181A; --canvas:#18181A; --stage:#111113;
  --panel:#232325; --surface:#232325; --panel2:#1E1E20; --elevated:#2A2A2D;
  --fill:#2C2C2F; --fill2:#262628; --fill3:#38383B;
  --label:#F5F5F7; --label2:#AEAEB4; --label3:#8E8E93; --label-disabled:#57575D;
  --sep:rgba(255,255,255,.10); --sep2:rgba(255,255,255,.07); --sep-strong:rgba(255,255,255,.17);
  --hover:rgba(255,255,255,.06); --pressed:rgba(255,255,255,.10);
  --tint:#0A84FF; --tint-hover:#3395FF; --tint-active:#0071E3; --tint-fill:#0A6CDB; --tint-fill-hover:#1A78E6;
  --tint-soft:rgba(10,132,255,.16); --tint-soft-2:rgba(10,132,255,.26); --link:#5CAEFF; --on-tint:#FFFFFF;
  --selection:rgba(10,132,255,.22); --focus-ring:0 0 0 3.5px rgba(10,132,255,.42);
  --red:#FF5A55; --red-text:#FF8580; --danger:#FF8580; --danger-soft:rgba(255,90,85,.15);
  --green:#32D74B; --green-text:#5EE07A; --green-soft:rgba(50,215,75,.14);
  --orange:#FFB224; --orange-text:#FFC85C; --orange-soft:rgba(255,178,36,.15);
  --purple-soft:rgba(191,139,255,.15); --purple-text:#CDA6FF;
  --material:rgba(36,36,40,.72); --material-heavy:rgba(44,44,48,.86); --glass-edge:rgba(255,255,255,.08);
  --shadow:0 0 0 .5px rgba(255,255,255,.06),0 1px 2px rgba(0,0,0,.30);
  --shadow-2:0 0 0 .5px rgba(255,255,255,.07),0 6px 18px rgba(0,0,0,.35);
  --pop-shadow:0 0 0 .5px rgba(255,255,255,.12),0 14px 36px rgba(0,0,0,.50),0 2px 6px rgba(0,0,0,.30);
  --sheet-shadow:0 0 0 .5px rgba(255,255,255,.12),0 30px 80px rgba(0,0,0,.60);
  --side-shadow:0 0 0 .5px rgba(255,255,255,.08),0 10px 30px rgba(0,0,0,.35);
  --control-shadow:0 0 0 .5px rgba(255,255,255,.12),0 1px 1.5px rgba(0,0,0,.4);
  --side-bg:rgba(36,36,40,.72); --side-text:#F5F5F7; --side-muted:#8E8E93; --side-icon:#5CAEFF;
  --side-hover:rgba(255,255,255,.06); --side-active:rgba(255,255,255,.10);
}

/* =========================================================== 2 BASE */
:root body:is(.ks,.studio-login,.vw,.vw-plain,.studio-message,.studio-policy){
  background:var(--bg); color:var(--label); font-family:var(--sf-text); letter-spacing:-.003em;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; text-rendering:optimizeLegibility}
:root body.ks.ad{font-size:14px;line-height:1.45}
:root body.ks.ad ::selection{background:var(--tint-soft-2)}
:root body.ks.ad :is(h1,h2,h3,h4){font-family:var(--sf-display);color:var(--label);letter-spacing:-.018em}
:root body.ks.ad a{color:var(--link)}
:root body.ks.ad :is(.num,.mono,.sku,code,kbd){font-variant-numeric:tabular-nums}
:root body.ks.ad :is(code,kbd,.mono){font-family:var(--mono)}
:root body.ks.ad :is(.muted,small.muted){color:var(--label2)}
:root body.ks.ad *{scrollbar-width:thin;scrollbar-color:rgba(128,128,128,.38) transparent}
:root body.ks.ad ::-webkit-scrollbar{width:10px;height:10px}
:root body.ks.ad ::-webkit-scrollbar-thumb{background:rgba(128,128,128,.34);border-radius:10px;border:3px solid transparent;background-clip:content-box}

/* =========================================================== 3 SHELL */
/* ---- floating glass sidebar (desktop) */
@media (min-width:861px){
  :root body.ks.ad{grid-template-columns:272px minmax(0,1fr)}
  :root.side-collapsed body.ks.ad{grid-template-columns:76px minmax(0,1fr)}
  :root body.ks.ad .ks-side{position:sticky;top:8px;margin:8px 0 8px 8px;height:calc(100dvh - 16px);
    border:0;border-radius:var(--r-side);background:var(--side-bg);
    -webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);
    box-shadow:var(--side-shadow),inset 0 0 0 .5px var(--glass-edge);padding:14px 10px 10px}
}
:root body.ks.ad .ks-side{color:var(--side-text)}
:root body.ks.ad .ks-side-top{gap:6px;margin-bottom:10px;padding:0 2px}
:root body.ks.ad .ks-brandmark{border-radius:10px;padding:4px 6px;gap:10px;color:var(--side-text);text-decoration:none}
:root body.ks.ad .ks-brandmark:hover{background:var(--side-hover)}
:root body.ks.ad .ks-brandmark{display:flex;align-items:center;min-width:0;flex:1}
:root body.ks.ad .ks-brandmark>span{display:flex;flex-direction:column;gap:3px;min-width:0}
:root body.ks.ad .studio-brand-icon{display:block;width:34px;height:34px;flex:none;border-radius:9px;box-shadow:0 0 0 .5px var(--sep),0 1px 3px rgba(0,0,0,.10);background:#fff;object-fit:cover}
:root body.ks.ad .studio-wordmark{display:block;width:128px;max-width:100%;height:auto}
:root[data-color-scheme="dark"] body.ks.ad .studio-wordmark{filter:invert(1) brightness(1.1)}
:root.side-collapsed body.ks.ad .ks-brandmark>span{display:none}
:root body.ks.ad .ks-brandmark small{font-size:11px;color:var(--side-muted);letter-spacing:0;text-transform:none}
:root body.ks.ad :is(.ks-collapse,.ks-drawer-close){width:28px;height:28px;border-radius:7px;color:var(--side-muted);background:transparent;border:0;box-shadow:none}
:root body.ks.ad :is(.ks-collapse,.ks-drawer-close):hover{background:var(--side-hover);color:var(--side-text)}
:root body.ks.ad .ks-nav{gap:1px}
:root body.ks.ad .ks-nav-group{margin:14px 8px 4px;font-size:11px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--side-muted)}
:root body.ks.ad .ks-nav a{min-height:30px;height:30px;padding:0 8px;gap:9px;border-radius:8px;font-size:13px;font-weight:400;
  color:var(--side-text);background:transparent;box-shadow:none;border:0;text-decoration:none;transition:background-color .12s var(--studio-ease)}
:root body.ks.ad .ks-nav a::before,:root body.ks.ad .ks-nav a::after{display:none}
:root body.ks.ad .ks-nav a svg{width:17px;height:17px;color:var(--side-icon);flex:none;stroke-width:1.7}
:root body.ks.ad .ks-nav a:hover{background:var(--side-hover);color:var(--side-text)}
:root body.ks.ad .ks-nav a[aria-current=page]{background:var(--side-active);color:var(--side-text);font-weight:500;box-shadow:none}
:root body.ks.ad .ks-nav a[aria-current=page] svg{color:var(--side-icon)}
:root body.ks.ad .studio-nav-section summary{font-size:11px;font-weight:600;text-transform:none;letter-spacing:0;color:var(--side-muted)}
:root body.ks.ad .ks-side-foot{border-top:.5px solid var(--sep);padding-top:8px;margin-top:8px}
:root body.ks.ad .ks-me{border-radius:10px;padding:6px 8px;color:var(--side-text);text-decoration:none}
:root body.ks.ad .ks-me:hover{background:var(--side-hover)}
:root body.ks.ad .ks-signout{border-radius:7px;font-size:12px;color:var(--label2);background:transparent;border:0;box-shadow:none}
:root body.ks.ad .ks-signout:hover{background:var(--side-hover);color:var(--label)}
:root body.ks.ad .ks-ver{font-size:11px;color:var(--side-muted)}
:root body.ks.ad .avatar{border-radius:50%;background:var(--tint-soft);color:var(--tint);font-weight:600;box-shadow:inset 0 0 0 .5px rgba(0,0,0,.06)}
/* icon rail */
:root.side-collapsed body.ks.ad .ks-side{padding:12px 8px}
:root.side-collapsed body.ks.ad .ks-nav a{justify-content:center;padding:0;width:40px;margin:0 auto}
:root.side-collapsed body.ks.ad .ks-nav-group{height:.5px;margin:8px 6px;overflow:hidden;font-size:0;background:var(--sep)}

/* ---- toolbar: glass, quiet, 52px */
:root body.ks.ad .ks-main{padding:0 32px 64px}
:root body.ks.ad .studio-toolbar{position:sticky;top:0;z-index:30;min-height:52px;margin:0 -32px 24px;padding:8px 32px;gap:10px;
  background:color-mix(in srgb,var(--bg) 78%,transparent);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);
  border-bottom:.5px solid var(--sep2);box-shadow:none}
:root body.ks.ad .studio-location{font-size:13px;color:var(--label2);flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (min-width:861px){:root body.ks.ad .studio-toolbar{flex-wrap:nowrap}:root body.ks.ad .studio-toolbar>*:not(.studio-location){flex:none}}
:root body.ks.ad .studio-location strong{font-family:var(--sf-display);font-size:15px;font-weight:600;color:var(--label);letter-spacing:-.012em}
:root body.ks.ad .studio-toolbar .ks-topsearch{border-radius:9px;background:var(--fill);border:0;box-shadow:none;height:32px}
:root body.ks.ad .studio-toolbar .ks-topsearch:focus-within{background:var(--panel);box-shadow:var(--control-shadow),var(--focus-ring)}
:root body.ks.ad .studio-toolbar .ks-topsearch input[type=search]{background:transparent;border:0;box-shadow:none;height:32px;font-size:13px;color:var(--label)}
:root body.ks.ad .studio-toolbar .ks-topsearch input[type=search]:focus{box-shadow:none}
:root body.ks.ad .studio-toolbar .ks-topsearch svg{color:var(--label3)}
:root body.ks.ad .studio-toolbar .ks-topsearch kbd{font-family:var(--sf-text);font-size:11px;color:var(--label3);background:transparent;border:0;box-shadow:none}
:root body.ks.ad :is(.studio-brand-select select,.studio-appearance select){height:32px;border-radius:var(--r-sm);font-size:13px}
:root body.ks.ad .studio-toolbar .studio-new{height:32px;min-height:32px;border-radius:999px;padding:0 14px 0 11px}
:root body.ks.ad .studio-appearance>span{font-size:12px;color:var(--label2)}

/* ---- page header */
:root body.ks.ad .ad-head{margin-bottom:20px;gap:12px 16px;align-items:flex-end}
:root body.ks.ad :is(h1,.ad-head h1){font-family:var(--sf-display);font-size:28px;font-weight:700;letter-spacing:-.025em;line-height:1.15;color:var(--label)}
:root body.ks.ad .ad-sub{font-size:13px;color:var(--label2);margin-top:4px}
:root body.ks.ad .ad-actions{gap:8px}
:root body.ks.ad h2{font-size:17px;font-weight:600;letter-spacing:-.014em}
:root body.ks.ad :is(.section-title,.studio-section-head h2,.studio-library-section-header h2){font-size:20px;font-weight:600;letter-spacing:-.02em;text-transform:none}
:root body.ks.ad .studio-eyebrow,:root body.ks.ad .ci-eyebrow{font-size:12px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--label2)}
:root body.ks.ad .breadcrumbs{font-size:13px;color:var(--label2)}

/* =========================================================== 4 CONTROLS */
/* buttons: primary is the default .btn in this app */
:root body.ks.ad :is(.btn,button.btn,a.btn){min-height:var(--control-h);height:auto;padding:0 14px;gap:6px;border-radius:var(--r-sm);
  font-family:var(--sf-text);font-size:13px;font-weight:500;line-height:1;letter-spacing:-.003em;
  background:var(--tint-fill);color:var(--on-tint);border:0;text-decoration:none;
  box-shadow:0 0 0 .5px color-mix(in srgb,var(--tint-fill) 70%,#000),0 1px 2px color-mix(in srgb,var(--tint-fill) 30%,transparent),inset 0 .5px 0 rgba(255,255,255,.18);
  transition:background-color .12s var(--studio-ease),box-shadow .12s var(--studio-ease),color .12s var(--studio-ease),transform .12s var(--studio-ease)}
:root body.ks.ad :is(.btn,button.btn,a.btn):hover{background:var(--tint-fill-hover);color:var(--on-tint);text-decoration:none;transform:none}
:root body.ks.ad :is(.btn,button.btn,a.btn):active{transform:scale(.985)}
:root body.ks.ad .btn svg{width:15px;height:15px}
/* secondary (ghost in this codebase) = macOS push button */
:root body.ks.ad :is(.btn--ghost,.btn.btn--ghost){background:var(--panel);color:var(--label);box-shadow:var(--control-shadow)}
:root body.ks.ad :is(.btn--ghost,.btn.btn--ghost):hover{background:color-mix(in srgb,var(--panel) 92%,var(--label) 8%);color:var(--label)}
:root body.ks.ad :is(.btn--link,.btn.btn--link){background:transparent;color:var(--link);box-shadow:none;padding:0 6px}
:root body.ks.ad :is(.btn--link,.btn.btn--link):hover{background:var(--hover);color:var(--link)}
:root body.ks.ad .btn--danger{background:var(--red);color:#fff;box-shadow:0 0 0 .5px color-mix(in srgb,var(--red) 70%,#000),0 1px 2px rgba(0,0,0,.12)}
:root body.ks.ad .btn--danger:hover{background:color-mix(in srgb,var(--red) 88%,#000);color:#fff}
:root body.ks.ad .btn--danger-t{background:transparent;color:var(--red-text);box-shadow:none}
:root body.ks.ad .btn--danger-t:hover{background:var(--danger-soft);color:var(--red-text)}
:root body.ks.ad :is(.btn--sm,.btn.btn--sm){min-height:var(--control-h-sm);padding:0 10px;font-size:12px;border-radius:7px}
:root body.ks.ad :is(.btn--icon,.btn.btn--icon){width:var(--control-h);min-width:var(--control-h);padding:0;justify-content:center}
:root body.ks.ad .btn--sm.btn--icon{width:var(--control-h-sm);min-width:var(--control-h-sm)}
:root body.ks.ad :is(.btn,.btn--ghost):is(:disabled,[disabled],[aria-disabled=true]){background:var(--fill2);color:var(--label-disabled);box-shadow:none;cursor:not-allowed;transform:none}
:root body.ks.ad .filebtn{border-radius:var(--r-sm)}

/* text fields / selects / text areas */
:root body.ks.ad :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]),select,textarea){
  min-height:var(--control-h);border-radius:var(--r-sm);padding:0 10px;font:13px/1.3 var(--sf-text);color:var(--label);
  background:var(--panel);border:1px solid var(--sep-strong);box-shadow:inset 0 .5px 1px rgba(0,0,0,.04);
  transition:border-color .12s var(--studio-ease),box-shadow .12s var(--studio-ease)}
:root body.ks.ad textarea{padding:8px 10px;line-height:1.45}
:root body.ks.ad :is(input:not([type=checkbox]):not([type=radio]),select,textarea):hover{border-color:color-mix(in srgb,var(--sep-strong) 60%,var(--label) 18%)}
:root body.ks.ad :is(input:not([type=checkbox]):not([type=radio]),select,textarea):focus{outline:none;border-color:var(--tint);box-shadow:var(--focus-ring)}
:root body.ks.ad :is(input,textarea)::placeholder{color:var(--label3);opacity:1}
:root body.ks.ad :is(input,select,textarea):disabled{background:var(--panel2);color:var(--label-disabled);cursor:not-allowed}
:root body.ks.ad select:not([multiple]){appearance:none;-webkit-appearance:none;padding-right:28px;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%2386868D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 5 3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 9px center;background-size:9px 13px}
:root body.ks.ad input[type=file]::file-selector-button{height:26px;border-radius:7px;border:0;background:var(--fill);color:var(--label);font:500 12px var(--sf-text);padding:0 10px;margin-right:10px;cursor:pointer}
:root body.ks.ad :is(input[type=checkbox],input[type=radio],input[type=range]){accent-color:var(--tint)}
:root body.ks.ad .fld{gap:6px}
:root body.ks.ad .fld>span{font-size:12px;font-weight:500;color:var(--label2);letter-spacing:0;text-transform:none}
:root body.ks.ad .fld small{font-size:11.5px;color:var(--label3)}
:root body.ks.ad .chk{gap:8px;font-size:13px;color:var(--label)}
:root body.ks.ad :is(.err,.fld.err) :is(input,select,textarea){border-color:var(--red);box-shadow:0 0 0 3px var(--danger-soft)}
:root body.ks.ad .copyfield input{font-family:var(--mono);font-size:12px}

/* segmented controls & filter pills */
:root body.ks.ad :is(.seg,.pl-seg,.lb-viewseg){display:inline-flex;gap:2px;padding:2px;border-radius:9px;background:var(--fill);border:0;box-shadow:inset 0 0 0 .5px var(--sep2)}
:root body.ks.ad :is(.seg,.pl-seg,.lb-viewseg)>:is(a,button,label){min-height:26px;padding:0 12px;border-radius:7px;border:0;background:transparent;color:var(--label2);font-size:12.5px;font-weight:500;box-shadow:none;text-decoration:none;display:inline-flex;align-items:center}
:root body.ks.ad :is(.seg,.pl-seg,.lb-viewseg)>:is(a,button,label):hover{color:var(--label);background:transparent}
:root body.ks.ad :is(.seg,.pl-seg,.lb-viewseg)>:is(a,button,label):is([aria-current],[aria-pressed=true],[aria-selected=true],.on,.cur,.is-active){background:var(--panel);color:var(--label);box-shadow:0 0 0 .5px rgba(0,0,0,.08),0 1px 3px rgba(0,0,0,.10)}
:root[data-color-scheme="dark"] body.ks.ad :is(.seg,.pl-seg,.lb-viewseg)>:is(a,button,label):is([aria-current],[aria-pressed=true],[aria-selected=true],.on,.cur,.is-active){background:var(--fill3)}
:root body.ks.ad :is(.pill,.tg-pill,.tg-chip,.pl-chip){border-radius:999px;font-size:12px;font-weight:500;background:var(--fill);color:var(--label2);border:0;box-shadow:none}
:root body.ks.ad :is(a.pill,button.pill,.tg-chip,a.tg-pill):hover{background:var(--fill3);color:var(--label);text-decoration:none}
:root body.ks.ad :is(.pill,.tg-pill,.tg-chip,.pl-chip):is([aria-current],[aria-pressed=true],.on,.is-active){background:var(--tint);color:var(--on-tint)}
:root body.ks.ad .filters{gap:8px;align-items:center}

/* =========================================================== 5 CONTENT */
:root body.ks.ad :is(.card-p,.grp,.b-sec,.side-p,.savebox,.stat,.metric,.lb-card,.ci-panel,.studio-doc-card,.pcard,.pcard2,.colour-card,.queue,.tblwrap,.studio-recent,.studio-docs){
  background:var(--panel);border:0;border-radius:var(--r-lg);box-shadow:var(--shadow)}
:root body.ks.ad :is(.card-p,.grp){padding:20px}
:root body.ks.ad :is(.card-p,.side-p) h2{font-size:15px;font-weight:600;letter-spacing:-.012em}
:root body.ks.ad :is(.pcard,.pcard2,.studio-template-card,.studio-doc-card,.colour-card,.lb-card){transition:box-shadow .15s var(--studio-ease),transform .15s var(--studio-ease)}
:root body.ks.ad :is(.pcard,.pcard2,.studio-template-card,.studio-doc-card,.colour-card):hover{box-shadow:var(--shadow-2);transform:none}
:root body.ks.ad :is(.pcard-img,.mgrid-img,.cgrid-img,.tthumb,.studio-doc-cover){border-radius:8px;background:var(--fill2)}
:root body.ks.ad .stats{gap:12px}
:root body.ks.ad :is(.stat,.metric){padding:16px 18px}
:root body.ks.ad :is(.stat,.metric) :is(b,strong,.v,.val){font-family:var(--sf-display);font-weight:600;letter-spacing:-.028em;font-variant-numeric:tabular-nums}
:root body.ks.ad :is(.stat,.metric) :is(span,small,.l){color:var(--label2)}

/* badges: capsules with a dot — never colour alone */
:root body.ks.ad .bdg{height:20px;padding:0 8px;gap:5px;border-radius:999px;font-size:11.5px;font-weight:500;letter-spacing:0;text-transform:none;background:var(--fill);color:var(--label2);border:0}
:root body.ks.ad .bdg::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.85}
:root body.ks.ad .bdg--published,:root body.ks.ad .bdg.ok{background:var(--green-soft);color:var(--green-text)}
:root body.ks.ad .bdg--warn{background:var(--orange-soft);color:var(--orange-text)}
:root body.ks.ad .bdg--draft,:root body.ks.ad .bdg--muted{background:var(--fill);color:var(--label2)}
:root body.ks.ad .bdg--flag{background:var(--danger-soft);color:var(--red-text)}
:root body.ks.ad .studio-template-edition,:root body.ks.ad .studio-template-collection{border-radius:999px;font-size:11px;font-weight:500;letter-spacing:0;text-transform:none}

/* notes, flashes, empty states */
:root body.ks.ad .note{border:0;border-radius:10px;background:var(--orange-soft);box-shadow:none;color:var(--label);font-size:13px}
:root body.ks.ad .note--quiet{background:var(--panel2);box-shadow:inset 0 0 0 .5px var(--sep2)}
:root body.ks.ad .ad-flash{border:0;border-radius:10px;background:var(--green-soft);color:var(--label);box-shadow:none;font-size:13px;border-left:0}
:root body.ks.ad .ad-flash--error{background:var(--danger-soft)}
:root body.ks.ad .empty{background:transparent;box-shadow:none;color:var(--label2);font-size:13px;border:0}
:root body.ks.ad .empty :is(h2,h3,b,strong){color:var(--label);font-size:15px;font-weight:600}
:root body.ks.ad :is(.dropzone,.drop){border:1.5px dashed var(--sep-strong);border-radius:var(--r-lg);background:var(--panel2)}
:root body.ks.ad :is(.dropzone,.drop):is(.is-over,.over,.drag){border-color:var(--tint);background:var(--tint-soft)}

/* =========================================================== 6 DATA */
:root body.ks.ad .tblwrap{overflow:auto}
:root body.ks.ad .tbl{font-size:13px;background:transparent;font-variant-numeric:tabular-nums}
:root body.ks.ad .tbl :is(th,td){padding:0 12px;height:44px;border-bottom:.5px solid var(--sep2)}
:root body.ks.ad .tbl :is(th,td):first-child{padding-left:16px}
:root body.ks.ad .tbl thead th{height:34px;font-size:11.5px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--label2);
  background:color-mix(in srgb,var(--panel) 92%,transparent);border-bottom:.5px solid var(--sep)}
:root body.ks.ad .tbl tbody tr:last-child td{border-bottom:0}
:root body.ks.ad .tbl tbody tr:hover>td{background:var(--hover)}
:root body.ks.ad .tbl tbody tr:is(.sel,.selected,[aria-selected=true])>td{background:var(--selection)}
:root body.ks.ad .tbl--sm :is(th,td){height:36px}
:root body.ks.ad :is(.list-row,.pl-row,.tree-row,.queue .row){border-radius:8px}
:root body.ks.ad :is(.list-row,.pl-row,.tree-row):hover{background:var(--hover)}
:root body.ks.ad .pager{gap:4px}
:root body.ks.ad .pager :is(a,span){min-width:30px;height:30px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;font-size:13px}
:root body.ks.ad .pager a:hover{background:var(--hover);text-decoration:none}
:root body.ks.ad .pager [aria-current]{background:var(--tint);color:var(--on-tint)}
:root body.ks.ad .bulkbar{background:var(--material-heavy);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);border-radius:14px;box-shadow:var(--pop-shadow)}

:root body.ks.ad input[type=range]{background:transparent;border:0;box-shadow:none;min-height:0;padding:0}
/* step indicator (Import, Create): capsules on the panel */
:root body.ks.ad .steps li{background:var(--panel);box-shadow:var(--shadow);color:var(--label3)}
:root body.ks.ad .steps li.cur{color:var(--label)}
:root body.ks.ad .steps li.cur::before{background:var(--tint-fill);color:var(--on-tint)}
:root body.ks.ad .steps li.done::before{background:var(--green);color:#fff}
/* folder product tiles */
:root body.ks.ad .pcard2 .im{background:var(--fill2)}
:root body.ks.ad .pcard2-sel{background:var(--material-heavy);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);border-radius:7px;box-shadow:0 0 0 .5px var(--sep),0 1px 3px rgba(0,0,0,.12)}

/* generic ARIA tab lists (PDF design studio inspector, etc.) = segmented control */
:root body.ks.ad [role=tablist]{display:flex;flex-wrap:wrap;gap:2px;padding:2px;border-radius:9px;background:var(--fill);box-shadow:inset 0 0 0 .5px var(--sep2);border:0}
:root body.ks.ad [role=tablist]>[role=tab]{flex:1 1 auto;min-height:26px;padding:0 10px;border-radius:7px;border:0;background:transparent;color:var(--label2);font:500 12.5px/1 var(--sf-text);box-shadow:none;cursor:pointer}
:root body.ks.ad [role=tablist]>[role=tab]:hover{color:var(--label)}
:root body.ks.ad [role=tablist]>[role=tab][aria-selected=true]{background:var(--panel);color:var(--label);box-shadow:0 0 0 .5px rgba(0,0,0,.08),0 1px 3px rgba(0,0,0,.10)}
:root[data-color-scheme="dark"] body.ks.ad [role=tablist]>[role=tab][aria-selected=true]{background:var(--fill3)}

/* =========================================================== 7 OVERLAYS */
:root body:is(.ks,.vw) :is(.dlg,dialog.dlg){border:0;border-radius:var(--r-xl);background:var(--elevated);color:var(--label);box-shadow:var(--sheet-shadow);padding:22px 24px}
:root body:is(.ks,.vw) :is(.dlg,dialog)::backdrop{background:rgba(0,0,0,.24);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
:root body.ks.ad .dlg h2{font-size:17px;font-weight:600;letter-spacing:-.014em}
:root body.ks.ad .dlg-act{gap:8px;border-top:.5px solid var(--sep2);padding-top:14px;margin-top:18px}
:root body.ks.ad :is(.tg-card-menu,.menu,[role=menu],.mpick-menu,details.menu>div){background:var(--material-heavy);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);
  border:0;border-radius:12px;box-shadow:var(--pop-shadow),inset 0 0 0 .5px var(--glass-edge);padding:5px}
:root body.ks.ad [role=menu] :is(a,button,[role=menuitem]){border-radius:7px;min-height:28px;font-size:13px}
:root body.ks.ad [role=menu] :is(a,button,[role=menuitem]):is(:hover,:focus-visible){background:var(--tint);color:var(--on-tint);text-decoration:none}
:root body.ks.ad .ad-toast{background:var(--material-heavy);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);color:var(--label);border:0;border-radius:14px;box-shadow:var(--pop-shadow),inset 0 0 0 .5px var(--glass-edge);font-size:13px;font-weight:500}
:root body.ks.ad [role=tooltip]{background:var(--material-heavy);color:var(--label);border-radius:8px;box-shadow:var(--pop-shadow);font-size:12px}

/* =========================================================== 8 SCREENS */
/* dashboard hero & template library hero: calm, no decorative glows */
:root body.ks.ad :is(.studio-home-hero,.studio-library-hero){border-radius:20px;border:0;box-shadow:var(--shadow);overflow:hidden}
:root body.ks.ad :is(.studio-home-hero-glow,.studio-library-art-sparkle,.studio-library-orbit){display:none}
:root body.ks.ad :is(.studio-home-hero,.studio-library-hero) h1{font-size:clamp(30px,3.2vw,44px);font-weight:700;letter-spacing:-.034em;line-height:1.06}
:root body.ks.ad .studio-home-hero{background:linear-gradient(160deg,#1D4FD6 0%,#173CA8 55%,#0F2A78 100%);color:#fff}
:root body.ks.ad .studio-home-hero :is(h1,p,.studio-home-greeting,.studio-home-period,.studio-home-hero-meta){color:#fff}
:root body.ks.ad .studio-home-hero :is(p,.studio-home-hero-meta){color:rgba(255,255,255,.80)}
:root body.ks.ad .studio-home-hero :is(.studio-eyebrow,.studio-eyebrow *){color:rgba(255,255,255,.78)}
:root body.ks.ad .studio-home-hero .studio-home-greeting{color:rgba(255,255,255,.85);font-weight:500}
:root body.ks.ad .studio-home-hero .btn{background:#fff;color:#0F2A78;box-shadow:0 1px 2px rgba(0,0,0,.12)}
:root body.ks.ad .studio-home-hero .btn:hover{background:rgba(255,255,255,.90);color:#0F2A78}
:root body.ks.ad .studio-home-hero .btn--ghost{background:rgba(255,255,255,.14);color:#fff;box-shadow:inset 0 0 0 .5px rgba(255,255,255,.3)}
:root body.ks.ad .studio-home-hero .btn--ghost:hover{background:rgba(255,255,255,.22);color:#fff}
:root body.ks.ad .studio-home-floating-label{background:rgba(255,255,255,.86);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);border-radius:12px;color:#1D1D1F;box-shadow:0 8px 24px rgba(0,0,0,.18)}
:root body.ks.ad .studio-library-hero{background:var(--panel)}
:root body.ks.ad .studio-library-hero h1 em{font-style:normal;color:var(--tint)}
/* template cards */
:root body.ks.ad .studio-template-card{background:var(--panel);border:0;border-radius:14px;box-shadow:var(--shadow);overflow:hidden}
:root body.ks.ad .studio-template-art{background:var(--fill2);border-radius:0}
:root body.ks.ad .studio-template-description h3{font-size:14px;font-weight:600;letter-spacing:-.01em}
:root body.ks.ad .studio-template-description p{font-size:12.5px;color:var(--label2)}
:root body.ks.ad .studio-library-search{border-radius:10px}
:root body.ks.ad :is(.tg-cat,.tg-group){border-radius:var(--r-lg);background:var(--panel);box-shadow:var(--shadow);border:0}
/* colour library */
:root body.ks.ad .colour-card-chip{border-radius:8px;box-shadow:inset 0 0 0 .5px rgba(0,0,0,.10)}
/* editors: inspector panels look like macOS inspectors */
:root body.ks.ad :is(.side-p,.savebox){background:var(--panel);border-radius:var(--r-lg)}
:root body.ks.ad .steps{counter-reset:none}
/* product filters disclosure */
:root body.ks.ad .product-filter-details{border-radius:var(--r-lg);background:var(--panel);box-shadow:var(--shadow);border:0}

/* =========================================================== 9 SIGN-IN & VIEWER */
:root body.studio-login .btn{min-height:40px;border-radius:10px;background:var(--tint-fill);color:#fff;font:600 15px/1 var(--sf-text);border:0;
  box-shadow:0 0 0 .5px color-mix(in srgb,var(--tint-fill) 70%,#000),0 1px 2px rgba(0,0,0,.12),inset 0 .5px 0 rgba(255,255,255,.18)}
:root body.studio-login .btn:hover{background:var(--tint-fill-hover)}
:root body.studio-login :is(input[type=text],input[type=password],input[type=email]){font:15px/1.2 var(--sf-text);color:var(--label);background:var(--panel)}
:root body.studio-login :is(input[type=text],input[type=password],input[type=email]):focus{outline:none;box-shadow:var(--focus-ring)}
:root body.studio-login h1{font-family:var(--sf-display);font-weight:700;letter-spacing:-.028em}
:root body.studio-login .sub{color:var(--label2)}
:root body:is(.vw,.vw-plain,.studio-message,.studio-policy) :is(.btn,button.btn){border-radius:10px;font-family:var(--sf-text);font-weight:500}

/* =========================================================== 10 A11Y & MOTION */
:root body:is(.ks,.studio-login,.vw) :focus-visible{outline:none!important;box-shadow:var(--focus-ring)!important;border-radius:var(--r-sm)}
:root body.ks.ad .ad-skip:focus{background:var(--tint);color:var(--on-tint);border-radius:8px}
@media (prefers-reduced-motion:no-preference){
  :root body:is(.ks,.vw) .dlg[open]{animation:studio-sheet .24s var(--ease-spring) both}
  :root body.ks.ad :is([role=menu],.tg-card-menu){animation:studio-pop .18s var(--ease-out) both;transform-origin:top center}
  :root body.ks.ad .ad-toast:not([hidden]){animation:studio-toast .24s var(--ease-spring) both}
}
@keyframes studio-pop{from{opacity:0;transform:scale(.97) translateY(-2px)}to{opacity:1;transform:none}}
@keyframes studio-sheet{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:none}}
@keyframes studio-toast{from{opacity:0;transform:translateY(10px) scale(.96)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  :root body *,:root body *::before,:root body *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
}
@media (prefers-reduced-transparency:reduce){
  :root body.ks.ad :is(.ks-side,.studio-toolbar,.ks-tabbar,.ks-mobile-bar,[role=menu],.ad-toast,.bulkbar){-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--panel)!important}
}
@media (prefers-contrast:more){
  :root:not(.studio-x) body.ks{--sep:rgba(0,0,0,.28);--sep2:rgba(0,0,0,.18);--sep-strong:rgba(0,0,0,.45);--label2:#3A3A3F;--label3:#5B5B62}
}

/* =========================================================== 11 RESPONSIVE */
@media (min-width:1600px){:root body.ks.ad .ks-main{padding:0 40px 64px}:root body.ks.ad .studio-toolbar{margin:0 -40px 24px;padding:8px 40px}}
@media (max-width:1200px) and (min-width:861px){:root body.ks.ad .ks-main{padding:0 24px 56px}:root body.ks.ad .studio-toolbar{margin:0 -24px 20px;padding:8px 24px}}
/* phone & small tablet: drawer sidebar as a floating glass sheet, glass bars, touch sizes */
@media (max-width:860px){
  :root body.ks.ad{--control-h:40px;--control-h-sm:34px}
  :root body.ks.ad :is(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px}
  :root body.ks.ad .ks-side,:root.side-collapsed body.ks.ad .ks-side{top:8px;left:8px;bottom:8px;height:auto;width:min(320px,calc(100vw - 16px));border-radius:var(--r-side);
    background:var(--material-heavy);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);box-shadow:var(--sheet-shadow)}
  :root body.ks.ad .ks-nav a{min-height:40px;height:40px;font-size:15px}
  :root body.ks.ad :is(.ks-mobile-bar,.ks-tabbar){background:var(--material);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);box-shadow:none}
  :root body.ks.ad .ks-mobile-bar{border-bottom:.5px solid var(--sep2)}
  :root body.ks.ad .ks-tabbar{border-top:.5px solid var(--sep2)}
  :root body.ks.ad .ks-tabbar :is(a,button)[aria-current=page]{color:var(--tint)}
  :root body.ks.ad .ks-main{padding:4.5rem 16px calc(6rem + env(safe-area-inset-bottom))}
  :root body.ks.ad .studio-toolbar{margin:0 -16px 16px;padding:8px 16px}
  :root body.ks.ad :is(h1,.ad-head h1){font-size:26px}
  :root body.ks.ad .ad-head{align-items:stretch;text-align:left}
  :root body.ks.ad .ad-head>div:first-child{align-self:flex-start;text-align:left}
  :root body.ks.ad .ad-actions{justify-content:flex-start}
  :root body.ks.ad .studio-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center}
  :root body.ks.ad .studio-toolbar .studio-appearance>span{display:none}
  :root body.ks.ad .studio-toolbar .ks-topsearch{grid-column:1/-1}
  :root body:is(.ks,.vw) .dlg{border-radius:18px 18px 0 0}
}
@media print{
  :root body.ks.ad{background:#fff}
  :root body.ks.ad :is(.card-p,.tblwrap,.stat){box-shadow:none;border:1px solid #ddd}
}
