/* Darkroom under safelight: warm near-black, amber instrumentation, and one
   surface of true paper white where the image lives. */

:root {
  --ink:      #14120e;
  --panel:    #1c1a15;
  --raised:   #24211a;
  --line:     #322e25;
  --amber:    #e0a032;
  --amber-dim:#8a6620;
  --paper:    #e8e2d4;
  --text:     #d6cfbe;
  --muted:    #8b8375;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --ui:      "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bar-h: 72px;
  --sleeve-h: 132px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute only works through a browser default rule, so any
   author rule setting `display` beats it. Several elements here set display
   for layout and are toggled with `hidden`, so restate it with weight. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

/* ---------- top bar ---------- */

.bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--paper);
}
.brand p {
  margin: 1px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.bar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- buttons ---------- */

.btn {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--raised);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 120ms, background 120ms;
}
.btn:hover:not(:disabled) { border-color: var(--amber-dim); background: #2b2820; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-key { background: var(--amber); border-color: var(--amber); color: #1a1408; font-weight: 600; }
.btn-key:hover:not(:disabled) { background: #eeae3d; border-color: #eeae3d; }

.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.ghost { background: transparent; }

/* ---------- layout ---------- */

main {
  display: flex;
  height: calc(100% - var(--bar-h) - var(--sleeve-h));
}

.panel {
  width: 268px;
  flex: none;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  padding: 18px 18px 28px;
}

.panel-empty { padding-top: 24px; }
.panel-empty p { margin: 0 0 6px; font-size: 14px; }
.dim { color: var(--muted); font-size: 13px; }

.group { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.group h2 {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.row-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.row-btns .btn { font-size: 16px; padding: 7px 0; }

.slider { display: block; margin-bottom: 15px; }
.slider > span { font-size: 13.5px; }
.slider output {
  float: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.slider input { width: 100%; margin: 7px 0 0; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 3px; background: var(--line); border-radius: 2px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--amber); cursor: pointer; border: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--amber); cursor: pointer; border: 0;
}
input[type="range"]:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }

.check { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--amber); width: 15px; height: 15px; }

.note { margin: 14px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }

/* ---------- stage ---------- */

.stage {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  padding: 28px;
  min-width: 0;
  background:
    repeating-linear-gradient(45deg, #17150f 0 10px, #141209 10px 20px);
}

.stage-inner { position: relative; line-height: 0; }

#canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - var(--bar-h) - var(--sleeve-h) - 56px);
  background: var(--paper);
  box-shadow: 0 0 0 8px var(--paper), 0 18px 44px rgba(0,0,0,0.55);
}

.stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage.dragover { background: #1f1a10; }
.stage.dragover .stage-empty { color: var(--amber); }

.crop-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
/* Only one element ever paints the mask: the box's spread shadow when there is
   a selection, this pseudo-element when there isn't. Stacking both double-darkens. */
.crop-layer.no-sel::before { content: ""; position: absolute; inset: 0; background: rgba(10,8,4,0.62); }

.crop-box {
  position: absolute;
  border: 1px solid var(--amber);
  box-shadow: 0 0 0 9999px rgba(10,8,4,0.62);
  display: none;
  cursor: move;
}
.crop-box.on { display: block; }

.crop-box .grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent 33.33%, rgba(224,160,50,0.35) 33.33% calc(33.33% + 1px), transparent calc(33.33% + 1px) 66.66%, rgba(224,160,50,0.35) 66.66% calc(66.66% + 1px), transparent calc(66.66% + 1px)),
    linear-gradient(to bottom, transparent 33.33%, rgba(224,160,50,0.35) 33.33% calc(33.33% + 1px), transparent calc(33.33% + 1px) 66.66%, rgba(224,160,50,0.35) 66.66% calc(66.66% + 1px), transparent calc(66.66% + 1px));
}

/* Handles are 11px visually but carry a 22px transparent hit area, because a
   1px border is not a pointer target anyone can reliably hit. */
