/* =============================================================
   Whirlpool KMS — Components
   ============================================================= */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--s-8);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
    transform 0.05s var(--ease);
}
.btn:hover {
  background: var(--paper);
  border-color: var(--black);
}
.btn:active {
  transform: translateY(1px);
}
.btn--primary {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}
.btn--primary:hover {
  background: var(--ink);
  border-color: var(--ink);
}
.btn--ghost {
  border-color: transparent;
  background: transparent;
}
.btn--ghost:hover {
  background: var(--surface);
  border-color: transparent;
}
.btn--lg {
  padding: 14px 24px;
  font-size: var(--t-body);
}
.btn--sm {
  padding: 7px 12px;
  font-size: var(--t-caption);
}

/* ============ Top bar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s-6);
  height: 64px;
  padding: 0 var(--s-8);
  background: var(--white);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
}
.brand__mark {
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--black);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand__sub {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.topnav {
  display: flex;
  gap: var(--s-1);
  margin-left: var(--s-4);
}
.topnav a {
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--secondary);
  padding: 8px 12px;
  border-radius: var(--radius);
}
.topnav a:hover {
  background: var(--surface);
  color: var(--ink);
}
.topnav a.is-active {
  color: var(--black);
  font-weight: 600;
  background: var(--surface);
}

.topbar__spacer {
  flex: 1;
}

/* Compact search in the topbar (everywhere except home) */
.topbar__search {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 320px;
  max-width: 34vw;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color 0.15s var(--ease);
}
.topbar__search:focus-within {
  border-color: var(--black);
}
.topbar__search input {
  border: 0;
  outline: 0;
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--t-small);
  background: transparent;
  color: var(--ink);
}
.topbar__search .icon {
  color: var(--muted);
  flex: none;
}

/* ============ UI language switcher (segmented) ============ */
.uilang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  flex: none;
}
.uilang__icon {
  color: var(--muted);
  display: inline-flex;
  margin-right: 2px;
}
.uilang__opt {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  color: var(--secondary);
  background: transparent;
  border: 0;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.uilang__opt:hover {
  color: var(--ink);
}
.uilang__opt.is-on {
  background: var(--black);
  color: var(--white);
}

/* ============ Role switcher ============ */
.roleswitch {
  position: relative;
}
.roleswitch__btn {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 7px 12px;
  border: 1.5px solid var(--black);
  border-radius: var(--radius);
  background: var(--white);
}
.roleswitch__btn:hover {
  background: var(--paper);
}
.roleswitch__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-weight: 500;
}
.roleswitch__meta {
  text-align: left;
  line-height: 1.15;
}
.roleswitch__role {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--ink);
}
.roleswitch__line {
  font-size: var(--t-caption);
  color: var(--muted);
}
.roleswitch__caret {
  color: var(--muted);
  margin-left: var(--s-1);
}

.roleswitch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
  padding: var(--s-2);
  z-index: 60;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s var(--ease), transform 0.14s var(--ease);
}
.roleswitch.is-open .roleswitch__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.roleswitch__menu-head {
  padding: var(--s-2) var(--s-3) var(--s-3);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--s-2);
}
.roleitem {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
}
.roleitem:hover {
  background: var(--surface);
}
.roleitem.is-current {
  border-color: var(--black);
  background: var(--paper);
}
.roleitem__dot {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  margin-top: 2px;
}
.roleitem.is-current .roleitem__dot {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}
.roleitem__label {
  font-weight: 600;
  font-size: var(--t-small);
}
.roleitem__blurb {
  font-size: var(--t-caption);
  color: var(--muted);
  line-height: 1.45;
  margin-top: 2px;
}

