/* Metis — a calm layer over Pico CSS 2.
   Goal: one clear primary action per page, quiet everything else.

   Pico sets its theme variables under `:root:not([data-theme=dark])` and
   `[data-theme=light]`, which outrank a bare `:root`; match that specificity
   or none of these overrides take effect. */

:root, :root:not([data-theme="dark"]), [data-theme="light"] {
  --pico-font-size: 15px;
  --pico-line-height: 1.5;
  --pico-spacing: .9rem;
  --pico-typography-spacing-vertical: .9rem;
  --pico-block-spacing-vertical: 1rem;
  --pico-block-spacing-horizontal: 1.1rem;
  --pico-form-element-spacing-vertical: .5rem;
  --pico-form-element-spacing-horizontal: .75rem;
  --pico-border-radius: .55rem;
  --pico-background-color: #f5f6f8;
  --pico-card-background-color: #fff;
  --pico-card-sectioning-background-color: #f8fafc;
  --pico-muted-border-color: #e3e7ed;
  --pico-muted-color: #64708a;
  --pico-color: #1f2937;
  --pico-h1-color: #111827; --pico-h2-color: #111827; --pico-h3-color: #111827;
  --pico-h4-color: #111827; --pico-h5-color: #111827;
  --pico-primary: #2457d6;
  --pico-primary-background: #2457d6;
  --pico-primary-border: #2457d6;
  --pico-primary-hover: #1d47b3;
  --pico-primary-hover-background: #1d47b3;
  --pico-primary-hover-border: #1d47b3;
  --pico-primary-underline: rgba(36,87,214,.35);
  --pico-primary-focus: rgba(36,87,214,.25);
  --pico-primary-inverse: #fff;
  --pico-secondary-background: #eef1f6;
  --pico-secondary-border: #eef1f6;
  --pico-secondary: #334155;
  --pico-secondary-inverse: #1f2937;
  --pico-secondary-hover-background: #e2e7ef;
  --pico-secondary-hover-border: #e2e7ef;
  --pico-secondary-hover: #1f2937;
  --pico-card-box-shadow: 0 1px 2px rgba(16,24,40,.05);

  --metis-blue: #2457d6;
  --metis-green: #15803d;
  --metis-amber: #b45309;
  --metis-red: #b91c1c;
  --metis-slate: #475569;
  --shell-max: 1240px;
}

