/* Dock and work drawer */
:root {
  --binder-ink: var(--print-ink);
  --binder-label: var(--print-ink-muted);
  --folder-paper: var(--paper);
}
.tabs {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 3px;
  width: fit-content;
  max-width: calc(100% - 2 * var(--outer));
  margin: 0 auto 10px;
  padding: 4px 8px 6px;
  overflow-x: auto;
  background: linear-gradient(#866143, var(--walnut));
  border: 1px solid #63452e;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px #c19b65, 0 3px #543e2a, 0 7px 18px #69493332;
}
.tabs button {
  --tool-ink: #463728;
  --tool-face: #d4b479;
  --tool-light: #fff3cf;
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  flex: 0 0 auto;
  gap: 1px;
  min-width: clamp(67px, 6.4vw, 104px);
  min-height: 61px;
  padding: 1px 8px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #3b291d23;
  color: #fff1d5;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
@media (min-width: 1000px) {
  .tabs { translate: min(2vw, 24px) 0; }
}
.tabs button:hover { background: #3524164d; }
.tabs button[aria-current] {
  color: var(--print-ink);
  background: linear-gradient(#fff3d4, #ead19d);
  border-color: #dabb83;
  box-shadow: inset 0 0 0 1px #fff5d9, 0 2px 2px #39281759;
  font-weight: 750;
}
.tabs button:focus-visible { outline-color: #ffe7ad; outline-offset: -3px; }
.tabs button[aria-current]:focus-visible { outline-color: var(--shell-focus); }
.tabs .index-icon {
  width: 45px;
  height: 36px;
  fill: none;
  stroke: var(--tool-ink);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 #2e211766);
  transition: transform var(--motion);
}
.tabs button[aria-current] .index-icon { transform: translateY(-2px); }
@media (prefers-reduced-motion: no-preference) {
  .tabs button:hover .index-icon { transform: translateY(-3px); }
  .tabs button:active .index-icon { transform: translateY(1px); }
}
.tabs .tool-face { fill: var(--tool-face); }
.tabs .tool-light { fill: var(--tool-light); }
.tabs [data-t="studio"] { --tool-face: #a7c0a2; }
.tabs [data-t="work"] { --tool-face: #c88f60; }
.tabs [data-t="ceo"] { --tool-face: #a9bca5; }
.tabs [data-t="chat"] { --tool-face: #e2a995; }
.tabs [data-t="company"] { --tool-face: #c5a35f; }
.tabs [data-t="rules"] { --tool-face: #93b0a6; }
.tabs [data-t="log"] { --tool-face: #d39a85; }
.tabs .n {
  position: absolute;
  inset: 4px max(3px, calc(50% - 31px)) auto auto;
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  min-height: 17px;
  padding-inline: 4px;
  border: 1px solid #fff3dc;
  border-radius: 99px;
  color: var(--paper);
  background: var(--bad);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .tabs .index-icon { transition: none; }
}

.workspace {
  --workspace-gutter: clamp(14px, 1.35vw, 22px);
  position: relative;
  padding-block: 7px;
  border: 1px solid #b99b66;
  border-inline-start: 4px solid #99754c;
  border-radius: 5px 8px 8px 5px;
  background: var(--folder-paper);
  color: var(--binder-ink);
  box-shadow: 0 3px #b28d5d, 0 8px 18px #69493322;
  font: 400 15px/1.55 var(--shell-font);
}
.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 8px;
  align-items: center;
  flex: none;
  margin: 0 var(--workspace-gutter) 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--paper-rule);
}
.workspace:not([data-tab="detail"]) .workspace-header {
  display: flex;
  justify-content: flex-end;
  margin-block: 0;
  padding: 0;
  border: 0;
}
.workspace[data-tab="chat"] .workspace-header {
  position: absolute;
  z-index: 1;
  inset-block-start: 8px;
  inset-inline-end: var(--workspace-gutter);
  margin: 0;
}
.workspace-title {
  margin: 0;
  font-size: clamp(26px, 2.25vw, 34px);
  font-weight: 700;
  line-height: 1.13;
  letter-spacing: -.05em;
}
.workspace-subtitle {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  color: var(--binder-label);
}
.workspace-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: fit-content;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--binder-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.workspace-action:hover, .workspace-action:active { background: var(--shell-hover); }
#paneBack {
  grid-column: 1;
  grid-row: 1;
  margin: -4px 0 8px -8px;
  padding-inline: 6px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--print-accent);
}
#paneBack:hover, #paneBack:active { background: var(--shell-hover); }
#paneBack svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.workspace-title { grid-column: 1; grid-row: 1; overflow-wrap: anywhere; }
#drawerClose {
  grid-column: 2;
  grid-row: 1;
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: transparent;
}
#drawerClose svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
#drawerClose:hover { background: var(--shell-hover); }
#chatJump {
  align-self: flex-end;
  min-height: 36px;
  margin: 4px var(--workspace-gutter) 0;
  font-size: 13px;
}
.workspace-header:has(#paneBack:not([hidden])) .workspace-title { grid-row: 2; }
.workspace :focus-visible {
  outline: 2px solid var(--shell-focus);
  outline-offset: 2px;
}
.workspace .pane {
  padding-inline: var(--workspace-gutter);
  scrollbar-color: #a9936c transparent;
}
.workspace .pane:focus-visible { outline-offset: -2px; }
.tabs ::selection, .workspace ::selection { color: var(--print-ink); background: var(--shell-selection); }

.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane {
  --workspace-action: var(--accent);
  --workspace-surface: #fff8e7;
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane :is(.runbox, .tk) {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-inline-start: 3px double #ab7657;
  border-radius: 2px 6px 6px 2px;
  background: var(--workspace-surface);
  line-height: 1.55;
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .runbox {
  background: var(--soft);
  color: var(--binder-ink);
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane > .empty {
  padding: 0;
  background: transparent;
  color: var(--binder-label);
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .tk.cur { border-inline-start-color: var(--workspace-action); }
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane :is(.sec, .tk h3 em) {
  color: var(--workspace-action);
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane :is(.plain, .mcheck) {
  border: 0;
  border-radius: 4px;
  background: var(--workspace-surface);
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .plain.see { background: var(--soft); }
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .plain small { color: var(--workspace-action); }
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane input[type="text"] {
  min-height: 44px;
  border-color: var(--paper-rule);
  border-radius: 5px;
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .b {
  min-height: 44px;
  border-color: var(--workspace-action);
  border-radius: 5px;
  background: var(--workspace-action);
  color: #fff;
  white-space: normal;
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .b.ghost {
  border-color: var(--paper-rule);
  background: var(--paper);
  color: var(--workspace-action);
}
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .b:not(.ghost, :disabled):hover { background: var(--mast-ink); }
.workspace:is([data-tab="ceo"], [data-tab="work"], [data-tab="rules"], [data-tab="log"]) .pane .b.ghost:not(:disabled):hover { background: var(--shell-hover); }
.workspace .pane :is(a:not(.b), .mline .mini) { color: var(--print-accent); }
.workspace .pane .b[aria-disabled="true"] { opacity: .65; }

.ledger-log {
  --ledger-time: 8ch;
  margin: 0;
  padding: 4px 10px 12px;
  list-style: none;
  border: 1px solid var(--paper-rule);
  border-radius: 2px 6px 6px 2px;
  background: #fff8e7;
}
.ledger-log .ev {
  display: grid;
  grid-template-columns: var(--ledger-time) minmax(0, 1fr);
  gap: 14px;
  padding: 9px 0;
  font-size: 14px;
}
.ledger-log time {
  position: relative;
  padding-inline-start: 1px;
}
.ledger-log time::after {
  position: absolute;
  inset: -9px -7px -9px auto;
  border-inline-end: 1px solid #ab765777;
  content: "";
}

.workspace .pane:has(.manual-intro, .profile-manual) {
  --manual-scroll-track: var(--soft);
  margin: 0 6px 12px;
  padding-inline: calc(var(--workspace-gutter) - 6px);
  padding-block-end: 16px;
  border-radius: 0;
  scroll-padding-block: 8px 16px;
  scrollbar-gutter: stable;
  scrollbar-color: var(--binder-label) var(--manual-scroll-track);
}
@supports selector(::-webkit-scrollbar) {
  .workspace .pane:has(.manual-intro, .profile-manual) { scrollbar-color: auto; }
  .workspace .pane:has(.manual-intro, .profile-manual)::-webkit-scrollbar { width: 10px; }
  .workspace .pane:has(.manual-intro, .profile-manual)::-webkit-scrollbar-track {
    background: var(--manual-scroll-track);
    border-radius: 5px;
  }
  .workspace .pane:has(.manual-intro, .profile-manual)::-webkit-scrollbar-thumb {
    background: var(--binder-label);
    border-radius: 5px;
  }
}
.mline .lbtn { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-block-start: 6px; }
.mline .mini { min-width: 44px; min-height: 44px; padding-inline: 8px; }
.workspace .mline {
  padding: 10px 10px 6px;
  border: 0;
  border-block-end: 1px solid var(--paper-rule);
  border-radius: 0;
  background: #fff8e7;
}
.workspace .mline.star { background: #fff0ca; }
.mline .kind0 { color: var(--binder-label); background: var(--soft); }
.mline .kind0.mine { color: var(--print-accent); background: #f4e2cd; }
.workspace .mline .mini { border-radius: 4px; background: var(--paper); font-size: 12px; }
.workspace .mline .mini:hover { background: var(--shell-hover); }

.directory { color: var(--binder-ink); }
.directory-total {
  display: flex;
  flex-wrap: wrap;
  row-gap: 7px;
  margin: 0 0 17px;
  padding: 11px 8px;
  border-block: 1px solid var(--paper-rule);
  background: #eee2c5;
}
.directory-total > div {
  min-width: 68px;
  padding-inline: 13px;
  border-inline-start: 1px solid var(--line);
}
.directory-total > div:first-child { border: 0; padding-inline-start: 0; }
.directory-total dt { color: var(--binder-label); font-size: 13px; }
.directory-total dd {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.directory-total .directory-error :is(dt, dd) { color: var(--bad); }
.directory-sheet { display: grid; gap: 18px; }
.directory-team {
  --directory-accent: #ecce9a;
  --badge-edge: #a0664a;
  display: grid;
  gap: 5px;
}
.directory-team[data-area="editing"] { --directory-accent: #e9d8af; --badge-edge: #99703d; }
.directory-team[data-area="production"] { --directory-accent: #dfe4bc; --badge-edge: #586d47; }
.directory-team[data-area="proofing"] { --directory-accent: #ebcbb3; --badge-edge: #97604a; }
.directory-team h3, .directory-queue h3 {
  margin: 0;
  padding-block-end: 4px;
  border-bottom: 1px solid var(--paper-rule);
  color: var(--binder-ink);
  font-size: 15px;
  line-height: 1.4;
}
.directory-team h3 span { margin-left: 4px; color: var(--binder-label); font-size: 13px; font-weight: 400; }
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 182px), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.directory-grid > li { min-width: 0; }
.directory-person {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 8px;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 1px 9px;
  width: 100%;
  height: 100%;
  min-height: 78px;
  padding: 8px 12px 8px 9px;
  border: 1px solid var(--paper-rule);
  border-inline-start: 3px solid var(--badge-edge);
  border-radius: 4px 8px 8px 4px;
  background: #fff8e7;
  box-shadow: 0 2px 0 #69493318;
  color: var(--binder-ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.directory-person::after {
  grid-area: 1 / 3 / 3 / 4;
  width: 6px;
  height: 6px;
  border: solid var(--print-accent);
  border-width: 1.5px 1.5px 0 0;
  content: "";
  transform: rotate(45deg);
}
.directory-person:hover, .directory-person:focus-visible { border-color: var(--badge-edge); background: #fff2d5; }
.directory-person .usagi-portrait, .directory-person .av {
  display: grid;
  grid-area: 1 / 1 / 3 / 2;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid #92734b68;
  border-radius: 4px;
  background-color: var(--directory-accent);
}
.directory-person .av { font-size: 25px; font-weight: 600; line-height: 1; }
.directory-identity { display: grid; align-self: end; gap: 2px; word-break: keep-all; }
.directory-identity b { font-size: 16px; line-height: 1.3; }
.directory-identity small { color: var(--binder-label); font-size: 13px; line-height: 1.3; }
.directory-state {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-top: 5px;
  color: var(--binder-label);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.directory-state::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.directory-state.is-active { color: var(--ok); font-weight: 600; }
.directory-state.is-active::before { background: currentColor; }
.directory-state.is-error { color: var(--bad); font-weight: 600; }
.directory-state.is-error::before { background: currentColor; }
.workspace-staff-row {
  width: 100%;
  min-height: 44px;
  padding: 7px 5px;
  border: 0;
  border-bottom: 1px solid var(--paper-rule);
  border-radius: 0;
  background: #fff8e7;
  color: inherit;
  font: inherit;
  text-align: start;
}
.workspace .pane .workspace-staff-row:hover { background: #fff0d1; }
.directory-empty { margin: 0; }
.directory-queue { margin-top: 20px; padding: 11px 12px; border: 1px solid var(--paper-rule); background: #fff8e7; }
.directory-queue p { margin: 6px 0; }
.directory-reteam {
  min-height: 44px;
  margin-top: 20px;
  padding: 6px 14px;
  border: 1px solid var(--paper-rule);
  border-radius: 5px;
  background: #fff8e7;
  color: var(--binder-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.directory-reteam:hover:not(:disabled) { border-color: var(--print-accent); background: var(--shell-hover); }
.directory-reteam:disabled { opacity: .6; cursor: default; }

#scene [data-role="ceo"] { pointer-events: none; }
#scene [data-job-id] { cursor: pointer; }
#scene [data-job-id][data-selected] > .person-tag { visibility: visible; }
#sceneActions .hs[aria-current="true"] rect { fill: #dfeadf; stroke: #496957; }
#sceneActions .scene-staff-target { outline: 0; }
#sceneActions .scene-staff-target:focus-visible rect { stroke: var(--shell-focus); stroke-width: 2px; }
.workspace[data-tab="detail"] .pane :is(.cgrid, .kanban) { grid-template-columns: minmax(0, 1fr); }
.workspace[data-tab="detail"] .pane .chiprow button { min-height: 44px; }
.profile { display: grid; gap: 19px; word-break: keep-all; }
.profile > section {
  padding: 12px 14px 15px;
  border-block: 1px solid var(--paper-rule);
  background: #fff8e7;
}
.profile h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.35; font-weight: 700; }
.profile p { margin: 0; }
.profile p + p { margin-top: 4px; }
.profile-state {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--paper-rule);
  border-inline-start: 4px solid #8b5c37;
  border-radius: 4px 8px 8px 4px;
  background: #ebdebd;
  box-shadow: 0 2px 0 #69493318;
}
.profile-state > div { min-width: 0; }
.profile-state h3 { margin: 0 0 2px; color: var(--binder-label); font-size: 13px; }
.profile-state p { line-height: 1.35; }
.profile-state :is(.usagi-portrait, .profile-initial) {
  flex: none;
  width: clamp(70px, 6.9vw, 94px);
  height: clamp(70px, 6.9vw, 94px);
  border: 1px solid #92734b9c;
  border-radius: 5px;
  background-color: #fff1ce;
}
.profile-state .profile-initial { display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.profile-chat { margin-top: 8px; border-color: var(--paper-rule); border-radius: 5px; }
.profile-meta { color: var(--binder-label); }
.profile-activity {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.profile-activity li { display: flex; align-items: baseline; gap: 10px; }
.profile-activity time {
  flex: none;
  color: var(--binder-label);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.profile-rule summary {
  min-height: 44px;
  padding: 9px 3px;
  border-top: 1px solid var(--paper-rule);
  color: var(--binder-ink);
  font-weight: 600;
  cursor: pointer;
}
.profile-rule summary:hover { background: var(--shell-hover); }
.profile-rule small { margin-inline-start: 4px; color: var(--binder-label); font-weight: 400; }
.profile-rule > div { padding: 0 3px 10px; }
.profile-rule ul { margin: 0; padding-inline-start: 18px; }
.profile-rule p + .workspace-action { margin-block-start: 7px; }
.profile .mline { padding: 10px; font-size: 14px; }
.profile-editor { display: grid; gap: 6px; }
.profile-editor label { color: var(--binder-label); font-size: 14px; }
.profile-editor input {
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--paper-rule);
  border-radius: 9px;
  padding: 6px 8px;
  background: var(--paper);
  color: inherit;
  font: inherit;
  font-size: 16px;
}
.profile-editor .row { margin: 0; }
.profile-save { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.profile-save:not(:disabled):hover { background: var(--mast-ink); }
.profile-save:disabled, .workspace-action:disabled { opacity: .65; cursor: default; }

body.reel .workspace-header { display: none; }
body.reel .workspace { margin: 0; padding: 0; border-radius: 0; box-shadow: none; }

@media (forced-colors: active) {
  .tabs, .workspace, .workspace-header, .directory-total, .directory-person { color: CanvasText; background: Canvas; border-color: CanvasText; }
  .tabs button[aria-current] { forced-color-adjust: none; color: HighlightText; background: Highlight; border-color: Highlight; }
  .tabs button:focus-visible, .tabs button[aria-current]:focus-visible { outline-color: Highlight; outline-offset: 1px; }
  .tabs button[aria-current]:focus-visible { outline-color: HighlightText; outline-offset: -4px; }
  .tabs .index-icon { stroke: ButtonText; filter: none; }
  .tabs button[aria-current] .index-icon { stroke: HighlightText; }
  .tabs .tool-face, .tabs .tool-light { fill: none; }
  .tabs .n { border-color: ButtonText; }
  .tabs button:hover:not(:focus-visible) { outline: 1px dashed ButtonText; outline-offset: -2px; }
  .workspace :focus-visible { outline-color: Highlight; }
  .directory-person, .profile-state, .profile-editor input, .workspace-action { border: 1px solid ButtonText; }
  .ledger-log, .ledger-log time::after, .profile > section { border-color: CanvasText; }
  #sceneActions .scene-staff-target:focus-visible rect { stroke: Highlight; }
  #sceneActions .hs[aria-current="true"] rect { fill: Canvas; stroke: Highlight; }
}
