/* ── shell.css — the tree-left · tabs-right shell every authoring MFE wears (Configuration, Studio) ──
   One look, one file; an app adds only what is its own in its page. Theme tokens come from base.css. */
:root{ --lock:var(--text-tertiary) }   /* --warn-bg / --ok are the design system's roles (generated); the lock tone is the tertiary ink */
  *{box-sizing:border-box}html,body,#root{height:100%;margin:0}
  /* ── the two panes: tree left, detail right ── */
  .body{display:grid;grid-template-columns:300px 1fr;min-height:0}
  .body>*{min-width:0}   /* a grid cell's min-width defaults to its content: a wide list must scroll inside, never widen the page */
  .tree{border-right:var(--shell-divider);background:var(--shell-chrome-bg);overflow:auto;padding:var(--shell-gutter-y) 8px 10px;display:flex;flex-direction:column;gap:8px;min-height:0}

   /* one scope is a statement, not a select of one */
  .node{list-style:none;margin:0;padding:0}
  .node-row{display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:8px;cursor:pointer;font-size:var(--fs-sm);min-height:28px}
  .node-row:hover{background:color-mix(in srgb,var(--accent) 8%,transparent)}
  .node-row.sel{background:color-mix(in srgb,var(--accent) 16%,transparent);font-weight:600}

  .node-ic{color:var(--muted);display:inline-flex;flex:none}
  .node-label{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .badge{font-size:var(--fs-xs);color:var(--muted);background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:0 6px;font-variant-numeric:tabular-nums}
  .kids{margin:0;padding-left:14px}
  /* Studio: per-row verbs on hover (Extend · Clone); always present for the keyboard, visible on hover/focus */
  .node-acts{display:inline-flex;gap:2px;opacity:0;transition:opacity .12s}
  .node-row:hover .node-acts,.node-row:focus-within .node-acts,.node-row.sel .node-acts{opacity:1}

  .tab-sub{font-size:var(--fs-sm);color:var(--muted);padding:8px 22px 0}
  /* the tab rule: a tab is a label — the description is the body's lede (.tab-lede), never in the strip */
  .tab-lede{font-size:var(--fs-sm);color:var(--muted);padding:10px 22px 0;line-height:1.45;display:flex;gap:8px;align-items:baseline;flex-wrap:wrap}   /* full width — a description is one line on a wide screen, wraps on a phone */
  .tab-t{display:inline-flex;align-items:center;gap:6px}.tab-n{color:var(--muted);font-weight:400}.tab.on .tab-n{color:var(--brand-hover)}

  .checks .check.gap b{font-weight:600}
  /* a tab's count */
  .tab .n{display:inline-flex;min-width:20px;height:20px;border-radius:50%;border:1px solid var(--line2,var(--line));align-items:center;justify-content:center;font-size:var(--fs-xs);font-variant-numeric:tabular-nums;color:var(--muted)}
  .tab.on .n{border-color:var(--accent);color:var(--brand-hover)}

  /* ── detail ── */
  .detail{overflow:auto;min-height:0;display:flex;flex-direction:column}

  .uuid{font-size:var(--fs-xs);color:var(--muted);background:none;border:1px dashed var(--line);border-radius:6px;padding:2px 8px;cursor:pointer;font-family:var(--mono)}

  .uuid:hover{color:var(--brand-hover);border-color:var(--accent)}
  .tabs-wrap{position:relative}
  /* the strip is the runtime's Tabs.List (views/tabs.mjs): it draws its own rule and underline; this is only the page gutter
     and the one-line law (overflow hidden — what does not fit goes to the combo) */
  .tabs{flex-wrap:nowrap;padding:10px 22px 0;overflow:hidden}
  .tab.lock{color:var(--lock)}
  .tab .n,.tab.lock .glyph{opacity:.85}
  .tabs-ghost{position:absolute;left:0;top:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none;border:0;padding-top:0}
  .tabs-ghost .tabs{padding-top:0}
  .tab-more{appearance:none;-webkit-appearance:none;margin-left:auto;padding-right:22px;background:transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 6px center;max-width:200px;text-overflow:ellipsis}
  .tab-lede-n{font-weight:600;color:var(--ink);margin-right:8px;font-variant-numeric:tabular-nums}
  /* SUBTABS — a form's groups inside a page: the same strip, one size down, flush with the card (no page gutter) */
  .tabs-sub .tabs{padding:0;margin-bottom:12px}

  .locked{border:1px dashed var(--line);border-radius:12px;padding:18px;color:var(--muted);display:flex;flex-direction:column;gap:8px;align-items:flex-start}
  .drawer .card {background:var(--panel);border:1px solid var(--card-border);box-shadow:var(--shadow-card);border-radius:var(--radius-lg,14px);padding:var(--space-lg,20px);display:flex;flex-direction:column;gap:8px;max-width:none;width:100%;margin:0}
  .card h3{margin:0;font-size:var(--fs-sm);color:var(--muted);font-weight:600}

  .row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
  .sp{flex:1}
  /* .table / .tablewrap / .input / .select / .textarea moved to base.css — they are generic
     primitives, not shell layout, and Prism (which does not wear this shell) needs them too. */
  .field{display:flex;flex-direction:column;gap:4px}
  .fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}
  .toggle{width:auto;transform:scale(1.15)}
  .actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
  /* .btn-primary / .btn-danger: the flat system in base.css */
  .ok{color:var(--ok);font-size:var(--fs-sm)}.note{font-size:var(--fs-sm);color:var(--muted)}.note.warn{color:var(--warn)}

  .search{max-width:320px}
  .chip{font-size:var(--fs-xs);background:var(--bg);border:1px solid var(--line);border-radius:20px;padding:2px 8px;color:var(--muted)}
  .drawer{position:fixed;top:0;right:0;bottom:0;width:min(520px,100%);background:var(--panel);border-left:1px solid var(--line);box-shadow:var(--float);z-index:20;overflow:auto;padding:18px 20px;display:flex;flex-direction:column;gap:12px}

  .matrix td.y{color:var(--ok);text-align:center}.matrix td.n{color:var(--line2);text-align:center}

  @media(max-width:820px){
    .body{grid-template-columns:1fr}
    .tree{position:fixed;inset:0 20% 0 0;z-index:15;box-shadow:var(--float);transform:translateX(-105%);transition:transform .2s}
    .tree.open{transform:none}

.tabs{padding:8px 14px 0}.tab-lede{padding:8px 14px 0}
.who{display:none}
  }