/* ============ Login ============ */
.login {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 100vh;
}
.login__brandpane {
  background: var(--black);
  color: var(--white);
  padding: var(--s-16) var(--s-12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login__brandpane .brand__mark {
  border-color: var(--white);
  color: var(--white);
}
.login__brandpane .brand__name {
  color: var(--white);
}
.login__brandpane .brand__sub {
  color: var(--disabled);
}
.login__tag {
  font-family: var(--font-display);
  font-size: var(--t-display-l);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 14ch;
}
.login__points {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-top: var(--s-8);
}
.login__point {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  color: var(--disabled);
  font-size: var(--t-small);
}
.login__point b {
  color: var(--white);
  font-weight: 600;
}
.login__point .num {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--white);
  border: 1px solid #444;
  border-radius: var(--radius);
  padding: 2px 6px;
}
.login__formpane {
  display: grid;
  place-items: center;
  padding: var(--s-12);
}
.login__card {
  width: 100%;
  max-width: 380px;
}
.login__card h1 {
  font-size: var(--t-h1);
  margin-bottom: var(--s-2);
}
.login__card p.sub {
  color: var(--secondary);
  font-size: var(--t-small);
  margin-bottom: var(--s-8);
}
.login__field {
  margin-bottom: var(--s-4);
}
.login__field label {
  display: block;
  font-size: var(--t-caption);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.login__field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--t-small);
}
.login__field input:focus {
  outline: 2px solid var(--black);
  outline-offset: 1px;
  border-color: var(--black);
}
.login__sso {
  width: 100%;
  margin-top: var(--s-2);
}
.login__divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-6) 0;
  color: var(--muted);
  font-size: var(--t-caption);
}
.login__divider::before,
.login__divider::after {
  content: "";
  height: 1px;
  background: var(--line-soft);
  flex: 1;
}
.login__foot {
  margin-top: var(--s-8);
  font-size: var(--t-caption);
  color: var(--muted);
}

/* ============ Home (search-first) ============ */
.home {
  flex: 1;
}
.home__hero {
  padding: var(--s-16) 0 var(--s-12);
  text-align: center;
}
.home__eyebrow {
  margin-bottom: var(--s-4);
}
.home__title {
  font-size: var(--t-display-l);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: var(--s-3);
}
.home__subtitle {
  color: var(--secondary);
  font-size: var(--t-h3);
  font-weight: 400;
  max-width: 46ch;
  margin: 0 auto var(--s-8);
}

/* Hero search bar — the centre of gravity */
.searchbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 6px 6px 20px;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: var(--white);
  transition: box-shadow 0.15s var(--ease);
}
.searchbar:focus-within {
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}
.searchbar .icon {
  color: var(--ink);
  flex: none;
}
.searchbar .btn--primary .icon {
  color: var(--white);
}
.searchbar input {
  flex: 1;
  border: 0;
  outline: 0;
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  color: var(--ink);
  background: transparent;
  padding: 14px 0;
}
.searchbar input::placeholder {
  color: var(--muted);
}

.home__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-6);
}
.home__chips-label {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  letter-spacing: 0.04em;
  align-self: center;
  margin-right: var(--s-1);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: var(--t-small);
  color: var(--secondary);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.chip:hover {
  border-color: var(--black);
  color: var(--ink);
  background: var(--paper);
}
.chip.is-active {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}
.chip .code-tag {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
}

/* Quick categories + popular docs row */
.home__sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-8);
  padding-bottom: var(--s-16);
}
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--line-soft);
}
.panel__head h3 {
  font-size: var(--t-body);
  font-weight: 600;
}
.catgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.catgrid button {
  text-align: left;
  padding: var(--s-4) var(--s-6);
  background: var(--white);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  transition: background 0.12s var(--ease);
}
.catgrid button:hover {
  background: var(--surface);
}
.catgrid button:nth-child(2n) {
  border-right: 0;
}
.catgrid button:nth-last-child(-n + 2) {
  border-bottom: 0;
}
.catgrid__name {
  font-weight: 500;
  font-size: var(--t-small);
}
.catgrid__count {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 2px;
}

.poplist__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  padding: var(--s-3) var(--s-6);
  background: var(--white);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s var(--ease);
}
.poplist__item:last-child {
  border-bottom: 0;
}
.poplist__item:hover {
  background: var(--surface);
}
.poplist__rank {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  width: 18px;
  flex: none;
}
.poplist__title {
  font-size: var(--t-small);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.poplist__views {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  flex: none;
}

/* ============ Results layout ============ */
.results {
  flex: 1;
  display: grid;
  grid-template-columns: 264px 1fr;
  gap: var(--s-8);
  padding: var(--s-8) 0 var(--s-16);
  align-items: start;
}

/* Filter rail */
.filters {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  position: sticky;
  top: 88px;
}
.filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
}
.filters__head .overline {
  color: var(--secondary);
}
.facet {
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
}
.facet:last-child {
  border-bottom: 0;
}
.facet__title {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  margin-bottom: var(--s-3);
}
.facet__opt {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: 6px 4px;
  background: transparent;
  border: 0;
  text-align: left;
  border-radius: var(--radius);
  transition: background 0.1s var(--ease);
}
.facet__opt:hover {
  background: var(--paper);
}
.facet__box {
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  display: grid;
  place-items: center;
}
.facet__box svg {
  opacity: 0;
}
.facet__opt.is-on .facet__box {
  background: var(--black);
  border-color: var(--black);
}
.facet__opt.is-on .facet__box svg {
  opacity: 1;
  color: var(--white);
}
.facet__label {
  flex: 1;
  font-size: var(--t-small);
  color: var(--ink);
}
.facet__opt.is-on .facet__label {
  font-weight: 600;
}
.facet__count {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}
.facet__opt--mono .facet__label {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
}