html { scroll-padding-top: 4.5rem; }
body { background: var(--pico-background-color); }
h1, h2, h3, h4, h5 { --pico-font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
a { text-decoration: none; } a:hover { text-decoration: underline; }
table { font-size: .92rem; }
th { font-weight: 600; color: var(--pico-muted-color); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
td, th { --pico-spacing: .6rem; }
article { box-shadow: var(--pico-card-box-shadow); border: 1px solid var(--pico-muted-border-color); }
article > header { background: transparent; border-bottom: 1px solid var(--pico-muted-border-color); font-weight: 600; }
article > footer { background: var(--pico-card-sectioning-background-color); }
small, .muted { color: var(--pico-muted-color); }
code { font-size: .85em; }
label { font-weight: 600; font-size: .9rem; }
label small { font-weight: 400; }
input, select, textarea { font-size: .95rem; }
button, [role=button] { font-weight: 600; }
details summary { cursor: pointer; }

/* ---------------------------------------------------------------- shell */
.topbar { background: #fff; border-bottom: 1px solid var(--pico-muted-border-color); position: sticky; top: 0; z-index: 20; }
.topbar-inner, .subnav-inner, .page { max-width: var(--shell-max); margin: 0 auto; padding: 0 1.25rem; }
.topbar-inner { display: flex; align-items: center; gap: 1.25rem; height: 3.4rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 750; font-size: 1.05rem; color: var(--pico-h1-color); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: .5rem;
              background: var(--metis-blue); color: #fff; font-size: .95rem; }
.mainnav { display: flex; gap: .15rem; margin-left: .5rem; }
.mainnav a { padding: .45rem .7rem; border-radius: .5rem; color: var(--pico-secondary); font-weight: 550; font-size: .93rem; }
.mainnav a:hover { background: var(--pico-secondary-background); text-decoration: none; }
.mainnav a.active { background: #e8eefc; color: var(--metis-blue); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.usermenu { margin: 0; }
.usermenu summary { padding: .35rem .7rem; font-size: .9rem; border: 0; background: transparent; }
.usermenu ul { min-width: 220px; }
.usermenu li small { display: block; padding: .2rem .6rem; }

.subnav { background: #fff; border-bottom: 1px solid var(--pico-muted-border-color); }
.subnav-inner { display: flex; align-items: center; gap: .1rem; height: 2.6rem; overflow-x: auto; }
.subnav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pico-muted-color);
                margin: 0 .35rem 0 1rem; white-space: nowrap; }
.subnav-group:first-child { margin-left: 0; }
.subnav a { padding: .3rem .6rem; border-radius: .4rem; font-size: .88rem; color: var(--pico-secondary); white-space: nowrap; }
.subnav a.active { background: #e8eefc; color: var(--metis-blue); font-weight: 600; }
.subnav a:hover { text-decoration: none; background: var(--pico-secondary-background); }

.page { padding-top: 1.5rem; padding-bottom: 3rem; }
.page-narrow { max-width: 760px; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1, .page-head h2 { margin: 0 0 .15rem; }
.page-head p { margin: 0; color: var(--pico-muted-color); }
.page-head .actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.page-head .actions form { margin: 0; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pico-muted-color); font-weight: 600; margin-bottom: .2rem; }

/* ---------------------------------------------------------------- buttons */
.btn, button.btn { width: auto; margin: 0; padding: .5rem .95rem; font-size: .9rem; border-radius: .5rem; line-height: 1.25; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.btn-sm, button.btn-sm { padding: .32rem .7rem; font-size: .83rem; }
.btn-primary { background: var(--metis-blue); border-color: var(--metis-blue); color: #fff; }
.btn-primary:hover { background: var(--pico-primary-hover); border-color: var(--pico-primary-hover); text-decoration: none; }
.btn-secondary { background: var(--pico-secondary-background); border-color: var(--pico-secondary-background); color: var(--pico-secondary); }
.btn-secondary:hover { background: var(--pico-secondary-hover-background); border-color: var(--pico-secondary-hover-background); text-decoration: none; color: var(--pico-secondary); }
.btn-ghost { background: transparent; border-color: var(--pico-muted-border-color); color: var(--pico-secondary); }
.btn-ghost:hover { background: var(--pico-secondary-background); text-decoration: none; }
.btn-success { background: var(--metis-green); border-color: var(--metis-green); color: #fff; }
.btn-success:hover { background: #166534; border-color: #166534; }
.btn-danger { background: transparent; border-color: #fca5a5; color: var(--metis-red); }
.btn-danger:hover { background: #fef2f2; border-color: var(--metis-red); }
.btn[disabled], button.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
/* legacy helper names still used by admin pages */
button.small { padding: .2rem .6rem; font-size: .8rem; width: auto; margin: 0; }
button.danger { color: var(--metis-red); border-color: #fca5a5; background: transparent; }
button.danger:hover { background: #fef2f2; }
.action-btn { display: inline-flex; align-items: center; gap: .45rem; width: auto; margin: 0; white-space: nowrap;
              padding: .5rem .9rem; font-size: .875rem; font-weight: 600; line-height: 1.25; border-radius: .5rem; }
button.action-btn { width: auto; }
.action-btn.disabled { background: var(--pico-secondary-background); color: var(--pico-muted-color); cursor: not-allowed; }
.page-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.page-actions form { margin: 0; }

/* ---------------------------------------------------------------- pills & badges */
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 650; padding: .16rem .55rem;
        border-radius: 999px; white-space: nowrap; line-height: 1.3; vertical-align: middle; }
.pill.lg { font-size: .85rem; padding: .3rem .8rem; }
.pill::before { content: ""; width: .45em; height: .45em; border-radius: 50%; background: currentColor; opacity: .8; }
.st-draft { background: #fff4d6; color: #92400e; }
.st-submitted { background: #e0eaff; color: #1e40af; }
.st-changes_requested { background: #ffe4e6; color: #9f1239; }
.st-approved { background: #dcfce7; color: #166534; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px;
         vertical-align: middle; text-transform: uppercase; letter-spacing: .02em; }
.status-draft, .role-vendor { background: #fef3c7; color: #92400e; }
.status-submitted, .role-staff { background: #dbeafe; color: #1e40af; }
.status-approved { background: #dcfce7; color: #166534; }
.status-unmapped { background: #e2e8f0; color: #475569; }
.role-admin { background: #ede9fe; color: #5b21b6; }
.req-required { background: #fee2e2; color: #991b1b; }
.req-conditional { background: #fef3c7; color: #92400e; }
.req-recommended { background: #dbeafe; color: #1e40af; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; font-weight: 600; }
.sku.provisional { color: var(--metis-amber); background: #fff7ed; padding: .05rem .4rem; border-radius: .3rem; border: 1px dashed #fdba74; }

/* ---------------------------------------------------------------- meter */
.meter { display: inline-flex; align-items: center; gap: .5rem; min-width: 120px; }
.meter-track { flex: 1; height: .45rem; background: #e5e9f0; border-radius: 999px; overflow: hidden; min-width: 70px; }
.meter-fill { display: block; height: 100%; background: var(--metis-blue); border-radius: 999px; transition: width .3s; }
.meter-fill.done { background: var(--metis-green); }
.meter-label { font-size: .78rem; color: var(--pico-muted-color); min-width: 2.6em; text-align: right; font-variant-numeric: tabular-nums; }
.meter.big .meter-track { height: .7rem; }
.meter.big .meter-label { font-size: .95rem; font-weight: 600; color: var(--pico-color); }

/* ---------------------------------------------------------------- flashes */
.flashes { margin-bottom: 1rem; }
.flash { padding: .7rem 1rem; border-radius: .5rem; margin-bottom: .5rem; border: 1px solid transparent; font-size: .93rem; }
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-info    { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }
.flash-error   { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }

/* ---------------------------------------------------------------- callouts */
.callout { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
           padding: .9rem 1.1rem; border-radius: .65rem; border: 1px solid; margin-bottom: 1.25rem; }
.callout p { margin: 0; }
.callout .callout-text { flex: 1 1 320px; }
.callout .callout-title { font-weight: 650; margin-bottom: .15rem; }
.callout .btn-row { flex: 0 0 auto; }
.callout-todo { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.callout-review { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.callout-changes { background: #fff1f2; border-color: #fecdd3; color: #881337; }
.callout-done { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.callout-neutral { background: #fff; border-color: var(--pico-muted-border-color); color: var(--pico-color); }
.quote { border-left: 3px solid currentColor; padding: .3rem .8rem; margin: .5rem 0 0; opacity: .95; white-space: pre-line; }
.help-note { border-left: 3px solid var(--pico-muted-border-color); background: #fff; padding: .7rem .9rem;
             border-radius: 0 .5rem .5rem 0; font-size: .86rem; line-height: 1.55; color: var(--pico-muted-color); margin-bottom: 1.25rem; }
.help-note p { margin: 0; } .help-note p + p { margin-top: .4rem; } .help-note strong { color: var(--pico-color); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { display: block; background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: .65rem; padding: .85rem 1rem;
        color: inherit; box-shadow: var(--pico-card-box-shadow); }
a.stat:hover { border-color: var(--metis-blue); text-decoration: none; }
.stat .n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .82rem; color: var(--pico-muted-color); margin-top: .15rem; }
.stat.hot { border-color: #bfdbfe; background: #f5f9ff; }
.stat.hot .n { color: var(--metis-blue); }
.stat.warn { border-color: #fecdd3; background: #fff7f8; }
.stat.warn .n { color: #9f1239; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.layout-side { position: sticky; top: 4.2rem; display: grid; gap: 1rem; }
.layout-side article { margin: 0; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } .layout-side { position: static; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.narrow { max-width: 720px; margin: 0 auto; }
.stack > * + * { margin-top: .6rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--pico-muted-color); font-weight: 500; }
.kv dd { margin: 0; }
.kv form { margin: 0; }

/* ---------------------------------------------------------------- toolbar & tables */
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar form { margin: 0; }
.toolbar input, .toolbar select { margin: 0; }
.toolbar select { width: auto; max-width: 260px; flex: 0 0 auto; }
.toolbar .search { flex: 1 1 260px; max-width: 420px; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 999px; font-size: .85rem;
        border: 1px solid var(--pico-muted-border-color); background: #fff; color: var(--pico-secondary); font-weight: 550; }
.chip:hover { border-color: var(--metis-blue); text-decoration: none; }
.chip.active { background: #e8eefc; border-color: #c7d5f8; color: var(--metis-blue); }
.chip .n { font-size: .75rem; background: rgba(0,0,0,.06); padding: 0 .4rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
.chip.active .n { background: rgba(36,87,214,.15); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .5rem; align-items: end; }
.filter-grid input, .filter-grid select, .filter-grid button { margin-bottom: 0; }
.more-filters { margin: .25rem 0 1rem; }
.more-filters summary { font-size: .85rem; color: var(--pico-muted-color); width: max-content; }
.more-filters[open] summary { margin-bottom: .6rem; }
.table-card { background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: .65rem; overflow: hidden; box-shadow: var(--pico-card-box-shadow); }
.table-card table { margin: 0; }
.table-card th { background: var(--pico-card-sectioning-background-color); }
.table-card tbody tr:last-child td { border-bottom: 0; }
.table-card tr.clickable:hover td { background: #f8fafc; }
td.primary a { font-weight: 600; color: var(--pico-color); }
td.primary a:hover { color: var(--metis-blue); }
td.primary .sub { display: block; font-size: .8rem; color: var(--pico-muted-color); font-weight: 400; }
.thumb-col { width: 56px; padding-left: .6rem; padding-right: .2rem; }
.thumb { width: 42px; height: 42px; object-fit: contain; background: #fff; display: grid; place-items: center;
         border: 1px solid var(--pico-muted-border-color); border-radius: .45rem; font-size: 1rem; }
.thumb-empty { background: #f1f4f8; border-style: dashed; }
.thumb-live { color: var(--pico-muted-color); background: #f8fafc; }
.thumb-live svg { width: 18px; height: 18px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 1.2rem; justify-content: center; align-items: center; margin: 1rem 0; font-size: .9rem; }
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty-title { font-weight: 650; margin-bottom: .2rem; }
.empty .btn { margin-top: .75rem; }

/* ---------------------------------------------------------------- product page */
.product-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.product-title h1 { margin: 0; }
.product-meta { display: flex; gap: .5rem 1.1rem; flex-wrap: wrap; color: var(--pico-muted-color); font-size: .9rem; margin-top: .3rem; }
.product-meta .sku { color: var(--pico-color); }
.step-list { margin: 0; padding: 0; list-style: none; }
.step-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--pico-muted-border-color); }
.step-list li:first-child { border-top: 0; }
.step-list .step-name { flex: 1; font-weight: 550; }
.step-list .step-name a { color: inherit; }
.step-list .meter { min-width: 150px; }
.step-list .missing { font-size: .8rem; color: var(--pico-muted-color); min-width: 6em; text-align: right; }
.summary-table td.attr-name { width: 42%; color: var(--pico-muted-color); }
.summary-table tr.empty-row td { color: var(--pico-muted-color); }
.summary-table tr.empty-row td.attr-name::after { content: ""; }
.summary-table td .dash { color: #cbd5e1; }
.section-block { margin-bottom: 1rem; }
.section-block summary { display: flex; align-items: center; gap: .75rem; padding: .65rem .9rem; background: #fff;
                         border: 1px solid var(--pico-muted-border-color); border-radius: .6rem; font-weight: 600; }
.section-block[open] summary { border-radius: .6rem .6rem 0 0; }
.section-block summary::marker { color: var(--pico-muted-color); }
.section-block .section-body { border: 1px solid var(--pico-muted-border-color); border-top: 0; border-radius: 0 0 .6rem .6rem; background: #fff; padding: 0 .9rem; }
.section-block .section-body table { margin: 0; }
.section-block .section-body tr:last-child td { border-bottom: 0; }
.section-block .count { margin-left: auto; font-size: .8rem; color: var(--pico-muted-color); font-weight: 500; }
.section-block .edit-link { font-size: .85rem; font-weight: 500; }
.readiness-list { margin: 0; padding: 0; list-style: none; }
.readiness-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--pico-muted-border-color); font-size: .9rem; }
.readiness-list li:first-child { border-top: 0; }
.readiness-list .ch { flex: 1; font-weight: 550; }
.readiness-list details { margin: 0; }
.readiness-list details summary { font-size: .8rem; color: var(--pico-muted-color); }
.readiness-list details p { font-size: .82rem; margin: .3rem 0 0; color: var(--pico-muted-color); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: .5rem 0; border-top: 1px solid var(--pico-muted-border-color); font-size: .88rem; }
.activity li:first-child { border-top: 0; }
.activity .who { color: var(--pico-muted-color); font-size: .8rem; }
.activity .msg { margin: .15rem 0 0; white-space: pre-line; }
.activity .internal { font-size: .68rem; color: #5b21b6; background: #ede9fe; padding: 0 .35rem; border-radius: .3rem; margin-left: .3rem; }
.note-form textarea { margin-bottom: .4rem; font-size: .9rem; min-height: 4.5rem; }
.note-form .btn-row { justify-content: space-between; }
.inline-edit summary { font-size: .85rem; color: var(--metis-blue); }
.inline-edit form { margin-top: .5rem; }
.inline-edit input, .inline-edit select, .inline-edit textarea { margin-bottom: .5rem; font-size: .9rem; }

/* ---------------------------------------------------------------- galleries */
.gallery-head { margin: 1rem 0 .5rem; font-size: .92rem; }
.gallery-head small { font-weight: 400; font-size: .8rem; }
.gallery { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; }
.gallery figure { margin: 0; width: 120px; text-align: center; }
.gallery img { width: 120px; height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; display: block; }
.gallery figcaption { font-size: .72rem; color: var(--pico-muted-color); margin-top: .25rem; }
.img-actions { display: flex; gap: .3rem; justify-content: center; margin-top: .3rem; }
.img-actions form { margin: 0; }
.img-actions button { padding: .15rem .45rem; font-size: .72rem; margin: 0; width: auto; }
.upload-form { margin-top: 1rem; max-width: 520px; }
.upload-form input[type=file] { margin-bottom: .25rem; }
.upload-form button { width: auto; }

/* ---------------------------------------------------------------- wizard */
.wizard { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .wizard { grid-template-columns: 1fr; } .wizard-side { position: static; } }
.wizard-side { position: sticky; top: 4.2rem; }
.stepper { list-style: none; margin: 0 0 1rem; padding: 0; background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: .65rem; overflow: hidden; }
.stepper li a { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; color: var(--pico-secondary); font-size: .88rem; border-top: 1px solid var(--pico-muted-border-color); }
.stepper li:first-child a { border-top: 0; }
.stepper li a:hover { background: #f8fafc; text-decoration: none; }
.stepper li.active a { background: #e8eefc; color: var(--metis-blue); font-weight: 600; }
.stepper .num { flex: 0 0 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700;
                background: #eef1f6; color: var(--pico-secondary); }
.stepper li.active .num { background: var(--metis-blue); color: #fff; }
.stepper li.done .num { background: #dcfce7; color: var(--metis-green); }
.stepper .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper .cnt { font-size: .75rem; color: var(--pico-muted-color); font-variant-numeric: tabular-nums; }
.wizard-tools { font-size: .85rem; display: grid; gap: .5rem; }
.wizard-tools label { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .85rem; margin: 0; }
.wizard-tools input[type=checkbox] { margin: 0; }
.wizard-main .page-head { margin-bottom: 1rem; }
.section-head { margin: 1.5rem 0 .6rem; font-size: 1rem; color: var(--pico-muted-color); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1.25rem; padding: .85rem 1rem; border: 1px solid var(--pico-muted-border-color);
         border-radius: .65rem; margin-bottom: .6rem; background: #fff; }
.field.filled { border-left: 3px solid var(--metis-green); }
.field.readonly-field { background: var(--pico-card-sectioning-background-color); }
.field-main { min-width: 0; }
.field-main label { font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.field .unit { font-weight: 400; color: var(--pico-muted-color); }
.field .hint { margin: .1rem 0 .45rem; font-size: .86rem; color: var(--pico-muted-color); }
.field .example { margin: .3rem 0 0; font-size: .8rem; color: var(--pico-muted-color); }
.field .notes { margin: .3rem 0 0; font-size: .8rem; color: #92400e; }
.field input, .field select, .field textarea { margin-bottom: 0; }
.field textarea { min-height: 6rem; }
.input-unit { display: flex; align-items: center; gap: .5rem; }
.input-unit input { max-width: 220px; }
.unit-suffix { font-weight: 600; color: var(--pico-muted-color); }
.field-diagram { grid-row: 1 / span 2; margin: 0; text-align: center; align-self: start; }
.field-diagram img { width: 130px; height: 130px; object-fit: contain; background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; }
.field-diagram figcaption { font-size: .72rem; color: var(--pico-muted-color); }
@media (max-width: 640px) { .field { grid-template-columns: 1fr; } .field-diagram { grid-row: auto; } }
.readonly-value { font-weight: 600; margin: .2rem 0 .3rem; }
.field .lock { margin: .2rem 0 0; font-size: .8rem; color: var(--pico-muted-color); }
.req-pill { font-size: .68rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; background: #fee2e2; color: #991b1b; text-transform: uppercase; letter-spacing: .02em; cursor: help; }
.req-pill.soft { background: #eef1f6; color: var(--pico-muted-color); }
.only-empty .field.filled { display: none; }
.only-empty .section-head.all-filled { display: none; }
.wizard-actions { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; padding: .75rem 0; margin-top: 1rem;
                  background: linear-gradient(to bottom, rgba(245,246,248,0), var(--pico-background-color) 30%); }
.wizard-actions .spacer { flex: 1; }
.wizard-actions button { width: auto; margin: 0; }

/* ---------------------------------------------------------------- misc kept for admin */
.req { color: var(--metis-red); }
.inline-form { display: flex; gap: .6rem; align-items: start; max-width: 760px; flex-wrap: wrap; }
.inline-form input, .inline-form select { margin-bottom: 0; flex: 1 1 200px; }
.inline-form button { width: auto; margin: 0; }
.mapping-row { display: flex; gap: .6rem; align-items: center; margin: 0; flex-wrap: wrap; }
.mapping-row input[type=text] { margin: 0; max-width: 260px; }
.mapping-row select { margin: 0; max-width: 240px; width: auto; }
.mapping-row button { margin: 0; }
.access-row { flex-wrap: nowrap; }
.access-row select { min-width: 0; flex: 1 1 140px; }
.type-form select { margin: 0; max-width: 260px; }
.check-inline { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; font-weight: 400; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .15rem 1rem; margin-bottom: 1rem; }
.checkbox-grid label { font-weight: 400; }
.vendor-access { margin: .5rem 0 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.vendor-access label { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border: 1px solid var(--pico-muted-border-color);
                       border-radius: .5rem; margin-bottom: .35rem; cursor: pointer; }
.vendor-access label:hover { border-color: var(--metis-blue); }
.vendor-access input[type=checkbox] { flex: 0 0 auto; margin: 0; }
.vendor-access .v-name { flex: 1 1 auto; min-width: 0; }
.vendor-access .v-id { flex: 0 0 auto; font-size: .72rem; white-space: nowrap; color: var(--pico-muted-color); }
.search-bar { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: .5rem; align-items: center; max-width: 760px; margin-bottom: 1.25rem; }
.search-bar input[type=search] { margin: 0; }
@media (max-width: 640px) { .search-bar { grid-template-columns: 1fr; } }
.vendor-results td { vertical-align: middle; }
.vendor-results input[type=text] { margin: 0; }
.vendor-results button { width: auto; margin: 0; padding: .4rem .8rem; font-size: .85rem; white-space: nowrap; }
.create-attr { display: inline-block; margin: 0 .35rem 0 0; }
.create-attr summary { font-size: .8rem; cursor: pointer; white-space: nowrap; }
.create-attr form { margin: .4rem 0 0; min-width: 230px; }
.create-attr input { margin-bottom: .3rem; }
.actions { white-space: nowrap; }
.actions form { display: inline-block; margin: 0; }
.actions form + form { margin-left: .35rem; }
.progress-track { position: relative; background: #e5e9f0; border-radius: 999px; height: 1.3rem; overflow: hidden; margin-bottom: 1rem; }
.progress-fill { background: var(--metis-green); height: 100%; transition: width .3s; }
.progress-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: #1e293b; }

/* ---------------------------------------------------------------- login */
.login-wrap { max-width: 880px; margin: 3rem auto; }
.login-head { text-align: center; margin-bottom: 2rem; }
.login-head .brand-mark { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; font-size: 1.4rem; border-radius: .8rem; margin-bottom: .6rem; background: var(--metis-blue); color: #fff; font-weight: 750; }
.login-foot { text-align: center; margin-top: 1rem; }
.ms-btn { display: inline-flex; align-items: center; gap: .5rem; }

/* ---------------------------------------------------------------- tooltips */
.tip { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%; font-size: .68rem; font-weight: 700;
       background: #e5e9f0; color: var(--metis-slate); cursor: help; position: relative; vertical-align: middle; line-height: 1; margin-left: .15rem; flex: 0 0 auto; }
.tip:hover, .tip:focus-visible { background: var(--metis-blue); color: #fff; outline: none; }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + .5rem); transform: translateX(-50%);
              background: #1f2937; color: #fff; font-size: .78rem; font-weight: 400; line-height: 1.4; padding: .5rem .65rem; border-radius: .45rem;
              width: max-content; max-width: 280px; white-space: normal; text-align: left; z-index: 50; pointer-events: none; opacity: 0;
              transition: opacity .12s; box-shadow: 0 6px 20px rgba(16,24,40,.18); }
.tip::before { content: ""; position: absolute; left: 50%; bottom: calc(100% + .15rem); transform: translateX(-50%); border: .35rem solid transparent;
               border-top-color: #1f2937; opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 50; }
.tip:hover::after, .tip:hover::before, .tip:focus-visible::after, .tip:focus-visible::before { opacity: 1; }
td .tip::after, th .tip::after { max-width: 240px; }
th .th-tip { display: inline-flex; align-items: center; gap: .2rem; }
th .tip { text-transform: none; letter-spacing: 0; }
label .tip { margin-left: .25rem; }
/* tooltips near the left edge open to the right instead of clipping */
.layout-side .tip::after, .stepper .tip::after, .wizard-side .tip::after { left: 0; transform: none; }
.layout-side .tip::before, .stepper .tip::before, .wizard-side .tip::before { left: .5rem; transform: none; }

/* ---------------------------------------------------------------- help drawer */
.help-btn { gap: .35rem; }
.guide-drawer { position: fixed; top: 3.4rem; right: 0; bottom: 0; width: min(400px, 100vw); background: #fff; border-left: 1px solid var(--pico-muted-border-color);
                box-shadow: -8px 0 30px rgba(16,24,40,.12); z-index: 30; display: flex; flex-direction: column; }
.guide-drawer[hidden] { display: none; }
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem .4rem; }
.guide-close { width: auto; margin: 0; padding: .1rem .55rem; font-size: 1.2rem; line-height: 1; background: transparent; border: 0; color: var(--pico-muted-color); }
.guide-close:hover { color: var(--pico-color); }
.guide-body { padding: 0 1.1rem 1rem; overflow-y: auto; flex: 1; font-size: .92rem; }
.guide-body h3 { margin-bottom: .35rem; font-size: 1.15rem; }
.guide-foot { border-top: 1px solid var(--pico-muted-border-color); padding: .7rem 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .82rem; flex-wrap: wrap; }
.guide-foot label { margin: 0; font-size: .82rem; font-weight: 500; }
.guide-foot input[type=checkbox] { margin: 0; }
.guide-steps { padding-left: 1.3rem; margin: .5rem 0; list-style: decimal; }
.guide-steps li { list-style: decimal; }
.guide-steps li, .guide-tips li { margin-bottom: .4rem; line-height: 1.5; }
.guide-tips { padding-left: 1.1rem; margin: .5rem 0 0; color: var(--pico-muted-color); font-size: .88rem; list-style: none; }
.guide-tips li::marker { content: "→ "; color: var(--metis-blue); }
@media (min-width: 1100px) { body.guide-open .page { padding-right: 420px; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ask { margin: 0; padding: 0 1.1rem .6rem; }
.ask input[type=search] { margin: 0; font-size: .9rem; padding-top: .45rem; padding-bottom: .45rem; height: auto; }
.ask-page .ask { padding: 0; }
.ask-page .ask label { font-weight: 600; }
.ask-page .ask-results { margin-top: .9rem; }
.ask-results { list-style: none; padding: 0; margin: 0 0 .5rem; }
.ask-results li { list-style: none; padding: .6rem 0; border-top: 1px solid var(--pico-muted-border-color); }
.ask-results li:first-child { border-top: 0; padding-top: 0; }
.ask-results .eyebrow { display: block; }
.ask-title { font-weight: 600; font-size: 1rem; }
.ask-results p { margin: .25rem 0 .3rem; line-height: 1.5; font-size: .9rem; }
.ask-results mark { padding: 0 .1em; border-radius: 2px; }
.ask-empty { color: var(--pico-muted-color); font-size: .9rem; }
.ask-back { margin: .4rem 0 0; }
.ask-back .btn { width: auto; }
.help-manual .help-guide { padding: .6rem 0 .4rem; border-top: 1px solid var(--pico-muted-border-color); }
.help-manual .help-guide:first-of-type { border-top: 0; padding-top: 0; }
.help-manual .help-guide h3 { font-size: 1.05rem; margin: 0 0 .3rem; }
.help-manual .kv { grid-template-columns: max-content 1fr; }
.toc { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.toc > li { margin-bottom: .5rem; }
.toc ul { list-style: none; padding-left: .6rem; margin: .2rem 0 0; }
.toc ul li { margin: .15rem 0; }
.login-help { max-width: 560px; margin: 1rem auto 0; font-size: .9rem; }
.login-help summary { text-align: center; color: var(--metis-blue); }
.login-help .guide-steps { text-align: left; }