/* the boot placeholder is a centred flex box; once the shell mounts, the root must be a plain 100%-high block
   or a long tree grows the DOCUMENT instead of scrolling inside its pane */
/* …and the boot centring must not outlive the boot: `place-items:center` makes a grid item shrink to its content,
   which a framed app answers with the iframe default of 300px. display:block already said as much;
   justify-items is stated too, so the rule holds whichever way the cascade resolves display. */
#root:has(> .shell),#root:has([data-skin]),#root.skinned{display:block;height:100%;justify-items:stretch}   /* a tenant's shell skin fills the root like the shell does — never centred like the boot spinner */
/* ── Browse cards (Studio) ── */
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}

/* governance editing (Studio rung 4): a grant cell is a button; kind-rows open on click */
.matrix button.cell { all: unset; cursor: pointer; display: inline-block; min-width: 26px; padding: 2px 6px; border-radius: 6px; text-align: center; font: inherit; }
.matrix button.cell:hover { background: var(--accent-soft); }
.matrix button.cell[aria-pressed="true"] { color: var(--ok); font-weight: 600; }
.matrix button.cell:disabled { opacity: .5; cursor: progress; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--accent-soft); }
.table td.mono, .table td > b { white-space: nowrap; }
.table td .chip { white-space: nowrap; }