/* Results main column */
.results__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.results__title {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: 600;
}
.results__title .q {
  font-family: var(--font-mono);
  font-weight: 500;
}
.results__meta {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  color: var(--muted);
  margin-top: 2px;
}
.results__sort {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-small);
  color: var(--secondary);
}
.results__sort select {
  font-family: var(--font-body);
  font-size: var(--t-small);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

/* The access-control note — the money moment */
.trim-note {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  margin-bottom: var(--s-4);
  font-size: var(--t-small);
  color: var(--ink);
  animation: trimIn 0.3s var(--ease);
}
.trim-note .icon {
  flex: none;
}
.trim-note b {
  font-family: var(--font-mono);
  font-weight: 600;
}
@keyframes trimIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Active filter pills above results */
.activefilters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.activefilters:empty {
  display: none;
}
.filterpill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 5px 6px 5px 12px;
  border: 1px solid var(--black);
  border-radius: var(--radius-pill);
  font-size: var(--t-caption);
  background: var(--white);
}
.filterpill button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.filterpill button:hover {
  background: var(--surface);
  color: var(--ink);
}

/* Result cards */
.resultlist {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.rcard {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s-5, 20px) var(--s-6);
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease),
    transform 0.06s var(--ease);
  cursor: pointer;
  animation: cardIn 0.25s var(--ease) backwards;
}
.rcard:hover {
  background: var(--paper);
  border-color: var(--black);
}
.rcard:active {
  transform: translateY(1px);
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.rcard__top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.rcard__type {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
  padding: 3px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 5px;
}
.rcard__internal {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  color: var(--white);
  background: var(--black);
  padding: 3px 8px;
  border-radius: var(--radius);
}
.rcard__title {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: var(--s-2);
}
.rcard__summary {
  font-size: var(--t-small);
  color: var(--secondary);
  line-height: 1.5;
  margin-bottom: var(--s-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rcard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.rcard__codes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.metaitem {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}
.metaitem .icon {
  color: var(--disabled);
}
.metadot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line);
}

/* Empty / failed search */
.empty {
  text-align: center;
  padding: var(--s-16) var(--s-8);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.empty__icon {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto var(--s-4);
  color: var(--muted);
}
.empty h3 {
  font-size: var(--t-h3);
  margin-bottom: var(--s-2);
}
.empty p {
  color: var(--secondary);
  font-size: var(--t-small);
  max-width: 44ch;
  margin: 0 auto var(--s-4);
}
.empty__suggest {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ============ Document detail ============ */
.detail {
  flex: 1;
  padding: var(--s-6) 0 var(--s-16);
}
.detail__back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-small);
  color: var(--secondary);
  margin-bottom: var(--s-6);
  padding: 6px 8px;
  border-radius: var(--radius);
}
.detail__back:hover {
  background: var(--surface);
  color: var(--ink);
}
.detail__grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--s-8);
  align-items: start;
}
.detail__head {
  margin-bottom: var(--s-6);
}
.detail__crumbs {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-bottom: var(--s-3);
}
.detail__title {
  font-size: var(--t-h1);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin-bottom: var(--s-4);
}
.detail__codes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-6);
}

