/* Professional interface themes. The photo canvas remains neutral in every theme. */
:root{
  --theme-topbar-a:#1a1d25;--theme-topbar-b:#15171d;--theme-input:rgba(10,12,16,.7);
  --theme-hover:#2b323f;--theme-shadow:rgba(0,0,0,.55);--theme-glow-a:rgba(240,192,116,.10);
  --theme-glow-b:rgba(86,128,176,.12);--theme-panel:rgba(22,27,35,.98);
}
html[data-theme="studio"]{
  color-scheme:dark;--bg:#0f1217;--s1:#171b23;--s2:#1d222c;--s3:#232936;
  --line:rgba(255,255,255,.11);--line2:rgba(255,255,255,.17);--ink:#f3efe6;--ink-2:#dbe2ee;--muted:#bac3d1;
  --brass:#f0c074;--brass-l:#ffd98a;--brass-d:#b98625;--ok:#63d28c;--ok-l:#9fe6b0;
  --danger:#e1786d;--danger-l:#ffb4a0;--info:#b9c9ff;--info-l:#d8c5ff;
}
html[data-theme="graphite"]{
  color-scheme:dark;--bg:#111416;--s1:#181c1e;--s2:#1e2326;--s3:#272d31;
  --line:rgba(238,244,241,.11);--line2:rgba(238,244,241,.18);--ink:#f2f4f3;--ink-2:#dde3e1;--muted:#b7c1bf;
  --brass:#d8b879;--brass-l:#edd29c;--brass-d:#9b7839;--ok:#67cf91;--ok-l:#9be3b6;
  --danger:#e47d75;--danger-l:#ffaaa3;--info:#b9cadc;--info-l:#d5e2ee;
  --theme-topbar-a:#1d2123;--theme-topbar-b:#151819;--theme-input:rgba(8,11,12,.72);--theme-hover:#30373a;
  --theme-shadow:rgba(0,0,0,.5);--theme-glow-a:rgba(216,184,121,.075);--theme-glow-b:rgba(118,151,148,.09);--theme-panel:rgba(26,31,33,.98);
}
html[data-theme="midnight"]{
  color-scheme:dark;--bg:#0b1020;--s1:#11192a;--s2:#172137;--s3:#202d46;
  --line:rgba(198,218,255,.12);--line2:rgba(198,218,255,.21);--ink:#f1f5ff;--ink-2:#d9e4f7;--muted:#b7c6dd;
  --brass:#84bdf4;--brass-l:#b8dcff;--brass-d:#477daf;--ok:#64d6a2;--ok-l:#92e8bf;
  --danger:#ef817d;--danger-l:#ffaaa6;--info:#b9c9ff;--info-l:#d9e4ff;
  --theme-topbar-a:#15203a;--theme-topbar-b:#0d1425;--theme-input:rgba(5,9,18,.75);--theme-hover:#2a3c5d;
  --theme-shadow:rgba(2,5,12,.62);--theme-glow-a:rgba(101,164,225,.14);--theme-glow-b:rgba(111,96,202,.12);--theme-panel:rgba(16,24,42,.985);
}
html[data-theme="ivory"]{
  color-scheme:light;--bg:#eeeae2;--s1:#fffdf9;--s2:#f7f3eb;--s3:#eae4d9;
  --line:rgba(31,39,49,.13);--line2:rgba(31,39,49,.22);--ink:#20262f;--ink-2:#39424e;--muted:#626c79;
  --brass:#a66b25;--brass-l:#c88b3d;--brass-d:#7d4b12;--ok:#207a4b;--ok-l:#2f8d5b;--danger:#b84e45;--danger-l:#c65e54;
  --info:#3f609f;--info-l:#5f5a9a;--theme-topbar-a:#fffdf9;--theme-topbar-b:#f2ede4;--theme-input:#fff;
  --theme-hover:#ded6c8;--theme-shadow:rgba(52,42,29,.17);--theme-glow-a:rgba(176,113,34,.10);
  --theme-glow-b:rgba(75,111,147,.08);--theme-panel:rgba(255,253,248,.99);
}

