/* TOPHIVE Design Lab — Prompt Tracker workspace
   Canonical styles for /prompts/tracker.html and /lab/prompts/.
   The data grid owns the layout; the inspector stays in sync with selection. */
:root {
  --canvas:#f7f8f4;
  --surface:#fff;
  --surface-muted:#f2f5f1;
  --ink:#1d2622;
  --muted:#687b70;
  --soft-ink:#53685b;
  --line:#dae4da;
  --line-soft:#eaf0ea;
  --accent:#305e44;
  --accent-soft:#e7f1e8;
  --radius:10px;
}
* {box-sizing:border-box}
html {scroll-behavior:smooth}
body {margin:0;background:var(--canvas);color:var(--ink);font:14px/1.5 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
button,input,select,textarea {font:inherit}
button {cursor:pointer}
a {color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,
[tabindex="0"]:focus-visible {outline:2px solid #3f855e;outline-offset:2px}
button:disabled {opacity:.5;cursor:not-allowed}
[hidden] {display:none!important}
.sr-only {position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

.lab-prompt-page > main.shell.prompt-workspace-page,
main.shell.prompt-workspace-page {
  display:flex;
  flex-direction:column;
  width:100%;
  max-width:1240px;
  height:calc(100dvh - 69px);
  min-height:560px;
  margin:0 auto;
  padding:0 18px 14px;
  color:var(--ink);
  background:transparent;
}
body:not(.lab-prompt-page) main.shell.prompt-workspace-page {height:100dvh}
.prompt-workspace-page > section + section {border-top:0}

/* One-line workspace identity; status counts live inside the data grid. */
.prompt-workspace-page .worktop {
  min-height:60px;
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  border-bottom:1px solid var(--line);
}
.prompt-workspace-page .worktop h1 {
  margin:0;
  font-size:24px;
  font-weight:760;
  letter-spacing:-.055em;
  line-height:1.15;
  color:var(--ink);
}
.prompt-workspace-page .worktop h1 span {color:#85a18d}
.prompt-workspace-page .worktop-link {
  display:inline-flex;
  align-items:center;
  gap:7px;
  flex:none;
  font-size:12px;
  font-weight:650;
  color:#728679;
  transition:color .16s ease;
}
.prompt-workspace-page .worktop-link:hover {color:#2f6749}

/* Canvas-like inspector controls: compact icon buttons and popover menus. */
.prompt-workspace-page .toolbar {
  position:relative;
  z-index:20;
  flex:0 0 auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:nowrap;
  padding:12px 0;
  border:0;
}
.prompt-workspace-page .toolbar-left,
.prompt-workspace-page .toolbar-right {display:flex;align-items:center;gap:8px;min-width:0}
.prompt-workspace-page .toolbar-left {flex:1}
.prompt-workspace-page .toolbar-right {flex:none}
.search-field {display:flex;align-items:center;gap:9px;width:270px;max-width:100%;height:39px;padding:0 11px;border:1px solid #d4e0d6;border-radius:8px;background:#fff;transition:border-color .16s,box-shadow .16s}
.search-field:focus-within {border-color:#6b9c7a;box-shadow:0 0 0 3px #e3f1e6}
.search-field svg,.toolbar-control svg,.toolbar-next svg,.toolbar-more svg {width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.search-field svg {color:#71897a}
.search-field input {min-width:0;flex:1;width:100%;height:100%;border:0;padding:0;background:transparent;color:#1d3025;font-size:12px;outline:0}
.search-field input:focus-visible {outline:0}
.search-field input::placeholder {color:#89978d}
.search-field kbd {flex:none;padding:1px 6px;font:11px ui-monospace,Menlo,monospace;color:#87958c;border:1px solid #dfe8df;border-radius:4px}
.filter-control {position:relative;flex:none}
.toolbar-control,.toolbar-more,.toolbar-next {
  display:inline-flex;align-items:center;justify-content:center;gap:8px;height:39px;padding:0 11px;
  border:1px solid #d4e0d6;border-radius:8px;background:#fff;color:#53685b;
  font-size:12px;font-weight:650;white-space:nowrap;transition:background .16s,border-color .16s,color .16s;
}
.toolbar-control:hover,.toolbar-more:hover {background:#f2f7f2;border-color:#a6bdac;color:#2e5a3c}
.toolbar-control[aria-expanded="true"] {background:#eef5ef;border-color:#9abb9f;color:#2e603f}
.toolbar-control .chevron {width:12px;height:12px;margin-left:2px}
.filter-indicator {display:grid;place-items:center;min-width:16px;height:16px;border-radius:5px;background:#cee4d2;color:#285c40;font:700 10px ui-monospace,Menlo,monospace}
.clear-filters {padding:7px;border:0;background:transparent;color:#47755b;font-size:11px;font-weight:670;white-space:nowrap}
.clear-filters:hover {text-decoration:underline;text-underline-offset:3px}
.toolbar-next {background:#243b30;border-color:#243b30;color:#fff;padding:0 13px}
.toolbar-next:hover {background:#335845;border-color:#335845}
.toolbar-next svg {width:15px}
.toolbar-more {width:39px;padding:0}
.filter-popover {
  position:absolute;top:calc(100% + 7px);left:0;z-index:80;width:274px;max-width:calc(100vw - 32px);
  padding:9px;background:#fff;border:1px solid #d6e3d7;border-radius:11px;
  box-shadow:0 16px 38px rgba(25,52,34,.14);
}
.filter-popover--actions {left:auto;right:0;width:224px}
.filter-popover-label {padding:7px 9px 10px;color:#8b9b8e;font:750 10px/1.2 ui-monospace,Menlo,monospace;letter-spacing:.11em;text-transform:uppercase}
.filter-options {display:grid;gap:2px;max-height:min(55dvh,340px);overflow:auto}
.filter-option,.action-option {
  width:100%;min-height:36px;display:flex;align-items:center;gap:9px;justify-content:space-between;
  padding:8px 10px;border:0;border-radius:7px;background:transparent;color:#455e4d;text-align:left;
  font-size:12px;font-weight:570;
}
.filter-option:hover,.action-option:hover {background:#f1f6f1}
.filter-option[aria-checked="true"] {background:#e9f2ea;color:#205b3d;font-weight:750}
.filter-option .option-count {margin-left:auto;color:#9aaa9d;font:11px ui-monospace,Menlo,monospace}
.filter-option .option-check {width:15px;text-align:right;color:#2f7551}
.action-option {justify-content:flex-start;font-weight:620}
.action-option span {width:20px;color:#508269;font-size:17px}
.action-note {margin:6px 6px 2px;padding:9px 5px 2px;border-top:1px solid #e5eee6;font-size:10px;line-height:1.5;color:#859789}

/* Desktop master–detail: closing the Inspector gives every pixel back to
   the table. Reopen allocates a neighboring column; nothing overlays the grid. */
.prompt-workspace-page .workspace {
  display:grid;
  grid-template-columns:minmax(0,1fr) 0px;
  column-gap:0;
  flex:1 1 auto;
  min-width:0;
  min-height:0;
  padding:0;
  align-items:stretch;
  transition:grid-template-columns .24s cubic-bezier(.2,.85,.25,1),column-gap .24s ease;
}
.prompt-workspace-page .workspace.inspector-visible {
  grid-template-columns:minmax(0,1fr) 340px;
  column-gap:12px;
}
.prompt-workspace-page .table-panel,
.prompt-workspace-page .inspector {
  min-width:0;
  min-height:0;
  height:100%;
  background:#fff;
  border:1px solid #d6e1d7;
  border-radius:10px;
  overflow:hidden;
  box-shadow:none;
}
.table-panel {display:flex;flex-direction:column}
.table-caption {height:48px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 16px;border-bottom:1px solid var(--line-soft);background:#fff}
.table-caption-title {display:flex;align-items:center;gap:9px;font-size:13px;font-weight:770;letter-spacing:-.018em}
.caption-count {border:1px solid #d8e6da;border-radius:5px;padding:2px 6px;color:#587765;font:700 10px ui-monospace,Menlo,monospace}
.table-caption-hint {color:#8b9a8f;font-size:11px}
.table-scroll {min-width:0;min-height:0;flex:1 1 auto;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#cfdbcf transparent}
.prompt-workspace-page table {width:100%;min-width:710px;border-collapse:separate;border-spacing:0;table-layout:fixed}
.prompt-workspace-page thead th {
  position:sticky;top:0;z-index:3;height:37px;padding:0 12px;background:#f4f7f3;
  border-bottom:1px solid #e1e9e1;color:#7d9282;text-align:left;
  font:750 9px/1.35 ui-monospace,Menlo,monospace;text-transform:uppercase;letter-spacing:.09em;
}
.prompt-workspace-page th.col-pick {width:42px}
.prompt-workspace-page th.col-design {width:29%}
.prompt-workspace-page th.col-direction {width:23%}
.prompt-workspace-page th.col-composition {width:29%}
/* The status is a trailing table attribute: anchor the label and every
   stage badge to the same right inset, regardless of inspector visibility. */
.prompt-workspace-page th.col-stage {width:19%;text-align:right;padding-right:18px}
.prompt-workspace-page tbody td:last-child {text-align:right;padding-right:18px}
.prompt-workspace-page td {
  height:71px;padding:11px 12px;border-top:0;border-bottom:1px solid #eaf0e9;
  color:#637368;font-size:11.5px;line-height:1.43;vertical-align:middle;
  overflow-wrap:break-word;
}
.prompt-workspace-page tbody tr {cursor:pointer;transition:background .14s}
.prompt-workspace-page tbody tr:hover {background:#f6f9f5}
.prompt-workspace-page tbody tr.selected {background:#eaf3eb}
.prompt-workspace-page tbody tr.selected td:first-child {box-shadow:inset 3px 0 #5e9b76}
.prompt-workspace-page tbody tr:last-child td {border-bottom:0}
.pick {width:23px;height:23px;border:1px solid #d4dfd6;border-radius:5px;background:#fff;display:grid;place-items:center;font-size:13px;color:#829887}
.prompt-workspace-page tbody tr.selected .pick {background:#3c7553;color:#fff;border-color:#3c7553}
.rowname {display:block;color:#202c24;font-size:12.5px;font-weight:740;letter-spacing:-.022em;line-height:1.25}
.rowid {display:block;margin-top:6px;color:#93a398;font:10px/1.25 ui-monospace,Menlo,monospace}
.rowfamily {display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.prompt-workspace-page .badge {
  display:inline-flex;align-items:center;gap:6px;padding:5px 8px;border:1px solid #e0e7e0;
  border-radius:5px;background:#eef1ee;color:#6a7b6e;font:700 10px/1 ui-monospace,Menlo,monospace;
  white-space:nowrap;text-transform:capitalize;letter-spacing:0;
}
.badge::before {content:"";width:5px;height:5px;display:block;flex:none;border-radius:50%;background:#a5b3a6}
.badge.drafted {background:#f0edfc;color:#6b5d91;border-color:#e3def6}.badge.drafted::before {background:#9c86d3}
.badge.built {background:#eaf2f9;color:#457390;border-color:#d9e7f1}.badge.built::before {background:#7da3c0}
.badge.reviewed {background:#fff5e7;color:#916b3a;border-color:#f1e6d6}.badge.reviewed::before {background:#cda35b}
.badge.locked {background:#e4f1e7;color:#2e6f49;border-color:#d5e9d8}.badge.locked::before {background:#68a781}
.panel-bottom {height:39px;flex:none;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:0 15px;border-top:1px solid #e3ebe3;color:#829388;font:10px ui-monospace,Menlo,monospace}
.empty {padding:58px 18px;text-align:center;color:#748879}
.empty-icon {display:block;margin-bottom:11px;font-size:25px}
.empty strong {display:block;color:#334b3b;font-size:16px}
.empty p {font-size:12px;margin:7px 0 14px}
.secondary-btn,.primary-btn {display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:8px 12px;border:1px solid #d0ded2;border-radius:7px;background:#fff;color:#3b664c;font-size:11px;font-weight:700}
.secondary-btn:hover {background:#f1f6f1}
.primary-btn {border-color:#294d38;background:#294d38;color:#fff}
.primary-btn:hover {background:#376448}

/* Inspector scroll is independent of the data grid. */
.prompt-workspace-page .inspector {
  display:flex;
  flex-direction:column;
  position:relative;
  top:auto;
  transition:opacity .2s ease,visibility .24s,transform .24s ease;
}
.prompt-workspace-page .inspector:not(.is-open) {
  border-width:0;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateX(8px);
}
.prompt-workspace-page .inspector.is-open {opacity:1;visibility:visible;transform:translateX(0)}
.inspect-head {height:58px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:9px;padding:0 16px;border-bottom:1px solid var(--line-soft)}
.inspect-head-copy {display:grid;gap:2px}
.inspect-title {font-size:12px;font-weight:790;letter-spacing:-.013em}
.inspect-subtitle {font-size:10px;color:#8a9b8d}
.icon-button {width:29px;height:29px;display:grid;place-items:center;padding:0;background:#fff;border:1px solid #d9e4d9;border-radius:7px;color:#647c68;line-height:0}
.icon-button svg {display:block;width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.icon-button:hover {background:#eff4ef}
.inspect-scroll {min-height:0;flex:1 1 auto;overflow:auto;scrollbar-width:thin;scrollbar-color:#cbd7cc transparent;overscroll-behavior:contain}
.inspect-body {padding:17px 16px 22px}
.inspect-meta {display:flex;justify-content:space-between;align-items:center;gap:10px}
.inspect-meta .tiny {font:700 10px ui-monospace,Menlo,monospace;color:#8aa18e;letter-spacing:.025em}
.inspect-stage {font:700 10px ui-monospace,Menlo,monospace;color:#5c8969;text-transform:uppercase}
.inspect-body h2 {margin:12px 0 11px;font-size:23px;letter-spacing:-.06em;line-height:1.12;font-weight:770}
.tagline {display:flex;flex-wrap:wrap;gap:5px}
.ref {display:inline-flex;padding:5px 7px;border-radius:4px;background:#edf4ed;color:#607b65;font:10px ui-monospace,Menlo,monospace}
.brief-fields {margin:16px 0 0}
.detail {margin:0;padding:12px 0;border-top:1px solid #edf1eb}
.detail dt {margin:0;color:#8b9b8e;font:730 9px/1.4 ui-monospace,Menlo,monospace;letter-spacing:.1em;text-transform:uppercase}
.detail dd {margin:5px 0 0;color:#3b5644;font-size:12px;line-height:1.45}
.inspect-editor {margin:4px 0 0;padding:17px 0 0;border-top:1px solid #dfe9df;background:transparent}
.inspect-editor label {display:block;margin:0 0 7px;color:#6f8975;font:720 10px ui-monospace,Menlo,monospace;letter-spacing:.045em;text-transform:uppercase}
.inspect-editor label:not(:first-child) {margin-top:15px}
.inspect-editor select,.inspect-editor textarea {
  display:block;width:100%;padding:10px 11px;border:1px solid #d5e1d5;border-radius:7px;
  background:#fff;color:#2a4835;font-size:12px;line-height:1.5;
}
.inspect-editor select {height:39px;appearance:none;-webkit-appearance:none;padding-right:33px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 15 15'%3E%3Cpath d='m3.5 5.5 4 4 4-4' fill='none' stroke='%23577b61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 11px center;background-size:15px;
}
.inspect-editor textarea {resize:vertical;min-height:92px;max-height:270px}
.inspect-editor textarea::placeholder {color:#9ca99e}
.inspect-actions {display:flex;gap:8px;margin-top:12px}
.inspect-actions button {flex:1;white-space:nowrap}
.save-state {margin:11px 0 0;color:#91a194;font-size:10px;line-height:1.45}
.inspect-empty {padding-top:65px;text-align:center}
.inspect-empty-mark {display:grid;place-items:center;width:46px;height:46px;margin:0 auto 12px;border:1px solid #d3e2d5;border-radius:11px;background:#f1f6f1;font-size:20px;color:#7d9b84}
.inspect-empty p {font-size:12px;color:#778c7d}
.drawer-backdrop {display:none}
body.prompt-drawer-open{overflow:hidden}
.toast {position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:130;min-width:140px;max-width:calc(100vw - 24px);padding:11px 15px;background:#233f2f;border-radius:8px;color:#fff;font-size:12px;box-shadow:0 8px 26px #1e3f2c24;text-align:center}

@media(max-width:1100px) {
  .prompt-workspace-page .workspace {display:block;position:relative}
  .prompt-workspace-page .table-panel {height:100%}
  .prompt-workspace-page .inspector {
    position:fixed;z-index:101;inset:0 0 0 auto;top:0;
    width:min(390px,100%);height:100dvh;border-radius:0;
    transform:translateX(102%);visibility:hidden;pointer-events:none;
    transition:transform .23s cubic-bezier(.2,.9,.3,1),visibility .23s;
    box-shadow:-14px 0 46px #193b2820;
  }
  .prompt-workspace-page .inspector.is-open {transform:translateX(0);visibility:visible;pointer-events:auto}
  .prompt-workspace-page .drawer-backdrop:not([hidden]) {display:block;position:fixed;inset:0;z-index:100;background:rgba(19,37,25,.35)}
}
@media(max-width:730px) {
  .lab-prompt-page > main.shell.prompt-workspace-page,
  main.shell.prompt-workspace-page {height:auto;min-height:calc(100dvh - 69px);padding:0 12px 24px}
  .prompt-workspace-page .worktop {min-height:56px}
  .prompt-workspace-page .worktop h1 {font-size:21px}
  .prompt-workspace-page .worktop-link {font-size:11px}
  .prompt-workspace-page .toolbar {flex-wrap:wrap;align-items:stretch;gap:8px;padding:11px 0}
  .prompt-workspace-page .toolbar-left {width:100%;flex-wrap:wrap;gap:7px}
  .search-field {width:100%;flex:1 0 100%}
  .toolbar-control {height:36px;padding:0 10px}
  .prompt-workspace-page .toolbar-right {width:100%;justify-content:space-between;gap:7px}
  .toolbar-next {height:36px}
  .toolbar-more {height:36px;width:36px}
  .filter-popover {top:calc(100% + 5px)}
  .prompt-workspace-page .workspace {height:min(65dvh,580px);min-height:360px}
  .table-caption {height:43px}
  .table-caption-hint {display:none}
  .panel-bottom {height:37px}
}
@media(max-width:390px){
  .toolbar-control {max-width:150px}
  .toolbar-control #family-current,.toolbar-control #status-current {max-width:104px;overflow:hidden;text-overflow:ellipsis}
}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .prompt-workspace-page *, .prompt-workspace-page *::before,.prompt-workspace-page *::after {transition:none!important;animation:none!important}
}