/* Preview surface */
.preview {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--s-6);
}
.preview__bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}
.preview__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.preview__name {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
  margin-left: var(--s-2);
}
.preview__body {
  padding: var(--s-8) var(--s-12);
  background: var(--white);
  min-height: 360px;
}
/* ---- Video player (16:9 stage + control bar) ---- */
.vplayer {
  background: #0d0e10;
}
/* keep the embedded player a sensible size inside a document */
.preview .vplayer {
  max-width: 680px;
  margin: var(--s-5, 20px) auto;
  border-radius: var(--radius);
  overflow: hidden;
}
.vplayer__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
}
.vplayer__poster {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 0%, #2b2f36 0%, #14161a 55%, #0d0e10 100%);
}
.vplayer__watermark {
  position: absolute;
  left: 16px;
  top: 14px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.32);
}
.vplayer__play {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  place-items: center;
  color: var(--black);
  cursor: pointer;
  padding-left: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s var(--ease), opacity 0.2s var(--ease);
}
.vplayer__play:hover {
  transform: scale(1.07);
}
.vplayer__badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  padding: 3px 7px;
  border-radius: 3px;
}
.vplayer__controls {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 11px 14px;
  background: #16181c;
}
.vplayer__ctrlbtn {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
}
.vplayer__ctrlbtn:hover {
  color: #fff;
}
.vplayer__i-pause {
  display: none;
}
.vplayer__track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  cursor: pointer;
}
.vplayer__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: #fff;
  border-radius: 999px;
}
.vplayer__progress::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
}
.vplayer__time {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}
/* playing state */
.vplayer.is-playing .vplayer__play {
  opacity: 0;
  pointer-events: none;
}
.vplayer.is-playing .vplayer__i-play {
  display: none;
}
.vplayer.is-playing .vplayer__i-pause {
  display: inline-flex;
}
.vplayer.is-playing .vplayer__progress {
  animation: vplay 12s linear forwards;
}
@keyframes vplay {
  from { width: 0; }
  to { width: 100%; }
}
.vcaption {
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
}
.viewer__videowrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.viewer__videowrap .vcaption {
  background: var(--white);
}
.doc-page h4 {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  margin: 0 0 var(--s-3);
}
.doc-page p {
  color: var(--secondary);
  font-size: var(--t-small);
  line-height: 1.7;
  margin-bottom: var(--s-4);
  max-width: 62ch;
}
.doc-page .skeleton,
.viewer__page .skeleton {
  height: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: var(--s-3);
}
.skeleton.w-90 { width: 90%; }
.skeleton.w-75 { width: 75%; }
.skeleton.w-60 { width: 60%; }
.doc-page .steps {
  margin: var(--s-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.doc-page .step {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
}
.doc-page .step .num {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--white);
  background: var(--black);
  width: 22px;
  height: 22px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex: none;
}
.doc-page .step span:last-child {
  font-size: var(--t-small);
  color: var(--ink);
}

/* Metadata table */
.metatable {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--s-6);
}
.metatable__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  border-bottom: 1px solid var(--line-soft);
}
.metatable__row:last-child {
  border-bottom: 0;
}
.metatable__k {
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
}
.metatable__v {
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-small);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.metatable__v.mono {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
}

/* Related knowledge panel */
.related__head {
  margin-bottom: var(--s-4);
}
.related__head h3 {
  font-size: var(--t-h3);
}
.related__head p {
  font-size: var(--t-small);
  color: var(--muted);
  margin-top: 2px;
}
.related__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.relcard {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  text-align: left;
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.relcard:hover {
  border-color: var(--black);
  background: var(--paper);
}
.relcard__icon {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--ink);
}
.relcard__type {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.relcard__title {
  font-size: var(--t-small);
  font-weight: 500;
  line-height: 1.3;
  margin-top: 2px;
}

.sidebox {
  margin-bottom: var(--s-6);
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: capitalize;
}
.pill--draft {
  border: 1px solid var(--muted);
  color: var(--muted);
}
.pill--review {
  border: 1px dashed var(--ink);
  color: var(--ink);
}
.pill--approved {
  border: 1px solid var(--success);
  color: var(--success);
  background: var(--success-soft);
}
.pill--published {
  background: var(--success);
  color: var(--white);
  border: 1px solid var(--success);
}

/* Audience badges (Internal / All staff / Public) */
.abadge {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.abadge--internal {
  color: var(--white);
  background: var(--black);
}
.abadge--staff {
  color: var(--secondary);
  border: 1px solid var(--line);
}
.abadge--public {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid var(--success-line);
}

/* =============================================================
   Journey 2 — Authoring, lifecycle, review
   ============================================================= */

/* Page scaffold shared by author + review screens */
.page {
  flex: 1;
  padding: var(--s-8) 0 var(--s-16);
}
.page__head {
  margin-bottom: var(--s-8);
}
.page__eyebrow {
  margin-bottom: var(--s-3);
}
.page__title {
  font-size: var(--t-h1);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: var(--s-2);
}
.page__lede {
  color: var(--secondary);
  font-size: var(--t-body);
  max-width: 64ch;
}
.page__grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--s-8);
  align-items: start;
}