/* ── a list screen: its bar, sortable headers and pager ── */
.crud-bar { align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 10px; }
.crud .search { max-width: 320px; }
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; } .table th.sortable:hover { color: var(--ink); } .table th.sortable.on { color: var(--accent, var(--ink)); }
.pager { align-items: center; gap: 8px; padding: 8px 4px 0; }
.dim { font-size: var(--fs-xs); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

pre.code { margin: 0; padding: 10px 0; font: var(--fs-sm)/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; white-space: pre; }
pre.code > div { padding: 0 12px 0 0; white-space: pre; }

pre.code .sign { display: inline-block; width: 14px; color: var(--muted); user-select: none; }
pre.code.diff .add { background: color-mix(in srgb, var(--ok) 12%, transparent); } pre.code.diff .add .sign { color: var(--ok); }
pre.code.diff .del { background: color-mix(in srgb, var(--danger) 12%, transparent); } pre.code.diff .del .sign { color: var(--danger); }
pre.code.diff .skip { color: var(--muted); font-style: italic; padding: 2px 12px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }

/* ── platform-aware code tokens (mfe-common/lib/code-tokens.mjs) ── */
pre.code .tk-key, pre.code .tk-pred { color: var(--brand-hover); }
pre.code .tk-str, pre.code .tk-lit { color: color-mix(in srgb, var(--ok) 75%, var(--ink)); }
pre.code .tk-num, pre.code .tk-bool, pre.code .tk-null { color: color-mix(in srgb, var(--danger) 70%, var(--ink)); }
pre.code .tk-iri { color: var(--ink); } pre.code .tk-prefix, pre.code .tk-lang, pre.code .tk-comment { color: var(--muted); font-style: italic; }
pre.code .tk-punct { color: var(--muted); }
pre.code button.tk-ref { all: unset; cursor: pointer; font: inherit; color: var(--brand-hover); text-decoration: underline dotted; text-underline-offset: 3px; }
pre.code button.tk-ref:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 3px; }
pre.code > div.hit { background: color-mix(in srgb, var(--accent) 12%, transparent); }
pre.code.wrap, pre.code.wrap > div { white-space: pre-wrap; word-break: break-all; }

pre.code button.fold { all: unset; display: inline-block; width: 12px; margin: 0 2px 0 -12px; text-align: center; color: var(--muted); font-size: var(--fs-xs); cursor: pointer; user-select: none; }

pre.code button.fold:hover { color: var(--accent, var(--ink)); }

/* ── icon buttons (mfe-common/views/buttons.mjs): the verb is the glyph, the text is the tooltip ── */
/* .btn.ib sizes and the `on` state: base.css (the flat system) */
.seg { display: inline-flex; gap: 4px; }

.datatable tr.expanded > td { background: var(--card-2); }
.glyph { display: inline-flex; vertical-align: -2px; }
.glyph.ok { color: var(--ok); } .glyph.err { color: var(--danger); } .glyph.dim { color: var(--muted); }
td.y .glyph { color: var(--ok); } td.n .glyph { color: var(--line2); }

/* suggested properties — chips with one-click add */
.suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.suggest .chip.add { cursor: pointer; border-style: dashed; }
.suggest .chip.add:hover { background: var(--accent-soft); }

/* the VISUAL GALLERY (Studio V1) — a visual kind's members: the mark at 48 px, its name, its shelf */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.gallery-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border:1px solid var(--card-border); box-shadow:var(--shadow-card); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: default; font: inherit; text-align: center; min-width: 0; }
.gallery-card:hover { border-color: var(--accent); }
.gallery-mark { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }

.gallery-name { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.gallery-shelf { font-size:var(--fs-xs); color: var(--muted); }
.gallery-card.sel { border-color: var(--accent); background: var(--accent-soft); }
.gallery-detail { margin-top: 12px; }

/* a folding card (Readiness on the Preview step): one summary line, the body behind it */
details.card.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card.fold > summary::-webkit-details-marker { display: none; }
details.card.fold > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .12s; flex: none; }
details.card.fold[open] > summary::before { transform: rotate(45deg); }
details.card.fold > summary h3 { margin: 0; }
details.card.fold[open] > summary { margin-bottom: 8px; }

