/* Structure and native element defaults. Theme and shared component skins live in studio-design.css. */
*{box-sizing:border-box;letter-spacing:0}
html{scroll-behavior:auto}
body{margin:0;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI Variable","Segoe UI","PingFang SC","Microsoft YaHei UI","Microsoft YaHei",sans-serif;font-size:14px;line-height:1.6}
button,input,textarea,select{font:inherit}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
button,a{touch-action:manipulation}
button{cursor:pointer}button:disabled{cursor:not-allowed}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,summary:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
h1,h2,h3,h4,p{margin-top:0}h2{font-size:19px;line-height:1.5}h3{font-size:16px}small{font-size:12px}
svg{flex-shrink:0;vertical-align:middle}img{max-width:100%}[hidden]{display:none!important}
.skip-link{position:fixed;top:-100px;left:20px;z-index:100;padding:10px}.skip-link:focus{top:10px}
.sidebar{position:fixed;inset:0 auto 0 0;display:flex;flex-direction:column;z-index:20;overflow:auto}
.brand{display:flex;align-items:center;font-weight:650;min-width:0}.brand span{min-width:0;overflow-wrap:anywhere}.brand small{display:block;font-weight:400;overflow-wrap:anywhere}
.sidebar nav{flex:1}.nav-link{display:flex;align-items:center;gap:11px}.nav-link span{min-width:0;overflow-wrap:anywhere}.nav-link i{margin-left:auto}
.studio-menu summary{list-style:none}.studio-menu summary::-webkit-details-marker{display:none}
.studio-menu-title{display:flex;align-items:center;gap:11px;min-height:44px;padding:10px 11px;cursor:pointer;user-select:none}
.menu-chevron{margin-left:auto;transition:transform .18s}.studio-menu[open] .menu-chevron{transform:rotate(90deg)}
.studio-submenu .nav-link{width:100%;text-align:left}.studio-submenu .nav-link svg{display:none}
.workspace-status{display:flex;align-items:center;gap:8px}.workspace-status>i{border-radius:50%}
.topbar{display:flex;justify-content:space-between;align-items:center;gap:15px;position:sticky;top:0;z-index:10}
.top-context{flex-wrap:nowrap}.top-location{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-location b{color:var(--text)}
.top-tools{flex-wrap:nowrap;flex:none}.topbar .row{flex-wrap:nowrap}.topbar .top-context{min-width:0;overflow:hidden}.credit-pill{display:flex;align-items:center;gap:7px;padding:6px 12px;font-size:12px}
.icon-button{display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;background:transparent}
.profile-button{display:flex;align-items:center;text-align:left;background:transparent;border:0;color:var(--text)}.profile-button small{display:block}.avatar{display:grid;place-items:center;flex:none}
.mobile-menu{display:none}.page-content{margin:auto;min-width:0}.page-header{display:flex;justify-content:space-between}.page-subtitle{max-width:760px}
.muted{color:var(--muted)}.card,.panel{padding:22px;min-width:0;border:1px solid var(--line)}.card h2,.panel h2{margin-bottom:14px}.card h3{margin-bottom:8px}
.button{line-height:1.5;white-space:normal;overflow-wrap:anywhere;text-align:center}
.toolbar,.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.toolbar{gap:8px}.grow{flex:1;min-width:0}.stack{display:flex;flex-direction:column;gap:16px}
.field{display:flex;flex-direction:column;min-width:0;color:var(--text)}.input,.textarea,.select{width:100%;padding:10px 12px;line-height:1.6}.textarea{resize:vertical;min-height:130px}.select{cursor:pointer}
.form-grid,.split{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.split{gap:20px}
.chip{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid var(--line);border-radius:6px;background:transparent;color:var(--muted);line-height:1.5;cursor:pointer}.chip:hover,.chip.selected{color:var(--accent);border-color:var(--accent);background:var(--soft)}
.tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid var(--line);padding-bottom:12px;margin-bottom:20px}.tabs button{border:1px solid transparent;background:transparent;color:var(--muted);padding:8px 14px}.tabs button:hover{color:var(--accent);background:var(--soft)}.tabs button.active{color:var(--accent);background:var(--soft);border-color:color-mix(in srgb,var(--accent) 24%,var(--line));box-shadow:inset 0 1px #ffffff18;font-weight:600}
.stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:24px}.metric{padding:20px;border:1px solid var(--line);background:var(--surface)}.metric>span,.metric>small{display:block;color:var(--muted)}.metric strong{font-weight:550;display:block;margin:7px 0 2px}.metric em{color:var(--success);font-style:normal}
.table-wrap{overflow:auto;border:1px solid var(--line)}.data-table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}.data-table th{font-weight:500;background:var(--surface-2);padding:12px 16px}.data-table td{padding:15px 16px;border-top:1px solid var(--line)}.data-table tbody tr:hover{background:var(--soft)}
.badge{display:inline-block;border:1px solid var(--line)}.badge.success,.success{color:var(--success)}.badge.warning,.warning{color:var(--warning)}.badge.error,.error{color:var(--danger)}.badge.success{background:color-mix(in srgb,var(--success) 8%,transparent);border-color:color-mix(in srgb,var(--success) 20%,transparent)}.badge.warning{background:color-mix(in srgb,var(--warning) 8%,transparent);border-color:color-mix(in srgb,var(--warning) 20%,transparent)}.badge.error{background:color-mix(in srgb,var(--danger) 8%,transparent);border-color:color-mix(in srgb,var(--danger) 20%,transparent)}
.empty{display:grid;place-content:center;text-align:center;min-height:200px;padding:36px 24px;color:var(--muted);gap:8px}.empty h3{color:var(--text);font-weight:600;margin:0}.empty p{max-width:46ch;margin:0 auto;line-height:1.8}
.section-title{display:flex;align-items:center;justify-content:space-between;margin:26px 0 16px;gap:12px}.section-title h2{margin:0}.section-title p{margin:0;color:var(--muted)}
.compact-list{list-style:none;margin:0;padding:0}.compact-list li{display:flex;justify-content:space-between;padding:14px 0;border-top:1px solid var(--line);gap:15px}.compact-list li small{color:var(--muted)}.compact-list li strong{font-weight:500;color:var(--accent)}
.mono{font-family:ui-monospace,Consolas,monospace}.progress-track{height:5px;background:var(--surface-2);border-radius:5px;overflow:hidden}.progress-track span{height:100%;background:var(--accent);display:block;border-radius:5px}
.studio-back{display:flex;align-items:center;gap:8px;white-space:nowrap;padding:8px 0;margin-right:20px;color:var(--muted)}.studio-back svg{transform:rotate(180deg)}.studio-back:hover{color:var(--accent)}
.studio-heading{display:flex;align-items:center;gap:13px}.studio-heading b{font-weight:550;max-width:300px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.studio-heading small{color:var(--muted);white-space:nowrap}
.workspace-studio .mobile-menu{display:none}
.workspace-studio .n-wizard .page-header a.ghost[data-route="/novels"],.workspace-studio .s-module .page-header .button.ghost[data-route="/scripts"],.workspace-studio .d-worknav .d-library-link,.workspace-studio .d-worknav .d-project-name{display:none}
.login-page{min-height:100dvh;position:relative;overflow:hidden;background:var(--bg)}
#toast-region{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:8px;z-index:1000;pointer-events:none}.qj-toast{font-size:13px}
*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}*::-webkit-scrollbar{width:6px;height:6px}*::-webkit-scrollbar-thumb{background:var(--line);border-radius:6px}*::-webkit-scrollbar-track{background:transparent}
@media(max-width:850px){.split{grid-template-columns:1fr}.stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.sidebar{transform:translateX(-100%);transition:transform .2s}.sidebar.mobile-open{transform:translateX(0)}.mobile-menu{display:flex}.top-section,.breadcrumb-slash{display:none}.top-location>b{display:inline}.credit-pill span{display:none}.profile-button .chevron{display:none}.page-header{flex-direction:row;align-items:center;flex-wrap:wrap}.form-grid{grid-template-columns:1fr}.studio-back{margin-right:6px}.studio-back span{max-width:105px;overflow:hidden;text-overflow:ellipsis}.studio-heading{flex-direction:column;align-items:flex-start;gap:0}.studio-heading b{max-width:110px}.studio-heading small{font-size:11px}}

/* Shared shell: tools stay in the navigation; creative surfaces own the viewport. */
body .sidebar{width:208px;padding:0 12px;overflow:hidden;background:var(--surface);border-right:1px solid var(--line)}
body .sidebar>nav{min-height:0;overflow:auto;overscroll-behavior:contain;padding:4px 0 12px}
body .shell-brand-row{display:flex;align-items:center;gap:4px;min-height:64px;flex-shrink:0}
body .shell-brand-row .brand{flex:1;gap:9px;margin:0;padding:0;font-size:17px;min-height:44px}
body .shell-collapse{width:32px;height:36px;min-width:32px;border-radius:8px;color:var(--muted)}
body .sidebar .nav-group{margin-bottom:13px}
body .sidebar .nav-group>p{padding:9px 10px 4px;margin:0;color:var(--muted);font-size:11px}
body .sidebar .nav-link,body .sidebar .studio-menu-title{min-height:42px;padding:9px 10px;border-radius:9px;font-size:13px;gap:10px}
body .sidebar .nav-link.active{box-shadow:inset 0 1px #ffffff18;background:var(--accent);color:var(--on-accent)}
body .studio-menu-title>.qj-icon:last-child{margin-left:auto;width:12px;transition:transform .16s}
body .studio-menu[open]>.studio-menu-title>.qj-icon:last-child{transform:rotate(90deg)}
body .sidebar-bottom{padding:10px 0;border-top:1px solid var(--line);margin:0;flex-shrink:0}
body .sidebar .workspace-status{min-height:28px;padding:0 10px;font-size:11px}
body .shell-sidebar-tools{display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin-bottom:8px}
body .shell-sidebar-tools .credit-pill{justify-content:flex-start;width:100%;border:0;background:transparent;padding:7px 9px}
body .shell-sidebar-tools .profile-button{min-height:38px;padding:4px 8px;font-size:12px;gap:8px}
body .shell-sidebar-tools .shell-utilities{padding:0;border:0;gap:4px}
body .shell-sidebar-tools .icon-button{height:36px;width:36px;min-width:36px}
body .workspace{margin-left:208px;--chrome-height:56px}
body .workspace-studio{margin-left:0}
body .topbar{height:56px;min-height:56px;padding:0 22px;background:var(--surface);border-bottom:1px solid var(--line);backdrop-filter:none}
body .topbar .top-location>b{font-size:14px}
body .page-content{max-width:none;padding:22px 24px 30px}
body .sidebar-compact{width:64px;padding:0 8px}
body .sidebar-compact .shell-brand-row{flex-direction:column;gap:0;justify-content:center;min-height:88px}
body .sidebar-compact .brand{flex:none;justify-content:center;min-height:42px}
body .sidebar-compact .brand>span,body .sidebar-compact .nav-link>span,body .sidebar-compact .nav-group>p,body .sidebar-compact .nav-link>i{display:none}
body .sidebar-compact .nav-link{padding:10px 0;justify-content:center;min-height:44px;width:46px}
body .sidebar-compact .nav-group{margin-bottom:12px}
body .sidebar-compact .workspace-status{padding:0;justify-content:center}
body .sidebar-compact .workspace-status>span,body .sidebar-compact .credit-pill>b,body .sidebar-compact .credit-pill>span,body .sidebar-compact .profile-button>span:last-child{display:none}
body .sidebar-compact .shell-sidebar-tools{justify-content:center;gap:5px}
body .sidebar-compact .credit-pill,body .sidebar-compact .profile-button{justify-content:center;width:40px;min-width:40px;padding:6px}
body .sidebar-compact .shell-utilities{flex-direction:column}
body .workspace-compact{margin-left:64px}
body .workspace-bench{--chrome-height:0px}
body .workspace-bench>.topbar{display:none}
body .workspace-bench>.page-content{padding:0;height:100dvh;overflow:hidden}
body .page-content:has(.g-home){padding:24px;min-height:calc(100dvh - 56px)}
@media(max-width:650px){
  body .sidebar,body .sidebar-compact{width:232px;max-width:calc(100vw - 52px);padding:0 12px;z-index:70;box-shadow:16px 0 60px #0003}
  body .sidebar-compact .shell-brand-row{flex-direction:row;min-height:64px}
  body .sidebar-compact .brand{flex:1;justify-content:flex-start}
  body .sidebar-compact .brand>span,body .sidebar-compact .nav-link>span,body .sidebar-compact .nav-group>p,body .sidebar-compact .workspace-status>span{display:block}
  body .sidebar-compact .nav-link{width:100%;justify-content:flex-start;padding:10px}
  body .sidebar-compact .shell-sidebar-tools{justify-content:flex-start;flex-direction:row}
  body .sidebar-compact .shell-utilities{flex-direction:row}
  body .workspace,body .workspace-compact,body .workspace-studio{margin-left:0}
  body .topbar{padding-inline:12px}
  body .page-content{padding:16px 12px 22px}
  body .page-content:has(.g-home){padding:18px 14px}
  body .sidebar .nav-link,body .sidebar .studio-menu-title,body .shell-collapse{min-height:44px}
}
@media(max-width:650px){
  body .workspace{--chrome-height:56px}
  body .topbar,body .workspace-studio .topbar{display:flex;grid-template-rows:none;height:56px;min-height:56px;padding:6px 10px;gap:6px}
  body .topbar .top-context{grid-row:auto;flex:1;min-width:0;overflow:hidden;gap:6px!important}
  body .topbar .top-tools{grid-row:auto;flex:none;width:auto;min-width:0;gap:2px!important}
  body .topbar .top-location>b,body .topbar .studio-heading b{font-size:15px!important;line-height:1.4}
  body .topbar .studio-heading{display:block;min-width:0;flex:1}
  body .topbar .studio-back{padding:0;flex:0 0 36px}
  body .topbar .studio-back .shell-back-mark{min-width:36px;width:36px;height:44px}
  body .topbar .credit-pill{margin:0;padding:0 4px;gap:4px;max-width:100px;min-height:44px}
  body .topbar .credit-pill>b{font-size:11px;max-width:66px;overflow:hidden;text-overflow:ellipsis}
  body .topbar .credit-pill>span{display:none}
  body .topbar .shell-utilities{gap:0}
  body .topbar .profile-button{min-width:36px;width:36px;min-height:44px;padding:0}
  body .workspace-bench{--chrome-height:0px}
}