/* ---- Lifecycle stepper (Draft → Review → Approved → Published) ---- */
.lifecycle {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.lifecycle__step {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--disabled);
}
.lifecycle__node {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  background: var(--white);
  color: var(--disabled);
  flex: none;
}
.lifecycle__step.is-done .lifecycle__node {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}
.lifecycle__step.is-current .lifecycle__node {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.lifecycle__step.is-done,
.lifecycle__step.is-current {
  color: var(--ink);
}
.lifecycle__bar {
  width: 28px;
  height: 1px;
  background: var(--line);
  margin: 0 var(--s-2);
}
.lifecycle__bar.is-done {
  background: var(--ink);
}

/* ---- Form ---- */
.form {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.form__section {
  padding: var(--s-6);
  border-bottom: 1px solid var(--line-soft);
}
.form__section:last-child {
  border-bottom: 0;
}
.form__legend {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  margin-bottom: var(--s-4);
}
.field {
  margin-bottom: var(--s-4);
}
.field:last-child {
  margin-bottom: 0;
}
.field > label {
  display: block;
  font-size: var(--t-small);
  font-weight: 600;
  margin-bottom: var(--s-2);
}
.field__hint {
  font-size: var(--t-caption);
  color: var(--muted);
  font-weight: 400;
  margin-left: var(--s-2);
}
.field input[type='text'],
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--t-small);
  background: var(--white);
  color: var(--ink);
}
.field input.mono {
  font-family: var(--font-mono);
}
.field textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--black);
  outline-offset: 1px;
  border-color: var(--black);
}
.field__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

/* mock upload dropzone */
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--s-8);
  text-align: center;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
  cursor: pointer;
}
.dropzone:hover {
  border-color: var(--black);
  background: var(--paper);
}
.dropzone.has-file {
  border-style: solid;
  border-color: var(--ink);
  background: var(--paper);
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
}
.dropzone__icon {
  color: var(--secondary);
  margin-bottom: var(--s-3);
}
.dropzone.has-file .dropzone__icon {
  margin-bottom: 0;
}
.dropzone__main {
  font-size: var(--t-small);
  font-weight: 600;
}
.dropzone__sub {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 4px;
}
.dropzone.has-file .dropzone__file {
  flex: 1;
}

/* ---- Video upload widget (Repair Video doc type) ---- */
.vupload {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--s-8);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.vupload[data-video-upload]:hover {
  border-color: var(--black);
  background: var(--paper);
}
.vupload__icon {
  color: var(--secondary);
  margin-bottom: var(--s-3);
}
.vupload__main {
  font-size: var(--t-small);
  font-weight: 600;
}
.vupload__sub {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 4px;
}

/* processing state */
.vupload--proc {
  border-style: solid;
  border-color: var(--line);
  background: var(--paper);
  text-align: left;
  cursor: default;
  padding: var(--s-5, 20px);
}
.vproc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.vproc__name {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-small);
  font-weight: 600;
}
.vproc__status {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
}
.vproc__bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: var(--s-4);
}
.vproc__bar span {
  display: block;
  height: 100%;
  background: var(--black);
  border-radius: 999px;
  transition: width 0.16s linear;
}
.vsteps {
  display: flex;
  align-items: center;
}
.vstep {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.03em;
  color: var(--disabled);
  white-space: nowrap;
}
.vstep__node {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 10px;
  background: var(--white);
  color: var(--disabled);
  flex: none;
}
.vstep.is-done {
  color: var(--ink);
}
.vstep.is-done .vstep__node {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.vstep.is-cur {
  color: var(--ink);
}
.vstep.is-cur .vstep__node {
  border-color: var(--ink);
  color: var(--ink);
}
.vstep__bar {
  flex: 1;
  height: 1px;
  background: var(--line);
  margin: 0 var(--s-2);
  min-width: 12px;
}
.vsteps__spin {
  display: inline-flex;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ready state */
.vupload--ready {
  border-style: solid;
  border-color: var(--ink);
  background: var(--paper);
  text-align: left;
  cursor: default;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
}
.vthumb {
  position: relative;
  width: 116px;
  height: 66px;
  flex: none;
  border-radius: var(--radius);
  background: radial-gradient(120% 120% at 50% 0%, #2b2f36, #0d0e10);
  display: grid;
  place-items: center;
  color: #fff;
}
.vthumb__dur {
  position: absolute;
  right: 5px;
  bottom: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 5px;
  border-radius: 3px;
}
.vupload__info {
  flex: 1;
  min-width: 0;
}
.vupload__name {
  font-size: var(--t-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vupload__meta {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 3px;
}
.vupload__ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--t-caption);
  color: var(--success);
  font-weight: 500;
  margin-top: 6px;
}

/* visibility radio cards (ties to security trimming) */
.radio-cards {
  display: grid;
  gap: var(--s-3);
}
.radio-card {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.radio-card:hover {
  border-color: var(--black);
}
.radio-card.is-on {
  border-color: var(--black);
  background: var(--paper);
  box-shadow: inset 3px 0 0 var(--black);
}
.radio-card__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  flex: none;
  margin-top: 2px;
  display: grid;
  place-items: center;
}
.radio-card.is-on .radio-card__dot::after {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--black);
}
.radio-card__label {
  font-size: var(--t-small);
  font-weight: 600;
}
.radio-card__blurb {
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 2px;
}

/* chips input for fault codes */
.tagrow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.tagrow .chip {
  cursor: pointer;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
}

.form__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5, 20px) var(--s-6);
  background: var(--surface);
}
.form__foot .hint {
  font-size: var(--t-caption);
  color: var(--muted);
}
.form__foot-actions {
  display: flex;
  gap: var(--s-2);
}

