/* JG Brand Studio · editor chrome (dark, Rev B). Artwork styles live in artboard.css. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #000; color: var(--on-black); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; user-select: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--blue-on-black); outline-offset: 2px; }
.hidden { display: none !important; }
h1, h2, h3, h4 { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* ===== Shell ===== */
.app-shell { display: grid; grid-template-rows: 52px 1fr; height: 100vh; height: 100dvh; width: 100vw; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.top-bar { background: #000; border-bottom: 1px solid #242928; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; gap: 10px; z-index: 100; min-width: 0; }
.top-left, .top-center, .top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-left .wm { font-size: 19px; color: var(--on-black); flex-shrink: 0; }
.badge-rev { font: 400 9px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: 4px 7px; border: 1px solid #2e3433; color: var(--blue-on-black); border-radius: 2px; white-space: nowrap; }
.doc-title-input { background: transparent; border: 1px solid transparent; color: var(--on-black); font: 600 13.5px/1 var(--sans); padding: 6px 8px; border-radius: var(--rad); width: 240px; min-width: 120px; }
@media (hover: hover) { .doc-title-input:hover { border-color: #2e3433; } }
.doc-title-input:focus { border-color: var(--blue-on-black); background: var(--panel); outline: none; }
.save-state { font: 400 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ash-on-black); white-space: nowrap; }
.save-state.dirty { color: #e5bf6f; }
.password-form { display:grid; gap:10px; }
.password-form label { font-weight:600; font-size:13px; }
.password-form input:not([hidden]) { width:100%;padding:12px;border:1px solid #454d4b;border-radius:4px;background:#000;color:var(--on-black);font:16px var(--sans); }
.password-form p { font-size:13px;color:var(--ash-on-black); }
.password-form #passwordResult { min-height:22px;color:var(--on-black); }
.password-form .primary { justify-content:center;padding:13px; }
.doc-title-input { width: clamp(100px, 13vw, 220px); min-width: 80px; }
@media (max-width: 1480px) { .top-left .badge-rev, .top-left .save-state { display: none; } }

.tb-btn { font: 500 12px/1 var(--sans); background: var(--panel); color: var(--on-black); border: 1px solid #2b302f; padding: 7px 11px; border-radius: var(--rad); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (hover: hover) { .tb-btn:hover { background: var(--raised); border-color: #454d4b; } }
.tb-btn:disabled { opacity: .4; cursor: not-allowed; }
.tb-btn[aria-pressed="true"] { border-color: var(--blue-on-black); color: var(--blue-on-black); background: #131924; }
.tb-btn.sm { padding: 4px 8px; font-size: 11px; }
.tb-btn.icon { padding: 6px 8px; }
.tb-btn.danger { color: #ff8f73; }
.tb-btn svg { flex-shrink: 0; }
/* Single orange primary button per view (Rev B) */
.tb-btn.primary { background: var(--orange); color: #fff; border-color: var(--orange); font-weight: 700; font-size: 13px; padding: 8px 15px; }
@media (hover: hover) { .tb-btn.primary:hover { background: #d14412; } }

.studio-body { display: grid; grid-template-columns: 68px 320px 1fr; height: 100%; min-height: 0; overflow: hidden; position: relative; }
.studio-body.drawer-closed { grid-template-columns: 68px 0 1fr; }

/* Left rail */
.left-rail { background: #000; border-right: 1px solid #242928; display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 2px; z-index: 40; overflow-y: auto; scrollbar-width: none; }
.rail-btn { width: 58px; padding: 8px 2px; background: transparent; color: var(--ash-on-black); border: 0; border-radius: var(--rad); display: flex; flex-direction: column; align-items: center; gap: 4px; font: 500 10px/1.1 var(--sans); position: relative; }
.rail-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
@media (hover: hover) { .rail-btn:hover { color: var(--on-black); background: var(--panel); } }
.rail-btn[aria-selected="true"] { color: var(--on-black); background: var(--raised); }
.rail-btn[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--orange); border-radius: 0 2px 2px 0; }
.rail-btn .badge { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #e5bf6f; color: #000; font: 700 9px/16px var(--sans); }
.rail-btn .badge.bad { background: #ff8f73; }
.rail-sep { width: 36px; height: 1px; background: #242928; margin: 6px 0; }

/* Drawer */
.left-drawer { background: var(--panel); border-right: 1px solid #242928; display: flex; flex-direction: column; overflow: hidden; z-index: 30; min-width: 0; }
.drawer-header { padding: 12px 14px 10px; border-bottom: 1px solid #222726; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.drawer-header h3 { font: 700 14.5px/1.2 var(--sans); color: var(--on-black); }
.drawer-search { margin: 10px 14px 0; }
.drawer-search input { width: 100%; background: #060808; border: 1px solid #2e3433; border-radius: 4px; padding: 7px 10px; font-size: 12.5px; }
.drawer-content { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 18px; }
.drawer-sec-title { font: 400 9.5px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--blue-on-black); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.drawer-note { border-top: 1px solid #242928; padding-top: 12px; font-size: 12px; color: #c4ccc9; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl-card { background: #080a0a; border: 1px solid #262c2b; border-radius: var(--rad); padding: 10px; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--on-black); transition: border-color .15s ease, transform .15s ease; position: relative; }
@media (hover: hover) { .tpl-card:hover { border-color: var(--blue-on-black); transform: translateY(-1px); } }
.tpl-card .tpl-preview { height: 68px; border-radius: 2px; background: #161a1a; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,.06); text-align: center; }
.tpl-card .tpl-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tpl-card .tpl-name { font: 600 11.5px/1.25 var(--sans); }
.tpl-card .tpl-sub { font: 400 8.5px/1.2 var(--mono); color: var(--ash-on-black); text-transform: uppercase; }
.tpl-card .card-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 3px; border: 0; background: rgba(0,0,0,.7); color: #ff8f73; display: none; }
@media (hover: hover) { .tpl-card:hover .card-x { display: block; } }
.elem-btn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.elem-tile { background: #080a0a; border: 1px solid #262c2b; border-radius: var(--rad); padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 400 8.5px/1.1 var(--mono); text-transform: uppercase; color: var(--ash-on-black); }
@media (hover: hover) { .elem-tile:hover { border-color: var(--blue-on-black); color: var(--on-black); background: var(--raised); } }
.elem-tile svg { width: 26px; height: 26px; color: var(--on-black); }
.empty-note { font-size: 12.5px; color: var(--ash-on-black); padding: 12px; border: 1px dashed #2e3433; border-radius: 4px; text-align: center; }
.dropzone { border: 1px dashed #3a4140; border-radius: 6px; padding: 18px 12px; text-align: center; color: #c4ccc9; font-size: 12.5px; }
.dropzone.over { border-color: var(--blue-on-black); background: #0d1218; }

/* Layers */
.layer-list { display: flex; flex-direction: column; gap: 2px; }
.layer-row { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 6px; padding: 6px 6px; border-radius: 4px; border: 1px solid transparent; background: #080a0a; font-size: 12px; }
@media (hover: hover) { .layer-row:hover { border-color: #2e3433; } }
.layer-row.sel { border-color: var(--blue-on-black); background: #0d1218; }
.layer-row .lt { white-space: nowrap; overflow: hidden; font: 400 9px/1 var(--sans); color: var(--ash-on-black); text-transform: uppercase; }
.layer-row .ln { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row .la { display: flex; gap: 2px; }
.layer-row .la button { width: 24px; height: 24px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--ash-on-black); border-radius: 3px; font-size: 12px; }
@media (hover: hover) { .layer-row .la button:hover { background: var(--raised); color: var(--on-black); } }
.layer-row .la button[aria-pressed="true"] { color: var(--orange); }
.layer-row.is-hidden .ln { opacity: .45; text-decoration: line-through; }

/* QA */
.qa-summary { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.qa-ok { padding: 16px; border: 1px solid #22402d; background: #08130c; color: #8fcfa6; border-radius: 4px; font-size: 13px; }
.qa-item { border: 1px solid #2e3433; border-left: 3px solid #e5bf6f; border-radius: 4px; padding: 10px 12px; background: #080a0a; display: grid; gap: 6px; }
.qa-item.error { border-left-color: #ff8f73; }
.qa-item.info { border-left-color: var(--blue-on-black); }
.qa-item b { font-size: 12.5px; }
.qa-item p { font-size: 12px; color: #c4ccc9; }
.qa-item .qa-meta { font: 400 8.5px/1.2 var(--mono); color: var(--ash-on-black); text-transform: uppercase; letter-spacing: .08em; }
.qa-item .qa-actions { display: flex; gap: 6px; }

/* Canvas area */
.canvas-area { display: grid; grid-template-rows: 48px 1fr 44px; background: #070808; height: 100%; overflow: hidden; position: relative; min-width: 0; }
.context-bar { background: var(--panel); border-bottom: 1px solid #242928; padding: 0 12px; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: thin; z-index: 25; white-space: nowrap; }
.ctx-group { display: flex; align-items: center; gap: 5px; padding-right: 9px; border-right: 1px solid #262b2a; flex-shrink: 0; }
.ctx-group:last-child { border-right: 0; }
.ctx-label { font: 400 9px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ash-on-black); }
.ctx-input, .ctx-select { background: #060808; color: var(--on-black); border: 1px solid #2e3433; border-radius: 3px; padding: 5px 7px; font: 500 12px/1 var(--sans); }
.ctx-input[type="number"] { width: 62px; }
.ctx-input:focus, .ctx-select:focus { outline: 2px solid var(--blue-on-black); }
.color-dot { width: 22px; height: 22px; border-radius: 3px; border: 1px solid rgba(255,255,255,.25); padding: 0; position: relative; flex-shrink: 0; }
.color-dot[aria-pressed="true"] { outline: 2px solid var(--blue-on-black); outline-offset: 2px; }
.icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; background: #060808; border: 1px solid #2e3433; border-radius: 3px; color: var(--on-black); padding: 0; }
@media (hover: hover) { .icon-btn:hover { background: var(--raised); } }
.icon-btn[aria-pressed="true"] { border-color: var(--blue-on-black); color: var(--blue-on-black); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.canvas-viewport { overflow: auto; position: relative; background-color: #070808; background-image: radial-gradient(#1c2120 1px, transparent 1px); background-size: 20px 20px; touch-action: none; }
.canvas-viewport.panning { cursor: grab; }
.canvas-viewport.panning * { cursor: grab !important; }
.pages { display: flex; flex-direction: column; align-items: center; padding: 40px 40px 120px; gap: 36px; min-width: min-content; }
.page-wrapper { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.page-bar { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 400 10px/1 var(--mono); color: var(--ash-on-black); text-transform: uppercase; letter-spacing: .1em; }
.page-bar .pt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-wrapper.active .page-bar .pt { color: var(--on-black); }
.page-bar-actions { display: flex; gap: 4px; flex-shrink: 0; }
.page-bar-actions button { background: var(--panel); color: var(--ash-on-black); border: 1px solid #292e2d; border-radius: 2px; padding: 4px 7px; font: 400 9.5px/1 var(--mono); }
@media (hover: hover) { .page-bar-actions button:hover { color: var(--on-black); border-color: var(--on-black); } }
.artboard-frame { position: relative; }
.artboard.studio { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 24px 64px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.08); }
.page-wrapper.active .artboard.studio { box-shadow: 0 24px 64px rgba(0,0,0,.85), 0 0 0 2px var(--blue-on-black); }
.artboard.studio.show-grid::after { content: ""; position: absolute; inset: 48px; border: 1px dashed rgba(232,80,26,.45); background-image: linear-gradient(90deg, rgba(31,50,96,.12) 1px, transparent 1px); background-size: calc(100% / 6) 100%; pointer-events: none; z-index: 900; }
.bleed-guide { position: absolute; inset: 0; pointer-events: none; z-index: 901; outline: 1px dashed rgba(255,143,115,.0); }
.show-safe .bleed-guide { box-shadow: inset 0 0 0 24px rgba(232,80,26,.06); outline: 1px dashed rgba(232,80,26,.5); outline-offset: -24px; }

/* Interactive elements */
.artboard.studio .cv-el { cursor: move; touch-action: none; }
@media (hover: hover) { .artboard.studio .cv-el:hover { outline: 1px dashed rgba(31,50,96,.55); } }
@media (hover: hover) { .artboard.studio.dark-bg .cv-el:hover { outline-color: rgba(143,168,218,.6); } }
.artboard.studio .cv-el.selected { outline: 2px solid var(--blue) !important; z-index: 800; }
.artboard.studio.dark-bg .cv-el.selected { outline-color: var(--blue-on-black) !important; }
.artboard.studio .cv-el.locked { cursor: default; }
.artboard.studio .cv-el.locked.selected { outline-style: dashed !important; }
.artboard.studio .cv-el.editing { cursor: text; user-select: text; outline: 2px solid var(--orange) !important; z-index: 850; }
.cv-el [contenteditable="true"] { outline: none; cursor: text; user-select: text; }
.artboard.studio .cv-el.hidden-el { opacity: .25 !important; outline: 1px dotted #888; }
.rh, .rot { display: none; position: absolute; z-index: 860; }
.rh { width: 10px; height: 10px; background: #fff; border: 2px solid var(--blue); border-radius: 2px; touch-action: none; }
.cv-el.selected.single:not(.editing):not(.locked) .rh, .cv-el.selected.single:not(.editing):not(.locked) .rot { display: block; }
.rh.nw { top: -6px; left: -6px; cursor: nwse-resize; } .rh.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.rh.sw { bottom: -6px; left: -6px; cursor: nesw-resize; } .rh.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.rh.e { top: 50%; right: -6px; margin-top: -8px; height: 16px; cursor: ew-resize; } .rh.w { top: 50%; left: -6px; margin-top: -8px; height: 16px; cursor: ew-resize; }
.rh.s { bottom: -6px; left: 50%; margin-left: -8px; width: 16px; cursor: ns-resize; } .rh.n { top: -6px; left: 50%; margin-left: -8px; width: 16px; cursor: ns-resize; }
.rot { top: -34px; left: 50%; margin-left: -9px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); cursor: grab; touch-action: none; }
.rot::after { content: ""; position: absolute; left: 7px; top: 16px; width: 1px; height: 14px; background: var(--blue); }
.snap-x, .snap-y { position: absolute; background: var(--orange); pointer-events: none; z-index: 950; display: none; }
.snap-x { top: 0; bottom: 0; width: 1px; } .snap-y { left: 0; right: 0; height: 1px; }
.marquee { position: absolute; border: 1px solid var(--blue-on-black); background: rgba(143,168,218,.12); pointer-events: none; z-index: 960; display: none; }
.size-tip { position: fixed; z-index: 400; pointer-events: none; background: #101413; color: #e3f1ec; border: 1px solid #2e3433; border-radius: 3px; padding: 3px 6px; font: 400 10px/1 var(--mono); display: none; }

/* Float pill */
.float-pill { position: absolute; display: none; background: #101413; color: #E3F1EC; border: 1px solid #2e3433; border-radius: 4px; padding: 3px; gap: 2px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.45); z-index: 99; white-space: nowrap; }
.float-pill button { background: transparent; color: #E3F1EC; border: 0; padding: 5px 7px; font: 500 11px/1 var(--sans); border-radius: 2px; }
.float-pill .toolbar-icon { vertical-align: middle; }
@media (hover: hover) { .float-pill button:hover { background: #262c2b; } }
@media (hover: hover) { .float-pill button.del:hover { color: #ff7a5c; } }

/* Bottom bar */
.bottom-bar { background: #000; border-top: 1px solid #242928; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 400 10.5px/1 var(--mono); color: var(--ash-on-black); z-index: 40; min-width: 0; }
.bottom-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
#statusReadout { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoom-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.zoom-controls input[type="range"] { width: 110px; accent-color: var(--orange); }

/* Context menu */
.ctx-menu { position: fixed; z-index: 500; min-width: 210px; background: #101413; border: 1px solid #2e3433; border-radius: 6px; padding: 4px; box-shadow: 0 16px 40px rgba(0,0,0,.6); display: none; }
.ctx-menu button { width: 100%; display: flex; justify-content: space-between; gap: 20px; background: transparent; border: 0; color: var(--on-black); padding: 7px 10px; border-radius: 4px; font-size: 12.5px; text-align: left; }
@media (hover: hover) { .ctx-menu button:hover:not(:disabled) { background: var(--raised); } }
.ctx-menu button:disabled { opacity: .35; cursor: default; }
.ctx-menu button kbd { font: 400 10px var(--mono); color: var(--ash-on-black); }
.ctx-menu hr { border: 0; border-top: 1px solid #262b2a; margin: 4px 2px; }

/* Modals */
.modal-back { position: fixed; inset: 0; z-index: 600; background: rgba(0,0,0,.72); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-back.open { display: flex; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid #2e3433; border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,.7); display: flex; flex-direction: column; }
.modal.wide { width: min(1040px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #262b2a; }
.modal-head h2 { font: 700 18px/1.2 var(--sans); }
.modal-body { padding: 18px 20px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #262b2a; }
.field { display: grid; gap: 6px; }
.field > span { font: 400 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ash-on-black); }
.field input[type="text"], .field input[type="number"], .field select { background: #060808; border: 1px solid #2e3433; border-radius: 4px; padding: 8px 10px; }
.seg { display: inline-flex; border: 1px solid #2e3433; border-radius: 4px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: #c4ccc9; padding: 8px 12px; font-size: 12.5px; }
.seg button[aria-pressed="true"] { background: var(--on-black); color: #000; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.progress { height: 6px; background: #1c2021; border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue-on-black); transition: width .2s; }

/* Project manager */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.proj-card { background: #080a0a; border: 1px solid #262c2b; border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.proj-card.current { border-color: var(--blue-on-black); }
.proj-card .thumb { height: 120px; background: #161a1a; display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid #262c2b; }
.proj-card .thumb img { max-width: 100%; max-height: 100%; }
.proj-card .info { padding: 10px; display: grid; gap: 3px; }
.proj-card .info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-card .info span { font: 400 9px/1.3 var(--mono); color: var(--ash-on-black); text-transform: uppercase; }
.proj-card .acts { display: flex; gap: 4px; padding: 0 10px 10px; flex-wrap: wrap; }
.proj-new { border: 1px dashed #3a4140; background: transparent; color: #c4ccc9; border-radius: 6px; min-height: 200px; display: grid; place-items: center; font-size: 13px; }
@media (hover: hover) { .proj-new:hover { border-color: var(--blue-on-black); color: var(--on-black); } }

/* Shortcuts table */
.kbd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kbd-table td { padding: 6px 4px; border-bottom: 1px solid #1f2423; }
.kbd-table td:first-child { font: 400 11px var(--mono); color: var(--blue-on-black); white-space: nowrap; width: 40%; }

/* Manual */
.manual-modal-body .card { background: #080a0a; border: 1px solid #262b2a; padding: 18px; border-radius: 4px; }
.manual-modal-body .card p { font-size: 13px; color: #c4ccc9; margin-top: 6px; }

/* Toast */
.lock-toast { position: fixed; bottom: 58px; left: 50%; transform: translateX(-50%) translateY(20px); background: #101413; color: #E3F1EC; border: 1px solid #2e3433; border-left: 4px solid var(--blue-on-black); padding: 10px 16px; border-radius: 4px; font: 500 12.5px/1.4 var(--sans); box-shadow: 0 14px 36px rgba(0,0,0,.75); z-index: 700; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: min(640px, 90vw); }
.lock-toast.warn { border-left-color: var(--orange); }
.lock-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Narrow windows */
@media (max-width: 1100px) {
  .badge-rev, .save-state { display: none; }
  .doc-title-input { width: 160px; }
  .tb-btn .lbl { display: none; }
}

/* ===== Print engine: only #printRoot prints ===== */
#printRoot { display: none; }
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
  .print-sheet { position: relative; overflow: hidden; break-after: page; page-break-after: always; }
  .print-sheet:last-child { break-after: auto; page-break-after: auto; }
}

/* ===== Poster Studio ===== */
.studio-switch { margin-right: 6px; border-color: #2b302f; flex-wrap: nowrap; flex-shrink: 0; }
.studio-switch button { padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.studio-switch button[aria-pressed="true"] { background: var(--on-black); color: #000; }
.seg.mini button { padding: 4px 9px; font-size: 11.5px; }
.color-input { width: 26px; height: 24px; padding: 0; border: 1px solid rgba(255,255,255,.3); border-radius: 3px; background: none; cursor: pointer; flex-shrink: 0; }
.color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 2px; }
.art-hint { display: none; }
.artboard.studio .el-art { container-type: size; }
.artboard.studio .art-hint { display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: .5em 1em; border: 1px dashed rgba(255,255,255,.45); border-radius: 4px; background: rgba(0,0,0,.45); color: rgba(255,255,255,.8); font: 500 max(9px, 2.6cqmin)/1.3 var(--sans); white-space: nowrap; pointer-events: none; }
.artboard.studio .cv-el.selected .art-hint { display: none; }
.guides-pop { min-width: 220px; }
.ex-size { font: 400 11px/1.5 var(--mono); color: var(--blue-on-black); }
@media (max-width: 1500px) { .badge-rev { display: none; } .tb-btn .lbl { display: none; } }
@media (max-width: 1280px) { .studio-switch button { padding: 6px 8px; } .save-state { display: none; } }

/* ===== Foldables & touch (Galaxy Z Fold: inner ≈ 880 px wide, cover ≈ 410 px wide) ===== */
#moreBtn { display: none; }
/* Inner screen / tablets: the drawer floats over the canvas instead of squeezing it. */
@media (max-width: 1100px) {
  .studio-body, .studio-body.drawer-closed { grid-template-columns: 64px 1fr; }
  .left-drawer { position: absolute; left: 64px; top: 0; bottom: 0; width: min(340px, calc(100vw - 96px)); z-index: 70; box-shadow: 18px 0 48px rgba(0,0,0,.65); }
  .studio-body.drawer-closed .left-drawer { display: none; }
  .rail-btn { width: 56px; }
  .doc-title-input { width: 140px; }
  .top-center .tb-btn:not(.icon) .lbl { display: none; }
}
/* Cover screen / phones: tab bar at the bottom, drawer becomes a bottom sheet, extra tools move into ⋯. */
@media (max-width: 640px) {
  .app-shell { grid-template-rows: 48px 1fr; }
  .top-bar { padding: 0 8px; gap: 6px; }
  .top-left .wm, .badge-rev, .save-state, .doc-title-input,
  #toggleGridBtn, #toggleSafeBtn, #guidesBtn, #projectsBtn, #shortcutsBtn, #manualBtn { display: none; }
  #moreBtn { display: inline-flex; }
  .top-left { display: none; }
  .top-center { flex: 1; gap: 6px; }
  .top-right { gap: 6px; }
  .studio-switch button { padding: 6px 8px; font-size: 11.5px; }
  .tb-btn.primary { padding: 8px 12px; font-size: 12.5px; }
  .studio-body, .studio-body.drawer-closed { grid-template-columns: 1fr; grid-template-rows: 1fr calc(58px + env(safe-area-inset-bottom)); grid-template-areas: "canvas" "rail"; }
  .canvas-area { grid-area: canvas; grid-template-rows: 46px 1fr; }
  .bottom-bar { display: none; }
  .left-rail { grid-area: rail; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 4px 4px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid #242928; gap: 0; }
  .rail-btn { width: auto; min-width: 54px; flex: 1 0 auto; padding: 6px 4px; }
  .rail-btn[aria-selected="true"]::before { left: 10px; right: 10px; top: auto; bottom: -4px; width: auto; height: 3px; border-radius: 2px 2px 0 0; }
  .rail-sep { display: none; }
  .left-drawer { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: min(62dvh, 560px); border-radius: 14px 14px 0 0; border-top: 1px solid #2e3433; box-shadow: 0 -18px 48px rgba(0,0,0,.7); }
  .drawer-header::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #3a4140; }
  .drawer-header { position: relative; padding-top: 16px; }
  .pages { padding: 24px 16px 80px; gap: 24px; }
  .page-bar-actions button { padding: 6px 9px; }
  .grid-2 { grid-template-columns: 1fr; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 14px 14px 0 0; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .lock-toast { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
/* Fingers need bigger handles than a mouse. */
@media (pointer: coarse) {
  .rh { width: 18px; height: 18px; border-width: 3px; border-radius: 4px; }
  .rh.nw { top: -11px; left: -11px; } .rh.ne { top: -11px; right: -11px; } .rh.sw { bottom: -11px; left: -11px; } .rh.se { bottom: -11px; right: -11px; }
  .rh.e, .rh.w { margin-top: -14px; height: 28px; } .rh.e { right: -11px; } .rh.w { left: -11px; }
  .rh.n, .rh.s { margin-left: -14px; width: 28px; } .rh.n { top: -11px; } .rh.s { bottom: -11px; }
  .rot { width: 28px; height: 28px; margin-left: -14px; top: -52px; }
  .rot::after { left: 11px; top: 25px; height: 22px; }
  .float-pill button { padding: 9px 10px; font-size: 12.5px; }
  .ctx-menu button { padding: 11px 12px; font-size: 14px; }
  .icon-btn { width: 34px; height: 34px; }
  .ctx-input, .ctx-select { padding: 7px 8px; }
  .color-dot { width: 28px; height: 28px; }
}
/* Fold inner screen at larger display sizes (~750 px): keep the top bar on one line. */
@media (max-width: 800px) {
  .doc-title-input, .save-state, .badge-rev { display: none; }
  .top-bar { padding: 0 10px; gap: 6px; }
  .top-center, .top-right { gap: 5px; }
}
.os-library-grid > .tpl-card { content-visibility: auto; contain-intrinsic-size: auto 130px; }
.os-library-grid > .tpl-card[hidden] { display: none; }
#osKind { margin: 8px 0 14px 8px; padding: 6px 10px; color: var(--on-black); background: var(--panel); border: 1px solid var(--steel); border-radius: 4px; }
#osKind:focus-visible { outline: 2px solid var(--blue-on-black); outline-offset: 2px; }

/* Mobile-only views are styled in ios.css; these never enter desktop layout. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.mobile-page-picker, .mobile-document, .mobile-page-info, .mobile-tools,
.mobile-inspector, .mobile-canvas-hint, .mobile-library-snap, #mobileLibrarySelect,
.ios-sheet, .ios-backdrop { display: none; }
