/* Admin-app additions on top of the ported workspace stylesheet (sm.css). */

/* Pages render inside .views via routing, so neutralise the single-page .view toggle. */
.views > .viewwrap { display: block; animation: vfade .18s ease; }

/* The mockup scopes .wrap padding to #view-X; routed pages have no such ancestor,
   so content was flush to the edges (e.g. Portals). Give .wrap a global default. */
.wrap { max-width: 1500px; margin: 0 auto; padding: 18px 26px 40px; }

/* With the brand header removed, the nav is top-most. Restore the section spacing the
   mockup scoped to #view-X so elements aren't flush against the nav or each other. */
.viewhdr { padding-top: 22px; }
.cs-topo { margin-top: 18px; }

.sm-click { cursor: pointer; }
.sm-muted { color: var(--muted); }
.sm-row-actions { display: flex; gap: 8px; align-items: center; }

/* Lightweight modal for edit dialogs */
.sm-modal-backdrop { position: fixed; inset: 0; background: rgba(10,25,41,.38); display: grid; place-items: center; z-index: 60; padding: 20px; }
.sm-modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; }
.sm-modal h3 { margin: 0; padding: 18px 22px; border-bottom: 1px solid var(--line-2); font-size: 16px; }
.sm-modal .mbody { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.sm-modal .mfoot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow); opacity: 0; transition: .2s; z-index: 80; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Simple two-column form grid reused across editors */
.sm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .sm-grid2 { grid-template-columns: 1fr; } }

/* Globalised component styles (the mockup scopes these to #view-services). */
.steplist { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.steprow { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 12px; background: var(--surface); }
.steprow .sidx { width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font: 700 11px/1 var(--mono); color: var(--muted); }
.steprow .smain { flex: 1; min-width: 0; }
.steprow .smain b { display: block; font-size: 12.5px; color: var(--ink); }
.steprow .smain span { font-size: 11px; color: var(--muted); }

/* Services list: header + rows share one grid (the mockup scoped .svchead grid to
   #view-services, which routed pages lack — so the header columns were collapsing). */
/* Scoped to the Services LIST (which lives in .wrap) so it doesn't clobber the catalogue
   services table (.catpane .svcrow), which has its own 7-column grid in sm.css. */
.cmgr .wrap .svchead, .cmgr .wrap .svcrow { display: grid; grid-template-columns: 1.9fr 1.5fr 120px 1.3fr 116px 30px; align-items: center; gap: 12px; padding: 12px 16px; }
.svctable { margin-top: 6px; }
.svcsearch { margin-bottom: 4px; }

/* Faceted filters + list meta + pager */
.sm-facet { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 2px; }
.sm-facet-lbl { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin-right: 2px; cursor: help; }
.sm-listmeta { display: flex; align-items: center; gap: 8px; margin: 14px 2px 2px; font-size: 12.5px; color: var(--muted); }
.sm-sort { max-width: 130px; padding: 5px 9px; font-size: 12.5px; height: auto; }
.sm-pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.sm-pager .btn { padding: 7px 13px; }

/* Designer — tag chip inline input (gray placeholder, type directly) */
.chip-edit { border: none; background: transparent; min-width: 64px; width: 84px; font: inherit; color: inherit; outline: none; }
.chip-edit::placeholder { color: var(--faint); font-style: italic; }

/* Designer — icon picker */
.icon-picker { position: relative; }
.icon-current { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 7px 11px; cursor: pointer; font: inherit; }
.icon-current .icon-chip { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-deep); display: grid; place-items: center; }
.icon-current .icon-chip .ico { width: 16px; height: 16px; }
.icon-grid { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-height: 230px; overflow: auto; }
.icon-opt { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-opt:hover { border-color: var(--accent); color: var(--accent-deep); }
.icon-opt.on { border-color: var(--accent-deep); background: var(--accent-soft); color: var(--accent-deep); }
.icon-opt .ico { width: 17px; height: 17px; }

/* Designer — classification category tree */
.cat-tree { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 6px; max-height: 380px; overflow: auto; margin-top: 8px; }
.cat-row { display: flex; align-items: center; gap: 4px; padding: 1px 0; }
.cat-chev { width: 15px; height: 15px; color: var(--faint); cursor: pointer; transition: transform .12s; flex: 0 0 auto; }
.cat-chev.open { transform: rotate(90deg); }
.cat-chev-sp { width: 15px; flex: 0 0 auto; }
.cat-check { display: flex; align-items: center; gap: 9px; flex: 1; padding: 6px 9px; border-radius: var(--radius-xs); cursor: pointer; font-size: 13px; }
.cat-check:hover { background: var(--surface-2); }
.cat-check.on { background: var(--accent-soft); color: var(--accent-deep); }
.cat-check .cn { flex: 1; }
.cat-check .cc { font-size: 10.5px; color: var(--faint); }
.cat-check.on .cc { color: var(--accent-deep); }

/* Designer — content structured editors */
.ed-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ed-row { display: flex; align-items: center; gap: 8px; }
.ed-bullet { color: var(--faint); font-weight: 700; }
.ed-faq { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ed-faq-h { display: flex; align-items: center; gap: 8px; }
.ed-q { font: 700 11px var(--mono); color: var(--accent-deep); background: var(--accent-soft); border-radius: 6px; padding: 3px 8px; flex: 0 0 auto; }

/* Designer — searchable process picker */
.proc-picker { position: relative; max-width: 480px; }
.proc-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 11px; }
.proc-input > .ico { width: 16px; height: 16px; color: var(--faint); flex: 0 0 auto; }
.proc-input .inp { border: none; flex: 1; padding: 9px 0; background: transparent; }
.proc-input .inp:focus { outline: none; box-shadow: none; }
.proc-input .proc-sel { font-size: 11px; color: var(--accent-deep); background: var(--accent-soft); border-radius: 6px; padding: 2px 7px; }
.proc-list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 300px; overflow: auto; padding: 6px; }
.proc-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; border: none; background: transparent; padding: 9px 11px; border-radius: var(--radius-xs); cursor: pointer; text-align: left; font: inherit; }
.proc-opt:hover { background: var(--surface-2); }
.proc-opt.on { background: var(--accent-soft); }
.proc-opt .po-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.proc-opt .po-main .mono { font-size: 10.5px; color: var(--faint); }
.proc-opt .po-ar { font-size: 12px; color: var(--muted); flex: 0 0 auto; }