/* sidebar helper card */
.sidecard {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s-5, 20px);
  margin-bottom: var(--s-4);
}
.sidecard h3 {
  font-size: var(--t-body);
  margin-bottom: var(--s-2);
}
.sidecard p {
  font-size: var(--t-small);
  color: var(--secondary);
  line-height: 1.55;
}
.sidecard__steps {
  margin-top: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.sidecard__step {
  display: flex;
  gap: var(--s-3);
  font-size: var(--t-small);
}
.sidecard__step .n {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--white);
  background: var(--black);
  width: 20px;
  height: 20px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex: none;
}

/* ---- My documents list ---- */
.docrow {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  text-align: left;
  padding: var(--s-4) var(--s-5, 20px);
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin-bottom: var(--s-2);
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
button.docrow {
  cursor: pointer;
}
button.docrow:hover {
  border-color: var(--black);
  background: var(--paper);
}
.docrow__main {
  flex: 1;
  min-width: 0;
}
.docrow__title {
  font-weight: 600;
  font-size: var(--t-small);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docrow__meta {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 3px;
}

/* ---- Review queue table ---- */
.qtable {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.qtable__head,
.qtable__row {
  display: grid;
  grid-template-columns: 1fr 150px 120px 120px 110px;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5, 20px);
}
.qtable__head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
}
.qtable__row {
  border-bottom: 1px solid var(--line-soft);
  background: var(--white);
  cursor: pointer;
  transition: background 0.12s var(--ease);
  text-align: left;
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  font: inherit;
}
.qtable__row:last-child {
  border-bottom: 0;
}
.qtable__row:hover {
  background: var(--paper);
}
.qtable__doctitle {
  font-weight: 600;
  font-size: var(--t-small);
}
.qtable__sub {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 2px;
}
.qcell-mono {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
}

/* queue count badge */
.countbadge {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  margin-left: var(--s-2);
}

/* toast-ish inline banner for confirmations */
.banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5, 20px);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  margin-bottom: var(--s-6);
  animation: trimIn 0.3s var(--ease);
}
.banner__icon {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  display: grid;
  place-items: center;
}
.banner__title {
  font-weight: 600;
  font-size: var(--t-small);
}
.banner__sub {
  font-size: var(--t-caption);
  color: var(--secondary);
  margin-top: 1px;
}
.banner--success {
  border-color: var(--success-line);
  background: var(--success-soft);
}
.banner--success .banner__icon {
  background: var(--success);
}
.banner--danger {
  border-color: var(--danger-line);
  background: var(--danger-soft);
}
.banner--danger .banner__icon {
  background: var(--danger);
}