/* A FRAMED TOOL: a tool that runs on its own origin, shown inside the one document. Full-bleed in the
   slot, because the tool draws its own navigation and a border around it would be a second frame around a frame;
   the one control is the way out to its own origin (a popup, a download, the full width), on a slim bar of the shell's
   above the frame — never over it, where the tool draws its own controls. */
.mfe-frame-wrap { position: relative; width: 100%; height: 100%; min-height: clamp(420px, calc(100vh - 120px), 1600px); background: var(--bg); display: flex; flex-direction: column; }
.mfe-frame-bar { flex: none; display: flex; justify-content: flex-end; align-items: center; min-height: 32px; padding: 2px 8px; border-bottom: 1px solid var(--border); background: var(--bg); }
.mfe-frame { width: 100%; flex: 1 1 auto; min-height: 0; border: 0; display: block; background: var(--bg-card); }
.mfe-frame-pop { height: 26px; padding: 0 8px; border-color: transparent; text-decoration: none; font-size: var(--fs-sm); color: var(--text-secondary); }
.mfe-frame-pop:hover, .mfe-frame-pop:focus-visible { color: var(--text-primary); }
@media (max-width: 720px) {
  .mfe-frame-wrap { min-height: calc(100vh - 96px); }
}

/* ── ORGANISATION SWITCHER (views/org-switch.mjs) — the one way to change the organisation the shell works in: the row
   under the rail's brand mark, the window (laptop) or sheet (phone) it opens, and the organisation's name in an app's
   panel. Tokens only; the rail row keeps the rows' 48 px icon column so nothing moves when the rail opens. ── */
.org-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:var(--radius-md);background:var(--brand-bg);color:var(--brand-hover);
  font-size:var(--fs-xs);font-weight:600;letter-spacing:.02em;line-height:1;user-select:none}
.org-mark-logo{object-fit:contain;background:var(--bg-card);display:block}
.org-switch-head{padding:2px 4px 12px}
.org-switch-title{font-size:var(--fs-lg);font-weight:600;color:var(--text-primary)}
.org-switch-sub{font-size:var(--fs-sm);color:var(--text-secondary);margin-top:2px}
.org-search{margin-bottom:8px}
.org-rows{display:flex;flex-direction:column;gap:2px;max-height:min(60vh,420px);overflow-y:auto}
.org-row{display:flex;align-items:center;gap:12px;min-height:48px;padding:8px 10px;border-radius:var(--radius-md);color:var(--text-primary);font-size:var(--fs-md)}
.org-row:hover,.org-row:focus-visible{background:var(--bg-card-hover)}
.org-row:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
.org-row[data-here]{font-weight:600}
.org-row[disabled]{cursor:progress}
.org-row-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.org-row-end{display:inline-flex;align-items:center;color:var(--brand-hover)}
.org-row-busy{font-size:var(--fs-xs);color:var(--text-secondary)}
.org-none{padding:12px 10px;color:var(--text-secondary);font-size:var(--fs-sm)}
.org-failed{margin-top:8px;color:var(--danger);font-size:var(--fs-sm)}
.org-grip{display:block;width:40px;height:4px;border-radius:2px;background:var(--line);margin:0 auto 12px}

/* the organisation row at the rail's foot (rail.mjs, useRailOrg): a rail row like Home or Account — its mark in
   the icon column, its full name when the rail opens — with a quiet up-down arrow after the name: it opens a choice */
.org-rail-row .nav-ic img,.org-rail-row .nav-ic>span{border-radius:6px}
.org-rail-row .nav-row-label{display:flex;align-items:center;gap:6px;min-width:0}
.org-rail-row .nav-row-label::after{content:"";flex:none;width:6px;height:6px;margin-inline-start:auto;margin-inline-end:4px;border:solid var(--text-secondary);
  border-width:0 1.5px 1.5px 0;transform:rotate(45deg) translateY(-2px);opacity:.8}

/* THE ASSISTANT, PINNED (views/assistant.mjs): a column on the right of every screen. The page makes room for it —
   the shell's content keeps clear — so it is beside the work, never over it. */
:root[data-agent-pinned="true"] .shell-main{padding-right:var(--agent-pinned-w,400px)}