/* Designer — form field cards */
.fld-card .fld-h { display: flex; align-items: center; gap: 9px; }
.fld-card .fld-h > .ico { width: 16px; height: 16px; color: var(--accent-deep); }

/* Service View — read-only value + version list */
.ro-val { font-size: 13.5px; color: var(--ink); padding: 2px 0; }
.ro-val.muted { color: var(--muted); }
.ver-list { display: flex; flex-direction: column; }
.ver-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.ver-row:last-of-type { border-bottom: none; }
.ver-row.cur { background: var(--accent-soft); margin: 0 -14px; padding: 12px 14px; border-radius: 8px; border-bottom: none; }
.ver-v { font: 700 13px var(--mono); min-width: 52px; }
.ver-info { flex: 1; min-width: 0; }
.ver-info .vnote { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.sm-ver-btn { padding: 6px 11px; font-size: 12px; }

/* Placeholder text disappears the moment a field gains focus (requested UX). */
.inp:focus::placeholder,
input:focus::placeholder,
textarea:focus::placeholder,
.proc-input .inp:focus::placeholder { color: transparent; }

/* Read-only "view" rows reused by record / portal / category view states. */
.ro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
@media (max-width: 720px) { .ro-grid { grid-template-columns: 1fr; } }
.ro-field { display: flex; flex-direction: column; gap: 3px; }
.ro-field > label { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .5px; color: var(--faint); }
.ro-table { width: 100%; }
.ro-table .x { color: var(--faint); }

/* Edit-mode action bar (Save / Cancel) shared by the view→edit pages. */
.edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.edit-actions .spacer { flex: 1; }

/* Related-data list shown in view states (records related to this one, etc.). */
.rel-list { display: flex; flex-direction: column; gap: 8px; }
.rel-item { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 12px; background: var(--surface); text-decoration: none; color: inherit; }
.rel-item:hover { border-color: var(--accent); background: var(--surface-2); }
.rel-item .ri-ic { width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-deep); display: grid; place-items: center; flex: 0 0 auto; }
.rel-item .ri-ic .ico { width: 15px; height: 15px; }
.rel-item .ri-main { flex: 1; min-width: 0; }
.rel-item .ri-main b { display: block; font-size: 12.5px; color: var(--ink); }
.rel-item .ri-main span { font-size: 11px; color: var(--muted); }
.rel-item .ri-card { font: 600 10.5px var(--mono); color: var(--faint); }