/* empty review queue */
.queue-empty {
  text-align: center;
  padding: var(--s-12) var(--s-8);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

@media (max-width: 1024px) {
  .page__grid { grid-template-columns: 1fr 300px; }
}
@media (max-width: 860px) {
  .page__grid { grid-template-columns: 1fr; }
  .field__row { grid-template-columns: 1fr; }
  .qtable__head { display: none; }
  .qtable__row {
    grid-template-columns: 1fr auto;
    grid-auto-rows: auto;
  }
  .qtable__row > :nth-child(n + 3) { display: none; }
}

/* =============================================================
   Journey 3 — Admin / governance dashboard
   ============================================================= */

/* headline metric cards */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-8);
}
.metric {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s-5, 20px) var(--s-6);
  background: var(--white);
}
.metric__label {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.metric__value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.metric__sub {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
  margin-top: var(--s-2);
}
.metric__sub .delta {
  color: var(--ink);
  font-weight: 500;
}
.metric__sub .delta--up {
  color: var(--success);
}
.metric__sub .delta--down {
  color: var(--danger);
}
.metric--accent {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}
.metric--accent .metric__label,
.metric--accent .metric__sub {
  color: var(--disabled);
}
.metric--accent .metric__sub .delta {
  color: var(--white);
}

/* dashboard panel grid */
.dash {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  margin-bottom: var(--s-6);
  align-items: start;
}
.dash__panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
}
.dash__panel--full {
  grid-column: 1 / -1;
}
.dash__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5, 20px);
  border-bottom: 1px solid var(--line-soft);
}
.dash__head h3 {
  font-size: var(--t-body);
  font-weight: 600;
}
.dash__head .overline {
  color: var(--muted);
}
.dash__body {
  padding: var(--s-4) var(--s-5, 20px);
}

/* horizontal bar chart (CSS bars, monochrome) */
.bars {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.bar {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: var(--s-3);
}
.bar__label {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar__track {
  height: 18px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}
.bar__fill {
  display: block;
  height: 100%;
  background: var(--black);
  border-radius: 2px;
  transform-origin: left;
  animation: barGrow 0.6s var(--ease) both;
}
.bar__fill--mid {
  background: var(--secondary);
}
.bar__val {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  text-align: right;
}
@keyframes barGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* clickable list rows (failed searches, review-due, most-viewed) */
.listrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  padding: var(--s-3) 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
}
.listrow:last-child {
  border-bottom: 0;
}
button.listrow {
  cursor: pointer;
  padding: var(--s-3) var(--s-2);
  margin: 0 calc(-1 * var(--s-2));
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line-soft);
}
button.listrow:hover {
  background: var(--surface);
}
.listrow__rank {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  width: 20px;
  flex: none;
}
.listrow__main {
  flex: 1;
  min-width: 0;
}
.listrow__title {
  font-size: var(--t-small);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listrow__title.mono {
  font-family: var(--font-mono);
}
.listrow__sub {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
  margin-top: 2px;
}
.listrow__val {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
  flex: none;
}
.listrow__bar {
  width: 90px;
  height: 6px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.listrow__bar span {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
}

/* due-date pill (weight + outline, no colour) */
.due {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex: none;
}
.due--over {
  background: var(--danger);
  color: var(--white);
}
.due--soon {
  border: 1px solid var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}
.due--ok {
  border: 1px solid var(--line);
  color: var(--muted);
}

.failhint {
  font-size: var(--t-caption);
  color: var(--muted);
  padding: var(--s-3) 0 0;
  line-height: 1.5;
}

/* audit log table */
.audit {
  width: 100%;
}
.audit__row {
  display: grid;
  grid-template-columns: 130px 150px 130px 1fr;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) var(--s-5, 20px);
  border-bottom: 1px solid var(--line-soft);
}
.audit__row:last-child {
  border-bottom: 0;
}
.audit__row--head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
}
.audit__time {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}
.audit__user {
  font-size: var(--t-small);
  font-weight: 500;
}
.audit__role {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}
.audit__action {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  display: inline-flex;
  align-self: start;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  white-space: nowrap;
}
.audit__target {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .dash { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 90px 1fr 40px; }
  .audit__row { grid-template-columns: 1fr 1fr; }
  .audit__row--head { display: none; }
  .audit__row > :nth-child(3),
  .audit__row > :nth-child(4) { grid-column: span 2; }
}

/* =============================================================
   Phase-2 alignment additions: language switcher, PDF viewer,
   browse-by-type, semantic-colour touches
   ============================================================= */

/* failed-search count in danger red (a real content-gap signal) */
.listrow__val--fail {
  color: var(--danger);
  font-weight: 500;
}

