/* ==========================================================================
   Alto Field Tools — main.css
   Catalog Search Workbench shell (DEC-018, docs/fable-ui-brief.md)
   Original Alto Well & Pump branding. Pattern inspired by faceted-search
   UX; no third-party code, chrome, or assets copied.

   Sections:
     1. Tokens
     2. Base / reset
     3. Top bar + menu bar
     4. Login
     5. Scoped search row
     6. Catalog workbench layout (two-column + rail)
     7. Result cards
     8. Detail pages (item / assembly)
     9. Imports & summary (carried over, unchanged behavior)
    10. Responsive: tablet (>=640px) and desktop (>=960px)
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  /* Alto blue/grey palette (Patch 1B correction) */
  --alto-blue: #1174c3;        /* primary actions, links */
  --alto-blue-light: #63bbf2;  /* light action accents */
  --alto-blue-mid: #4e94bf;    /* medium blue */
  --alto-navy: #2f5973;        /* primary nav bar, headings */
  --alto-wash: #acd7f2;        /* light blue wash / highlight borders */
  --alto-bg: #f2f2f2;          /* page background / light grey */
  --alto-text: #262626;        /* primary text */
  --alto-green: #7dbf3b;       /* small Alto accent only */
  --alto-warn: #754e12;        /* admin / warning brown */
  --alto-tan: #caa162;         /* soft tan admin accent */
  /* Rev 5: danger red for below-margin and stale pricing states. Not part of
     the DEC-020 palette yet; record in the next DESIGN/interface pass. */
  --alto-danger: #b3392e;
  --alto-card: #ffffff;
  --alto-border: #dde4e9;      /* light neutral borders */
  --alto-muted: #5a6771;
  --radius-card: 10px;
  --radius-control: 8px;
  --focus-ring: 0 0 0 3px rgba(17, 116, 195, 0.18);
  --rail-min: 13rem;
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--alto-bg);
  color: var(--alto-text);
}

/* 2. Base / reset --------------------------------------------------------- */
* {
  box-sizing: border-box;
}

body {
  background: var(--alto-bg);
  margin: 0;
}

.page-shell {
  margin: 0 auto;
  max-width: 76rem;
  padding: 1rem;
}

input,
button,
select,
textarea {
  border: 1px solid #c3ced6;
  border-radius: var(--radius-control);
  font: inherit;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  width: 100%;
}

input,
select,
textarea {
  background: #ffffff;
  color: var(--alto-text);
}

textarea {
  line-height: 1.45;
  resize: vertical;
}

/* Custom dropdown chevron + roomier padding for all selects (search scope
   overrides with its own icon). */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231174c3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: right 0.85rem center;
  background-repeat: no-repeat;
  padding-right: 2.4rem;
}

/* Focus/hover affordance: subtle border-based states instead of glow
   (accessibility: visibility preserved, decoration removed). Text inputs
   rely on the caret plus a darker border; selects darken on hover/focus so
   they read as interactive; nothing stays highlighted after blur. */
input:focus,
select:focus,
textarea:focus {
  border-color: #7d97a8;
  box-shadow: none;
  outline: none;
}

select:hover {
  border-color: #9fb2c0;
}

button:focus-visible,
a:focus-visible,
label:focus-visible {
  outline: 2px solid var(--alto-blue-mid);
  outline-offset: 2px;
}

button {
  background: var(--alto-blue);
  border-color: var(--alto-blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 2.8rem;
  width: auto;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  background: var(--alto-blue);
  border-color: var(--alto-blue);
}

.button-secondary {
  background: #ffffff;
  border-color: var(--alto-blue-mid);
  color: var(--alto-blue);
}

.button-caution {
  border-color: var(--alto-tan);
  color: var(--alto-warn);
}

.error {
  color: #9f1d1d;
}

/* 3. Header (brand + global search + session controls) + nav bar ---------- */
.site-head {
  background: #ffffff;
  border-bottom: 1px solid var(--alto-border);
}

/* Very top brand stripe: Alto green + blue. */
.top-stripe {
  background: linear-gradient(90deg, var(--alto-green) 0 55%, var(--alto-blue) 55% 100%);
  height: 4px;
}

.top-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  min-height: 3rem;
  padding: 0.5rem 1rem 0.8rem;
}

.top-nav a {
  color: var(--alto-navy);
  text-decoration: none;
}

.brand {
  color: var(--alto-navy);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Global search sits between brand and session controls on desktop; on
   mobile it wraps to its own full-width row (stacked control preserved). */
.head-search {
  flex: 1 1 100%;
  min-width: 0;
  order: 3;
}

.top-nav-right {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-left: auto;
}

/* Compact view control (admin-only placeholder): "View: Admin ▾". */
.view-pill {
  background: #f6f8fa;
  border: 1px solid var(--alto-border);
  border-radius: 999px;
  color: var(--alto-navy);
  font-size: 0.8rem;
  font-weight: 700;
  min-height: 0;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
}

.logout-link {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--alto-blue) !important;
  font-size: inherit;
  font-weight: 700;
  min-height: 0;
  padding: 0.18rem 0.55rem;
  width: auto;
}

.logout-link:hover {
  background: rgba(17, 116, 195, 0.08);
}

/* Hamburger toggle (CSS-only). Visible on mobile; menu-bar collapses. */
.nav-toggle-box {
  display: none;
}

.nav-toggle {
  cursor: pointer;
  display: none;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.4rem;
}

.nav-toggle span {
  background: var(--alto-navy);
  border-radius: 2px;
  display: block;
  height: 2px;
  width: 1.35rem;
}

.menu-bar {
  align-items: center;
  background: var(--alto-navy);
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0 0.6rem;
}

.menu-link {
  border-bottom: 3px solid transparent;
  color: #ffffff;
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.55rem 0.7rem 0.45rem;
  text-decoration: none;
  white-space: nowrap;
}

.menu-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-link.is-active {
  border-bottom-color: var(--alto-green);
}

.menu-link.is-disabled {
  cursor: default;
  opacity: 0.55;
}

.menu-link.is-disabled:hover {
  background: transparent;
}

/* Logout inside the menu panel: mobile-only affordance (non-sensitive).
   The top-bar Logout link serves tablet/desktop. */
.menu-logout {
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  display: none;
  min-height: 0;
  text-align: left;
  width: 100%;
}

