:root {
  --ink: #18211f;
  --muted: #687471;
  --line: #d9dfdc;
  --surface: #ffffff;
  --soft: #f7f1e9;
  --accent: #216e62;
  --accent-2: #c16b4b;
  --shadow: 0 18px 45px rgba(24, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, #f6f8f6 0%, #edf4f1 42%, #fbf2ea 100%);
  font-family: Arial, Helvetica, sans-serif;
}

.portal-shell {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 14px 18px;
  background: #17211f;
  color: #ffffff;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: #dbeaf0;
  letter-spacing: 3px;
  line-height: 1;
  white-space: nowrap;
}

.logo-word {
  font-size: 30px;
  font-weight: 700;
}

.logo-script {
  position: relative;
  top: -1px;
  margin: 0 -1px 0 1px;
  color: #4a91b3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.portal-user button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.portal-admin-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.portal-admin-button:hover,
.portal-admin-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.portal-admin-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.eyebrow,
.tool-kicker {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.portal-tools {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.tool-section {
  display: grid;
  gap: 10px;
}

.tool-section-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.priority-tools-section {
  order: 2;
}

.sales-tools-section.priority-tools-section {
  order: 2;
}

.client-workspace {
  order: 3;
}

.quick-tools-section {
  order: 4;
}

.quick-calcs-section {
  order: 5;
}

.sales-tools-section {
  order: 6;
}

.portal-admin-workspace {
  order: 7;
}

.compact-tool-grid {
  grid-template-columns: minmax(0, 1fr);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(280px, 560px);
  gap: 10px;
  align-items: start;
  justify-content: end;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.portal-link-button {
  justify-self: start;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.portal-link-button:hover,
.portal-link-button:focus-visible {
  color: var(--accent-2);
  outline: none;
}

.portal-button {
  min-height: 44px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  min-height: 36px;
  padding: 7px 12px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--accent);
  font-size: 13px;
}

.portal-message {
  min-height: 18px;
  margin: -10px 0 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.inline-message {
  min-height: 20px;
  margin: 0 0 10px;
}

.split-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.client-workspace {
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.project-setup-disclosure > summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 18px;
  cursor: pointer;
  list-style: none;
}

.project-setup-disclosure > summary::-webkit-details-marker {
  display: none;
}

.project-setup-disclosure[open] > summary {
  min-height: auto;
}

.project-setup-disclosure[open] > summary .summary-hint {
  color: var(--muted);
}

.setup-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}

.setup-toggle-icon::before {
  content: "+";
}

.project-setup-disclosure[open] .setup-toggle-icon::before,
.project-list-disclosure[open] .setup-toggle-icon::before {
  content: "-";
}

.project-setup-body {
  padding: 0 18px 18px;
}

.project-setup-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.client-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.shared-form {
  display: grid;
  gap: 12px;
  max-width: 640px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shared-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.shared-form input,
.shared-form select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.project-list-disclosure {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.project-list-disclosure summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  min-height: 72px;
  padding: 18px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.project-list-disclosure summary::-webkit-details-marker {
  display: none;
}

.summary-hint {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.project-list-disclosure[open] .summary-hint {
  color: var(--muted);
}

.portal-admin-body {
  display: grid;
  gap: 14px;
  padding: 0 12px 12px;
}

.portal-admin-disclosure[open] .setup-toggle-icon::before {
  content: "-";
}

.portal-admin-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-admin-subheader {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.portal-admin-panel-title {
  margin: 0;
}

/*
 * The heading IS the control (the W3C APG disclosure shape): a real button
 * inside the h3, so the panel keeps the aria-labelledby target it already
 * had while the toggle gets keyboard focus, an accessible name taken from
 * its own text, and aria-expanded. Reset to look like the heading it wraps
 * rather than like a .portal-button, which would read as an action.
 */
.portal-admin-panel-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.portal-admin-panel-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/*
 * Its own class rather than .setup-toggle-icon, whose "-" state is selected
 * by an ANCESTOR being open (.portal-admin-disclosure[open] .setup-toggle-icon)
 * - inside this workspace that ancestor is always open when anything here is
 * visible, so a shared icon could never show "+".
 */
.portal-admin-panel-toggle-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.portal-admin-panel-toggle-icon::before {
  content: "+";
}

.portal-admin-panel-toggle[aria-expanded="true"] .portal-admin-panel-toggle-icon::before {
  content: "-";
}

.portal-admin-panel-body {
  display: grid;
  gap: 12px;
}

.portal-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.salesforce-import-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(120px, 180px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fbf9;
}

.salesforce-import-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.salesforce-import-form input {
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  text-transform: none;
}

.salesforce-import-file-field input {
  padding: 6px;
}

.salesforce-import-actions {
  align-self: end;
}

.salesforce-import-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.salesforce-import-summary[hidden] {
  display: none;
}

.salesforce-import-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.salesforce-import-summary-grid > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #f8fbf9;
}

.salesforce-import-summary-grid span,
.salesforce-import-detail-list span,
.salesforce-import-result span {
  color: var(--muted);
  font-size: 12px;
}

.salesforce-import-summary-grid strong {
  font-size: 22px;
}

.salesforce-import-status-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
}

.salesforce-import-detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.salesforce-import-detail-list li,
.salesforce-import-result {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-left: 3px solid var(--accent);
  background: #f8fbf9;
}

/* A database refusal: the batches answered, the rows did not land. */
.salesforce-import-result-refused {
  border-left-color: #b42318;
  background: #fef3f2;
}

.salesforce-import-result-refused span {
  color: #7a271a;
}

.salesforce-import-blocking .salesforce-import-detail-list li {
  border-left-color: #b42318;
  background: #fff5f4;
}

.salesforce-import-reason-list {
  margin: 2px 0 0;
  padding-left: 18px;
  font-size: 12px;
}

.salesforce-import-reason-list li {
  display: list-item;
  padding: 0;
  border: 0;
  background: transparent;
}

/* Needs review, grouped by reason (owner request 2026-10-05). */
.salesforce-import-reason-group {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.salesforce-import-reason-group > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  padding: 9px 10px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.salesforce-import-reason-group > summary span {
  color: var(--muted);
  font-size: 12px;
}

.salesforce-import-reason-group > .salesforce-import-detail-list {
  padding: 0 10px 10px;
}

/* Portal Admin > Salesforce Opportunity Import > Salesforce status mappings
   (owner rulings 2026-10-05). */
.salesforce-status-mappings {
  margin-top: 12px;
}

.salesforce-status-mapping-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 12px;
  align-items: end;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fbf9;
}

.salesforce-status-mapping-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.salesforce-status-mapping-form label.full,
.salesforce-status-mapping-form .portal-designer-actions {
  grid-column: 1 / -1;
}

.salesforce-status-mapping-form input[type="text"],
.salesforce-status-mapping-form select {
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  text-transform: none;
}

.salesforce-status-mapping-form .portal-field-help {
  font-weight: 400;
  text-transform: none;
}

.salesforce-status-mapping-list,
.salesforce-status-waiting-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.salesforce-status-mapping-row,
.salesforce-status-waiting-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  overflow-wrap: anywhere;
}

.salesforce-status-mapping-row > div:first-child,
.salesforce-status-waiting-list li > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
  min-width: 0;
}

.salesforce-status-mapping-row small,
.salesforce-status-waiting-list li span {
  color: var(--muted);
  font-size: 12px;
}

.salesforce-status-mapping-row.is-inactive {
  color: var(--muted);
  background: #f8fbf9;
}

.salesforce-status-mapping-actions {
  display: flex;
  gap: 6px;
}

.salesforce-status-waiting {
  margin: 8px 0;
}

.salesforce-status-waiting h5 {
  margin: 0;
  font-size: 13px;
}

.salesforce-status-waiting-list li {
  border-left: 3px solid #b54708;
  background: #fffaeb;
}

.salesforce-status-meanings {
  margin-top: 10px;
}

.salesforce-status-meanings > summary {
  cursor: pointer;
  font-weight: 700;
}

.salesforce-status-meanings dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 6px 12px;
  margin: 8px 0 0;
}

.salesforce-status-meanings dt {
  font-weight: 700;
}

.salesforce-status-meanings dd {
  margin: 0;
  min-width: 0;
}

@media (max-width: 840px) {
  .salesforce-import-form {
    grid-template-columns: 1fr;
  }

  .salesforce-import-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .salesforce-import-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  cursor: pointer;
}

.portal-admin-subheader h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.portal-accessory-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fbf9;
}

.portal-admin-editor-grid,
.portal-admin-table-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.portal-maintenance-stack {
  display: grid;
  gap: 12px;
}

.portal-maintenance-section {
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-maintenance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.portal-maintenance-summary::-webkit-details-marker {
  display: none;
}

.portal-maintenance-summary h4,
.portal-maintenance-summary p {
  margin: 0;
}

.portal-maintenance-summary h4 {
  font-size: 17px;
}

.portal-maintenance-summary p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.portal-maintenance-section[open] > .portal-maintenance-summary {
  border-bottom: 1px solid var(--line);
  background: #f8fbf9;
}

.portal-maintenance-content {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.portal-accessory-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.portal-accessory-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-field-help {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
}

.portal-field-help code {
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
}

.portal-accessory-form-grid .full {
  grid-column: 1 / -1;
}

.portal-accessory-form-grid input,
.portal-accessory-form-grid select,
.portal-accessory-form-grid textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.portal-accessory-form-grid textarea {
  min-height: 72px;
  resize: vertical;
}

.portal-accessory-image-manager {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-accessory-image-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f6f8f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.portal-accessory-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portal-accessory-image-controls {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.portal-accessory-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-accessory-image-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: none;
}

.portal-accessory-image-advanced {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.portal-accessory-image-advanced summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.portal-accessory-image-key-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 10px;
}

.portal-placement-manager {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-placement-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-placement-picker-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 90px auto;
  gap: 10px;
  align-items: end;
}

.portal-placement-picker-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-placement-picker-grid .portal-button {
  min-height: 38px;
}

.portal-placement-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
  align-items: center;
}

.portal-placement-chip,
.portal-placement-empty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid var(--line);
  background: #f8fbf9;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.portal-placement-chip {
  padding: 4px 4px 4px 9px;
}

.portal-placement-empty {
  padding: 4px 9px;
  color: var(--muted);
}

.portal-placement-chip button {
  min-height: 24px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.portal-option-form-grid input[readonly] {
  color: var(--muted);
  background: #eef3f1;
}

.portal-accessory-tools {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 0;
}

.portal-maintenance-table {
  display: grid;
  gap: 10px;
  overflow: hidden;
  min-width: 0;
}

.portal-maintenance-table-wide {
  max-width: 100%;
}

.portal-maintenance-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.portal-maintenance-table-header h4 {
  margin: 0;
  font-size: 16px;
}

.portal-maintenance-table-header input {
  width: min(260px, 100%);
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.portal-accessory-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fbf9;
}

.portal-accessory-filter-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-accessory-filter-grid input,
.portal-accessory-filter-grid select {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.portal-material-filter-grid {
  grid-template-columns: minmax(320px, 1fr) minmax(160px, 220px);
}

.portal-countertop-filter-grid {
  grid-template-columns: minmax(320px, 1fr) minmax(160px, 220px) minmax(160px, 220px);
}

.portal-door-drawer-filter-grid {
  grid-template-columns: minmax(280px, 1.2fr) repeat(3, minmax(160px, 220px));
}

.portal-accessory-list {
  display: grid;
  gap: 8px;
}

.portal-accessory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-option-row h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-option-key {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f8fbf9;
  font-size: 11px;
  font-weight: 800;
  text-transform: none;
}

.portal-accessory-row.inactive {
  opacity: 0.68;
  background: #f4f1ed;
}

.portal-accessory-row h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.portal-accessory-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.portal-accessory-catalog-row {
  grid-template-columns: 74px minmax(0, 1fr) auto;
}

.portal-accessory-thumb {
  width: 74px;
  height: 74px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #f6f8f5;
}

.portal-accessory-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.portal-accessory-placements {
  margin-top: 6px !important;
  color: var(--accent-dark) !important;
}

.portal-accessory-description {
  margin-top: 7px !important;
  font-weight: 400 !important;
}

.portal-tool-admin-table {
  display: grid;
  gap: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-rate-limit-list {
  display: grid;
  gap: 10px;
  overflow-x: auto;
}

.portal-rate-limit-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(120px, 0.7fr)) minmax(90px, auto) auto;
  gap: 10px;
  align-items: end;
  min-width: 860px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-rate-limit-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-rate-limit-row input[type="number"] {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  font: inherit;
}

.portal-rate-limit-row small {
  grid-column: 1 / -1;
  color: var(--muted);
}

/* Portal Admin > Inventory Settings (owner ruling 2026-10-03). */
.portal-inventory-record-list,
.portal-inventory-grid {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.portal-inventory-record {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-inventory-record.inactive {
  opacity: 0.65;
}

.portal-inventory-record input[type="text"] {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  font: inherit;
}

.portal-inventory-record small {
  flex-basis: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.portal-inventory-setting {
  display: grid;
  gap: 5px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.portal-inventory-grid-row {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.portal-inventory-grid-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.portal-tool-admin-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(190px, 1fr) minmax(160px, 0.9fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 720px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.portal-tool-admin-row:last-child {
  border-bottom: 0;
}

.portal-tool-admin-row.inactive {
  opacity: 0.68;
  background: #f4f1ed;
}

.portal-tool-admin-head {
  background: #eef7f3;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-tool-admin-name,
.portal-tool-admin-route,
.portal-tool-admin-maintenance {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.portal-tool-admin-name span,
.portal-tool-admin-route span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.portal-tool-admin-route code {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.portal-tool-maintenance-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
}

.portal-tool-admin-link {
  min-height: 34px;
  padding: 6px 12px;
  text-decoration: none;
}

.portal-designer-form {
  max-width: none;
  padding: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-address-fieldset {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fbf9;
}

.portal-access-fieldset {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-address-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-access-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

/* People & Access "Other Salesforce emails" (owner rulings 2026-10-03). */
.portal-salesforce-emails {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-salesforce-emails h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-salesforce-email-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.portal-salesforce-email-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  border: 1px solid var(--line);
}

.portal-salesforce-email-row.is-retired {
  color: var(--muted);
  background: #f8fbf9;
}

.portal-salesforce-email-row strong {
  overflow-wrap: anywhere;
}

.portal-salesforce-email-add {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  align-items: end;
}

.portal-access-matrix {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
}

.portal-access-matrix-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 180px);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-access-matrix-row:last-child {
  border-bottom: 0;
}

.portal-access-matrix-head {
  min-height: 32px;
  background: #eef7f3;
  font-size: 10px;
}

.portal-access-matrix-subtitle {
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--line);
  background: #eef7f3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
}

.portal-access-matrix-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal-access-matrix-row select {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-transform: none;
}

.portal-address-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.portal-address-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-address-grid .full {
  grid-column: span 2;
}

.portal-address-grid input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.portal-checkbox-label input {
  width: auto;
  min-height: 22px;
  justify-self: start;
  accent-color: var(--accent);
}

.portal-designer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-designer-actions .portal-button {
  min-height: 38px;
  padding: 7px 12px;
}

.portal-designer-list {
  display: grid;
  gap: 10px;
}

.portal-location-list {
  display: grid;
  gap: 10px;
}

.portal-location-row h3 {
  margin-bottom: 5px;
}

.portal-location-time-zone {
  margin: 6px 0 4px;
}

.portal-location-time-zone.missing {
  color: #9a3412;
  font-weight: 600;
}

.portal-location-time-zone-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.portal-location-time-zone-edit select {
  max-width: 100%;
}

.portal-designer-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(180px, 1.2fr) minmax(110px, 0.55fr) minmax(150px, 0.85fr) minmax(150px, 0.85fr) minmax(80px, 0.4fr);
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.portal-designer-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-designer-row input,
.portal-designer-row select {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.portal-designer-row .portal-checkbox-label input {
  min-height: 22px;
}

.portal-designer-row .portal-button {
  min-height: 36px;
  padding: 7px 12px;
}

.portal-designer-row-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  gap: 6px;
  align-items: center;
  justify-content: end;
}

.portal-designer-meta {
  grid-column: 1 / -1;
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
}

.tool-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.tool-card strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
}

.tool-card span:last-child {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.quick-tools-section .tool-card,
.quick-calcs-section .tool-card {
  gap: 4px;
  min-height: 86px;
  padding: 16px 20px;
  align-content: start;
}

.quick-tools-section .tool-kicker,
.quick-calcs-section .tool-kicker {
  margin-bottom: 0;
}

.quick-tools-section .tool-card span:last-child,
.quick-calcs-section .tool-card span:last-child {
  display: none;
}

.sales-tools-section .tool-card {
  gap: 4px;
  min-height: 86px;
  padding: 16px 20px;
  align-content: start;
}

.sales-tools-section .tool-kicker {
  margin-bottom: 0;
}

.sales-tools-section .tool-card span:last-child {
  display: none;
}

#quickBallparkLink {
  order: 1;
}

#closetInventoryLink {
  order: 2;
}

#shoeShelfLink {
  order: 3;
}

#marketIntelLink {
  order: 4;
}

#drawerCapacityLink {
  order: 5;
}

.tool-card[aria-disabled="true"] {
  color: #4d5a57;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .portal-shell {
    width: 100%;
    padding: 0 0 24px;
  }

  .portal-header {
    min-height: 64px;
    padding: 10px 12px;
  }

  .brand-logo {
    letter-spacing: 1px;
  }

  .logo-word {
    font-size: 19px;
  }

  .logo-script {
    font-size: 34px;
  }

  .portal-user {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .portal-tools {
    gap: 18px;
    margin: 18px 14px 0;
  }

  .tool-section-header h2 {
    font-size: 20px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 0 14px 14px;
    padding: 16px;
    border-radius: 8px;
  }

  .portal-message {
    grid-column: auto;
  }

  .tool-card {
    min-height: 84px;
    padding: 12px;
    border-radius: 8px;
  }

  .tool-card strong {
    font-size: 18px;
    line-height: 1.12;
  }

  .tool-card span:last-child {
    display: none;
  }

  .tool-kicker {
    font-size: 10px;
  }

  #closetInventoryLink {
    order: 2;
  }

  #marketIntelLink {
    order: 3;
  }

  #shoeShelfLink {
    order: 4;
  }

  #drawerCapacityLink {
    order: 5;
  }

  .client-workspace {
    border-radius: 8px;
  }

  .portal-admin-workspace {
    border-radius: 8px;
  }

  .project-setup-disclosure > summary {
    align-items: start;
    min-height: 62px;
    padding: 14px;
  }

  .project-list-disclosure summary {
    align-items: start;
    min-height: 62px;
    padding: 14px;
  }

  .project-setup-body {
    padding: 0 14px 14px;
  }

  .project-setup-actions {
    justify-content: stretch;
  }

  .project-setup-actions .secondary-button {
    width: 100%;
  }

  .client-layout,
  .form-grid,
  .portal-admin-editor-grid,
  .portal-admin-table-grid,
  .portal-accessory-filter-grid,
  .portal-address-grid,
  .portal-accessory-form-grid,
  .portal-accessory-row,
  .portal-designer-row {
    grid-template-columns: 1fr;
  }

  .portal-address-grid .full {
    grid-column: auto;
  }

  .portal-accessory-catalog-row {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .portal-accessory-catalog-row .portal-designer-row-actions {
    grid-column: 1 / -1;
  }

  .portal-designer-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .portal-designer-row-actions {
    grid-template-columns: 1fr;
  }

  .project-list-disclosure {
    min-height: auto;
  }

}

/* Problem Reports admin panel. A read-only list: the reports designers file
   with the "Report a problem" button that ships on every route. */
.portal-problem-report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 18px;
  padding: 12px 14px;
  border: 1px solid #d7dedd;
  border-radius: 8px;
  background: #f8fbf9;
}

/*
 * The total and the note span the whole block rather than becoming two more
 * columns of counts: one is the headline, the other is a caveat, and neither
 * is a group the reader compares against the others.
 */
.portal-problem-report-summary-total,
.portal-problem-report-summary .portal-admin-note {
  grid-column: 1 / -1;
  margin: 0;
}

.portal-problem-report-summary-total {
  font-size: 15px;
  font-weight: 800;
}

.portal-problem-report-summary .portal-admin-note {
  color: #566360;
  font-size: 12px;
}

.portal-problem-report-summary-group h5 {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-problem-report-summary-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.portal-problem-report-summary-group li {
  word-break: break-word;
}

.portal-problem-report-summary-count {
  display: inline-block;
  min-width: 2ch;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.portal-problem-report-list {
  display: grid;
  gap: 12px;
}

.portal-problem-report {
  padding: 12px 14px;
  border: 1px solid #d7dedd;
  border-radius: 8px;
  background: #ffffff;
}

.portal-problem-report h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.portal-problem-report p {
  margin: 0 0 4px;
}

.portal-problem-report-when,
.portal-problem-report-context,
.portal-problem-report-attachments {
  font-size: 12px;
  color: #566360;
  word-break: break-word;
}

.portal-problem-report-description {
  white-space: pre-wrap;
}

/* The report's compact diagnostic timeline is intentionally collapsed: an
   operator needs the startup/error stage when investigating, while the normal
   bug list must remain scannable. The renderer receives only the shared
   platform's identifier-free projection. */
.portal-problem-report-diagnostics {
  margin: 6px 0;
  font-size: 12px;
  color: #394744;
}

.portal-problem-report-diagnostics summary {
  cursor: pointer;
  font-weight: 700;
}

.portal-problem-report-diagnostics ol {
  margin: 6px 0 0;
  padding-left: 20px;
}

.portal-problem-report-diagnostics li {
  margin: 3px 0;
  word-break: break-word;
}

.portal-problem-report-diagnostics time,
.portal-problem-report-diagnostics li span {
  color: #566360;
}

/* Status control on a problem report. Only rendered for a profile holding
   problem_reports at manage; the database checks that again on every write. */
.portal-problem-report-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  color: #4a5754;
}

.portal-problem-report-status select {
  font: inherit;
  padding: 4px 6px;
}

/* The photo a designer took, at a size the owner can actually judge. Small
   enough that several reports stay scannable, large enough to see what is
   wrong; the full image opens over the current tracker. */
.portal-problem-report-photo {
  display: inline-block;
  margin: 0.35rem 0.35rem 0 0;
  border: 1px solid var(--portal-border, #d4d4d8);
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
}
.portal-problem-report-photo img {
  width: 132px;
  height: 132px;
  object-fit: cover;
  display: block;
}
.portal-problem-report-photo-viewer {
  box-sizing: border-box;
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 16px;
  border: 1px solid var(--portal-border, #d4d4d8);
  border-radius: 10px;
  background: #fff;
}
.portal-problem-report-photo-viewer::backdrop { background: rgba(0, 0, 0, .65); }
.portal-problem-report-photo-viewer form { margin: 0 0 12px; }
.portal-problem-report-photo-viewer img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 auto;
  object-fit: contain;
}
.portal-problem-report-reference {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  margin-right: 0.35rem;
}

/* Report view (RPT-11): tools down, statuses across. Every non-zero count is a
   button that filters the list; the table scrolls inside its own box so a
   phone never scrolls the whole admin page sideways. */
.portal-problem-report-grid-wrap {
  grid-column: 1 / -1;
  overflow-x: auto;
}

.portal-problem-report-grid {
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.portal-problem-report-grid caption {
  caption-side: top;
  text-align: left;
  color: #566360;
  font-size: 12px;
  padding-bottom: 4px;
}

.portal-problem-report-grid th,
.portal-problem-report-grid td {
  padding: 3px 10px;
  border-bottom: 1px solid #e3e9e7;
  text-align: right;
  white-space: nowrap;
}

.portal-problem-report-grid th[scope="row"],
.portal-problem-report-grid thead th:first-child {
  text-align: left;
}

.portal-problem-report-grid thead th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-problem-report-grid-cell {
  min-width: 2.5ch;
  padding: 2px 6px;
  border: 1px solid #c9d4d1;
  border-radius: 4px;
  background: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.portal-problem-report-grid-cell:hover,
.portal-problem-report-grid-cell:focus-visible {
  border-color: #2f6b5f;
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px rgba(47, 107, 95, 0.25);
}

.portal-problem-report-grid-zero {
  color: #9aa6a3;
}

/* Filters: search, then one checkbox group per dimension. */
.portal-problem-report-filters {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d7dedd;
  border-radius: 8px;
}

.portal-problem-report-search {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.portal-problem-report-search input {
  font: inherit;
  font-weight: 400;
  padding: 6px 8px;
  min-width: 0;
}

/* RPT-184: the list order. Same shape as the search above it. */
.portal-problem-report-sort {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.portal-problem-report-sort select {
  font: inherit;
  font-weight: 400;
  padding: 6px 8px;
  max-width: 100%;
}

.portal-problem-report-facets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 16px;
}

.portal-problem-report-facet {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 13px;
}

.portal-problem-report-facet legend {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.portal-problem-report-facet label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  word-break: break-word;
}

.portal-problem-report-filter-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.portal-problem-report-shown {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

/* One line per report until opened. The description on the line is cut to
   one line; the full text is in the detail. */
.portal-problem-report-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  cursor: pointer;
  font-size: 13px;
}

.portal-problem-report-line-kind,
.portal-problem-report-line-tool,
.portal-problem-report-line-status,
.portal-problem-report-line-priority {
  color: #4a5754;
  font-weight: 700;
}

/* RPT-184: "Needed before go-live" stands out on the one-line summary. */
.portal-problem-report-go-live {
  padding: 0 6px;
  border: 1px solid #a33a2a;
  border-radius: 4px;
  color: #a33a2a;
  font-size: 12px;
}

/* RPT-184: the priority picker and the go-live box, below the status. */
.portal-problem-report-priority {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 8px;
}

.portal-problem-report-priority .portal-problem-report-context {
  flex-basis: 100%;
  margin: 0;
}

.portal-problem-report-line-text {
  flex: 1 1 240px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-problem-report[open] .portal-problem-report-line {
  margin-bottom: 8px;
}

/* THE LIST MAY NEVER BE WIDER THAN THE SCREEN. Each report row is a grid item
   of the list, and a grid item's default `min-width: auto` is its content's
   min-content width - which, with the one-line summary's text `nowrap`, is the
   full length of the description. Without this rule that length became the
   width of the list, the panel and the whole page (4751px in a 783px pane on
   Preview after #1355). The row is the one place it is needed: measured in
   Chromium, removing it alone restores the overflow, while the list and the
   summary line need no rule of their own.
   scripts/test-built-portal-problem-report-layout-contract.mjs measures it. */
#portalProblemReportList > details.portal-problem-report {
  min-width: 0;
}

/* An opened report shows the full description, which can hold an unbroken
   URL (RPT-59 carries a Drive folder link). Without this, opening such a
   report made the page 1017px wide at 390px, measured by the same contract. */
#portalProblemReportList .portal-problem-report-description {
  overflow-wrap: anywhere;
}

/* Telemetry operator view. Tables intentionally preserve exact UUIDs and
   build identifiers, so each one owns horizontal containment rather than
   widening the Portal Admin workspace on a phone. */
.portal-telemetry-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 12px 14px;
  border: 1px solid #d7dedd;
  border-radius: 8px;
  background: #f8fbf9;
}

.portal-telemetry-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #4a5754;
  font-size: 12px;
  font-weight: 700;
}

.portal-telemetry-toolbar select {
  min-width: 0;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.portal-telemetry-actions {
  align-self: end;
}

.portal-telemetry-summary {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.portal-telemetry-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.portal-telemetry-cards > div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #d7dedd;
  border-radius: 8px;
  background: #ffffff;
}

.portal-telemetry-cards strong {
  color: var(--ink);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.portal-telemetry-cards span {
  color: #566360;
  font-size: 12px;
  font-weight: 700;
}

.portal-telemetry-generated {
  margin: 0;
}

.portal-telemetry-table-section {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.portal-telemetry-table-section h4 {
  margin: 0;
  font-size: 14px;
}

.portal-telemetry-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #d7dedd;
  border-radius: 8px;
}

.portal-telemetry-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 12px;
}

.portal-telemetry-table th,
.portal-telemetry-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e7ecea;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.portal-telemetry-table th {
  background: #f3f7f5;
  color: #4a5754;
  font-size: 11px;
  text-transform: uppercase;
}

.portal-telemetry-table tbody tr:last-child td {
  border-bottom: 0;
}

.portal-telemetry-empty {
  color: #566360;
  font-style: italic;
  white-space: normal !important;
}

@media (max-width: 840px) {
  .portal-telemetry-toolbar {
    grid-template-columns: 1fr;
  }

  .portal-telemetry-actions {
    justify-content: flex-start;
  }
}
.portal-unsent-badge {
  margin-block: 1rem;
  padding: 1rem;
  border: 1px solid #b7791f;
  border-radius: 0.5rem;
  background: #fff8e6;
  color: #413018;
}
.portal-unsent-badge[hidden] { display: none; }
.portal-unsent-badge ul { margin-bottom: 0; padding-left: 1.25rem; }
.portal-unsent-badge a { color: #674400; text-decoration: underline; }
.portal-unsent-badge small { display: block; margin-block: 0.2rem 0.6rem; }

/* Install-later decisions keep each request and its reason visibly together. */
.install-later-queue-card { border-top: 1px solid #d1d5db; margin-top: 1rem; padding: 1rem 0; }
.install-later-queue-card label { display: block; margin: .75rem 0; }
.install-later-queue-card textarea { display: block; width: 100%; min-height: 5rem; }
/* Scoped catalog forms retain readable field comparisons on phone and tablet. */
.location-catalog-admin { min-width: 0; }
.location-catalog-admin label { display: grid; gap: .35rem; }
.location-catalog-admin input:not([type="checkbox"]), .location-catalog-admin select, .location-catalog-admin textarea { width: 100%; min-width: 0; padding: .6rem; font: inherit; }
.location-catalog-admin input[type="checkbox"] { width: 1.2rem; height: 1.2rem; }
.location-catalog-admin button { min-height: 44px; padding: .5rem .8rem; font: inherit; cursor: pointer; border: 1px solid #94a3b8; border-radius: .35rem; background: #fff; color: #18211f; }
.location-catalog-admin button[data-catalog-command="confirm"] { background: #234f42; color: #fff; }
.location-catalog-admin label:has(input[type="checkbox"]) { display: flex; align-items: start; gap: .5rem; }
.location-catalog-admin button:disabled { cursor: wait; }
.catalog-admin-toolbar, .catalog-admin-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-block: 1rem; }
.catalog-admin-toolbar label { flex: 1 1 16rem; }
.catalog-admin-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .9rem; }
.catalog-admin-attribute { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(10rem, 2fr); align-items: start; gap: .5rem; padding-block: .5rem; }
.catalog-admin-table-wrap { overflow-x: auto; max-width: 100%; margin-block: 1rem; }
.location-catalog-admin table { border-collapse: collapse; width: 100%; min-width: 48rem; }
.location-catalog-admin caption { text-align: left; padding-block: .5rem; }
.location-catalog-admin table td:last-child { min-width: 12rem; }
.location-catalog-admin th, .location-catalog-admin td { padding: .65rem; text-align: left; vertical-align: top; border-bottom: 1px solid #cbd5e1; overflow-wrap: anywhere; }
.location-catalog-admin article, .catalog-admin-preview { padding: 1rem; margin-block: 1rem; border: 1px solid #94a3b8; border-radius: .6rem; }
.location-catalog-admin pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.catalog-admin-conflict { background: #fff4d6; color: #332500; }
.catalog-admin-preview { border: 2px solid #215d8e; }
@media (max-width: 640px) {
  .catalog-admin-attribute { grid-template-columns: 1fr; }
  .catalog-admin-actions button { flex: 1 1 12rem; }
}
.location-catalog-admin [data-catalog-image-preview] { display: block; max-width: min(100%, 360px); max-height: 360px; object-fit: contain; }
.location-catalog-admin [data-catalog-image-preview][hidden] { display: none; }
/* Portal Admin > National Vendor Flags. Desktop-first (admin is desktop-only);
   wide tables scroll inside their own wrapper instead of widening the page. */
.national-vendor-admin { min-width: 0; }
.national-vendor-admin label { display: grid; gap: .35rem; }
.national-vendor-admin input:not([type="checkbox"]), .national-vendor-admin select, .national-vendor-admin textarea { width: 100%; min-width: 0; padding: .6rem; font: inherit; }
.national-vendor-admin input[type="checkbox"] { width: 1.2rem; height: 1.2rem; }
.national-vendor-admin .national-admin-check { display: flex; align-items: center; gap: .5rem; }
.national-vendor-admin button { min-height: 44px; padding: .5rem .8rem; font: inherit; cursor: pointer; border: 1px solid #94a3b8; border-radius: .35rem; background: #fff; color: #18211f; }
.national-vendor-admin button[data-national-command="confirm"] { background: #234f42; color: #fff; }
.national-vendor-admin button:disabled { cursor: not-allowed; opacity: .6; }
.national-admin-toolbar, .national-admin-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-block: 1rem; }
.national-admin-toolbar label { flex: 1 1 14rem; }
.national-admin-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .9rem; margin-block: 1rem; }
.national-admin-form-grid fieldset { display: grid; gap: .5rem; border: 1px solid #cbd5e1; border-radius: .35rem; }
.national-admin-table-wrap { overflow-x: auto; max-width: 100%; margin-block: 1rem; }
.national-vendor-admin table { border-collapse: collapse; width: 100%; min-width: 48rem; }
.national-vendor-admin caption { text-align: left; padding-block: .5rem; }
.national-vendor-admin th, .national-vendor-admin td { padding: .65rem; text-align: left; vertical-align: top; border-bottom: 1px solid #cbd5e1; overflow-wrap: anywhere; }
.national-vendor-admin code { font-size: 1rem; white-space: pre; }
.national-admin-flags { margin: 0; padding-left: 1.1rem; }
.national-admin-flags p { margin: .2rem 0; }
.national-vendor-admin article, .national-admin-preview { padding: 1rem; margin-block: 1rem; border: 1px solid #94a3b8; border-radius: .6rem; }
.national-admin-preview { border: 2px solid #215d8e; }
.national-vendor-admin td:first-child, .national-vendor-admin tbody th { min-width: 7rem; }