/* language switcher on the document detail */
.langswitch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-soft);
}
.langswitch__label {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: var(--s-1);
}
.langchip {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--secondary);
  cursor: pointer;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.langchip:hover {
  border-color: var(--black);
}
.langchip.is-on {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

/* ---- PDF viewer overlay ---- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: var(--s-6);
  animation: fadeIn 0.18s var(--ease);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.viewer__frame {
  width: min(880px, 100%);
  height: min(90vh, 1000px);
  background: var(--white);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.viewer__bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--ink);
  color: var(--white);
  flex: none;
}
.viewer__name {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--white);
}
.viewer__bar .viewer__spacer { flex: 1; }
.viewer__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--white);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
}
.viewer__btn:hover { background: rgba(255, 255, 255, 0.12); }
.viewer__pages {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  align-items: center;
}
.viewer__page {
  width: 100%;
  max-width: 640px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow-soft);
  padding: var(--s-8) var(--s-8) var(--s-12);
}
.viewer__page h4 {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  margin-bottom: var(--s-3);
}
.viewer__page p {
  font-size: var(--t-small);
  color: var(--secondary);
  margin-bottom: var(--s-4);
  line-height: 1.6;
}
.viewer__pagenum {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}

/* ---- Browse-by-knowledge-type tiles (mirrors the 8 spokes) ---- */
.typegrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
.typetile {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.typetile:hover {
  border-color: var(--black);
  background: var(--paper);
}
.typetile__icon {
  color: var(--ink);
}
.typetile__name {
  font-size: var(--t-small);
  font-weight: 600;
  line-height: 1.2;
}
.typetile__count {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}

@media (max-width: 860px) {
  .typegrid { grid-template-columns: 1fr 1fr; }
}

/* =============================================================
   Commerce bridge — parts availability + order handoff
   ============================================================= */
.partspanel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s-5, 20px);
  margin-bottom: var(--s-6);
}
.partspanel__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.partspanel__head h3 {
  font-size: var(--t-body);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.abadge--soon {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--secondary);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 3px 8px;
}
.partspanel__sub {
  font-size: var(--t-small);
  color: var(--secondary);
  line-height: 1.5;
  margin-bottom: var(--s-4);
}
.partspanel__list {
  display: flex;
  flex-direction: column;
}
.partrow {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line-soft);
}
.partrow:first-child {
  border-top: 0;
}
.partrow__icon {
  color: var(--secondary);
  flex: none;
}
.partrow__main {
  flex: 1;
  min-width: 0;
}
.partrow__name {
  display: block;
  font-size: var(--t-small);
  font-weight: 600;
}
.partrow__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: 4px;
}
.partrow__eta {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--muted);
}
.partrow__price {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  font-weight: 500;
  flex: none;
}
.stock {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.stock--in {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid var(--success-line);
}
.stock--low {
  color: var(--ink);
  border: 1px solid var(--line);
}
.stock--out {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
}

/* clickable part-number tag (order) */
button.code-tag--order {
  cursor: pointer;
  gap: 5px;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
button.code-tag--order:hover {
  border-color: var(--black);
  background: var(--paper);
}
button.code-tag--order .icon {
  color: var(--muted);
}

/* ---- Order handoff modal (reuses .viewer backdrop) ---- */
.handoff {
  align-items: center;
}
.handoff__card {
  width: min(440px, 100%);
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.handoff__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5, 20px);
  border-bottom: 1px solid var(--line-soft);
}
.handoff__icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  display: grid;
  place-items: center;
  flex: none;
}
.handoff__title {
  font-weight: 600;
  font-size: var(--t-body);
  flex: 1;
}
.handoff__x {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
}
.handoff__x:hover {
  color: var(--ink);
}
.handoff__body {
  padding: var(--s-5, 20px);
}
.handoff__part {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--s-4);
}
.handoff__pname {
  font-weight: 600;
  font-size: var(--t-small);
  flex: 1;
}
.handoff__price {
  font-family: var(--font-mono);
  font-weight: 600;
}
.handoff__dest {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-small);
  color: var(--ink);
  margin-bottom: var(--s-3);
}
.handoff__note {
  font-size: var(--t-caption);
  color: var(--muted);
  line-height: 1.6;
}
.handoff__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5, 20px);
  background: var(--surface);
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--line-soft);
  padding: var(--s-6) 0;
  margin-top: auto;
}
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--t-caption);
  color: var(--muted);
}
.footer__inner .mono {
  font-family: var(--font-mono);
}

/* ============ Misc ============ */
.icon {
  display: inline-flex;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .container { padding: 0 var(--s-6); }
  .topbar { padding: 0 var(--s-6); }
  .results { grid-template-columns: 220px 1fr; gap: var(--s-6); }
  .detail__grid { grid-template-columns: 1fr 300px; }
  .home__title { font-size: var(--t-h1); }
}

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login__brandpane { display: none; }
  .home__sections { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr; }
  .filters { position: static; }
  .detail__grid { grid-template-columns: 1fr; }
  .topbar__search { display: none; }
  .topnav { display: none; }
}