/* 4. Login ---------------------------------------------------------------- */
.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.stub-page,
.login-panel {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
}

.login-panel {
  box-shadow: 0 12px 32px rgba(47, 89, 115, 0.10);
  max-width: 24rem;
  width: min(100% - 2rem, 24rem);
}

.login-brand {
  border-bottom: 1px solid var(--alto-border);
  display: grid;
  gap: 0.2rem;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  text-align: center;
}

.login-wordmark {
  color: var(--alto-navy);
  font-size: 1.35rem;
  font-weight: 700;
}

.login-sub {
  color: var(--alto-muted);
  font-size: 0.85rem;
}

.login-panel form {
  display: grid;
  gap: 0.85rem;
}

.login-panel label {
  display: grid;
  gap: 0.3rem;
}

.login-panel label span {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-panel input {
  min-height: 3rem;
}

.login-submit {
  margin-top: 0.35rem;
  min-height: 3.1rem;
  width: 100%;
}

/* 5. Scoped search row ----------------------------------------------------- */
.search-form {
  display: block;
  margin: 0 auto;
  width: 100%;
}

.search-row {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

/* Connected input + icon button pair (always one row, shared straight edge). */
.search-main {
  display: flex;
  min-width: 0;
}

.search-main .search-input {
  border-bottom-right-radius: 0;
  border-right: 0;
  border-top-right-radius: 0;
  flex: 1 1 auto;
}

.search-main .search-go {
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  flex: 0 0 auto;
}

.search-scope {
  align-items: center;
  display: flex;
  gap: 0.3rem;
  position: relative;
}

.scope-icon {
  color: var(--alto-blue);
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
}

.search-scope select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #e9f3fb;
  background-image: none; /* uses .scope-icon glyph instead of the global chevron */
  border-color: #c3ced6;
  color: var(--alto-navy);
  font-weight: 700;
  min-height: 3.1rem;
  padding-right: 2.4rem;
}

.search-scope select:hover,
.search-scope select:focus {
  border-color: #8aa0b0;
}

.search-input {
  font-size: 1.05rem;
  min-height: 3.1rem;
}

.search-go {
  align-items: center;
  display: inline-flex;
  gap: 0.45rem;
  justify-content: center;
  min-height: 3.1rem;
  padding-inline: 1rem;
  width: auto;
}

.search-go-icon {
  display: block;
  flex: 0 0 auto;
}

.search-go-label {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* 6. Catalog workbench layout ---------------------------------------------- */
.catalog-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-top: 1rem;
}

.rail-toggle-box {
  display: none;
}

.rail-toggle {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  text-align: center;
}

.rail {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  display: none;
  gap: 1.1rem;
  padding: 1rem;
}

/* Mobile filter sheet: checkbox toggle opens the rail as an overlay. */
.rail-toggle-box:checked ~ .catalog-layout .rail {
  background: var(--alto-card);
  bottom: 0;
  display: grid;
  left: 0;
  overflow-y: auto;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 40;
}

.rail-close {
  color: var(--alto-blue);
  cursor: pointer;
  font-weight: 700;
  justify-self: end;
}

/* Rail head: Clear filters + mobile close control. */
.rail-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.clear-filters {
  color: var(--alto-blue);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.clear-filters:hover {
  text-decoration: underline;
}

.clear-filters.is-muted {
  color: #a3aeb6;
  cursor: default;
  font-weight: 400;
}

.rail-group {
  display: grid;
  gap: 0.7rem;
}

.rail-group > label {
  display: grid;
  gap: 0.35rem;
}

.rail-heading {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
  text-transform: uppercase;
}

.rail-note {
  color: var(--alto-muted);
  font-size: 0.85rem;
  margin: 0;
}

.rail-group span,
.rate-label {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.checkbox-row,
.radio-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-control);
  display: flex !important;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0.62rem 0.75rem;
}

.checkbox-row input,
.radio-row input {
  flex: 0 0 auto;
  height: 1.1rem;
  margin: 0;
  width: 1.1rem;
}

.checkbox-row span,
.radio-row span {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.2;
  text-transform: none;
}

/* Active-filter state: subtle, only while a real value is selected. */
.rail-filter.has-value,
.checkbox-row.has-value {
  background-color: #f2f8fd;
  border-color: var(--alto-blue-mid);
}

.radio-row.is-disabled {
  opacity: 0.6;
}

/* 7. Result cards ----------------------------------------------------------- */
.catalog-results {
  min-width: 0;
}

.search-intro {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  color: #39463d;
  padding: 1.4rem;
}

.search-intro h2 {
  color: var(--alto-navy);
  margin: 0 0 0.6rem;
}

.search-intro p {
  margin: 0 0 0.6rem;
}

.search-intro a {
  color: var(--alto-blue);
  font-weight: 700;
}

.result-summary {
  color: var(--alto-muted);
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.result-list,
.offer-list {
  display: grid;
  gap: 0.75rem;
}

.result-card {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-left: 2px solid var(--alto-wash);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  display: grid;
  gap: 1rem;
  padding: 1rem;
  position: relative;
}

.result-card:hover {
  border-color: var(--alto-blue-mid);
  border-left-color: var(--alto-blue-mid);
}

.result-title {
  color: var(--alto-blue);
  font-size: 1.08rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(17, 116, 195, 0.35);
  text-underline-offset: 3px;
}

/* Whole card is tappable via a stretched link — big mobile touch target. */
.result-title::after {
  content: "";
  inset: 0;
  position: absolute;
}

.result-title:hover {
  text-decoration-color: var(--alto-blue);
}

.result-desc,
.result-main p {
  color: #414c53;
  margin: 0.5rem 0 0;
}

.meta-row {
  align-items: center;
  color: var(--alto-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin-top: 0.35rem;
}

.meta-row span {
  white-space: nowrap;
}

.type-chip {
  background: #e3f0fa;
  border-radius: 999px;
  color: var(--alto-navy);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
}

.archived-chip {
  background: #f3e8d2;
  border-radius: 999px;
  color: var(--alto-warn);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
}

.result-ids {
  font-size: 0.88rem;
}

.supplier-line {
  color: #414c53;
  font-weight: 700;
  margin-top: 0.6rem;
}

.supplier-code {
  color: var(--alto-muted);
  font-weight: 400;
  margin-left: 0.5rem;
}

/* Supplier search box legacy alias — the module-search component (Rev 4)
   is the canonical class going forward. Kept as a matched-selector alias
   so any remaining .supplier-search references (older docs, backup
   templates) keep their sizing. Templates using .supplier-search should
   migrate to .module-search over time. */
.supplier-search {
  margin-bottom: 1rem;
  max-width: 28rem;
}

.supplier-search .search-input,
.supplier-search .search-go {
  min-height: 2.9rem;
}

/* Transparent outline pill button in the link color (Patch 2A-1c). */
.button-pill-outline {
  background: transparent;
  border: 1px solid var(--alto-blue);
  border-radius: 999px;
  color: var(--alto-blue);
}

.button-pill-outline:hover {
  background: rgba(17, 116, 195, 0.08);
}

/* Supplier detail header: Edit action sits next to the name (Patch 2A-1c),
   same left-title/right-action pattern as .page-head. */
.detail-head-row {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  width: 100%;
}

/* Supplier detail hero: logo placeholder + account fields (Patch 2A-1b). */
.supplier-hero {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.supplier-logo-placeholder {
  align-items: center;
  background: var(--alto-navy);
  border-radius: var(--radius-control);
  color: #ffffff;
  display: flex;
  flex: 0 0 auto;
  font-size: 1.3rem;
  font-weight: 700;
  height: 3.4rem;
  justify-content: center;
  width: 3.4rem;
}

.supplier-hero .detail-list {
  flex: 1 1 auto;
}

.rate-panel {
  align-content: start;
  background: #f7fafc;
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-control);
  display: grid;
  gap: 0.35rem;
  min-width: 11rem;
  padding: 0.8rem;
}

.rate-panel strong {
  color: var(--alto-text);
  font-size: 1.35rem;
}

.price-check {
  color: var(--alto-muted);
  font-size: 0.9rem;
}

.price-check.stale {
  color: var(--alto-warn);
  font-weight: 700;
}

.check-price {
  color: var(--alto-warn);
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-money {
  color: var(--alto-warn);
  font-size: 0.9rem;
  font-weight: 700;
}

.empty-state {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  color: var(--alto-muted);
  padding: 1rem;
}

/* 8. Detail pages ------------------------------------------------------------ */
.detail-head {
  align-items: start;
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.detail-head h1 {
  margin: 0;
}

.back-link {
  color: var(--alto-blue);
  font-weight: 700;
  text-decoration: none;
}

.detail-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-top: 1rem;
}

.detail-main {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.detail-sidebar {
  display: grid;
  gap: 1rem;
}

.sidebar-block {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
}

.rate-panel--detail {
  border-radius: var(--radius-card);
}

.view-select {
  width: 100%;
}

.detail-block {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  padding: 1rem;
}

.detail-block h2 {
  font-size: 1rem;
  margin: 0 0 0.8rem;
}

.detail-list {
  display: grid;
  gap: 0.45rem 1rem;
  grid-template-columns: minmax(7rem, 0.4fr) 1fr;
  margin: 0;
}

.detail-list dt {
  color: var(--alto-muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.offer-row {
  border-top: 1px solid var(--alto-border);
  display: grid;
  gap: 0.7rem;
  padding-top: 0.75rem;
}

.offer-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.preferred-badge {
  background: #e3f0fa;
  border-radius: 999px;
  color: var(--alto-navy);
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-left: 0.4rem;
  padding: 0.15rem 0.5rem;
}

.offer-rate {
  align-content: start;
  display: grid;
  gap: 0.25rem;
  justify-items: start;
}

.offer-rate .chip {
  align-items: center;
  align-self: start;
  display: inline-flex;
  justify-content: center;
  justify-self: start;
  line-height: 1.2;
  min-height: 1.45rem;
  width: max-content;
}

.page-intro {
  align-items: start;
  display: grid;
  gap: 0.75rem;
}

.page-intro h1 {
  margin: 0 0 0.35rem;
}

.intro-action {
  border: 1px solid var(--alto-blue-mid);
  border-radius: var(--radius-control);
  display: inline-block;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
}

/* Plain page header (not a result card): title left, actions right. */
.page-head {
  align-items: start;
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem;
  padding: 0 0.25rem;
}

.page-head h1 {
  margin: 0 0 0.3rem;
}

.page-sub {
  color: var(--alto-muted);
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 0.6rem;
}

.page-body {
  margin-top: 0.5rem;
}

/* 9. Imports & summary (unchanged behavior) ----------------------------------- */
.import-form {
  display: grid;
  gap: 1rem;
}

.import-form label,
.supplier-form label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.import-form span,
.supplier-form span {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Supplier create/edit form (Patch 2A-1c polish): fieldsets become plain
   bordered sections instead of default browser groove/legend styling. */
.supplier-form {
  display: grid;
  gap: 1.25rem;
}

.supplier-form fieldset {
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 1rem;
}

.supplier-form legend {
  color: var(--alto-navy);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 0.3rem;
}

.supplier-form .field-wide {
  grid-column: 1 / -1;
}

.import-panel h1,
.import-summary h2 {
  margin: 0 0 0.8rem;
}

.summary-head {
  align-items: start;
  display: grid;
  gap: 1rem;
}

.summary-head p {
  color: var(--alto-muted);
  margin: 0;
}

.summary-head form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.summary-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}

.summary-grid div,
.compact-list div {
  background: #f7fafc;
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-control);
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
}

.summary-grid span,
.compact-list span {
  color: var(--alto-muted);
  font-size: 0.9rem;
}

.summary-grid strong {
  font-size: 1.25rem;
}

.compact-list {
  display: grid;
  gap: 0.5rem;
}

.import-actions {
  align-items: stretch;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

.import-override {
  align-self: end;
  min-height: 2.8rem;
}

/* Legacy support: pages not yet migrated may still render .import-panel etc.
   inside .detail-block styling above. */

/* ==========================================================================
   Catalog Interface Components (Patch 2A Revision 4)
   Interface System v1 application layer for catalog/supplier surfaces.
   New classes ship alongside aliases for existing names so templates can
   migrate class-by-class in Slices 2 and 3.
   See docs/patches/patch-2a-revision-4-spec.md §3.
   Components: Page Header (detail variant), Local Toolbar, Module Search
   Row (alias supplier-search), Panel (alias detail-block/sidebar-block),
   Result Row, Hero, Summary Panel, Accordion, Chip family, Form
   Workspace (alias supplier-form), Action Bar (alias import-actions),
   External Link affordance.
   ========================================================================== */

/* Panel — the one container ------------------------------------------------ */
.panel {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  padding: 1rem;
}

/* Page Header — detail variant --------------------------------------------- */
.page-head--detail {
  display: grid;
  gap: 0.4rem;
  margin: 0.25rem 0 1rem;
  padding: 0 0.25rem;
}

.page-head--detail .back-link {
  display: inline-block;
  margin-bottom: 0.15rem;
}

.page-head--detail .back-link:hover {
  text-decoration: underline;
}

.page-head-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
}

/* Local Toolbar — module search + module actions --------------------------- */
.local-toolbar {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.25rem 0 1rem;
}

.local-toolbar .module-search,
.local-toolbar .supplier-search {
  flex: 1 1 20rem;
  margin-bottom: 0;
  min-width: 0;
}

.local-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

/* Module Search Row — module-local search (supplier_q, project_q, ...) ----- */
.module-search {
  margin-bottom: 1rem;
  max-width: 28rem;
}

.module-search .search-input,
.module-search .search-go {
  min-height: 2.9rem;
}

/* Result Row — Finder/Drive-style one-liner in a shared bordered container - */
.result-row-list {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  overflow: hidden;
}

.result-row {
  align-items: center;
  border-top: 1px solid var(--alto-border);
  column-gap: 1rem;
  display: flex;
  flex-wrap: wrap;
  min-height: 2.9rem;
  padding: 0.6rem 1rem;
  row-gap: 0.35rem;
  transition: background 0.1s ease;
}

.result-row:first-child {
  border-top: 0;
}

.result-row:hover {
  background: #f5f9fc;
}

.result-row.is-inactive {
  opacity: 0.7;
}

.result-row__title {
  color: var(--alto-blue);
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.result-row__title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-row__chips {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.result-row__meta {
  align-items: center;
  color: var(--alto-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.92rem;
  gap: 0.3rem 0.75rem;
  margin-left: auto;
}

.result-row__meta a {
  color: var(--alto-blue);
  font-weight: 700;
}

.result-row__meta strong {
  color: var(--alto-text);
  font-weight: 700;
}

.result-row__actions {
  align-items: center;
  display: flex;
  gap: 0.35rem;
}

.result-row__actions .button-secondary,
.result-row__actions .button-primary,
.result-row__actions .button-pill-outline {
  font-size: 0.88rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.75rem;
}

/* Hero — item detail identity block ---------------------------------------- */
.detail-hero {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
  padding: 1rem;
}

.detail-hero__photo {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #f6f7f8;
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-control);
  display: flex;
  justify-content: center;
  overflow: hidden;
  width: 100%;
}

.detail-hero__photo img {
  background: #ffffff;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.detail-hero__photo-glyph {
  color: #b0b7bd;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.detail-hero__manufacturer {
  color: var(--alto-muted);
  font-size: 0.9rem;
}

.detail-hero__manufacturer a {
  color: var(--alto-blue);
  font-weight: 700;
}

.detail-hero__manufacturer .detail-hero__model {
  color: var(--alto-muted);
  font-weight: 400;
  margin-left: 0.4rem;
}

.detail-hero__title {
  margin: 0;
}

.detail-hero__chips {
  align-items: center;
  color: var(--alto-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}

.detail-hero__source {
  border-top: 1px solid var(--alto-border);
  color: var(--alto-text);
  display: grid;
  gap: 0.25rem;
  padding-top: 0.6rem;
}

.detail-hero__source a {
  color: var(--alto-blue);
  font-weight: 700;
}

.detail-hero__source-empty {
  color: var(--alto-muted);
  font-style: italic;
}

.detail-hero__source-meta {
  color: var(--alto-muted);
  font-size: 0.9rem;
}

.detail-hero__sources-link {
  color: var(--alto-muted);
  display: inline-block;
  font-size: 0.88rem;
  margin-top: 0.35rem;
  text-decoration: none;
}

.detail-hero__sources-link:hover {
  color: var(--alto-blue);
  text-decoration: underline;
}

/* Summary Panel — evolved rate-panel--detail for hero-embedded price display */
.summary-panel {
  align-content: start;
  background: #f7fafc;
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-control);
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.85rem 1rem;
}

.summary-panel__label {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.summary-panel__rate {
  color: var(--alto-text);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
}

.summary-panel__unit {
  color: var(--alto-muted);
  font-size: 0.9rem;
}

.summary-panel__secondary {
  color: var(--alto-warn);
  font-size: 0.9rem;
  font-weight: 700;
}

.summary-panel__price-check {
  color: var(--alto-muted);
  font-size: 0.9rem;
}

.summary-panel__price-check--warn {
  color: var(--alto-warn);
  font-weight: 700;
}

.price-freshness {
  font-size: 0.9rem;
  font-weight: 700;
}

.price-freshness--current {
  color: #3f6a1e;
}

.price-freshness--stale {
  color: var(--alto-danger);
}

.summary-panel__admin {
  color: var(--alto-warn);
  font-size: 0.88rem;
  font-weight: 700;
}

.summary-panel__admin:first-of-type {
  margin-top: 0.4rem;
}

.summary-panel__mode {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-style: italic;
  margin-top: 0.4rem;
}

/* Accordion — native <details>/<summary> stack ----------------------------- */
.accordion-stack {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  overflow: hidden;
}

.accordion {
  border-top: 1px solid var(--alto-border);
}

.accordion:first-child {
  border-top: 0;
}

.accordion__summary {
  align-items: center;
  color: var(--alto-navy);
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  font-weight: 700;
  gap: 0.75rem;
  list-style: none;
  min-height: 3rem;
  padding: 0.75rem 1rem;
}

.accordion__summary::-webkit-details-marker {
  display: none;
}

.accordion__summary::marker {
  content: "";
}

.accordion__summary:hover {
  background: rgba(17, 116, 195, 0.04);
}

.accordion__summary::after {
  border-bottom: 2px solid var(--alto-blue);
  border-right: 2px solid var(--alto-blue);
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  height: 0.55rem;
  margin-left: auto;
  transform: rotate(45deg) translate(-0.15rem, -0.15rem);
  transition: transform 0.15s ease;
  width: 0.55rem;
}

.accordion[open] > .accordion__summary::after {
  transform: rotate(-135deg) translate(-0.05rem, -0.05rem);
}

.accordion__body {
  padding: 0.25rem 1rem 1rem;
}

.accordion__body > *:first-child {
  margin-top: 0;
}

.accordion__body > *:last-child {
  margin-bottom: 0;
}

/* Chip family — Metadata chip ---------------------------------------------- */
.chip {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  padding: 0.12rem 0.55rem;
  white-space: nowrap;
}

.chip--type {
  background: #e3f0fa;
  color: var(--alto-navy);
}

.chip--warn {
  background: #f3e8d2;
  color: var(--alto-warn);
}

.chip--preferred {
  background: #e3f0fa;
  color: var(--alto-navy);
}

.chip--ok {
  background: rgba(125, 191, 59, 0.14);
  color: #3f6a1e;
}

/* Form Workspace — grouped fieldset pattern for Edit Workspace forms ------- */
.form-workspace {
  display: grid;
  gap: 1.25rem;
}

.form-workspace fieldset {
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 1rem;
}

.form-workspace legend {
  color: var(--alto-navy);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 0.3rem;
}

.form-workspace label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.form-workspace label > span {
  color: var(--alto-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-workspace .field-wide {
  grid-column: 1 / -1;
}

.form-workspace input[type="date"] {
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}

/* Action Bar — Save/Cancel row for Edit Workspace forms -------------------- */
.action-bar {
  align-items: stretch;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

/* External link — ↗ affordance on external anchors -------------------------- */
.external-link::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.75;
}

/* Resource list — Resources accordion link stack ---------------------------- */
.resource-list {
  display: grid;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.resource-list a {
  color: var(--alto-blue);
  font-weight: 700;
}

/* 10. Responsive ---------------------------------------------------------------- */

/* Mobile-only adjustments (<640px): hamburger nav, compact scope control. */
@media (max-width: 639.98px) {
  .nav-toggle {
    display: flex;
  }

  .menu-bar {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.35rem 0.6rem 0.6rem;
  }

  .nav-toggle-box:checked ~ .menu-bar {
    display: flex;
  }

  .menu-link {
    border-bottom: 0;
    border-left: 3px solid transparent;
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
  }

  .menu-link.is-active {
    border-left-color: var(--alto-green);
  }

  /* Logout moves into the hamburger menu on mobile. */
  .menu-logout {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: block;
    margin-top: 0.3rem;
  }

  .top-nav-right .logout-link {
    display: none; /* non-sensitive: logout is in the menu panel on mobile */
  }

  .top-nav-right .view-pill {
    display: none; /* admin convenience control; desktop/tablet only. Non-sensitive. */
  }

  /* Scope control compacts on mobile; larger, better-centered arrow. */
  .search-scope select {
    font-size: 0.95rem;
    padding: 0.75rem 2.7rem 0.75rem 0.75rem;
  }

  .scope-icon {
    font-size: 1.5rem;
    right: 0.8rem;
  }

  /* Thin separator below the mobile search area; the Filters/View bar
     sits close beneath it as part of the top workbench controls. */
  .site-head {
    border-bottom: 7px solid var(--alto-blue);
  }

  .top-nav {
    padding-bottom: 0.75rem;
  }

  .page-shell {
    padding-top: 0.65rem;
  }

  .catalog-layout {
    gap: 0.75rem;
    margin-top: 0.35rem;
  }
}

/* Tablet and up (>=640px): search joins the header row between brand and
   session controls (WorldCat-inspired structure). */
@media (min-width: 640px) {
  .page-shell {
    padding: 1.5rem;
  }

  .head-search {
    display: flex;
    flex: 1 1 auto;
    justify-content: center; /* centers the connected control in the row */
    margin-inline: 0.4rem;
    order: 0; /* between brand and .top-nav-right in source order */
  }

  .search-form {
    max-width: 40rem;
  }

  /* Connected search control: [scope][input][icon button] with no gaps,
     shared borders, outer edges rounded only. Slimmer inside the header.
     Rev 6A: these connected-control rules are scoped to .head-search — they
     describe the header composition only. Standalone module searches
     (.module-search, e.g. supplier_q) have no scope control on their left
     and must keep their own left border and rounded left corners. */
  .head-search .search-row {
    gap: 0;
    grid-template-columns: minmax(8.5rem, auto) 1fr;
  }

  .head-search .search-row,
  .head-search .search-scope,
  .head-search .search-main {
    align-items: stretch;
  }

  .head-search .search-scope select,
  .head-search .search-main .search-input,
  .head-search .search-main .search-go {
    height: 2.6rem;
    min-height: 2.6rem;
  }

  .head-search .search-scope select,
  .head-search .search-main .search-input {
    padding-block: 0;
  }

  .head-search .search-scope select {
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
  }

  .head-search .search-main .search-input {
    border-left: 0;
    border-radius: 0;
  }

  .search-input:focus {
    position: relative;
    z-index: 1;
  }

  .head-search .search-go {
    padding-inline: 0.9rem;
  }

  .search-go-label {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px; /* icon-only button; label stays for screen readers */
  }

  .import-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .supplier-form fieldset,
  .form-workspace fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .import-actions,
  .action-bar {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, max-content));
    justify-content: start;
  }

  .action-bar {
    grid-template-columns: repeat(3, minmax(0, max-content));
  }

  /* Detail hero: photo left ~30%, identity right; summary panel full-width
     below the identity + photo pair (tablet-only compromise). */
  .detail-hero {
    grid-template-columns: minmax(9rem, 30%) 1fr;
    grid-template-areas:
      "photo manufacturer"
      "photo title"
      "photo chips"
      "photo source"
      "summary summary";
    gap: 0.75rem 1.25rem;
  }

  .detail-hero__photo { grid-area: photo; }
  .detail-hero__manufacturer { grid-area: manufacturer; }
  .detail-hero__title { grid-area: title; }
  .detail-hero__chips { grid-area: chips; }
  .detail-hero__source { grid-area: source; }
  .detail-hero .summary-panel { grid-area: summary; }

  .page-intro {
    grid-template-columns: 1fr auto;
  }

  .page-head {
    grid-template-columns: 1fr auto;
  }
}

/* Desktop (>=960px): two-column workbench and detail layouts. */
@media (min-width: 960px) {
  /* Align header and nav-bar gutters with the centered .page-shell content
     (max-width 76rem, 1.5rem padding). */
  .top-nav,
  .menu-bar {
    padding-inline: max(1.5rem, calc((100% - 76rem) / 2 + 1.5rem));
  }

  .rail-toggle {
    display: none;
  }

  .rail {
    align-content: start;
    display: grid;
    position: static;
  }

  .rail-close {
    display: none;
  }

  .catalog-layout {
    grid-template-columns: minmax(var(--rail-min), 1fr) 3fr;
  }

  .result-card,
  .offer-row {
    grid-template-columns: 1fr auto;
  }

  .detail-head {
    grid-template-columns: auto 1fr;
  }

  .detail-layout {
    align-items: start;
    grid-template-columns: minmax(0, 7fr) minmax(15rem, 3fr);
  }

  /* Explicit grid-column so supplier_detail can put the sidebar first in
     DOM (mobile: contact/account stack ABOVE the item list) while still
     placing it on the RIGHT at desktop. Assembly detail is unaffected —
     its DOM order already matches this layout. */
  .detail-layout .detail-main { grid-column: 1; }
  .detail-layout .detail-sidebar { grid-column: 2; }

  .detail-sidebar {
    position: sticky;
    top: 1rem;
  }

  .import-form {
    align-items: end;
    grid-template-columns: minmax(14rem, 1.2fr) minmax(12rem, 1fr) minmax(14rem, 1fr) minmax(11rem, auto);
  }

  .import-actions,
  .action-bar {
    align-self: end;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, max-content);
  }

  .action-bar {
    grid-template-columns: repeat(3, max-content);
  }

  .summary-head {
    grid-template-columns: 1fr auto;
  }

  /* Detail hero: three-column identity block —
     [photo ~24%][identity 1fr][summary auto]. Photo and Summary Panel
     span the identity rows; manufacturer/title/chips/source stack in
     the identity column. */
  .detail-hero {
    grid-template-columns: minmax(11rem, 24%) minmax(0, 1fr) minmax(13rem, 18rem);
    grid-template-areas:
      "photo manufacturer summary"
      "photo title        summary"
      "photo chips        summary"
      "photo source       summary";
    align-items: start;
    gap: 0.6rem 1.25rem;
  }

  .detail-hero__photo { grid-area: photo; align-self: start; }
  .detail-hero__manufacturer { grid-area: manufacturer; }
  .detail-hero__title { grid-area: title; }
  .detail-hero__chips { grid-area: chips; }
  .detail-hero__source { grid-area: source; }
  .detail-hero .summary-panel { grid-area: summary; }

  /* Local Toolbar: search + trailing actions stay on one row. */
  .local-toolbar {
    align-items: center;
  }
}

/* Mobile hero order: title → chips → manufacturer → photo → source summary
   → summary panel (spec §4.2). Order is layout-only; sensitive content is
   not present in field_tech payloads (role shaping decides visibility). */
@media (max-width: 639.98px) {
  .form-workspace fieldset {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-workspace label,
  .form-workspace input,
  .form-workspace select,
  .form-workspace textarea {
    max-width: 100%;
    min-width: 0;
  }

  .detail-hero__title { order: 1; }
  .detail-hero__chips { order: 2; }
  .detail-hero__manufacturer { order: 3; }
  .detail-hero__photo {
    order: 4;
    max-width: 60vw;
    align-self: flex-start;
  }
  .detail-hero__source { order: 5; }
  .detail-hero .summary-panel { order: 6; }
  .detail-hero .summary-panel__rate { font-size: 1.5rem; }

  .local-toolbar .module-search,
  .local-toolbar .supplier-search {
    flex: 1 1 100%;
  }

  .local-toolbar-actions {
    margin-left: 0;
  }
}

/* ==========================================================================
   Revision 4 Visual QA cleanup (Patch 2A, browser review 2026-07-05)
   Dense Finder/Drive-style catalog + supplier rows, catalog list shell
   (transparent filter rail, white rounded results), accordion open
   highlight, supplier detail 60/40 + small identity icon. No JS added;
   role shaping stays server-side (unchanged). See docs/patches/patch-2a.md
   "Revision 4 Visual QA Addendum".
   ========================================================================== */

/* Type / supplier monogram icon — small scannable badge, zero assets. */
.type-icon {
  align-items: center;
  background: #eef4f9;
  border-radius: 5px;
  color: var(--alto-navy);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  height: 1.6rem;
  justify-content: center;
  line-height: 1;
  width: 1.6rem;
}

/* Price-check status icon: green check = current, red = expired/missing. */
.price-check-icon {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 700;
  height: 1.45rem;
  justify-content: center;
  width: 1.45rem;
}

.price-check-icon--ok {
  background: rgba(125, 191, 59, 0.16);
  color: #3f6a1e;
}

.price-check-icon--warn {
  background: #f6ded5;
  color: #9f3b1d;
}

/* Shared dense-row container: one solid white rounded surface with hairline
   dividers, no per-row cards (Finder/Drive list feel). */
.result-rows {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  overflow: hidden;
}

/* Catalog result row — the whole row is a single anchor. No competing inner
   links (supplier is plain text), so full-row click needs no JS and no
   stretched-link hack. Desktop single line:
   [icon][name][supplier][rate/unit][price-check]. */
.catalog-row {
  align-items: center;
  border-top: 1px solid var(--alto-border);
  color: var(--alto-text);
  column-gap: 1rem;
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 2.3fr) minmax(0, 1.5fr) 9rem 1.6rem;
  min-height: 2.9rem;
  padding: 0.5rem 1rem;
  row-gap: 0.1rem;
  text-decoration: none;
  transition: background 0.1s ease;
}

.catalog-row:first-child {
  border-top: 0;
}

.catalog-row:hover {
  background: #f5f9fc;
}

.catalog-row__name {
  color: var(--alto-blue);
  font-weight: 700;
  overflow: hidden;
  padding-right: 0.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-row:hover .catalog-row__name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.catalog-row__supplier {
  color: var(--alto-muted);
  font-size: 0.92rem;
  overflow: hidden;
  padding-right: 0.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-row__rate {
  color: var(--alto-text);
  font-size: 0.95rem;
  white-space: nowrap;
}

.catalog-row__rate .unit {
  color: var(--alto-muted);
  font-weight: 400;
}

.catalog-row__check {
  justify-self: center;
}

/* Supplier directory row — NOT whole-row clickable (contains phone/map/
   catalog links). Icon+name is the single nav link; hover shades the row.
   Rev 6A: the trailing tracks are FIXED widths, not auto — each row is its
   own grid, so content-sized tracks collapse to zero on rows missing a
   Map/Catalog link and the action columns stop lining up between rows.
   Fixed tracks keep Phone | Map | Catalog | count on shared vertical axes;
   empty cells hold their track (no misleading placeholder controls). */
.supplier-row {
  align-items: center;
  border-top: 1px solid var(--alto-border);
  column-gap: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.5rem 3rem 4.5rem 5rem;
  min-height: 2.9rem;
  padding: 0.5rem 1rem;
  row-gap: 0.15rem;
  transition: background 0.1s ease;
}

.supplier-row:first-child {
  border-top: 0;
}

.supplier-row:hover {
  background: #f5f9fc;
}

.supplier-row.is-inactive {
  opacity: 0.7;
}

.supplier-row__id {
  align-items: center;
  color: var(--alto-blue);
  display: inline-flex;
  font-weight: 700;
  gap: 0.55rem;
  min-width: 0;
  text-decoration: none;
}

.supplier-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-row__id:hover .supplier-row__name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.supplier-row__phone,
.supplier-row__map,
.supplier-row__catalog {
  color: var(--alto-blue);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Long phone strings truncate inside their fixed track instead of pushing
   the Map/Catalog columns out of alignment. */
.supplier-row__phone {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supplier-row__count {
  color: var(--alto-muted);
  font-size: 0.92rem;
  justify-self: end;
  white-space: nowrap;
}

/* Supplier detail item row — Name | Category | Code | Price/Unit | check.
   Top/bottom hairlines only (no side borders, no rounded corners). */
.item-rows {
  border-top: 1px solid var(--alto-border);
}

.item-row {
  align-items: center;
  border-bottom: 1px solid var(--alto-border);
  column-gap: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) 8rem minmax(0, 9rem) 8rem 1.6rem;
  min-height: 2.8rem;
  padding: 0.5rem 0.25rem;
  row-gap: 0.15rem;
  transition: background 0.1s ease;
}

.item-row:hover {
  background: #f5f9fc;
}

.item-row__name {
  color: var(--alto-blue);
  font-weight: 700;
  overflow: hidden;
  padding-right: 0.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-row__name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.item-row__code {
  color: var(--alto-muted);
  font-size: 0.9rem;
  overflow: hidden;
  padding-right: 0.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-row__rate {
  font-size: 0.95rem;
  white-space: nowrap;
}

.item-row__rate .unit {
  color: var(--alto-muted);
}

.item-row__check {
  justify-self: center;
}

/* Supplier detail identity: small monogram icon replaces the large logo
   placeholder (removed from the header/left area per Rev 4 QA). */
.supplier-identity {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.supplier-identity .type-icon {
  height: 2rem;
  width: 2rem;
}

.supplier-identity h2 {
  font-size: 1rem;
  margin: 0;
}

/* Internal notes as its own block: heading, then prose below. */
.notes-block p {
  margin: 0.25rem 0 0;
  overflow-wrap: anywhere;
}

/* Tighter contact/account panels on supplier detail. */
.detail-sidebar .panel {
  padding: 0.85rem;
}

.detail-sidebar .panel h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.detail-sidebar .detail-list {
  gap: 0.3rem 0.75rem;
}

/* Accordion open state: highlight the open summary; body stays white. */
.accordion[open] > .accordion__summary {
  background: #eef4f9;
  border-bottom: 1px solid var(--alto-border);
}

.accordion__body {
  background: var(--alto-card);
}

/* Catalog list shell: summary line sits just above the white results box
   and top-aligns with the rail's Clear filters. */
.catalog-results .result-summary {
  margin: 0.1rem 0 0.6rem;
}

/* Mobile (<640): dense rows collapse to two lines. */
@media (max-width: 639.98px) {
  .catalog-row {
    grid-template-columns: 1.6rem 1fr auto auto;
    grid-template-areas:
      "icon name name name"
      "icon supplier rate check";
    row-gap: 0.15rem;
  }
  .catalog-row__icon { grid-area: icon; align-self: center; }
  .catalog-row__name { grid-area: name; }
  .catalog-row__supplier { grid-area: supplier; font-size: 0.85rem; }
  .catalog-row__rate { grid-area: rate; justify-self: end; font-size: 0.85rem; }
  .catalog-row__check { grid-area: check; justify-self: end; }

  .supplier-row {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas:
      "id phone count"
      "catalog map count";
    row-gap: 0.25rem;
  }
  .supplier-row__id { grid-area: id; }
  .supplier-row__phone { grid-area: phone; }
  .supplier-row__count {
    align-self: center;
    grid-area: count;
    justify-self: start;
  }
  .supplier-row__map { grid-area: map; }
  .supplier-row__catalog { grid-area: catalog; }

  .item-row {
    grid-template-columns: 1fr 1fr auto;
    grid-template-areas:
      "name name check"
      "cat code rate";
    row-gap: 0.2rem;
  }
  .item-row__name { grid-area: name; }
  .item-row__cat { grid-area: cat; }
  .item-row__code { grid-area: code; }
  .item-row__rate { grid-area: rate; justify-self: end; }
  .item-row__check { grid-area: check; justify-self: end; }
}

/* Desktop (>=960): transparent filter rail; results stay a white card;
   supplier detail runs ~60/40. */
@media (min-width: 960px) {
  .rail {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .detail-layout--6040 {
    grid-template-columns: minmax(0, 3fr) minmax(14rem, 2fr);
  }
}

/* Revision 4 local visual micro-polish: supplier layout/actions */
@media (min-width: 960px) {
  .detail-layout.detail-layout--6040 {
    grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
    align-items: start;
  }

  .detail-layout.detail-layout--6040 > .detail-main {
    grid-column: 1;
    grid-row: 1;
  }

  .detail-layout.detail-layout--6040 > .detail-sidebar {
    grid-column: 2;
    grid-row: 1;
  }
}

a.button-primary,
a.button-secondary,
a.button-pill-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  line-height: 1.1;
  white-space: nowrap;
}

a.button-primary:hover,
a.button-secondary:hover,
a.button-pill-outline:hover {
  text-decoration: none;
}

a.button-pill-outline {
  border: 1px solid #1174C3;
  color: #1174C3;
  background: transparent;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
}

a.button-pill-outline:hover {
  background: #ACD7F2;
  color: #2F5973;
  border-color: #2F5973;
}

.page-actions .button-pill-outline {
  align-self: flex-start;
}

.page-head--detail .button-secondary,
.detail-head-row .button-secondary {
  border: 1px solid #1174C3;
  color: #1174C3;
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font-weight: 700;
}

.page-head--detail .button-secondary:hover,
.detail-head-row .button-secondary:hover {
  background: #ACD7F2;
  color: #2F5973;
}

.supplier-account-title {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.supplier-account-name {
  color: var(--alto-text);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Product Edit v1 (Patch 2A Revision 5) ---------------------------------- */
/* Pricing-mode radio group inside the form workspace. Reuses .radio-row;
   the group spans the fieldset grid. */
.radio-row-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.radio-row-group .radio-row {
  min-height: 2.9rem;
  align-items: center;
}

/* Server-rendered read-only pricing inputs (synced / calculated values). */
.input-readonly,
.form-workspace input[readonly] {
  background: var(--alto-bg);
  color: var(--alto-muted);
  cursor: default;
}

/* Server-computed pricing summary line; --warn is the below-margin-floor
   red state (the ONLY approved use of --alto-danger). */
.pricing-computed {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-control);
  padding: 0.6rem 0.85rem;
  background: var(--alto-bg);
  font-size: 0.95rem;
}

.pricing-computed--warn {
  border-color: var(--alto-danger);
  background: rgba(179, 57, 46, 0.06);
}

.pricing-data-line {
  display: inline-flex;
  gap: 0.25rem;
}

.pricing-explain[hidden] {
  display: none;
}

.pricing-target[hidden] {
  display: none;
}

.pricing-explain--warn textarea {
  border-color: var(--alto-danger);
  box-shadow: 0 0 0 1px var(--alto-danger);
}

.pricing-explain__help {
  color: var(--alto-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.pricing-approval {
  display: grid;
  gap: 0.25rem;
  border-left: 3px solid var(--alto-tan);
  padding: 0.55rem 0.75rem;
  background: rgba(202, 161, 98, 0.1);
  color: var(--alto-text);
  min-width: 0;
  overflow-wrap: anywhere;
}

.pricing-approval > span {
  color: var(--alto-muted);
  font-size: 0.82rem;
}

.pricing-approval > p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Admin Access accordion body: pill/button links in a wrapping row.
   Archive/Restore uses .button-caution (link into the form's status
   control — never a destructive POST). */
.admin-access-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.admin-access-links .button-secondary,
.admin-access-links .button-caution {
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

/* Rev 5C — detail rate emphasis, floor note, intro, mobile rail ---------- */
/* Discounted Alto Rate is the prominent number (Rev 5C item 2). */
.summary-panel__rate--discount {
  font-size: 1.6rem;
}

.summary-panel__credit {
  align-self: flex-start;
}

/* Current below-floor approval (admin payload only). Brown admin/warning
   family — red stays reserved for the ACTIVE floor warning on the form. */
.summary-panel__floor-note {
  border-top: 1px solid var(--alto-border);
  color: var(--alto-warn);
  display: grid;
  font-size: 0.85rem;
  gap: 0.2rem;
  margin-top: 0.35rem;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  padding-top: 0.4rem;
}

.summary-panel__floor-note > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.summary-panel__floor-note em {
  color: var(--alto-muted);
  font-style: normal;
  white-space: nowrap;
}

/* Recently added heading on the search intro. */
.result-summary--recent {
  font-weight: 700;
  color: var(--alto-navy);
  margin-top: 0.75rem;
}

/* Mobile Filter & View sheet controls (Rev 5C item 7): proper buttons, not
   raw-hyperlink-looking text. */
.rail-head {
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.rail-head .clear-filters.button-pill-outline {
  text-decoration: none;
}

.rail-head .rail-close.button-secondary {
  border: 1px solid var(--alto-blue-mid);
  border-radius: 999px;
  color: var(--alto-blue);
  background: #ffffff;
  font-weight: 700;
  min-height: 0;
  padding: 0.45rem 0.85rem;
  width: auto;
}

.rail-toggle-box:checked ~ .catalog-layout .rail {
  padding: 1rem;
  gap: 0.75rem;
}

/* ==========================================================================
   Patch 2A Revision 6 — AltoWP landing page + catalog toolbar
   ========================================================================== */

/* AltoWP landing (Rev 6B): workspace launcher groups + cards. Mobile-first
   single column; cards use the panel language (border, small radius, subtle
   shadow — DESIGN.md elevation rules). Planned cards are intentionally
   quiet/unavailable, not disabled-looking controls. */
.home-group {
  margin-top: 1.4rem;
}

.home-group__title {
  color: var(--alto-navy);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}

.home-cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

.home-card {
  background: var(--alto-card);
  border: 1px solid var(--alto-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 4.6rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
}

a.home-card:hover {
  background: #f5f9fc;
  border-color: var(--alto-wash);
}

.home-card__label {
  color: var(--alto-blue);
  font-size: 1.05rem;
  font-weight: 700;
}

a.home-card:hover .home-card__label {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-card__desc {
  color: var(--alto-muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.home-card--planned {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.home-card--planned .home-card__label {
  color: var(--alto-muted);
}

.home-card__badge {
  background: var(--alto-bg);
  border: 1px solid var(--alto-border);
  border-radius: 999px;
  color: var(--alto-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-left: 0.45rem;
  padding: 0.1rem 0.55rem;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

@media (min-width: 640px) {
  .home-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .home-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Catalog toolbar (Rev 6C): admin-only "+ New item" action row above the
   workbench layout. Rendered only when the router supplies new_item_url
   (admin context branch) — the markup does not exist in field_tech HTML. */
.catalog-toolbar {
  margin-bottom: 0;
}
