    :root {
      color-scheme: dark;
      --bg:#0b0f14; --panel:#121821; --surface:rgba(255,255,255,0.045); --surface2:rgba(255,255,255,0.075);
      --line:rgba(255,255,255,0.09); --line2:rgba(255,255,255,0.16); --ink:#f7fafc;
      --muted:rgba(255,255,255,0.68); --soft:rgba(255,255,255,0.56); --primary:#d6a451;
      --primary-hover:#efbd68; --primary-soft:rgba(214,164,81,0.14); --ok:#36d399;
      --danger:#ff6b6b; --sidebar-w:248px; --topbar-h:58px; --radius:8px;
      --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:24px; --control-h:36px; --radius-sm:4px;
      --grid-line:rgba(138,180,255,.055); --stage-spec:#a99be2; --stage-control:#e59b6b; --stage-proof:#d7b96f;
      font-family:"Segoe UI","Microsoft YaHei",system-ui,-apple-system,sans-serif;
    }
    body[data-theme="graphite"] { color-scheme:dark; --ink:#eef4ff; --muted:#9ba9bc; --soft:#8998ad; --primary:#8ab4ff; --primary-hover:#a7c5ff; --primary-soft:rgba(138,180,255,0.13); --ok:#59d6b2; --danger:#ff7d8d; --bg:#0e1219; --panel:#151b25; --surface:#1a2230; --surface2:#222c3b; --line:#2b3748; --line2:#3a4960; }
    body[data-theme="emerald"] { color-scheme:dark; --ink:#effbf6; --muted:#91aa9f; --soft:#829b90; --primary:#31d0aa; --primary-hover:#47e1bc; --primary-soft:rgba(49,208,170,0.13); --ok:#76dda8; --danger:#ff8792; --bg:#08120f; --panel:#0e1b17; --surface:#12241e; --surface2:#193029; --line:#244137; --line2:#31574a; }
    * { box-sizing:border-box; }
    html { scroll-behavior:smooth; }
    body[data-theme="dark_gold"] { color-scheme:dark; }
    body { margin:0; min-height:100vh; color:var(--ink); background:var(--bg); letter-spacing:0; }
    button,input,textarea,select { font:inherit; }
    button { min-height:36px; border:0; border-radius:6px; padding:0 13px; background:var(--primary); color:#101318; font-weight:800; cursor:pointer; }
    button:hover { background:var(--primary-hover); }
    button.secondary { background:var(--surface2); color:var(--ink); border:1px solid var(--line2); }
    button.ghost { background:transparent; color:var(--primary); border:1px solid var(--line2); }
    button.danger { background:rgba(255,107,107,0.16); color:#ffe1e1; border:1px solid rgba(255,107,107,0.36); }
    input,textarea,select { width:100%; min-height:36px; border:1px solid var(--line); border-radius:6px; padding:8px 10px; background:rgba(255,255,255,0.045); color:var(--ink); outline:none; }
    input:focus,textarea:focus,select:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
    textarea { min-height:96px; resize:vertical; }
    label { display:block; color:var(--muted); font-size:12px; margin:10px 0 5px; }
    table { width:100%; min-width:760px; border-collapse:collapse; font-size:13px; }
    th,td { border-bottom:1px solid var(--line); padding:10px 9px; text-align:left; vertical-align:top; }
    th { color:var(--soft); font-size:12px; font-weight:800; background:rgba(255,255,255,0.035); position:sticky; top:0; z-index:1; }
    tr:hover td { background:rgba(255,255,255,0.025); }
    code,pre { font-family:"Consolas","JetBrains Mono",monospace; }
    pre { margin:0; padding:12px; overflow:auto; max-height:430px; background:rgba(0,0,0,0.23); border:1px solid var(--line); border-radius:6px; color:#d7e4ff; }
    .hidden { display:none !important; }
    .muted { color:var(--muted); }
    .ok { color:var(--ok); }
    .dangerText { color:var(--danger); }
    .login { min-height:100vh; display:grid; grid-template-columns:minmax(0,1fr) 430px; background:linear-gradient(135deg,#0b0f14 0%,#121826 58%,#17130c 100%); }
    .loginHero { display:grid; align-content:center; padding:56px clamp(24px,8vw,110px); }
    .loginHero h1 { margin:14px 0; font-size:clamp(38px,5vw,64px); line-height:1; letter-spacing:0; }
    .loginHero p { max-width:660px; margin:0; font-size:16px; line-height:1.7; }
    .badge { display:inline-flex; align-items:center; justify-content:center; min-height:24px; padding:0 9px; border-radius:999px; background:var(--primary-soft); color:var(--primary); border:1px solid var(--line); font-size:12px; font-weight:800; }
    .roleSwitch { display:inline-flex; gap:4px; padding:4px; border:1px solid var(--line); border-radius:8px; background:rgba(0,0,0,0.18); margin-top:24px; }
    .roleSwitch span { min-width:92px; text-align:center; padding:7px 10px; border-radius:6px; color:var(--muted); font-size:13px; font-weight:800; }
    .roleSwitch span.active { color:#111; background:var(--primary); }
    .loginPanel { display:grid; align-content:center; padding:34px; background:rgba(18,24,33,0.94); border-left:1px solid var(--line); }
    .loginCard { border:1px solid var(--line); border-radius:8px; background:rgba(255,255,255,0.04); padding:24px; box-shadow:0 18px 48px rgba(0,0,0,0.38); }
    .shell { display:grid; grid-template-columns:var(--sidebar-w) minmax(0,1fr); min-height:100vh; }
    .sidebar { background:rgba(7,10,15,0.98); border-right:1px solid var(--line); padding:18px; position:sticky; top:0; height:100vh; }
    .brand { display:flex; align-items:center; gap:10px; min-height:42px; margin-bottom:18px; }
    .brandMark { width:34px; height:34px; border-radius:8px; background:var(--primary); color:#111; display:grid; place-items:center; font-weight:900; }
    .brandTitle { font-weight:900; line-height:1.15; }
    .brandTitle span { display:block; color:var(--muted); font-size:12px; font-weight:700; margin-top:2px; }
    nav a { display:grid; gap:3px; color:var(--muted); text-decoration:none; padding:10px 11px; border-radius:6px; margin:3px 0; font-size:14px; font-weight:800; }
    nav a span { color:var(--soft); font-size:11px; font-weight:700; }
    nav a:hover, nav a.active { background:var(--surface2); color:var(--ink); }
    nav a:hover span, nav a.active span { color:var(--primary); }
    .viewHidden { display:none !important; }
    main { min-width:0; }
    .topbar { min-height:var(--topbar-h); display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 22px; border-bottom:1px solid var(--line); background:rgba(13,18,26,0.92); position:sticky; top:0; z-index:5; backdrop-filter:blur(14px); }
    h1 { margin:0; font-size:22px; letter-spacing:0; }
    h2 { margin:0 0 12px; font-size:17px; letter-spacing:0; }
    .content { padding:18px 22px 48px; min-width:0; overflow-x:hidden; }
    .content > * + * { margin-top:16px; }
    body[data-density="compact"] .content { padding-top:14px; }
    body[data-density="compact"] section { padding:14px; }
    body[data-density="compact"] th,body[data-density="compact"] td { padding:7px 8px; }
    body[data-density="compact"] input,body[data-density="compact"] select { min-height:32px; padding:6px 8px; }
    .opsDeck { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(260px,.65fr); gap:12px; margin-top:12px; }
    .situation,.quickLayer { border:1px solid var(--line); border-radius:6px; background:rgba(255,255,255,.025); padding:12px; }
    .deckTitle { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; } .deckTitle h3 { margin:0; font-size:13px; } .deckTitle span { color:var(--soft); font-size:11px; }
    .situationGrid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; }
    .situationCell { min-height:58px; padding:9px; border:1px solid var(--line); border-radius:4px; background:rgba(0,0,0,.16); }
    .situationCell b { display:block; color:var(--ok); font-size:12px; } .situationCell span { display:block; margin-top:5px; color:var(--muted); font-size:11px; }
    .stageRail { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-top:10px; border:1px solid var(--line); border-radius:6px; overflow:hidden; background:rgba(0,0,0,.14); }
    .stageRailItem { position:relative; padding:10px 12px 10px 30px; border-right:1px solid var(--line); } .stageRailItem:last-child { border-right:0; } .stageRailItem:before { content:""; position:absolute; left:12px; top:16px; width:8px; height:8px; border-radius:50%; background:var(--ok); box-shadow:0 0 0 3px rgba(91,209,143,.10); }
    .stageRailItem b { display:block; font-size:12px; } .stageRailItem span { display:block; margin-top:3px; color:var(--muted); font-size:10px; }
    .stageRailItem[data-stage="specification"] b { color:#b8ace8; } .stageRailItem[data-stage="orchestration"] b { color:#e6a376; } .stageRailItem[data-stage="delivery"] b { color:#d7b96f; }
    .quickActions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; } .quickActions button { min-height:34px; text-align:left; }
    @media (prefers-reduced-motion: reduce) { html { scroll-behavior:auto; } *,*:before,*:after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; } }
    @media (max-width:900px) { .opsDeck { grid-template-columns:1fr; } .situationGrid { grid-template-columns:repeat(2,minmax(0,1fr)); } .stageRail { grid-template-columns:1fr; } .stageRailItem { border-right:0; border-bottom:1px solid var(--line); } .stageRailItem:last-child { border-bottom:0; } }
    .stats { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); gap:12px; }
    .stat { min-height:92px; border:1px solid var(--line); border-radius:8px; padding:14px; background:linear-gradient(160deg,rgba(255,255,255,0.075),rgba(255,255,255,0.025)); }
    .stat strong { display:block; font-size:30px; line-height:1.1; }
    .stat span { color:var(--muted); font-size:13px; font-weight:800; }
    .grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; min-width:0; }
    section { border:1px solid var(--line); border-radius:8px; background:var(--panel); padding:16px; min-width:0; }
    .span6 { grid-column:span 1; }
    .span12 { grid-column:1 / -1; }
    .wide { max-width:100%; overflow-x:auto; }
    .row { display:flex; gap:10px; align-items:center; }
    .row > * { flex:1; min-width:0; }
    .toolbar,.toolbarRight { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
    .toolbarRight { justify-content:flex-end; }
    .tagbar { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin:8px 0 10px; }
    .tag { min-height:28px; padding:0 10px; border-radius:999px; border:1px solid var(--line2); color:var(--muted); background:var(--surface); font-size:12px; font-weight:800; }
    .tag.active { color:#101318; border-color:var(--primary); background:var(--primary); }
    .tableActions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; min-width:210px; }
    .tableActions button { min-height:28px; padding:0 9px; font-size:12px; }
    .sectionHead { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:8px; }
    .sectionHead p { margin:0; color:var(--muted); font-size:13px; }
    .pill { display:inline-flex; align-items:center; padding:3px 8px; border-radius:999px; font-size:12px; font-weight:800; background:rgba(255,255,255,0.06); color:var(--muted); border:1px solid var(--line); }
    .pill.ok { color:var(--ok); background:rgba(54,211,153,0.10); border-color:rgba(54,211,153,0.22); }
    .pill.warn { color:var(--primary); background:var(--primary-soft); border-color:rgba(214,164,81,0.22); }
    #toast { min-width:150px; text-align:right; color:var(--muted); }
    #generated_cards,#reset_result { min-height:96px; font-family:"Consolas","JetBrains Mono",monospace; }
    .search { max-width:260px; }
    .themeBtn { width:32px; min-width:32px; padding:0; border:1px solid var(--line2); background:var(--surface2); color:var(--ink); }
    .themeBtn.active { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); color:var(--primary); }
    .fieldError { min-height:18px; margin:5px 0 0; color:var(--danger); font-size:12px; }
    @media (max-width:1180px) { .stats { grid-template-columns:repeat(3,minmax(120px,1fr)); } }
    @media (max-width:980px) { .grid { grid-template-columns:1fr; } .span6 { grid-column:1 / -1; } }
    @media (max-width:840px) { .login { grid-template-columns:minmax(0,1fr); } .loginPanel { border-left:0; } .shell { width:100%; max-width:100vw; min-width:0; grid-template-columns:minmax(0,1fr); } .sidebar,main,.topbar,.content,.grid,section { width:100%; max-width:100%; min-width:0; } .sidebar { position:relative; height:auto; overflow:hidden; } .sidebar nav { width:100%; display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; } .sidebar nav a { flex:0 0 auto; white-space:nowrap; } .topbar { position:relative; align-items:flex-start; flex-direction:column; } #toast { width:100%; min-width:0; text-align:left; order:2; } .stats { grid-template-columns:repeat(2,minmax(0,1fr)); } }
    .controlGrid { position:fixed; inset:0; pointer-events:none; opacity:.7; background-image:linear-gradient(var(--grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--grid-line) 1px,transparent 1px); background-size:32px 32px; mask-image:linear-gradient(to bottom,#000,transparent 78%); }
    .shell,.login { position:relative; z-index:1; }
    [data-workspace] { position:relative; scroll-margin-top:72px; }
    [data-workspace]::before { content:attr(data-stage-label); position:absolute; top:10px; right:12px; color:var(--soft); font:700 10px/1 Consolas,monospace; }
    .workspaceState { display:none; min-height:118px; align-items:center; justify-content:center; border:1px dashed var(--line2); border-radius:var(--radius-sm); background:rgba(0,0,0,.14); text-align:center; padding:var(--space-5); }
    .workspaceState[data-visible="true"] { display:flex; }
    .workspaceState strong { display:block; margin-bottom:var(--space-2); font-size:14px; }
    .workspaceState p { margin:0 0 var(--space-3); color:var(--muted); font-size:12px; }
    .workspaceState button { min-height:30px; }
    .operationZone { display:flex; gap:var(--space-2); align-items:center; flex-wrap:wrap; margin:var(--space-2) 0 var(--space-3); padding:var(--space-2); border-block:1px solid var(--line); background:rgba(255,255,255,.018); }
    .workspaceMeta { display:flex; gap:var(--space-2); align-items:center; color:var(--soft); font-size:11px; }
    .stageRailItem { position:relative; }
    .stageRailItem[data-stage="specification"] { border-top:2px solid var(--stage-spec); }
    .stageRailItem[data-stage="orchestration"] { border-top:2px solid var(--stage-control); }
    .stageRailItem[data-stage="delivery"] { border-top:2px solid var(--stage-proof); }
    @media (max-width:840px) { table { min-width:0; } table thead { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; } table,table tbody,table tr,table td { display:block; width:100%; } table tr { padding:8px 0; border-bottom:1px solid var(--line); } table td { display:grid; grid-template-columns:minmax(88px,34%) minmax(0,1fr); gap:10px; border:0; padding:6px 8px; overflow-wrap:anywhere; } table td::before { content:attr(data-label); color:var(--soft); font-size:11px; font-weight:800; } .wide { overflow-x:visible; } [data-workspace]::before { position:static; display:block; margin-bottom:8px; } }
    @media (max-width:520px) { html,body { max-width:100%; overflow-x:hidden; } .content,.topbar,.loginPanel,.loginHero { padding-left:14px; padding-right:14px; } .row { flex-direction:column; align-items:stretch; } .stats { grid-template-columns:1fr; } .operationZone { align-items:stretch; } .operationZone > * { width:100%; max-width:none; } button,.tag,.themeBtn,.sidebar nav a,.quickActions button,.tableActions button,.workspaceState button { min-height:44px; } .toolbarRight,.sectionHead { min-width:0; max-width:100%; } .toolbarRight > * { max-width:100%; } pre,code,textarea,input,select { max-width:100%; overflow-wrap:anywhere; } }

.skipLink{position:fixed;z-index:100;left:14px;top:10px;padding:10px 14px;border-radius:7px;background:var(--primary-hover);color:#101318;transform:translateY(-150%);transition:transform .18s}.skipLink:focus{transform:translateY(0)}
.srOnly{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
:focus-visible{outline:3px solid var(--primary-hover);outline-offset:3px}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{box-shadow:0 0 0 3px var(--primary-soft)}
.topbarTitle{display:flex;align-items:center;gap:12px;min-width:0}.mobileNavToggle{display:none}.tableRegion{min-width:0}.workspaceState[role="status"]{outline:none}
button[disabled],button[aria-disabled="true"]{cursor:wait;opacity:.58}
@media (max-width:840px){.mobileNavToggle{display:inline-flex;align-items:center;justify-content:center}.sidebar{display:none}.sidebar[data-open="true"]{display:block}.topbarTitle{width:100%}.topbar{position:sticky;top:0}.toolbarRight{width:100%}.toolbarRight button,.themeBtn,.tag,.quickActions button,.tableActions button,.workspaceState button{min-height:44px}.sidebar nav a{min-height:44px}.search{min-height:44px}}
@media (forced-colors:active){button,a,input,textarea,select,section{forced-color-adjust:auto}.controlGrid{display:none}}

/* UI worker: focused form, navigation and narrow-screen refinements */
.passwordField{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:stretch}.passwordField input{min-width:0}.passwordToggle{white-space:nowrap}.loginStatus:empty{display:none}.fieldError[hidden]{display:none}.fieldError:not(:empty){padding-left:10px;border-left:2px solid var(--danger)}[aria-invalid="true"]{border-color:var(--danger)!important;box-shadow:0 0 0 3px rgba(255,107,107,.14)!important}
.searchField{flex:0 1 280px;min-width:min(100%,220px)}.searchField label{margin:0 0 5px;font-size:12px;font-weight:700;color:var(--muted)}.searchField .search{max-width:none}.sectionHead>div:first-child{min-width:0}
main,.content,.grid,.row,.sectionHead,.toolbar,.toolbarRight,.tableRegion,[data-view],[data-workspace]{min-width:0}img,svg{max-width:100%}pre,code,td,th{overflow-wrap:anywhere}.viewHidden{display:none!important}[data-view] h2:focus{outline:none}[data-view] h2:focus-visible{outline:3px solid var(--primary-hover);outline-offset:5px;border-radius:4px}
@media (max-width:840px){html,body{max-width:100%;overflow-x:clip}button,input,select{min-height:44px}textarea{min-height:96px}.sectionHead{flex-wrap:wrap}.searchField{flex:1 1 100%;width:100%;min-width:0}.searchField .search{width:100%}.passwordField{grid-template-columns:minmax(0,1fr) auto}.sidebar[data-open="true"]{position:fixed;z-index:70;inset:0 auto 0 0;display:block;width:min(86vw,320px);height:100dvh;overflow-y:auto;box-shadow:24px 0 70px rgba(0,0,0,.45)}.topbar{max-width:100%}.toolbarRight{justify-content:flex-start}.tableActions{max-width:100%}}
@media (max-width:440px){.passwordField{grid-template-columns:1fr}.passwordToggle{width:100%}.toolbarRight>.muted,.toolbarRight>.pill{display:none}.tableActions>*{flex:1 1 auto}.topbarTitle>div{min-width:0}.topbarTitle h1,.topbarTitle span{overflow-wrap:anywhere}}