/* ── Alignment: in two-pane (.workspace) pages the title was max-width-centered while the
   sidebar is flush-left, so on wide screens the title drifted far right of the content.
   Make the title span full width and line up with the sidebar header. ── */
.cmgr:has(.workspace) .viewhdr { max-width: none; margin: 0; padding-left: 18px; }

/* When the placeholder platform frame is on, the app scrolls inside .pf-main (not the
   viewport), so the full-height sticky sidebar must subtract the frame's chrome AND the
   page header above it — otherwise it overflows and forces a needless page scrollbar. */
.pf .cmgr .treepane { top: 57px; height: calc(100vh - 205px); }

/* When framed, the app must fill the scroll viewport (.pf-main), not force a full 100vh —
   otherwise a permanent right scrollbar appears even when content fits. */
.pf .app { min-height: 100%; }

/* Global segmented toggle (the mockup scoped `.seg` to #view-services, so the Database/API
   switch on Data Records was unstyled / misaligned). */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 3px; }
.seg button { border: none; background: transparent; border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Global card chrome — the mockup scoped `.card` to #view-services, so routed pages
   (Mobile, Settings, Process Models, Categories, Inbox) rendered flat. Mirror it globally
   so every page shares the same card UI. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.card > .ch { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card > .ch h3 { margin: 0; font-size: 14px; font-weight: 700; }
.card > .ch .ico { width: 17px; height: 17px; color: var(--accent-deep); }
.card > .ch .tag { margin-left: auto; font-size: 11px; color: var(--muted); }
.card > .cb { padding: 18px; }

/* Global required-marker / hint (the mockup scoped these to #view-services; other routed pages need them too). */
.req { color: var(--danger); font-weight: 700; }
.field .hint, label .hint { font-size: 11.5px; color: var(--faint); font-weight: 400; }

/* Add-services picker modal (searchable multi-select). */
.pick-search { position: relative; margin-bottom: 4px; }
.pick-list { max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 3px; margin-top: 6px; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { flex: 0 0 auto; width: 16px; height: 16px; }
.pick-row.on { background: var(--accent-soft); }
.sm-modal.lg { max-width: 680px; }

/* Data Records — stacked section cards in the detail pane need breathing room (nv-card has no margin). */
.cmgr .catpane .nv-card { margin-bottom: 16px; }
.cmgr .catpane .nv-card:last-child { margin-bottom: 0; }
/* Data fabric nodes are clickable → open the record type. */
.fabricwrap .fnode { cursor: pointer; }
.fabricwrap .fnode:hover rect { stroke: var(--accent); stroke-width: 2; }
/* A related record pulled in from another category — drawn lighter / dashed. */
.fabricwrap .fnode.ext rect { stroke-dasharray: 5 3; opacity: .92; fill: var(--surface-2); }
/* Inline add-record form grid. */
.row-add { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); margin-bottom: 12px; }
.row-add .raf { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

/* Portals — in view mode the sign-in / channel / auth / exposure toggles are inert (read-only). */
.pt-detail.viewing .pt-opt,
.pt-detail.viewing .ch-tg,
.pt-detail.viewing .azseg button,
.pt-detail.viewing .pt-exprow .pt-tg { pointer-events: none; cursor: default; }
.pt-detail.viewing .pt-opt .radio,
.pt-detail.viewing .ch-tg,
.pt-detail.viewing .pt-exprow .pt-tg { opacity: .9; }
