/* Portal layout derived from the approved customer reference. */
:root {
  --ink: var(--kl-ink, #1a292d);
  --muted: var(--kl-muted, #596970);
  --line: var(--kl-line, #d5dee0);
  --accent: var(--kl-accent, #0d676d);
  --paper: var(--kl-paper, #f3f6f6);
  --buyer-rail-width: 232px;
  --buyer-highlight: var(--instance-brand-color, var(--kl-accent-bright, #53bec6));
}
[hidden] { display: none !important; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--kl-font, Archivo, system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.5;
}
:focus-visible { outline: 2px solid var(--kl-focus, #11848c); outline-offset: 3px; }
#page-heading:focus-visible { outline: 2px solid var(--kl-focus, #11848c); }
.buyer-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.buyer-test-banner {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 24px;
  color: #1a292d; background: #f2b705; font-size: 13px; font-weight: 600;
}
.topbar {
  position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 72px; padding: 10px 24px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff;
}
.brand { display: flex; align-items: center; min-width: 0; gap: 18px; }
.buyer-logo-slot { display: grid; place-items: center; min-width: 0; }
.brand img { display: block; width: auto; max-width: min(190px, 28vw); height: 38px; object-fit: contain; object-position: center; }
@media (min-width: 961px) {
  .buyer-logo-slot { width: max(140px, calc(var(--buyer-rail-width) - 48px)); }
}
.brand strong { font-size: clamp(15px, 2vw, 23px); line-height: 1.15; letter-spacing: -.02em; }
.brand strong:empty { display: none; }
.brand span {
  min-width: 0; max-width: none; padding: 4px 0 4px 18px; border-left: 1px solid var(--line);
  font-size: 14px; font-weight: 500; letter-spacing: 0; line-height: 1.25; text-transform: none;
}
.buyer-header-tools, .buyer-account-toggle, .locales { display: flex; align-items: center; }
.buyer-header-tools { gap: 16px; min-width: 0; }
.locales { gap: 2px; }
.locales button {
  min-width: 36px; min-height: 36px; padding: 4px 7px; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; background: none; color: var(--muted); font-size: 13px;
}
.locales button[aria-pressed=true] { color: var(--ink); border-bottom-color: var(--accent); background: none; }
.buyer-account-toggle {
  min-width: 0; min-height: 40px; gap: 9px; padding: 0 9px 0 4px; border: 1px solid transparent;
  border-radius: 20px; color: var(--ink); background: transparent; cursor: pointer;
}
.buyer-account-toggle:hover { border-color: var(--line); }
#buyer-avatar {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  color: #fff; background: var(--ink); font-size: 12px; font-weight: 700;
}
#buyer-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#main { --sidebar-width: var(--buyer-rail-width); }
.dashboard { grid-template-columns: var(--buyer-rail-width) minmax(0, 1fr); max-width: none; margin: 0; }
.sidebar {
  padding: 0; background: var(--ink); color: #c9d6da; min-height: 0; align-self: stretch;
}
.sidebar-viewport {
  padding: 20px 12px; min-height: min(560px, calc(100dvh - 104px)); max-height: calc(100dvh - 104px);
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-button {
  display: flex; position: relative; align-items: center; gap: 10px; margin: 0; padding: 8px 11px;
  min-height: 44px; border: 0; border-radius: 6px; background: transparent; color: #c9d6da;
  font: inherit; font-weight: 500; text-align: left; overflow-wrap: normal;
}
.nav-button:hover, .nav-button[aria-current=page] { color: #fff; background: #263940; }
.nav-button[aria-current=page] { font-weight: 650; }
.nav-button[aria-current=page]::before {
  content: ""; position: absolute; left: 0; inset-block: 10px; width: 3px; border-radius: 0 2px 2px 0;
  background: var(--buyer-highlight);
}
.nav-button span:first-child { flex: none; width: 20px; text-align: center; }
.sidebar :focus-visible { outline-color: var(--kl-accent-bright, #53bec6); }
.side-profile {
  margin-top: auto; padding: 16px 12px 4px; border-top: 1px solid #ffffff20;
  font-size: 13px; color: #a9bec4;
}
.side-profile strong { color: #fff; }
.main-content {
  min-width: 0; max-width: 1280px; width: 100%; padding: 34px 32px 0; margin: 0;
}
.heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 22px; }
.heading h1 { font-size: clamp(24px, 2.7vw, 32px); line-height: 1.15; font-weight: 650; letter-spacing: -.015em; margin: 0; }
.heading p { font-size: 16px; max-width: 64ch; color: var(--muted); margin: 8px 0 0; }
.buyer-heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
#buyer-catalog-updated { color: var(--muted); font-size: 13px; }
.button, .refresh-list, .button.secondary, .buyer-sort select, .buyer-search input {
  min-height: 40px; border-radius: var(--kl-radius-sm, 4px); font-size: 14px; line-height: 1.3;
}
.button { border-color: var(--accent); background: var(--accent); color: #fff; }
.button:not(:disabled):hover { background: var(--kl-accent-hover, #0a5156); }
.button.secondary, .refresh-list { border-color: var(--line); background: #fff; color: var(--ink); }
.button.secondary:not(:disabled):hover, .refresh-list:not(:disabled):hover { background: #eaf4f4; }

.summary {
  display: inline-flex; max-width: 100%; gap: 2px; margin: 0 0 16px; padding: 3px;
  border: 0; border-radius: 6px; background: #e5eced;
}
.summary .stat {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 0;
  border-radius: 4px; color: var(--ink); background: transparent; text-align: left; cursor: pointer;
  font: inherit; font-size: 14px;
}
.summary .stat[aria-pressed=true] { background: #fff; box-shadow: 0 1px 2px #1a292d24; }
.summary .stat:disabled { color: var(--muted); cursor: default; }
.summary .stat span { color: inherit; line-height: 1.25; }
.summary .stat strong { flex: 0 0 auto; color: var(--muted); margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.buyer-order-tabs {
  position: relative; z-index: 1; display: flex; align-items: stretch; gap: 8px; overflow-x: auto;
  margin-bottom: -1px; padding: 4px 3px 0; scrollbar-width: thin;
}
.buyer-order-tab {
  flex: 0 0 clamp(180px, 25%, 350px); align-self: stretch; min-height: 70px; padding: 9px 15px;
  border: 1px solid var(--line); border-bottom-color: transparent; border-radius: 6px 6px 0 0;
  background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.buyer-order-tab[aria-pressed=true] {
  background: #fff; border-bottom-color: #fff; box-shadow: inset 0 3px 0 var(--instance-brand-color, var(--accent));
}
.buyer-order-tab:hover:not(:disabled) { background: #fff; }
.buyer-order-tab strong { display: block; font-size: 18px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.buyer-order-tab small { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; color: var(--muted); }
.buyer-order-tab b { color: var(--accent); }
.buyer-order-tab:focus-visible { outline-offset: -4px; }
.buyer-order-panel { padding: 13px 16px; border: 1px solid var(--line); border-radius: 0 6px 6px 6px; background: #fff; }
.buyer-order-panel .filters {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; padding: 0;
}
.buyer-order-select, .buyer-phase-select { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.buyer-order-select:focus-within, .buyer-phase-select:focus-within {
  position: static; width: auto; height: auto; overflow: visible; clip-path: none;
}
.buyer-order-panel .filters label, .buyer-phase-select { font-size: 13px; color: var(--ink); }
.buyer-order-panel select {
  min-height: 38px; width: 100%; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 4px; background: #fff; color: var(--ink); font-size: 14px;
}
.buyer-order-panel .filters .buyer-order-select { display: none; }
.buyer-phase-select { display: none; }
.buyer-order-panel .catalog-path { margin: 6px 0 0; padding: 0; border: 0; }
.buyer-phase-route {
  position: relative; display: flex; gap: 2px; margin-top: 12px; padding: 3px; overflow-x: auto;
  scrollbar-width: thin; isolation: isolate;
}
.buyer-phase-route::before {
  content: ""; position: sticky; flex: 0 0 0; top: 18px; left: 0; width: 100%;
  border-top: 2px dashed #b3c3c7; align-self: start; z-index: -1;
}
.buyer-phase {
  position: relative; flex: 1 0 124px; display: grid; justify-items: center; align-content: start; gap: 4px;
  min-height: 68px; padding: 7px 7px 9px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink); text-align: center; cursor: pointer; font: inherit; line-height: 1.25;
}
.buyer-phase[aria-pressed=true], .buyer-phase:hover { background: var(--kl-accent-soft, #edf7f8); }
.buyer-phase[aria-pressed=true] { box-shadow: inset 0 -2px 0 var(--accent); }
.buyer-phase strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.buyer-phase small { color: var(--muted); }
.buyer-phase-dot {
  width: 12px; height: 12px; margin: 2px 0 3px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px #fff;
}

.catalog-panel { overflow: visible; margin-top: 24px; border: 0; border-radius: 0; background: transparent; }
.buyer-gallery-tools {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.buyer-search { position: relative; display: flex; align-items: center; flex: 1 1 210px; margin-right: auto; max-width: 370px; }
.buyer-search input, .buyer-sort select { width: 100%; padding: 6px 10px; color: var(--ink); border: 1px solid var(--line); background: #fff; }
.buyer-search input { padding-left: 37px; }
.buyer-search svg { position: absolute; left: 12px; pointer-events: none; color: var(--muted); }
.buyer-gallery-tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.75; }
.buyer-sort { flex: 0 1 auto; min-width: 0; }
.buyer-view-switch { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 6px; background: #e5eced; }
.buyer-view-switch button {
  display: grid; place-items: center; width: 40px; height: 34px; border: 0; border-radius: 4px;
  color: var(--ink); background: transparent; cursor: pointer;
}
.buyer-view-switch button[aria-pressed=true] { background: #fff; box-shadow: 0 1px 2px #1a292d24; }
.catalog-options { gap: 8px; padding: 12px 0 0; border: 0; }
.catalog-options > label.selection-scope { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; }
.catalog-options input { margin: 0; }
.buyer-gallery-group { margin: 22px 0 0; }
.buyer-gallery-group h2 {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 650;
}
.buyer-gallery-group h2 small { color: var(--muted); font-size: 13px; font-weight: 500; }
.buyer-gallery-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr)); gap: 22px 18px;
}
.buyer-card, .buyer-card-meta { min-width: 0; }
.buyer-card-media {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px;
  background: #1b272b; color: #cee0e2;
}
.buyer-card.is-selected .buyer-card-media { outline: 3px solid var(--accent); outline-offset: 2px; }
.buyer-preview-tile { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: zoom-in; }
.buyer-preview-tile:focus-visible { outline-offset: -4px; }
.buyer-cover {
  display: grid; place-items: center; width: 100%; height: 100%;
  background: radial-gradient(ellipse at 62% 12%, #3d5357, transparent 62%), repeating-linear-gradient(136deg, #ffffff10 0 1px, transparent 1px 34px);
  font-size: clamp(20px, 3vw, 34px); font-weight: 650; letter-spacing: .03em;
}
.buyer-cover.pdf { background: linear-gradient(150deg, #47353c, #24272e); color: #f8dadd; }
.buyer-cover img { width: 100%; height: 100%; object-fit: contain; }
.buyer-pick {
  position: absolute; top: 8px; left: 8px; display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 4px; background: #fff; cursor: pointer;
}
.buyer-pick input { margin: 0; }
.buyer-card-media .tag { position: absolute; top: 8px; right: 8px; max-width: calc(100% - 60px); }
.tag { border-radius: 4px; font-size: 12px; background: #edf1f2; color: #40565a; }
.tag.pending { color: var(--kl-accent-hover, #0a5156); background: var(--kl-accent-soft, #edf7f8); }
.tag.done { color: #245740; background: #e8f3ed; }
.buyer-card-meta { padding: 8px 1px 0; }
.buyer-card-name { display: block; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.buyer-card-details { display: grid; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.buyer-card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.buyer-card-actions .text-button { min-height: 34px; padding-inline: 0; }
.buyer-empty { margin: 22px 0 0; padding: 30px 12px; border: 1px dashed var(--line); border-radius: 6px; text-align: center; color: var(--muted); background: #fff; }
#buyer-list { margin-top: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
#buyer-list th { background: #f6f9f9; color: var(--kl-ink-2, #34474d); }
#buyer-list td, #buyer-list th { font-size: 13px; }
#buyer-list .thumb { display: grid; width: 55px; height: 40px; flex-basis: 55px; background: #1b272b; color: #fff; }
#buyer-list .thumb img { max-width: 100%; max-height: 40px; }
#buyer-list .thumb.pdf { background: #47353c; }
.table-foot { padding-inline: 0; }
.actionbar {
  position: sticky; bottom: 12px; z-index: 8; width: min(100%, 780px); display: flex; flex-direction: row;
  align-items: center; gap: 12px; margin: 20px auto 0; padding: 11px 13px 11px 17px; border: 0;
  border-radius: 8px; background: var(--ink); color: #fff; box-shadow: 0 16px 36px -15px #0a121598;
}
.actionbar p { color: #d4e2e4; }
.actionbar .button { background: var(--kl-accent-bright, #53bec6); color: var(--ink); }
.actionbar .button.secondary { background: transparent; color: #fff; border-color: #9ab0b2; }
.actionbar .button:not(:disabled):hover { background: #c4e8e9; color: var(--ink); }
.receipt-note { margin-top: 12px; }
.main-content footer {
  display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 36px; padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
#preview-dialog {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: 100dvh; margin: 0;
  padding: 18px clamp(14px, 4vw, 48px); border: 0; border-radius: 0; background: #0f181b; color: #e6eef0;
}
#preview-dialog .dialog-head { align-items: center; flex-direction: row; border-bottom: 1px solid #77909560; padding-bottom: 10px; }
#preview-dialog h2 { color: inherit; font-size: 17px; }
#preview-name { margin: 10px 0; overflow-wrap: anywhere; }
#preview-dialog .preview-content { background: transparent; border: 0; color: inherit; }
#preview-dialog .preview-content img { max-width: 100%; max-height: calc(100dvh - 145px); object-fit: contain; }

@media (max-width: 960px) {
  .sidebar { padding: 0; position: static; }
  .sidebar-viewport { min-height: 0; max-height: none; padding: 8px 14px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .nav-button { width: auto; flex: 0 1 auto; min-height: 41px; padding: 5px 8px; font-size: 13px; }
  .sidebar .side-profile { display: none; }
  .main-content { padding: 22px 20px 0; }
  .catalog-panel .catalog-path { justify-content: start; }
  #buyer-list { padding: 0 5px; }
}
@media (max-width: 640px) {
  .topbar { min-height: 64px; gap: 8px; padding: 8px 12px; }
  .buyer-test-banner { padding-inline: 12px; }
  .brand { gap: 8px; }
  .brand span { padding-left: 8px; font-size: 12px; }
  .buyer-header-tools { gap: 6px; }
  .buyer-account-toggle { padding: 2px; }
  #buyer-account-name, .buyer-account-toggle > span:last-child { display: none; }
  .main-content { padding: 16px 12px 0; }
  .sidebar-viewport { padding-inline: 8px; }
  .sidebar nav { gap: 1px; }
  .nav-button { min-height: 38px; font-size: 12px; overflow-wrap: normal; hyphens: none; }
  .nav-button .buyer-nav-icon { width: 16px; height: 16px; }
  .summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; margin-bottom: 12px; }
  .summary .stat { display: grid; align-content: start; justify-items: start; min-width: 0; padding: 5px 7px; gap: 3px; font-size: 12px; }
  .summary .stat span { overflow-wrap: normal; hyphens: auto; }
  .buyer-order-panel .filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .buyer-order-panel { padding: 10px; }
  .buyer-order-tab { flex-basis: 175px; min-height: 64px; padding: 6px 10px; }
  .buyer-gallery-cards { grid-template-columns: repeat(auto-fit,minmax(min(150px,100%),1fr)); gap: 14px 12px; }
  .buyer-card-media .tag { top: 6px; right: 6px; font-size: 10px; padding: 3px 5px; }
  .buyer-pick { top: 6px; left: 6px; width: 31px; height: 31px; }
  .catalog-options > label.selection-scope { font-size: 12px; }
  .actionbar { flex-direction: column; align-items: stretch; padding: 9px; }
  .actionbar .action-buttons { display: flex; flex-direction: row; justify-content: flex-start; }
  .actionbar .action-buttons .button { width: auto; white-space: normal; }
}


.buyer-nav-icon { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.dashboard:has(#buyer-selection:not([hidden])) .main-content { padding-bottom: 108px; }
.actionbar { position: fixed; left: 50%; translate: -50% 0; width: min(780px, calc(100% - 24px)); }
#preview-dialog .dialog-head { justify-content: flex-start; }
#preview-dialog .dialog-head h2 { flex: 1; }
#preview-page { font-size: 13px; color: #b3c6c9; white-space: nowrap; }
.buyer-preview-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); gap: 24px; }
.buyer-preview-stage { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; min-width: 0; }
.buyer-preview-stage .preview-content { overflow: auto; padding: 10px; }
.buyer-preview-stage .preview-content.is-zoomed img { width: auto; max-width: none !important; height: auto; max-height: none !important; }
.buyer-preview-arrow { width: 40px; min-height: 42px; border: 1px solid #78969b; border-radius: 4px; background: transparent; color: #e6eef0; font-size: 25px; cursor: pointer; }
.buyer-preview-arrow:disabled { opacity: .45; cursor: default; }
.buyer-preview-side { min-width: 0; padding: 14px; border-left: 1px solid #77909560; overflow-wrap: anywhere; }
.buyer-preview-side dt { margin-top: 12px; font-size: 13px; color: #b3c6c9; }
.buyer-preview-side dd { margin: 3px 0; }
@media (max-width: 760px) {
  .buyer-preview-body { grid-template-columns: 1fr; gap: 12px; }
  .buyer-preview-side { border-left: 0; border-top: 1px solid #77909560; }
  #preview-dialog .preview-content img { max-height: calc(100dvh - 195px); }
}
@media (max-width: 440px) {
  .buyer-card-actions .text-button { min-height: 40px; }
  #preview-dialog .dialog-head { flex-wrap: wrap; gap: 7px; }
}


.buyer-test-banner .buyer-nav-icon { width: 16px; height: 16px; }
.nav-button[aria-current=page] { border-inline-start: 0; }
.summary .stat { border-top: 0; }
.buyer-cover:not(.pdf):has(svg), .thumb:not(.pdf):has(svg) { align-content: center; justify-items: center; gap: 5px; }
.buyer-cover svg, .thumb svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.buyer-cover:not(.pdf) span { font-size: .55em; }
.thumb:not(.pdf) span { font-size: 8px; }
.buyer-phase-route::before { position: absolute; left: 4%; width: 92%; top: 18px; }

.buyer-more-filters { display: contents; }
#buyer-list .sort-title { display: inline-flex; align-items: center; gap: 3px; }
[data-sidebar=reduced] { --buyer-rail-width: 72px; }
.sidebar .sidebar-toggle {
  display: grid; place-items: center; flex: none; width: 40px; min-height: 40px; margin: 0 0 7px auto;
  padding: 0; color: #c9d6da; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
}
.sidebar .sidebar-toggle:hover { background: #263940; color: #fff; }
[data-sidebar=reduced] .nav-button { justify-content: center; gap: 0; padding-inline: 7px; }
[data-sidebar=reduced] .nav-button span[data-i18n] {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
[data-sidebar=reduced] .sidebar .side-profile { display: none; }
[data-sidebar=reduced] .main-content { max-width: none; }
@media (min-width: 961px) {
  [data-sidebar=reduced] .sidebar .sidebar-toggle { margin-inline: auto; }
}
@media (max-width: 960px) {
  .sidebar-viewport { flex-direction: row; align-items: start; gap: 4px; }
  .sidebar .sidebar-toggle { width: 34px; min-height: 38px; margin: 0; }
}

.buyer-file-details { min-width: 0; display: grid; }
.buyer-document-description { color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