html[data-theme]{color:var(--ink);background:var(--bg);--brass-light:var(--brass-l);--brass-dark:var(--brass-d)}
html[data-theme] body{background:radial-gradient(900px 480px at 80% -8%,var(--theme-glow-a),transparent 60%),radial-gradient(1100px 600px at 6% -4%,var(--theme-glow-b),transparent 60%),var(--bg)}
html[data-theme] .topbar{background:linear-gradient(180deg,var(--theme-topbar-a),var(--theme-topbar-b))}
html[data-theme] input,html[data-theme] select,html[data-theme] textarea{background:var(--theme-input);color:var(--ink)}
html[data-theme] button:not(.brass):hover,html[data-theme] .btn:not(.brass):hover{background:var(--theme-hover)}
html[data-theme] .card{box-shadow:0 10px 30px -12px var(--theme-shadow)}
html[data-theme="ivory"] .brand::before{filter:drop-shadow(0 7px 12px rgba(50,40,27,.2))}
html[data-theme="ivory"] .brandLockupTop{color:#2a3038;text-shadow:none}
html[data-theme="ivory"] .brandLockupBottom{color:var(--brass);text-shadow:none}
html[data-theme="ivory"] input::placeholder,html[data-theme="ivory"] textarea::placeholder{color:#7b8490}
html[data-theme="ivory"] .chk,html[data-theme="ivory"] .auto-card{background:rgba(255,255,255,.58)}
html[data-theme="ivory"] textarea.prompt{background:#fff}
html[data-theme="ivory"] .art-tip{background:#262b33;color:#fff}
html[data-theme="ivory"] .ed-controls .group,html[data-theme="ivory"] .ed-controls .tool-tabs{border-color:var(--line);background:rgba(255,255,255,.42)}
html[data-theme="ivory"] .ed-controls .group:not(.collapsed){border-color:var(--line2);background:rgba(255,255,255,.67)}
html[data-theme="ivory"] .ed-controls .tool-tab:hover{background:rgba(32,38,47,.06)}
html[data-theme="ivory"] .ed-controls .tool-tab.is-active{background:rgba(166,107,37,.13);color:var(--brass-d)}
html[data-theme="ivory"] .ed-controls-head{background:rgba(255,253,249,.97)}
html[data-theme="ivory"] #fromEditor,html[data-theme="ivory"] .genrf{color:#205c38}
html[data-theme="ivory"] .feat p{color:var(--ink-2)}
html[data-theme="ivory"] .signature-shell{background:linear-gradient(135deg,#fffaf1,#f2ede4 48%,#e8dfd0)}
html[data-theme="ivory"] .signature-card,html[data-theme="ivory"] .signature-card.major{background:linear-gradient(180deg,var(--s1),var(--s2));border-color:var(--line)}
html[data-theme="ivory"] .signature-card p{color:var(--ink-2)}
html[data-theme="ivory"] .sl-hero{background:radial-gradient(900px 360px at 12% -20%,rgba(166,107,37,.16),transparent 60%),linear-gradient(155deg,#fffdf9,#eee7dc 58%,#ead4ad)}
html[data-theme="ivory"] .qcard,html[data-theme="ivory"] .qnote,html[data-theme="ivory"] .empty{background:var(--s1)}
html[data-theme="ivory"] .experience-switch,html[data-theme="ivory"] .raster-layer,
html[data-theme="ivory"] .server-project,html[data-theme="ivory"] .editor-more-menu,
html[data-theme="ivory"] .selection-operation{background:var(--s1);box-shadow:0 12px 30px -20px var(--theme-shadow)}
html[data-theme="ivory"] .geometry-modal,html[data-theme="ivory"] .bg-refine-card{
  --ink:#f3efe6;--ink-2:#dbe2ee;--muted:#bac3d1;--line:rgba(255,255,255,.11);--line2:rgba(255,255,255,.18);
}
html[data-theme="ivory"] .adm-wrap code,html[data-theme="ivory"] .gen-out textarea{background:#fff;color:var(--ink)}

/* The retouching surround never changes: theme colors must not bias color judgement. */
html[data-theme] .workspace-card,html[data-theme] .stage,html[data-theme] .canvasShell,
html[data-theme] .previewImage,html[data-theme] .variantThumb{color-scheme:dark}
html[data-theme] .workspace-card{background:linear-gradient(180deg,#20252f,#141820)!important}

/* Theme picker */
.theme-trigger{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:8px 11px;white-space:nowrap}
.theme-trigger__icon{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:conic-gradient(var(--brass) 0 25%,var(--s3) 25% 50%,var(--ink-2) 50% 75%,var(--s1) 75%);border:1px solid var(--line2);font-size:0;box-shadow:0 2px 8px rgba(0,0,0,.16)}
.theme-trigger--floating{position:fixed;z-index:121;top:62px;right:14px;background:var(--s2)}
.theme-panel{position:fixed;z-index:14000;width:min(420px,calc(100vw - 24px));padding:20px;border:1px solid var(--line2);border-radius:16px;background:var(--theme-panel);box-shadow:0 28px 80px rgba(0,0,0,.42),inset 0 1px 0 rgba(255,255,255,.04);backdrop-filter:blur(18px)}
.theme-panel[hidden]{display:none!important}
.theme-panel__eyebrow{color:var(--brass);font-size:10.5px;font-weight:850;letter-spacing:.13em;text-transform:uppercase}
.theme-panel__title{margin:4px 36px 15px 0;font-size:19px;line-height:1.2}
.theme-panel__close{position:absolute;top:10px;right:10px;width:36px;height:36px;padding:0;border:0;background:transparent;color:var(--muted);font-size:25px;line-height:1}
.theme-panel__choices{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.theme-choice{display:grid;grid-template-columns:42px minmax(0,1fr) 20px;align-items:center;gap:10px;min-height:76px;padding:10px;text-align:left;background:var(--s1);border:1px solid var(--line)}
.theme-choice:hover{border-color:var(--line2)}
.theme-choice.is-selected{border-color:var(--brass);box-shadow:0 0 0 2px color-mix(in srgb,var(--brass) 18%,transparent);background:color-mix(in srgb,var(--brass) 8%,var(--s1))}
.theme-choice__swatch{width:42px;height:48px;border-radius:10px;border:1px solid rgba(255,255,255,.18);box-shadow:inset 0 0 0 7px rgba(255,255,255,.055),0 5px 14px rgba(0,0,0,.16)}
.theme-choice__swatch--studio{background:linear-gradient(145deg,#171b23 0 55%,#f0c074 56%)}
.theme-choice__swatch--graphite{background:linear-gradient(145deg,#1e2326 0 55%,#d8b879 56%)}
.theme-choice__swatch--midnight{background:linear-gradient(145deg,#172137 0 55%,#84bdf4 56%)}
.theme-choice__swatch--ivory{background:linear-gradient(145deg,#fffdf9 0 55%,#a66b25 56%);border-color:rgba(32,38,47,.18)}
.theme-choice__copy{display:grid;gap:4px;min-width:0}
.theme-choice__copy strong{font-size:13px;color:var(--ink)}
.theme-choice__copy small{font-size:11px;line-height:1.3;color:var(--muted)}
.theme-choice__mark{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--brass);color:var(--bg);font-size:12px;font-weight:900;opacity:0;transform:scale(.75);transition:.15s}
.theme-choice.is-selected .theme-choice__mark{opacity:1;transform:none}
.theme-panel__note{margin:13px 0 0;padding-top:12px;border-top:1px solid var(--line);color:var(--muted);font-size:11.5px;line-height:1.45}

/* Similarity module uses a bundled stylesheet, so its primary surfaces are bridged here. */
html[data-theme] .dropzone,html[data-theme] .panel,html[data-theme] .scorePanel{background:linear-gradient(var(--s2),var(--s1));border-color:var(--line);box-shadow:0 10px 30px -12px var(--theme-shadow)}
html[data-theme] .noticeBar span,html[data-theme] .techStrip div{background:color-mix(in srgb,var(--s2) 88%,transparent);border-color:var(--line2);color:var(--ink-2)}
html[data-theme] .secondaryButton,html[data-theme] .iconButton,html[data-theme] .tabBar button{background:var(--s3);border-color:var(--line2);color:var(--ink)}
html[data-theme] .tabBar button.active{color:var(--brass);background:color-mix(in srgb,var(--brass) 13%,var(--s1));border-color:color-mix(in srgb,var(--brass) 62%,transparent)}
html[data-theme] .analysisBlock,html[data-theme] .promptBox,html[data-theme] .faceSelector,html[data-theme] .referencePhotos,html[data-theme] .approvalGate,html[data-theme] .historyCard{background:color-mix(in srgb,var(--s1) 82%,transparent);border-color:var(--line)}
html[data-theme] .uploadTarget{color:var(--ink);background:color-mix(in srgb,var(--s3) 34%,transparent);border-color:var(--line2)}
html[data-theme] .dropzone h2,html[data-theme] .sectionHeader h2,html[data-theme] .scoreCopy h2,html[data-theme] .analysisBlock h3,html[data-theme] .promptBox h3{color:var(--ink)}
html[data-theme] .eyebrow{color:var(--brass)}
html[data-theme] .imageMeta,html[data-theme] .statusLine,html[data-theme] .scoreCopy span,html[data-theme] .analysisBlock p,html[data-theme] .promptBox p,html[data-theme] .analysisBlock ul{color:var(--ink-2)}
html[data-theme] .uploadTarget small,html[data-theme] .canvasEmpty,html[data-theme] .emptyText,html[data-theme] .appFooter{color:var(--muted)}
html[data-theme="ivory"] .scoreDial{background:#fff;border-color:rgba(166,107,37,.22)}
html[data-theme="ivory"] th,html[data-theme="ivory"] td{border-color:var(--line)}
html[data-theme="ivory"] td{color:var(--ink-2)}
html[data-theme="ivory"] .manualScoreSelect,html[data-theme="ivory"] .brandingFields input{background:#fff;color:var(--ink-2);border-color:var(--line2)}

@media(max-width:760px){
  .theme-trigger--header{width:42px;min-width:42px;min-height:42px;padding:0}
  .theme-trigger--header .theme-trigger__label{display:none}
}
@media(max-width:640px){
  .theme-panel{inset:auto 8px calc(10px + env(safe-area-inset-bottom,0px))!important;width:auto;max-height:min(82dvh,620px);overflow:auto;padding:17px;border-radius:15px}
  .theme-panel__choices{grid-template-columns:1fr}
  .theme-choice{min-height:68px}
  .theme-trigger--floating{top:64px;right:10px}
}
@media(prefers-reduced-motion:reduce){.theme-choice__mark{transition:none}}