.crop-box .h {
  position: absolute;
  width: 11px; height: 11px;
  background: var(--amber);
  border: 1px solid #1a1408;
  box-sizing: border-box;
}
.crop-box .h::after { content: ""; position: absolute; inset: -6px; }
.crop-box .h[data-h="nw"] { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-box .h[data-h="n"]  { top: -6px; left: 50%; margin-left: -5.5px; cursor: ns-resize; }
.crop-box .h[data-h="ne"] { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-box .h[data-h="w"]  { top: 50%; left: -6px; margin-top: -5.5px; cursor: ew-resize; }
.crop-box .h[data-h="e"]  { top: 50%; right: -6px; margin-top: -5.5px; cursor: ew-resize; }
.crop-box .h[data-h="sw"] { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-box .h[data-h="s"]  { bottom: -6px; left: 50%; margin-left: -5.5px; cursor: ns-resize; }
.crop-box .h[data-h="se"] { bottom: -6px; right: -6px; cursor: nwse-resize; }

.crop-bar {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  font-size: 13px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.5);
}

/* ---------- negative sleeve ---------- */

.sleeve {
  height: var(--sleeve-h);
  border-top: 1px solid var(--line);
  background: #100e0a;
  display: flex;
  flex-direction: column;
}

.sprockets {
  height: 13px;
  flex: none;
  background-image: radial-gradient(circle at 8px 50%, var(--ink) 0 3.5px, transparent 3.6px);
  background-size: 22px 100%;
  background-color: #17150f;
}

.frames {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
}

.frame {
  flex: none;
  width: 118px;
  height: 88px;
  position: relative;
  border: 1px solid var(--line);
  background: #0b0a07;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.frame.active { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.frame:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.frame-tag {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3px 5px;
  background: linear-gradient(transparent, rgba(8,6,4,0.94) 45%);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.frame-edits { color: var(--amber); }

.frame-drop {
  position: absolute;
  top: 3px; right: 3px;
  width: 19px; height: 19px;
  border: 0; border-radius: 2px;
  background: rgba(10,8,4,0.8);
  color: var(--text);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms;
}
.frame:hover .frame-drop, .frame-drop:focus-visible { opacity: 1; }
.frame-drop:hover { background: #7a2a1c; }

.sleeve-empty {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 4px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: calc(var(--sleeve-h) + 18px);
  left: 50%; transform: translateX(-50%);
  max-width: 460px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 3px;
  background: var(--panel);
  font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
  z-index: 50;
}
.toast.bad { border-left-color: #d2603f; }

@media (max-width: 900px) {
  .bar { gap: 14px; }
  .panel { width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- history ---------- */

.history { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; }

/* ---------- crop bar additions ---------- */

.inline { display: flex; align-items: center; gap: 7px; }
.inline > span { font-size: 12.5px; color: var(--muted); }

select {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
select:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.crop-size {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  min-width: 108px;
}

/* ---------- export sheet ---------- */

.sheet {
  width: 340px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.sheet::backdrop { background: rgba(8,6,3,0.7); }

.sheet h2 {
  margin: 0 0 20px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--paper);
}

.field { margin-bottom: 18px; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg .btn[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1408;
  font-weight: 600;
}

.hint { margin: 8px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); min-height: 2.6em; }

.readout {
  margin: 0 0 20px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #100e0a;
  font-family: var(--mono);
  font-size: 12px;
}
.readout div { display: flex; justify-content: space-between; gap: 12px; }
.readout div + div { margin-top: 5px; }
.readout dt { color: var(--muted); }
.readout dd { margin: 0; color: var(--amber); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sheet-actions .btn { padding: 8px 15px; }

/* ---------- brush ---------- */

.ink {
  position: absolute;
  left: 0; top: 0;
  cursor: crosshair;
  touch-action: none;
}

.paint-bar {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(0,0,0,0.5);
}
.paint-bar input[type="range"] { width: 92px; }

.swatch {
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  /* Checkerboard shows through when the colour is partly transparent. */
  background-image:
    linear-gradient(45deg, #3a352b 25%, transparent 25%, transparent 75%, #3a352b 75%),
    linear-gradient(45deg, #3a352b 25%, transparent 25%, transparent 75%, #3a352b 75%);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
  position: relative;
}
.swatch::after {
  content: ""; position: absolute; inset: 2px; border-radius: 2px;
  background: var(--sw, #e0a032);
}
.swatch:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

#btn-eraser[aria-pressed="true"] {
  background: var(--amber); border-color: var(--amber); color: #1a1408; font-weight: 600;
}

.wheel-pop {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 200px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}
#wheel { display: block; cursor: crosshair; touch-action: none; border-radius: 50%; }

.inline.vert { display: block; margin-top: 12px; }
.inline.vert > span {
  display: block; margin-bottom: 5px;
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.13em; text-transform: uppercase;
}
.inline.vert input[type="range"] { width: 100%; }

.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 12px; }
.swatches button {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 2px;
  padding: 0; cursor: pointer;
}
.swatches button:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

.hex {
  width: 100%; margin-top: 10px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 3px;
  background: #100e0a; color: var(--amber);
  font-family: var(--mono); font-size: 12px;
  text-align: center; letter-spacing: 0.06em;
}
.hex:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* ---------- scissors ---------- */

.lasso-bar {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(0,0,0,0.5);
}
.lasso-hint {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  min-width: 240px;
}
.lasso-hint.ready { color: var(--amber); }
/* Studio workspace: neutral chrome keeps image color perception consistent. */
:root { --ink:#1b1c1f; --panel:#25262a; --raised:#303238; --line:#41434b; --amber:#8dbbff; --amber-dim:#648cca; --paper:#f0f1f4; --text:#d5d7de; --muted:#999da8; --bar-h:64px; --sleeve-h:110px; }
.bar { gap:18px; }
.brand p { letter-spacing:.04em; }
.workspace-bar { height:46px; display:flex; align-items:center; gap:24px; padding:0 18px; background:#202125; border-bottom:1px solid var(--line); }
.workspace-bar > span { color:var(--muted); font-size:12px; }
.workspace-bar .seg { grid-template-columns:repeat(3,auto); }
.btn.selected, .btn[aria-pressed="true"] { border-color:var(--amber); background:#344665; color:#c4dcff; }
.btn:hover:not(:disabled) { background:#3b3e46; }
.btn-key:hover:not(:disabled) { background:#b0d0ff; }
main { height:calc(100% - var(--bar-h) - var(--sleeve-h) - 46px); }
.tool-rail { order:0; display:flex; flex-direction:column; gap:8px; padding:12px 7px; width:50px; flex:none; background:var(--panel); border-right:1px solid var(--line); }
.tool-rail .btn { padding:6px; font-size:19px; }
#panel { order:2; width:260px; border-left:1px solid var(--line); border-right:0; padding:16px; }
.stage { order:1; overflow:auto; padding:70px 32px 32px; background:#191a1d; align-items:start; }
.stage-inner { margin:auto; max-width:100%; }
#canvas { box-shadow:0 4px 28px #0008; background:repeating-conic-gradient(#ddd 0% 25%,#fff 0% 50%) 0 / 16px 16px; max-height:calc(100vh - var(--bar-h) - var(--sleeve-h) - 155px); }
.view-bar { position:absolute; top:0; left:0; right:0; height:46px; display:flex; align-items:center; gap:12px; padding:8px 16px; background:#232428; border-bottom:1px solid var(--line); z-index:4; font-size:12px; }
#histogram { width:100%; height:70px; background:#1c1d20; border-bottom:1px solid var(--line); }
#document-info { overflow-wrap:anywhere; }
select, input[type="number"] { background:var(--ink); color:var(--text); border:1px solid var(--line); border-radius:3px; padding:5px; font:inherit; }
input:focus-visible, select:focus-visible { outline:2px solid var(--amber); outline-offset:3px; }
@media(max-width:760px) { .brand p, #workspace-hint { display:none; } .bar { padding:0 10px; gap:8px; } .bar-actions { gap:4px; } .bar-actions .btn { padding:7px; font-size:11px; } #panel { width:210px; } .tool-rail { width:42px; padding:8px 4px; } .view-bar { gap:6px; padding:6px; } .view-bar .btn { font-size:10px; } }
@media(max-width:540px) { html,body { overflow:auto; } main { min-height:640px; } #panel { width:180px; } .stage { padding-left:12px; padding-right:12px; } .view-bar { flex-wrap:wrap; height:auto; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none!important; transition:none!important; } }

.workspace-bar .seg .btn[aria-pressed="true"] { background:#344665; color:#c4dcff; border-color:var(--amber); }

.stage-inner { max-width:none; justify-self:start; }
#canvas { max-width:none; max-height:none; }

/* ---------- photoshop-style panels ---------- */

.tool-rail .btn[aria-pressed="true"] { border-color:var(--amber); background:#344665; color:#c4dcff; }
.tool-rail .rail-gap { flex:1; }

details.group > summary {
  list-style:none; cursor:pointer; user-select:none;
  margin:0 0 12px; display:flex; align-items:center; gap:7px;
  font-family:var(--mono); font-size:10px; font-weight:500;
  letter-spacing:.15em; text-transform:uppercase; color:var(--muted);
}
details.group > summary::-webkit-details-marker { display:none; }
details.group > summary::before { content:"▸"; font-size:10px; transition:transform 120ms; }
details.group[open] > summary::before { transform:rotate(90deg); }
details.group > summary:hover { color:var(--text); }
details.group > summary:focus-visible { outline:2px solid var(--amber); outline-offset:3px; }
details.group:not([open]) { padding-bottom:6px; margin-bottom:14px; }
details.group:not([open]) > summary { margin-bottom:0; }

.row-btns.three { grid-template-columns:repeat(3,1fr); }
.row-btns.two { grid-template-columns:1fr 1fr; }
.row-btns.three .btn, .row-btns.two .btn { font-size:12.5px; }
.seg.three { grid-template-columns:repeat(3,1fr); }
.seg.four { grid-template-columns:repeat(4,1fr); margin-bottom:10px; }

.history-list {
  list-style:none; margin:0; padding:4px; max-height:150px; overflow-y:auto;
  background:#1c1d20; border:1px solid var(--line); border-radius:3px;
  font-size:12.5px;
}
.history-list button {
  all:unset; box-sizing:border-box; display:block; width:100%;
  padding:4px 8px; border-radius:2px; cursor:pointer;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.history-list button:hover { background:#3b3e46; }
.history-list button:focus-visible { outline:2px solid var(--amber); outline-offset:-2px; }
.history-list button.current { background:#344665; color:#c4dcff; }
.history-list button.future { color:var(--muted); font-style:italic; }

#curves {
  display:block; width:100%; aspect-ratio:1; cursor:crosshair; touch-action:none;
  background:#1c1d20; border:1px solid var(--line); border-radius:3px;
}
.note.tight { margin-top:8px; }

.filter-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:4px 0 14px; }
.filter-row select { min-width:0; flex:1; }
input[type="color"] {
  width:30px; height:26px; padding:1px 2px; cursor:pointer;
  border:1px solid var(--line); border-radius:3px; background:var(--ink);
}

/* Floating option bars for drag tools, matching the brush and crop bars. */
.tool-bar {
  position:absolute; bottom:16px; left:50%; transform:translateX(-50%);
  display:flex; align-items:center; flex-wrap:wrap; justify-content:center; gap:10px;
  max-width:calc(100% - 32px); padding:9px 12px;
  border:1px solid var(--line); border-radius:3px;
  background:var(--panel); box-shadow:0 10px 26px rgba(0,0,0,.5);
  font-size:12.5px; z-index:5;
}
.tool-bar .check { margin:0; }
.tool-bar input[type="range"] { width:84px; }
.tool-bar .seg { gap:4px; }
.tool-bar .seg .btn { padding:4px 9px; font-size:14px; }
.tool-hint { font-family:var(--mono); font-size:11px; color:var(--muted); }
.paint-bar, .crop-bar, .lasso-bar { z-index:5; }

.view-bar label { display:flex; align-items:center; gap:6px; }
.view-tool { margin-left:auto; color:var(--muted); font-family:var(--mono); font-size:11px; }
.stage.can-pan, .stage.can-pan .ink, .stage.can-pan #canvas, .stage.can-pan .crop-layer { cursor:grab; }
.stage.grabbing, .stage.grabbing * { cursor:grabbing !important; }

.field-label.flush { margin:0; }
.readout dd.bad { color:#ff8b5e; white-space:normal; text-align:right; }

.wide-sheet { width:420px; }
.keys { margin:0 0 18px; font-size:13px; }
.keys div { display:flex; justify-content:space-between; gap:16px; padding:5px 0; border-bottom:1px solid var(--line); }
.keys dt { font-family:var(--mono); font-size:12px; color:var(--amber); }
.keys dd { margin:0; color:var(--text); }

/* ---------- video studio ---------- */

#video-workspace {
  display:grid; height:calc(100% - var(--bar-h) - 46px);
  grid-template-columns:250px minmax(0,1fr) 300px;
  grid-template-rows:minmax(0,1fr) 280px;
}
.vpanel { width:auto; padding:12px 14px; border-right:1px solid var(--line); }
.vinspector { border-right:0; border-left:1px solid var(--line); }
.vhead { display:flex; align-items:center; justify-content:space-between; margin:4px 0 10px; }
.vhead h2 { margin:0; font-family:var(--mono); font-size:10px; font-weight:500; letter-spacing:.15em; text-transform:uppercase; color:var(--muted); }
.vbtns { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:6px 0 12px; }
.vbtns .btn { font-size:12px; padding:6px 6px; }

.bin { list-style:none; margin:0 0 14px; padding:0; display:flex; flex-direction:column; gap:6px; }
.bin-item {
  position:relative; display:grid; grid-template-columns:64px minmax(0,1fr) auto; gap:9px; align-items:center;
  padding:5px; border:1px solid var(--line); border-radius:3px; background:var(--raised); cursor:grab; user-select:none;
}
.bin-item:hover { border-color:var(--amber-dim); }
.bin-item img, .bin-icon { width:64px; height:36px; object-fit:cover; border-radius:2px; background:#111; display:grid; place-items:center; color:var(--muted); font-size:16px; }
.bin-text { min-width:0; display:flex; flex-direction:column; gap:2px; }
.bin-text strong { font-size:12px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bin-text span { font-family:var(--mono); font-size:10px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bin-used { font-family:var(--mono); font-size:10px; color:var(--amber); }
.bin-item.offline { border-color:#7a2a1c; cursor:default; }
.bin-item.offline .bin-text span { color:#ff8b5e; }
.bin-drop { position:absolute; top:3px; right:3px; width:18px; height:18px; padding:0; border:0; border-radius:2px; background:rgba(10,8,4,.8); color:var(--text); cursor:pointer; opacity:0; font-size:12px; line-height:1; }
.bin-item:hover .bin-drop, .bin-drop:focus-visible { opacity:1; }
.bin-drop:hover { background:#7a2a1c; }

.vmonitor { display:flex; flex-direction:column; min-width:0; min-height:0; background:#141518; }
.vview { position:relative; flex:1; min-height:120px; overflow:hidden; }
/* Absolutely placed with auto size and both max limits, so the canvas keeps
   its aspect ratio and fits whichever dimension is tighter. */
#v-canvas { position:absolute; inset:0; margin:auto; max-width:calc(100% - 24px); max-height:calc(100% - 24px); width:auto; height:auto; box-shadow:0 4px 28px #0008; background:#000; }
.v-empty { position:absolute; inset:0; display:grid; place-content:center; text-align:center; color:var(--muted); pointer-events:none; }
.v-empty h2 { color:var(--paper); font-size:24px; font-weight:500; margin:0 0 6px; }
.vtransport { display:flex; align-items:center; gap:8px; padding:8px 12px; border-top:1px solid var(--line); background:var(--panel); font-size:12px; flex-wrap:wrap; }
.vtransport output { font-family:var(--mono); font-size:13px; color:var(--amber); font-variant-numeric:tabular-nums; margin-left:6px; }
.vtransport .dim { font-family:var(--mono); font-size:12px; }
.vtransport .check { margin:0 0 0 8px; }
#v-play { min-width:70px; }
.spacer { flex:1; }
.meter { width:90px; height:6px; border-radius:3px; background:#0d0e10; overflow:hidden; border:1px solid var(--line); }
#v-meter { height:100%; width:0; background:linear-gradient(90deg,#4caf6d,#c9d84a 80%,#e86a4a); transition:width 60ms linear; }

.vinspector .group { padding-bottom:12px; margin-bottom:12px; }
.vfield { display:flex; flex-direction:column; gap:5px; margin:0 0 10px; font-size:12.5px; }
.vfield > span { color:var(--muted); font-size:12px; }
.vfield.inline-field { flex-direction:row; align-items:center; justify-content:space-between; }
.vfield textarea, .vfield input[type="text"] {
  width:100%; resize:vertical; padding:6px 8px; border:1px solid var(--line); border-radius:3px;
  background:var(--ink); color:var(--text); font:inherit; font-size:13px;
}
.vfield input[type="number"] { width:100%; }
.vinspector .slider { margin-bottom:11px; }
.vinspector .slider > span { font-size:12.5px; }
.vscopes canvas { display:block; width:100%; height:auto; background:#0b0c0e; border:1px solid var(--line); border-radius:3px; }

.vtimeline { grid-column:1 / -1; display:flex; flex-direction:column; min-height:0; border-top:1px solid var(--line); background:var(--panel); }
.vtl-bar { display:flex; align-items:center; gap:6px; padding:6px 10px; border-bottom:1px solid var(--line); flex-wrap:wrap; font-size:12px; }
.vtl-bar .seg { gap:4px; }
.vtl-bar #v-zoom { width:110px; }
.vstatus { flex:1; min-width:120px; text-align:right; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.vstatus.bad { color:#ff8b5e; }
.vtl { flex:1; display:flex; min-height:0; }
.vtl-heads { width:96px; flex:none; border-right:1px solid var(--line); background:#202125; }
.vtl-rulerhead { height:24px; border-bottom:1px solid var(--line); }
.vtl-head { height:var(--track-h, 56px); display:flex; align-items:center; padding:0 10px; font-family:var(--mono); font-size:10px; letter-spacing:.06em; color:var(--muted); border-bottom:1px solid var(--line); }
.vtl-scroll { flex:1; overflow-x:auto; overflow-y:hidden; position:relative; }
.vtl-content { position:relative; min-width:100%; height:100%; }
.vtl-ruler { position:absolute; top:0; height:24px; display:block; cursor:pointer; background:#1d1e22; border-bottom:1px solid var(--line); z-index:2; }
.vtl-track { position:relative; height:var(--track-h, 56px); border-bottom:1px solid var(--line); }
.vtl-track:first-of-type { margin-top:24px; }
.vtl-track[data-track="v1"] { background:rgba(141,187,255,.03); }
.vtl-content.razor, .vtl-content.razor .vitem { cursor:crosshair; }

.vitem {
  position:absolute; top:4px; bottom:4px; overflow:hidden; border-radius:3px; cursor:grab;
  border:1px solid #6d8fc2; background:#2e4466 repeat-x left center / auto 100%;
  box-shadow:inset 0 0 0 999px rgba(30,45,70,.45);
}
.vitem.v2.title { background-color:#5b3d7a; border-color:#a885d4; }
.vitem.v2.caption { background-color:#3d5b4c; border-color:#7fc4a0; }
.vitem.v2 { background-color:#5b3d7a; border-color:#a885d4; }
.vitem.a2 { background:#23493a; border-color:#5fb88a; box-shadow:none; }
.vitem.selected { border-color:#fff; box-shadow:inset 0 0 0 999px rgba(30,45,70,.3), 0 0 0 1px #fff; z-index:1; }
.vitem.offline { border-color:#d2603f; background:#4a1d16; }
.vi-label { position:absolute; left:8px; right:8px; top:3px; font-size:11px; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-shadow:0 1px 2px #000; pointer-events:none; }
.vi-label em { color:#ffd27a; font-style:normal; }
.vitem .wave { position:absolute; left:0; right:0; bottom:2px; width:100%; height:calc(100% - 18px); pointer-events:none; }
/* Wide, invisible trim handles: a 1px border is not something anyone can grab. */
.vitem .edge { position:absolute; top:0; bottom:0; width:8px; cursor:ew-resize; z-index:1; }
.vitem .edge.s { left:0; }
.vitem .edge.e { right:0; }
.vitem .edge:hover, .vitem.selected .edge { background:rgba(255,255,255,.25); }
.vtrans {
  position:absolute; top:10px; bottom:10px; z-index:2; cursor:pointer; border-radius:2px;
  background:linear-gradient(to top right, rgba(255,255,255,.75) 49%, transparent 50%), rgba(224,160,50,.85);
  border:1px solid #fff;
}
.vtl-playhead { position:absolute; top:0; bottom:0; width:1px; background:#ff5a4f; z-index:3; pointer-events:none; }
.vtl-playhead::before { content:""; position:absolute; top:0; left:-6px; border:6px solid transparent; border-top:9px solid #ff5a4f; }
.vtl-drop { position:absolute; top:24px; bottom:0; width:2px; margin-left:-1px; background:var(--amber); z-index:4; pointer-events:none; }
body.v-exporting .vtimeline, body.v-exporting .vinspector, body.v-exporting .vbin { pointer-events:none; opacity:.6; }
body.v-exporting #v-cancel { pointer-events:auto; }
body.v-exporting .vtimeline { opacity:1; }

@media (max-width:1100px) {
  #video-workspace { grid-template-columns:200px minmax(0,1fr) 260px; }
}
@media (max-width:760px) {
  #video-workspace { grid-template-columns:1fr; grid-template-rows:auto minmax(260px,1fr) auto 300px; height:auto; min-height:calc(100% - var(--bar-h) - 46px); }
  .vbin, .vinspector { border:0; border-bottom:1px solid var(--line); max-height:320px; }
  .vbin { order:1; } .vmonitor { order:2; } .vinspector { order:3; } .vtimeline { order:4; }
}

/* Editable overlay stack */
.art-layers { margin:12px 0; max-height:240px; overflow:auto; }
.art-row { display:flex; gap:6px; align-items:center; margin:4px 0; }
.art-row .btn { flex:1; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
.art-row .btn[aria-pressed="true"] { border-color:var(--amber); background:#344665; color:#dceaff; }
.art-field { display:flex; flex-direction:column; gap:6px; font-size:12px; margin:10px 0; min-width:0; }
.art-field input:not([type="color"]), .art-field textarea, .art-field select { width:100%; min-width:0; padding:6px; color:var(--text); background:var(--ink); border:1px solid var(--line); border-radius:3px; font:inherit; }
.art-field textarea { resize:vertical; }
#text-properties { border-top:1px solid var(--line); margin-top:14px; }

/* Layer controls share the panel's existing compact form rhythm. */
.layer-section { border-top: 1px solid var(--line, #35383d); padding: 10px 0; margin-top: 8px; }
.layer-section > summary { cursor: pointer; font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.layer-section input[type=number] { min-width: 0; width: 100%; }
.layer-section .check { margin: 8px 0; }
.art-row button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Guides, grid, selection outline and handles drawn over the image. */
.hud { position:absolute; left:0; top:0; pointer-events:none; z-index:2; image-rendering:pixelated; }
.ink { z-index:1; }
.art-row .twisty { flex:0 0 auto; width:22px; padding:4px 0; text-align:center; }
.art-row .btn.clipped { border-left:3px solid var(--amber-dim); }
.art-row .btn.multi[aria-pressed="false"] { border-color:var(--amber-dim); background:#2b2820; }
.align-seg { display:grid; gap:6px; margin-bottom:6px; }
.align-seg .btn { font-size:15px; padding:5px 0; }
.guide-list { list-style:none; margin:8px 0; padding:0; max-height:140px; overflow:auto; font-size:12px; }
.guide-list li { display:flex; align-items:center; gap:6px; margin:4px 0; }
.guide-list li span { flex:0 0 74px; color:var(--muted); }
.guide-list input { flex:1; min-width:0; padding:4px 6px; color:var(--text); background:var(--ink); border:1px solid var(--line); border-radius:3px; font:inherit; }
.guide-list .btn { padding:2px 8px; }
.flush-field { margin:0; }
.tool-bar .seg.four { margin-bottom:0; display:grid; }
/* Fifteen tools no longer fit a short window; let the rail scroll. */
.tool-rail { overflow-y:auto; scrollbar-width:none; }
.tool-rail .btn { flex:none; }

/* ---------- PDF workspace ---------- */

#pdf-workspace {
  display:grid; height:calc(100% - var(--bar-h) - 46px);
  grid-template-columns:240px minmax(0,1fr) 290px;
  grid-template-rows:minmax(0,1fr);
}
#pdf-workspace[hidden] { display:none; }
.ppanel { width:auto; padding:12px 14px; }
.p-tasks { border-right:0; border-left:1px solid var(--line); }
#p-side { margin-bottom:12px; }
.p-page-tools { grid-template-columns:repeat(3,1fr); margin-bottom:8px; }
.p-page-tools .btn { font-size:12px; padding:6px 2px; }
.p-split { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; margin:4px 0; }
.p-split input { width:56px; }
.p-thumbs { list-style:none; margin:12px 0 0; padding:0; display:flex; flex-direction:column; gap:12px; }
.p-thumb { display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer; padding:6px; border:1px solid transparent; border-radius:3px; }
.p-thumb canvas { max-width:100%; background:#fff; box-shadow:0 2px 10px #0007; }
.p-thumb span { font-family:var(--mono); font-size:10px; color:var(--muted); }
.p-thumb.current span { color:var(--amber); }
.p-thumb[aria-selected="true"] { border-color:var(--amber); background:#2b2820; }
.p-thumb.drop-before { box-shadow:0 -3px 0 var(--amber); }
.p-thumb.drop-after { box-shadow:0 3px 0 var(--amber); }
.p-comments, .p-results { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; font-size:12px; }
.p-comments li, .p-results li { padding:7px 8px; border:1px solid var(--line); border-radius:3px; cursor:pointer; background:var(--raised); }
.p-comments li[aria-current="true"] { border-color:var(--amber); }
.p-comments .meta, .p-results .meta { font-family:var(--mono); font-size:10px; color:var(--muted); display:flex; justify-content:space-between; gap:6px; }
.p-comments .body { margin-top:4px; overflow-wrap:anywhere; white-space:pre-wrap; }
.p-comments .reply { margin:4px 0 0 10px; color:var(--muted); }
.p-stage { position:relative; display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; background:#191a1d; }
.p-view-bar { position:static; flex:none; flex-wrap:wrap; height:auto; min-height:46px; }
.p-sep { width:1px; height:20px; background:var(--line); }
.p-pageno { display:flex; align-items:center; gap:5px; }
.p-pageno input { width:52px; }
.p-tabs { display:flex; gap:2px; padding:0 10px; background:#232428; border-bottom:1px solid var(--line); overflow-x:auto; flex:none; }
.p-tabs:empty { display:none; }
.p-tab { display:flex; align-items:center; gap:6px; padding:6px 10px; font-size:12px; border:1px solid transparent; border-bottom:0; border-radius:3px 3px 0 0; cursor:pointer; white-space:nowrap; color:var(--muted); }
.p-tab[aria-selected="true"] { background:#191a1d; border-color:var(--line); color:var(--text); }
.p-tab .x { all:unset; cursor:pointer; padding:0 3px; border-radius:2px; }
.p-tab .x:hover { background:#3b3e46; }
.p-tab .dirty::after { content:" •"; color:var(--amber); }
.p-scroll { position:relative; flex:1; min-height:0; overflow:auto; }
.p-scroll.can-pan, .p-scroll.can-pan * { cursor:grab !important; }
.p-pages { display:flex; flex-direction:column; align-items:center; gap:18px; padding:24px; min-width:min-content; }
.p-page { position:relative; background:#fff; box-shadow:0 4px 24px #0009; flex:none; }
.p-page canvas.p-raster { position:absolute; inset:0; width:100%; height:100%; }
.p-page .p-layer { position:absolute; inset:0; touch-action:none; }
.p-page .p-label { position:absolute; left:0; top:-17px; font-family:var(--mono); font-size:10px; color:var(--muted); }
.p-empty { position:absolute; inset:0; }
.p-hl { position:absolute; background:rgba(255,214,0,.35); pointer-events:none; mix-blend-mode:multiply; }
.p-hl.current { background:rgba(255,120,0,.55); }
.p-sel { position:absolute; background:rgba(60,130,255,.3); pointer-events:none; }
.p-cmt { position:absolute; border:1px dashed transparent; cursor:pointer; }
.p-cmt:hover { border-color:rgba(60,130,255,.6); }
.p-cmt.selected { border:1.5px solid #3c82ff; background:rgba(60,130,255,.06); }
.p-preview { position:absolute; pointer-events:none; border:1.5px dashed #3c82ff; }
.p-field { position:absolute; box-sizing:border-box; border:0; padding:0 2px; margin:0; font:12px/1.2 Helvetica, Arial, sans-serif;
  background:rgba(70,130,255,.13); color:transparent; caret-color:#000; outline:none; resize:none; }
.p-field:hover { background:rgba(70,130,255,.22); }
.p-field:focus { background:#fff; color:#000; box-shadow:0 0 0 2px #3c82ff; }
.p-field[type="checkbox"], .p-field[type="radio"] { appearance:none; cursor:pointer; }
.p-field[type="checkbox"]:focus, .p-field[type="radio"]:focus { background:rgba(70,130,255,.13); }
.p-field[disabled] { background:transparent; cursor:not-allowed; }
.p-editor { position:absolute; z-index:3; min-width:60px; min-height:20px; padding:2px; border:1.5px solid #3c82ff; background:#fffef8; color:#000; font:12px/1.2 Helvetica, Arial, sans-serif; resize:both; }
.p-task-tabs { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; margin-bottom:12px; }
.p-task-tabs .btn { font-size:11.5px; padding:5px 2px; }
.p-task-tabs .btn[aria-pressed="true"], .p-tool-grid .btn[aria-pressed="true"] { border-color:var(--amber); background:#344665; color:#c4dcff; }
.p-tool-grid { display:grid; grid-template-columns:1fr 1fr; gap:5px; margin-bottom:10px; }
.p-tool-grid .btn { font-size:12px; padding:6px 6px; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.p-selected { border-top:1px solid var(--line); margin-top:14px; padding-top:10px; }
.p-selected h3 { margin:0 0 6px; font-family:var(--mono); font-size:10px; font-weight:500; letter-spacing:.15em; text-transform:uppercase; color:var(--muted); }
#p-sig-pad { display:block; width:100%; aspect-ratio:760/240; margin:12px 0; background:#fff; border-radius:3px; touch-action:none; cursor:crosshair; }
#p-sig-mode { margin-top:8px; }
@media (max-width:1100px) { #pdf-workspace { grid-template-columns:200px minmax(0,1fr) 250px; } }
@media (max-width:760px) { #pdf-workspace { grid-template-columns:1fr; grid-template-rows:auto minmax(320px,1fr) auto; height:auto; } }
#p-sig-dialog { width:min(600px, calc(100vw - 32px)); }

/* Workspace chooser and native Office sheet surface. */
.workspace-picker { position:relative; z-index:60; }
.workspace-menu { position:absolute; top:calc(100% + 10px); left:0; width:280px; padding:10px; background:#24262c; border:1px solid #444955; border-radius:10px; box-shadow:0 16px 48px #0008; }
.workspace-menu p { margin:6px 10px 10px; color:var(--muted); font:10px var(--mono); letter-spacing:.14em; }
.workspace-menu .btn { width:100%; display:flex; flex-direction:column; align-items:flex-start; gap:5px; margin:3px 0; padding:12px; text-align:left; }
.workspace-menu small { color:var(--muted); font-size:11px; }
.workspace-menu [aria-pressed=true] { border-color:var(--amber); background:#344665; }
#office-workspace { height:calc(100% - var(--bar-h) - 46px); display:flex; flex-direction:column; min-width:0; }
.o-filebar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; border-bottom:1px solid var(--line); background:var(--panel); }
.o-filebar strong { font-family:var(--display); font-size:18px; }
.o-local { font:9px var(--mono); color:#8bcbb4; margin-left:16px; letter-spacing:.12em; }
.o-filebar .row-btns { display:flex; margin:0; gap:6px; }
.o-filebar .row-btns .btn { padding:7px 12px; font-size:12px; white-space:nowrap; }
.o-empty { margin:auto; padding:30px; text-align:center; }
.o-empty h2 { font:28px var(--display); }
.o-empty p { color:var(--muted); max-width:500px; line-height:1.7; }
#o-editor { display:flex; flex-direction:column; flex:1; min-height:0; }
.o-toolbar { display:flex; gap:6px; padding:10px 14px; align-items:center; flex-wrap:wrap; background:#25272d; border-bottom:1px solid var(--line); }
.o-toolbar label { display:flex; align-items:center; gap:5px; color:var(--muted); font-size:11px; }
.o-toolbar input[type=number] { width:48px; }
.o-toolbar input[type=color] { width:25px; height:25px; padding:0; border:0; }
.o-toolbar select, .o-toolbar input, .o-sheetbar select { background:#191b20; color:var(--text); border:1px solid #414550; border-radius:4px; padding:5px; font:12px var(--ui); }
.o-divider { height:22px; border-left:1px solid #444955; margin:0 4px; }
.o-toolbar [aria-pressed=true] { background:#344665; border-color:var(--amber); }
.o-formula { display:flex; align-items:center; gap:12px; padding:7px 14px; border-bottom:1px solid #cad0d6; background:#f5f7f9; color:#687480; }
.o-formula input { background:white; color:#25313d; border:1px solid #c9d1da; border-radius:4px; padding:6px 9px; font:12px var(--mono); }
#o-address { width:105px; }
#o-input { flex:1; min-width:60px; }
#o-grid { position:relative; flex:1; min-height:120px; overflow:auto; background:#fff; color:#202125; outline:none; }
#o-grid:focus-visible { box-shadow:inset 0 0 0 2px #5b95d4; }
#o-cells { position:absolute; inset:0; pointer-events:none; }
.o-cell, .o-row-head, .o-col-head, .o-corner { position:absolute; overflow:hidden; white-space:nowrap; border-right:1px solid #e0e5ea; border-bottom:1px solid #e0e5ea; padding:4px 7px; font:12px var(--ui); user-select:none; }
.o-cell { pointer-events:auto; cursor:cell; }
.o-cell.o-selected { background-image:linear-gradient(#438cd322,#438cd322); }
.o-cell.o-active { outline:2px solid #397bb6; outline-offset:-2px; z-index:1; }
.o-row-head,.o-col-head,.o-corner { background:#eef1f5; color:#657180; text-align:center; font:11px var(--mono); z-index:2; }
.o-corner { z-index:3; }
.o-sheetbar { display:flex; align-items:center; gap:8px; padding:8px 14px; background:var(--panel); border-top:1px solid var(--line); overflow-x:auto; flex-shrink:0; }
#o-sheets { display:flex; gap:4px; }
#o-sheets .btn, #o-rename-sheet { white-space:nowrap; flex-shrink:0; }
#o-sheets [aria-pressed=true] { color:#a3dbc7; border-color:#609d87; background:#233c35; }
.o-status { display:flex; justify-content:space-between; gap:12px; padding:6px 14px; font:10px var(--mono); color:var(--muted); background:#191b20; min-height:28px; }
.o-status .bad { color:#f39b9b; }
@media(max-width:760px) { .o-filebar { align-items:flex-start; flex-direction:column; padding:10px; } .o-filebar .row-btns { flex-wrap:wrap; } .o-local { display:none; } .o-toolbar { max-height:110px; overflow-y:auto; padding:8px; } .o-status > span:last-child { display:none; } .o-status { flex-wrap:wrap; } }

/* Illustrator — vector art with a native Darkroom control surface. */
#illustrator-workspace { height:calc(100% - var(--bar-h) - 46px); display:flex; flex-direction:column; min-width:0; }
.i-filebar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; background:var(--panel); border-bottom:1px solid var(--line); }
.i-filebar strong { font:18px var(--display); }
.i-filebar > div > span { margin-left:16px; font:9px var(--mono); color:#c6abea; letter-spacing:.12em; }
.i-file-actions { display:flex; align-items:center; gap:6px; }
.i-file-actions .btn { white-space:nowrap; }
#i-editor { flex:1; min-height:0; display:grid; grid-template-columns:70px minmax(0,1fr) 260px; }
.i-empty { margin:auto; text-align:center; padding:30px; }
.i-empty h2 { font:28px var(--display); }
.i-empty p { color:var(--muted); max-width:500px; line-height:1.7; }
.i-tools { padding:10px 6px; display:flex; flex-direction:column; gap:6px; background:var(--panel); border-right:1px solid var(--line); overflow-y:auto; }
.i-tools .btn { padding:7px 2px; font-size:21px; }
.i-tools small { display:block; font-size:9px; margin-top:4px; color:var(--muted); }
.i-tools [aria-pressed=true] { background:#443956; border-color:#b493dc; color:#dec8fa; }
.i-center { min-width:0; min-height:0; display:flex; flex-direction:column; }
.i-viewbar { display:flex; align-items:center; gap:6px; padding:8px 12px; border-bottom:1px solid var(--line); }
.i-spacer { flex:1; }
.i-viewbar output { width:46px; font:11px var(--mono); text-align:center; }
.i-viewbar select { min-width:0; max-width:230px; }
.i-viewbar select, .i-filebar select, .i-inspector input:not([type=checkbox]), .i-inspector textarea, .i-inspector select, .i-field input, .i-fields input:not([type=checkbox]) { background:#191b20; color:var(--text); border:1px solid #414550; border-radius:4px; padding:6px 8px; font:12px var(--ui); min-width:0; width:100%; }
.i-viewbar select, .i-filebar select { width:auto; }
#i-stage { position:relative; flex:1; min-height:180px; overflow:auto; background:radial-gradient(#ffffff0d .8px,transparent .8px) 0 0 / 12px 12px,#303238; padding:40px; outline:none; touch-action:none; }
#i-stage:focus-visible { box-shadow:inset 0 0 0 2px #b493dc; }
#i-board { position:relative; margin:auto; background:white; box-shadow:0 10px 34px #0006; flex-shrink:0; }
#i-art,#i-overlay { position:absolute; inset:0; width:100%; height:100%; display:block; }
#i-art { pointer-events:none; user-select:none; }
#i-overlay { overflow:visible; touch-action:none; }
#i-stage[data-tool=hand] { cursor:grab; }
#i-stage[data-tool=rectangle], #i-stage[data-tool=ellipse], #i-stage[data-tool=pen], #i-stage[data-tool=pencil] { cursor:crosshair; }
#i-stage[data-tool=text] { cursor:text; }
#i-overlay [data-handle] { cursor:nwse-resize; pointer-events:all; }
.i-status { display:flex; justify-content:space-between; gap:12px; padding:8px 12px; font:10px var(--mono); color:var(--muted); background:#191b20; }
.i-status .bad { color:#f39b9b; }
.i-inspector { overflow:auto; padding:8px 14px 20px; background:var(--panel); border-left:1px solid var(--line); }
.i-inspector h2 { margin:16px 0 10px; font:10px var(--mono); text-transform:uppercase; letter-spacing:.13em; color:var(--muted); }
.i-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.i-fields label, .i-field { display:flex; flex-direction:column; gap:5px; font:11px var(--ui); color:var(--muted); }
.i-fields .check { flex-direction:row; align-items:center; }
.i-fields input[type=color] { padding:2px; height:30px; }
.i-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:10px 0; }
.i-actions .btn { padding:6px 4px; font-size:11px; }
.i-field { margin:10px 0; }
.i-inspector details { margin-top:16px; font-size:12px; }
.i-layer { display:flex; gap:3px; margin:4px 0; }
.i-layer .btn { padding:5px; font-size:11px; }
.i-layer-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.i-layer [aria-pressed=true] { background:#443956; border-color:#b493dc; }
#i-new-dialog { max-width:420px; width:calc(100% - 32px); }
@media(max-width:1000px) { #i-editor { grid-template-columns:60px minmax(0,1fr) 220px; } .i-status > span:last-child { display:none; } }
@media(max-width:650px) { .i-filebar { flex-direction:column; align-items:flex-start; padding:10px; } .i-file-actions { flex-wrap:wrap; } #i-editor { grid-template-columns:50px minmax(0,1fr); grid-template-rows:minmax(250px,1fr) 210px; overflow:auto; } .i-inspector { grid-column:1/-1; border-top:1px solid var(--line); } .i-tools small { font-size:8px; } .i-viewbar { flex-wrap:wrap; padding:6px; } .i-viewbar select { width:100%; max-width:none; } #i-stage { padding:20px; } .i-status { font-size:9px; } }
.i-section { border-top:1px solid var(--line); padding:10px 0 4px; }
.i-section:first-child { border-top:0; }
.i-section > summary { cursor:pointer; list-style:none; display:flex; align-items:center; gap:7px; margin:4px 0 10px; font:10px var(--mono); text-transform:uppercase; letter-spacing:.13em; color:var(--muted); }
.i-section > summary::-webkit-details-marker { display:none; }
.i-section > summary::before { content:"▸"; font-size:9px; transition:transform 120ms; }
.i-section[open] > summary::before { transform:rotate(90deg); }
.i-section > summary:hover { color:var(--text); }
.i-section .note { margin:0 0 8px; }
.i-swatches { display:grid; grid-template-columns:repeat(9,1fr); gap:4px; margin:10px 0 6px; }
.i-swatch { aspect-ratio:1; border:1px solid #ffffff2e; border-radius:3px; cursor:pointer; padding:0; }
.i-swatch:hover { outline:2px solid #b493dc; outline-offset:1px; }
.i-swatch.none { background:linear-gradient(to top right,#fff 45%,#e23b3b 45% 55%,#fff 55%); }
.i-align { display:grid; grid-template-columns:repeat(6,1fr); gap:4px; margin-bottom:8px; }
.i-align .btn { padding:5px 0; font-size:14px; }
.i-pair { display:flex; gap:4px; }
.i-pair .btn { flex:1; padding:6px 2px; font-size:11px; }
.i-fields label > .btn { padding:6px 4px; font-size:11px; }
.i-actions.three { grid-template-columns:repeat(3,1fr); }
.i-inspector .btn.wide { width:100%; margin-top:8px; }
.i-layer.current .i-layer-name { border-color:#b493dc66; color:#dec8fa; }
.i-snap { margin:0 6px 0 0; font-size:11px; }
#i-cursor { min-width:70px; text-align:center; }
.i-tools .btn { flex:none; }

/* Document editor — WordCraft pages with a Darkroom ribbon. */
#document-workspace { height:calc(100% - var(--bar-h) - 46px); display:flex; flex-direction:column; min-width:0; }
#document-workspace[hidden] { display:none; }
.d-filebar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 18px; background:var(--panel); border-bottom:1px solid var(--line); }
.d-filebar strong { font:18px var(--display); white-space:nowrap; }
.d-filebar > div > span { margin-left:16px; font:9px var(--mono); color:#9cc3f5; letter-spacing:.12em; }
.d-file-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.d-file-actions .btn { white-space:nowrap; }
.d-file-actions select, .d-ribbon select, .d-ribbon input:not([type=checkbox]):not([type=color]), #d-command-params { background:#191b20; color:var(--text); border:1px solid #414550; border-radius:4px; padding:5px 7px; font:12px var(--ui); min-width:0; }
#d-docs { max-width:190px; }
.d-empty { margin:auto; text-align:center; padding:30px; }
.d-empty h2 { font:28px var(--display); }
.d-empty p { color:var(--muted); max-width:500px; line-height:1.7; }
#d-editor { flex:1; min-height:0; display:flex; flex-direction:column; }
.d-tabs { display:flex; gap:2px; padding:6px 12px 0; background:var(--panel); overflow-x:auto; scrollbar-width:none; }
.d-tab { background:none; border:0; border-bottom:2px solid transparent; color:var(--muted); font:12px var(--ui); padding:6px 12px; cursor:pointer; white-space:nowrap; }
.d-tab:hover { color:var(--text); }
.d-tab[aria-selected=true] { color:#cfe2ff; border-bottom-color:#6ea8f7; }
.d-ribbon { background:var(--panel); border-bottom:1px solid var(--line); }
.d-ribbon > [role=tabpanel] { display:flex; align-items:stretch; gap:0; padding:8px 8px 4px; overflow-x:auto; min-height:92px; }
.d-ribbon > [role=tabpanel][hidden] { display:none; }
.d-group { display:flex; flex-direction:column; gap:5px; padding:0 10px; border-right:1px solid var(--line); flex-shrink:0; }
.d-group:last-child { border-right:0; }
.d-group > div { display:flex; align-items:center; gap:4px; }
.d-group > small { margin-top:auto; text-align:center; font:9px var(--mono); text-transform:uppercase; letter-spacing:.12em; color:var(--muted); padding-top:2px; }
.d-group .btn.sm { padding:4px 8px; min-width:28px; white-space:nowrap; }
.d-group [aria-pressed=true] { background:#233650; border-color:#6ea8f7; color:#cfe2ff; }
.d-group label { display:flex; align-items:center; gap:4px; font:11px var(--ui); color:var(--muted); white-space:nowrap; }
.d-group input[type=number] { width:58px; }
#d-size { width:56px; }
#d-font { width:150px; }
#d-style { width:150px; }
#d-find, #d-replace, #d-link, #d-hf-text, #d-comment, #d-caption-text, #d-watermark { width:150px; }
.d-color { position:relative; font-weight:700; color:var(--text)!important; }
.d-color input { width:26px; height:24px; padding:1px; border:1px solid #414550; border-radius:4px; background:#191b20; }
#d-stage { position:relative; flex:1; min-height:200px; overflow:auto; background:#3a3c42; padding:28px 32px 48px; cursor:text; }
#d-pages { display:flex; flex-direction:column; align-items:center; gap:22px; width:max-content; min-width:100%; }
.d-page { position:relative; background:white; box-shadow:0 2px 3px #0003, 0 10px 30px #0005; flex-shrink:0; }
.d-page canvas { position:absolute; inset:0; width:100%; height:100%; display:block; pointer-events:none; }
.d-overlay { position:absolute; inset:0; pointer-events:none; }
.d-sel { position:absolute; background:#3b82f655; mix-blend-mode:multiply; }
.d-caret { position:absolute; width:1.5px; margin-left:-.75px; background:#111; visibility:hidden; }
#d-stage.typing .d-caret { visibility:visible; animation:d-blink 1.06s steps(1) infinite; }
@keyframes d-blink { 50% { opacity:0; } }
#d-input { position:absolute; left:0; top:0; width:2px; height:16px; padding:0; border:0; margin:0; opacity:0; resize:none; overflow:hidden; white-space:pre; font-size:16px; caret-color:transparent; pointer-events:none; }
.d-status { display:flex; justify-content:space-between; gap:12px; padding:6px 14px; font:10px var(--mono); color:var(--muted); background:#191b20; min-height:28px; }
.d-status .bad { color:#f39b9b; }
#d-close-hf { padding:2px 10px; font-size:11px; margin-right:auto; }
.d-commands { gap:12px!important; max-height:260px; }
.d-command-list { display:flex; flex-direction:column; gap:6px; width:340px; flex-shrink:0; min-height:0; }
#d-command-results { overflow-y:auto; min-height:0; flex:1; display:flex; flex-direction:column; gap:2px; max-height:200px; }
.d-command { text-align:left; background:#1d1f24; border:1px solid transparent; border-radius:4px; color:var(--text); padding:5px 8px; cursor:pointer; font:12px var(--ui); }
.d-command small { display:block; color:var(--muted); font:10px var(--mono); margin-top:2px; }
.d-command:hover, .d-command[aria-selected=true] { border-color:#6ea8f7; background:#233650; }
.d-command-detail { flex:1; min-width:260px; display:flex; flex-direction:column; gap:6px; font-size:12px; }
.d-command-detail p { margin:4px 0; color:var(--muted); line-height:1.5; }
.d-command-detail code { display:block; font:11px var(--mono); color:#cfe2ff; white-space:pre-wrap; max-height:64px; overflow:auto; }
#d-command-params { font:12px var(--mono); min-height:44px; resize:vertical; }
#d-command-output { margin:0; font:11px var(--mono); color:var(--muted); white-space:pre-wrap; max-height:70px; overflow:auto; }
@media(max-width:760px) { .d-filebar { flex-direction:column; align-items:flex-start; padding:10px; } .d-file-actions { justify-content:flex-start; } .d-filebar > div > span { display:none; } #d-stage { padding:14px 10px 30px; } .d-commands { flex-direction:column; max-height:none; } .d-command-list { width:auto; } .d-status > span:last-child { font-size:9px; } }
