:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #fff8ee;
  --bg-deep: #eee7fa;
  --panel: #fffdf8;
  --panel-soft: #eee7fa;
  --text: #151334;
  --muted: #625f77;
  --accent: #e94f4b;
  --accent-2: #a88be8;
  --accent-3: #2458d8;
  --good: #2d765d;
  --warning: #a86224;
  --danger: #a52d42;
  --border: #ded6e6;
  --border-active: #2458d8;
  --focus: #2458d8;
  --on-accent: #151334;
  --on-hero: #ffffff;
  --hero-gradient: linear-gradient(145deg, #e94f4b, #a88be8);
  --header-bg: rgba(255, 248, 238, 0.94);
  --header-border: rgba(36, 88, 216, 0.16);
  --body-gradient: radial-gradient(circle at 8% 8%, rgba(233, 79, 75, 0.08), transparent 24rem), linear-gradient(180deg, #fffdf8, var(--bg));
  --nav-active: #eee7fa;
  --input-bg: rgba(255, 255, 255, 0.82);
  --surface-success: #e0eee7;
  --surface-warning: #f5e7d9;
  --surface-danger: #fff5f3;
  --surface-hover: #f7eff2;
  --surface-muted: #f0e8ec;
  --disabled-bg: #e7e2dd;
  --disabled-text: #847b7e;
  --shadow: 0 14px 36px rgba(21, 19, 52, 0.12);
  --shadow-strong: 0 14px 32px rgba(21, 19, 52, 0.16);
  --texture: repeating-linear-gradient(115deg, transparent 0 34px, rgba(36, 88, 216, 0.025) 35px 36px);
  --skeleton-gradient: linear-gradient(90deg, #eee7e1 25%, #f8f4ef 50%, #eee7e1 75%);
  --danger-border: #c85c5c;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090d18;
  --bg-deep: #21182e;
  --panel: #101524;
  --panel-soft: #21182e;
  --text: #f3eadc;
  --muted: #b9ae9f;
  --accent: #c39a4b;
  --accent-2: #f2c96b;
  --accent-3: #d8b169;
  --good: #8bc7a7;
  --warning: #e0b36b;
  --danger: #ff9b8f;
  --border: #44334b;
  --border-active: #f2c96b;
  --focus: #f2c96b;
  --on-accent: #090d18;
  --on-hero: #f3eadc;
  --hero-gradient: linear-gradient(145deg, #21182e, #090d18);
  --header-bg: rgba(8, 12, 23, 0.94);
  --header-border: #30253b;
  --body-gradient: radial-gradient(circle at 8% 8%, rgba(195, 154, 75, 0.08), transparent 24rem), linear-gradient(180deg, #101524, var(--bg));
  --nav-active: #21182e;
  --input-bg: #161c2c;
  --surface-success: #18382d;
  --surface-warning: #3b2c1a;
  --surface-danger: #3a2025;
  --surface-hover: #21182e;
  --surface-muted: #21182e;
  --disabled-bg: #2b2b31;
  --disabled-text: #827d7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  --shadow-strong: 0 18px 50px rgba(0, 0, 0, 0.32);
  --texture: repeating-linear-gradient(115deg, transparent 0 34px, rgba(195, 154, 75, 0.025) 35px 36px);
  --skeleton-gradient: linear-gradient(90deg, #161c2c 25%, #21182e 50%, #161c2c 75%);
  --danger-border: #8f4d54;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #151334;
  color: #fffdf8;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--body-gradient, linear-gradient(180deg, #fffdf8, var(--bg)));
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 20px 72px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 8;
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.app-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  max-width: 1240px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 20px;
}

.network-status {
  position: sticky;
  top: 72px;
  z-index: 7;
  margin: 0;
  padding: 10px 20px;
  border-bottom: 1px solid var(--danger-border);
  background: var(--surface-danger);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.network-status[data-kind="success"] {
  border-color: var(--good);
  background: var(--surface-success);
  color: var(--good);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  padding: 4px;
  color: var(--text);
  background: transparent;
  font: 700 1.2rem "Fraunces", serif;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50% 44% 52% 46%;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 1rem "Inter", sans-serif;
  transform: rotate(-5deg);
}

.app-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.app-nav__button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.app-nav__button.is-active {
  color: var(--accent);
  background: var(--nav-active);
}

.header-user {
  min-width: 0;
  max-width: 20ch;
  overflow: hidden;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-view {
  min-width: 0;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin: 10px 0 26px;
}

.page-heading h1,
.catalog-header h1 {
  max-width: none;
  font-size: clamp(2.45rem, 5vw, 4.4rem);
  line-height: 1;
}

.page-heading p:not(.eyebrow) {
  max-width: 62ch;
  margin: 10px 0 0;
  color: var(--muted);
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.62fr);
  gap: 22px;
  align-items: start;
}

.inventory-layout__content {
  min-width: 0;
}

.inventory-heading {
  margin-top: 0;
}

.inventory-layout__visual,
.matches-hero {
  border: 1px solid var(--border);
  border-radius: 28px 8px 8px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.inventory-layout__visual {
  position: sticky;
  top: 24px;
  height: min(820px, calc(100vh - 120px));
  min-height: 620px;
  margin: 0;
  overflow: hidden;
  background: var(--panel-soft);
}

.inventory-layout__visual img,
.matches-hero__visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.matches-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.62fr);
  min-height: 300px;
  margin-bottom: 22px;
  overflow: hidden;
}

.matches-hero__copy {
  display: flex;
  align-items: center;
  padding: 26px 34px;
}

.matches-hero__copy .page-heading {
  width: 100%;
  margin: 0;
  align-items: center;
}

.matches-hero__visual {
  position: relative;
  min-height: 300px;
  margin: 0;
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: var(--panel-soft);
}

.inventory-layout__visual::after,
.matches-hero__visual::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--text) 20%, transparent));
}

.inventory-layout__visual img {
  min-height: 620px;
}

[data-theme="dark"] .inventory-layout__visual,
[data-theme="dark"] .matches-hero {
  border-radius: 20px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  min-height: 590px;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(34px, 6vw, 76px);
  color: var(--on-hero);
  background: var(--hero-gradient);
}

.auth-visual::after {
  position: absolute;
  inset: -20% -15%;
  content: "";
  background: repeating-radial-gradient(ellipse at 35% 30%, transparent 0 42px, color-mix(in srgb, var(--on-hero) 7%, transparent) 43px 44px, transparent 45px 82px);
  opacity: 0.55;
  pointer-events: none;
  transform: rotate(-18deg);
}

.auth-visual > * {
  position: relative;
  z-index: 1;
}

.auth-visual h1 {
  max-width: 11ch;
  color: var(--on-hero);
  font-size: clamp(3rem, 5vw, 5.4rem);
  line-height: 0.94;
}

[data-theme="light"] #accountView:not(.is-authenticated) .auth-visual h1 {
  color: #000;
}

.auth-visual__artwork {
  position: absolute !important;
  right: -8%;
  bottom: -4%;
  z-index: 0 !important;
  width: min(58%, 430px);
  margin: 0;
  opacity: 0.96;
  pointer-events: none;
  transform: rotate(4deg);
}

.auth-visual__artwork img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  object-position: right bottom;
  filter: drop-shadow(0 18px 24px rgb(21 19 52 / 18%));
}

h1, h2, h3 {
  font-family: "Fraunces", serif;
  margin: 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.95;
  max-width: 10ch;
}

.lead, .panel p, .result-card__desc, li, label {
  color: var(--muted);
  line-height: 1.5;
}

.lead {
  max-width: 60ch;
  font-size: 1.05rem;
  margin: 18px 0 0;
}

.panel, .result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 20px;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
}

.panel {
  padding: 22px;
}

.onboarding {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 22px;
  border-color: var(--border);
  background: var(--panel-soft);
}

.onboarding__content {
  max-width: 760px;
}

.onboarding h2 {
  margin-bottom: 8px;
}

.onboarding__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
  counter-reset: onboarding-step;
}

.onboarding__steps li {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 20%, transparent);
  counter-increment: onboarding-step;
}

.onboarding__steps li::before {
  content: counter(onboarding-step);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.onboarding__steps span {
  color: var(--muted);
  font-size: 0.92rem;
}

.onboarding__actions,
.yarn-empty-state {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.yarn-empty-state p {
  flex-basis: 100%;
  margin: 8px 0 4px;
}

.auth-panel {
  margin: 0;
  padding: clamp(28px, 4vw, 58px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--panel);
}

.account-view.is-authenticated .auth-layout {
  grid-template-columns: 1fr;
  min-height: 0;
  max-width: 760px;
  margin: 60px auto 0;
}

.account-view.is-authenticated .auth-visual {
  display: none;
}

.auth-panel--recovery {
  border-color: color-mix(in srgb, var(--accent-3) 72%, transparent);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--accent-3) 16%, transparent),
    var(--shadow-strong),
    inset 0 1px 0 color-mix(in srgb, var(--on-accent) 72%, transparent);
  animation: recovery-highlight 1.8s ease-out 2;
  scroll-margin-top: 24px;
}

.auth-form--recovery {
  border-color: color-mix(in srgb, var(--accent-3) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-3) 10%, transparent);
}

@keyframes recovery-highlight {
  0%, 100% {
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--accent-3) 16%, transparent),
      var(--shadow-strong),
      inset 0 1px 0 color-mix(in srgb, var(--on-accent) 72%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 10px color-mix(in srgb, var(--accent-3) 28%, transparent),
      var(--shadow-strong),
      inset 0 1px 0 color-mix(in srgb, var(--on-accent) 72%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .auth-panel--recovery {
    animation: none;
  }
}

.auth-forms {
  display: block;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 28px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-muted);
}

.auth-mode-button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-button[aria-selected="true"] {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.auth-form {
  display: grid;
  gap: 15px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-field input::-ms-reveal,
.password-field input::-ms-clear {
  display: none;
}

.password-reveal {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.password-reveal svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-reveal:hover,
.password-reveal:focus-visible,
.password-reveal[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface-hover);
}
.auth-form > .button {
  width: 100%;
  margin-top: 4px;
}
.auth-form h3 {
  font-size: 1.35rem;
}

.auth-form label,
.auth-field {
  display: grid;
  gap: 5px;
  font-size: 0.86rem;
  font-weight: 600;
}

.field-hint {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 450;
  line-height: 1.4;
}

.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

#loginForm .password-field input {
  height: 44px;
  min-height: 44px;
}

.auth-logged-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.app-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--nav-active);
}

.theme-toggle__icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 1.1rem;
  line-height: 1;
}

.auth-logged-in > * {
  min-width: 0;
}

.auth-user {
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-success);
  color: var(--good);
  font-size: 0.86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

#authProfileSummary {
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

.account-danger-zone {
  display: grid;
  gap: 0.75rem;
  flex-basis: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--danger-border);
  border-radius: 1rem;
  background: var(--surface-danger);
}

.account-danger-zone h3,
.account-danger-zone p {
  margin: 0;
}

.account-danger-zone .button--danger {
  justify-self: start;
}

.account-security-zone {
  display: grid;
  flex-basis: 100%;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
}

.account-security-zone__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-security-zone h3,
.account-security-zone p {
  margin: 0;
}

.account-security-zone__panel {
  display: grid;
  gap: 0.75rem;
}

.account-security-zone__panel > .button {
  justify-self: start;
}

.auth-profile__name,
.auth-profile__email {
  display: block;
}

.auth-profile__email {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-message {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 0.9rem;
}

.auth-message[data-kind="success"] {
  color: var(--good);
}

.auth-message[data-kind="error"] {
  color: var(--accent);
}

.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel__header h2 {
  font-size: 1.7rem;
  margin-bottom: 4px;
}

.button {
  border: 0;
  min-height: 44px;
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-strong);
}

.button--ghost {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: none;
}

.button--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-border);
  box-shadow: none;
}

.button:disabled,
.app-nav__button:disabled {
  border-color: var(--border);
  background: var(--disabled-bg);
  color: var(--disabled-text);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.76;
}

.yarn-list, .results {
  display: grid;
  gap: 16px;
}

.yarn-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--panel);
}

.yarn-card__summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.yarn-card__swatch {
  width: 42px;
  height: 42px;
  border: 6px double var(--accent-2);
  border-radius: 50%;
  background: var(--panel-soft);
}

.yarn-card__identity {
  min-width: 0;
}

.yarn-card__identity h3 {
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  unicode-bidi: plaintext;
}

.yarn-card__identity p {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.yarn-card[data-saved="true"][data-editing="false"] .yarn-card__form {
  display: none;
}

.yarn-card[data-saved="false"] .yarn-card__summary,
.yarn-card[data-editing="true"] .yarn-card__summary {
  display: none;
}

.yarn-card__form {
  padding: 4px;
}

.yarn-card__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.yarn-card__row:last-child {
  margin-bottom: 0;
  grid-template-columns: 1fr 1fr auto;
}

.material-picker-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.92rem;
}

.material-picker-field legend {
  margin-bottom: 6px;
  padding: 0;
}

.material-picker {
  position: relative;
}

.material-picker summary {
  min-height: 47px;
  padding: 12px 38px 12px 13px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  cursor: pointer;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-picker summary::-webkit-details-marker {
  display: none;
}

.material-picker summary::after {
  position: absolute;
  top: 15px;
  right: 15px;
  content: "⌄";
  transition: transform 160ms ease;
}

.material-picker[open] summary::after {
  transform: rotate(180deg);
}

.material-picker summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 24%, transparent);
  outline-offset: 2px;
}

.material-picker--invalid summary {
  border-color: var(--danger);
}

.material-picker__options {
  position: absolute;
  z-index: 4;
  top: calc(100% + 6px);
  left: 0;
  width: min(390px, 100%);
  max-height: 280px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-strong);
}

.material-picker__option {
  display: flex;
  grid-template-columns: none;
  gap: 9px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.material-picker__option:hover {
  background: var(--surface-hover);
}

.material-picker__option input {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.field-hint,
.field-error {
  margin: 5px 0 0;
  font-size: 0.8rem;
}

.field-hint {
  color: var(--muted);
}

.field-error {
  color: var(--danger);
}

.yarn-save {
  background: var(--good);
}

.yarn-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 13px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.summary {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.summary strong {
  color: var(--text);
}

.auth-form--recovery {
  max-width: 520px;
  margin-top: 18px;
}

.auth-form--recovery p {
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--accent-3);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.storage-message {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-size: 0.86rem;
}

.storage-message p {
  margin: 0;
}

.storage-message__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.storage-message[data-kind="success"] {
  color: var(--good);
}

.storage-message[data-kind="error"] {
  color: var(--accent);
}

.storage-message[data-kind="warning"] {
  color: var(--warning);
}

.result-card {
  padding: 18px;
}

.result-card__top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 10px;
}

.result-card__meta {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

.match-variants {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.match-section-title,
.match-diagnostics > h3 {
  margin: 0;
}

.match-diagnostics {
  display: grid;
  gap: 1rem;
}

.diagnostic-card h4 {
  margin: 0;
  font-size: 1.05rem;
}

.diagnostic-reasons {
  margin: 0;
  padding-left: 1.25rem;
}

.result-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.match-variant {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 46%, transparent);
  overflow: hidden;
}

.match-variant summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
  list-style-position: inside;
}

.match-variant summary::marker {
  color: var(--accent);
}

.match-variant__score {
  color: var(--good);
  font-weight: 800;
}

.match-variant__meta {
  margin: 0;
  padding: 0 14px;
  font-size: 0.9rem;
}

.match-variant .requirements {
  margin: 8px 14px 14px;
}

.score-pill {
  white-space: nowrap;
  background: var(--surface-success);
  color: var(--good);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.requirements {
  margin: 12px 0 0;
  padding-left: 18px;
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 64%, transparent);
  border: 1px dashed var(--border-active);
}

.empty-state__text {
  margin: 0;
}

.empty-state__action {
  margin-top: 14px;
}

.empty-state[data-kind="loading"] {
  border-color: var(--border);
  background: var(--panel-soft);
}

.empty-state[data-kind="error"] {
  border-style: solid;
  border-color: var(--danger-border);
  background: var(--surface-danger);
  color: var(--danger);
}

.empty-state[data-kind="warning"] {
  border-style: solid;
  border-color: var(--warning);
  background: var(--surface-warning);
  color: var(--warning);
}

.catalog-panel {
  margin-top: 10px;
}

.catalog-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  gap: 24px 32px;
  align-items: end;
  margin-bottom: 18px;
}

.catalog-header__copy {
  min-width: 0;
}

.catalog-header__visual {
  min-height: 190px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-soft);
  box-shadow: var(--shadow);
}

.catalog-header__visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 190px;
  padding: 10px;
  object-fit: contain;
  object-position: center;
}

.catalog-header p:not(.eyebrow) {
  max-width: 66ch;
  margin-bottom: 0;
}

.catalog-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(200px, 1.35fr) repeat(5, minmax(130px, 0.75fr));
  gap: 12px;
}

.catalog-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.catalog-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.catalog-notice {
  margin-bottom: 16px;
}

.catalog-notice[hidden] {
  display: none;
}

.pattern-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.catalog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.catalog-actions[hidden] {
  display: none;
}

.pattern-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pattern-card--skeleton {
  min-height: 255px;
  justify-content: flex-start;
  gap: 15px;
  pointer-events: none;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: var(--skeleton-gradient);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}

.skeleton-line--short {
  width: 36%;
  height: 10px;
}

.skeleton-line--title {
  width: 72%;
  height: 27px;
}

.skeleton-line--medium {
  width: 58%;
}

@keyframes skeleton-shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
}

.pattern-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.pattern-card__top h3 {
  font-size: 1.35rem;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  word-break: break-word;
}

.result-card h3,
.match-variant summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

.pattern-card__kicker {
  margin: 0 0 4px;
  color: var(--accent-3);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pattern-card__description {
  flex: 1;
  margin: 14px 0;
  color: var(--muted);
  line-height: 1.5;
}

.pattern-card__details {
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.pattern-card__details summary {
  min-height: 44px;
  padding: 13px 0 9px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 750;
  cursor: pointer;
}

.pattern-card__details-body {
  padding: 2px 0 4px;
}

.pattern-card__facts {
  padding-top: 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--surface-success);
  color: var(--good);
  font-size: 0.72rem;
  font-weight: 700;
}

.status-pill--review {
  background: var(--surface-warning);
  color: var(--warning);
}

.material-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.material-tag {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--panel-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.pattern-card__yarns {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 0.82rem;
}

body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  pointer-events: none;
  background: var(--texture);
  z-index: -1;
}

@media (max-width: 960px) {
  .auth-layout, .catalog-header, .matches-hero {
    grid-template-columns: 1fr;
  }

  .inventory-layout {
    grid-template-columns: 1fr;
  }

  .inventory-layout__visual,
  .matches-hero__visual {
    position: relative;
    top: auto;
    height: 380px;
    min-height: 380px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .inventory-layout__visual img,
  .matches-hero__visual img {
    min-height: 380px;
    max-height: 480px;
  }

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

  .auth-visual {
    min-height: 390px;
  }

  .catalog-header {
    grid-template-columns: 1fr;
  }

  .catalog-header__visual {
    min-height: 240px;
  }

  .catalog-header__visual img {
    min-height: 240px;
  }

  .auth-forms {
    grid-template-columns: 1fr;
  }

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

  .app-header__inner {
    gap: 12px;
  }

  .app-nav__button {
    padding-inline: 10px;
  }

}

@media (max-width: 640px) {
  body {
    padding-bottom: 78px;
  }

  .app-header {
    background: var(--header-bg);
    backdrop-filter: none;
  }

  .network-status {
    top: 62px;
    padding-inline: 14px;
  }

  .auth-logged-in {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-logged-in .button {
    align-self: flex-start;
  }

  .shell {
    padding: 22px 14px 36px;
  }

  .matches-hero__copy {
    padding: 26px 22px;
  }

  .matches-hero__copy .page-heading {
    gap: 18px;
  }

  .inventory-layout__visual,
  .inventory-layout__visual img,
  .matches-hero__visual,
  .matches-hero__visual img {
    height: 300px;
    min-height: 300px;
  }

  .app-header__inner {
    grid-template-columns: 1fr auto;
    min-height: 62px;
    padding-inline: 14px;
  }

  .app-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 9;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(16px);
  }

  .app-nav__button {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 52px;
    border-radius: 12px;
    padding: 6px 3px;
    font-size: 0.7rem;
  }

  .auth-logged-out .app-nav {
    display: none;
  }

  .header-user {
    max-width: 14ch;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    margin-top: 2px;
  }

  .page-heading h1,
  .catalog-header h1 {
    font-size: clamp(2.25rem, 13vw, 3.35rem);
  }

  .auth-visual {
    min-height: 300px;
    padding: 34px 26px;
  }

  .auth-visual__artwork {
    right: -14%;
    width: 58%;
    opacity: 0.82;
  }

  .auth-visual__artwork img {
    max-height: 260px;
  }

  .auth-panel {
    padding: 28px 22px;
  }

  .panel__header, .result-card__top, .yarn-card__row:last-child {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .panel {
    padding: 18px;
  }

  .yarn-card {
    padding: 14px;
  }

  .yarn-card__summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .yarn-card__summary > .yarn-card__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 4px;
  }

  .yarn-card__row {
    grid-template-columns: 1fr;
  }

  .pattern-card__top {
    flex-direction: column-reverse;
  }

  .pattern-card__top h3 {
    font-size: 1.2rem;
  }

  .catalog-controls, .pattern-catalog {
    grid-template-columns: 1fr;
  }

  .catalog-summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .catalog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .onboarding__steps {
    grid-template-columns: 1fr;
  }

  .account-view.is-authenticated .auth-layout {
    margin-top: 18px;
  }
}

.legal-shell {
  width: min(100% - 40px, 980px);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 0 80px;
}

.legal-document {
  min-width: 0;
  padding: clamp(24px, 5vw, 56px);
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.legal-title {
  max-width: none;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
}

.legal-meta {
  display: grid;
  gap: 4px;
  margin: 22px 0 28px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
}

.legal-meta p,
.legal-paragraph,
.legal-notice,
.legal-copyright {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.legal-meta__version {
  color: var(--text) !important;
  font-weight: 750;
}

.legal-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-soft);
}

.legal-toc a,
.legal-actions a,
.legal-document a,
.app-footer a {
  color: var(--accent-3);
  font-weight: 700;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.18em;
}

.legal-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.legal-shell a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.legal-section {
  scroll-margin-top: 92px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  break-inside: avoid;
}

.legal-section__title {
  margin-bottom: 14px;
  color: var(--text);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.legal-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-left: 1.35rem;
}

.legal-list__item {
  color: var(--muted);
  line-height: 1.6;
}

.legal-notice {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  background: var(--panel-soft);
}

.legal-copyright {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.legal-actions {
  margin: 24px 0 0;
  text-align: center;
}

.legal-acceptance-gate {
  flex-basis: 100%;
  width: 100%;
  padding: 20px;
  border: 1px solid var(--border-active);
  border-radius: 16px;
  background: var(--panel-soft);
}

.legal-acceptance-gate h3 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.legal-acceptance-gate > p {
  margin: 8px 0;
}

.legal-consent {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.legal-consent__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  color: var(--text);
  font-weight: 650;
  line-height: 1.45;
}

.legal-consent__checkbox input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent-3);
}

.legal-consent__checkbox:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 4px;
}

.legal-consent .button {
  width: 100%;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 20px 36px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 640px) {
  .legal-shell {
    width: min(100% - 28px, 980px);
    padding: 22px 0 48px;
  }

  .legal-document {
    padding: 24px 18px;
    border-radius: 18px;
  }

  .legal-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .legal-toc a {
    border-radius: 12px;
  }

  .legal-section {
    padding: 22px 0;
  }

  .legal-acceptance-gate {
    padding: 16px;
  }

  .app-footer {
    padding-inline: 14px;
  }
}

@media print {
  .app-header,
  .legal-actions,
  .app-footer,
  .skip-link,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .legal-shell {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .legal-document {
    border: 0;
    box-shadow: none;
    background: #fff;
    color: #000;
  }

  .legal-meta,
  .legal-toc,
  .legal-notice {
    border-color: #000;
    background: #fff;
  }

  .legal-document a,
  .legal-meta p,
  .legal-paragraph,
  .legal-notice,
  .legal-list__item,
  .legal-copyright {
    color: #000;
  }

  .legal-section {
    break-inside: avoid;
  }
}

.idle-session-warning {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: 0 16px 40px rgb(0 0 0 / 16%);
}

.idle-session-warning p { margin: 0; }

@media (max-width: 640px) {
  .idle-session-warning {
    right: 16px;
    bottom: 16px;
    left: 16px;
    flex-direction: column;
    align-items: stretch;
  }
}

[data-theme="light"] .app-header {
  border-bottom: 4px solid #a88be8;
}

[data-theme="light"] .brand-mark {
  background: #e94f4b;
}

[data-theme="light"] #inventoryView .inventory-heading,
[data-theme="light"] #inventoryView .inventory-panel,
[data-theme="light"] #inventoryView .inventory-stat {
  background: #fffdf8;
}

[data-theme="dark"] .app-header {
  border-bottom-color: #30253b;
  background: rgba(8, 12, 23, 0.94);
}

[data-theme="dark"] .brand-mark {
  color: #f2c96b;
  background: #24162d;
  border: 1px solid #795b35;
}

[data-theme="dark"] #inventoryView .inventory-heading,
[data-theme="dark"] #inventoryView .inventory-panel,
[data-theme="dark"] #inventoryView .inventory-stat {
  background: #101524;
}

[data-theme="dark"] #inventoryView .inventory-heading,
[data-theme="dark"] #inventoryView .inventory-panel,
[data-theme="dark"] #inventoryView .inventory-stat,
[data-theme="dark"] #inventoryView .inventory-layout__visual {
  border-radius: 20px;
}

[data-theme="dark"] #inventoryView h1,
[data-theme="dark"] #inventoryView h2,
[data-theme="dark"] #matchesView h1,
[data-theme="dark"] #matchesView h2 {
  font-family: "Fraunces", serif;
}

[data-theme="dark"] #inventoryView .inventory-stat strong {
  color: #e2ba68;
}

[data-theme="dark"] #inventoryView .button:not(.button--ghost),
[data-theme="dark"] #inventoryView #inventoryMatchBtn {
  background: #c39a4b;
  color: #090d18;
  box-shadow: 0 0 0 1px #e1be72, 0 14px 34px rgb(195 154 75 / 16%);
}

[data-theme="dark"] #inventoryView .inventory-layout__visual,
[data-theme="dark"] #matchesView .matches-hero {
  box-shadow: 0 18px 50px rgb(0 0 0 / 24%);
}

/* Żywa pracownia: panoramiczne widoki Magazynu i Dopasowania. */
#inventoryView .inventory-layout {
  display: grid;
  grid-template: none / minmax(0, 1fr);
  gap: 22px;
}

#inventoryView .inventory-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  min-width: 0;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px 8px 8px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#inventoryView .inventory-heading {
  display: grid;
  grid-area: auto;
  align-content: center;
  align-items: start;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: clamp(30px, 4vw, 52px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#inventoryView .inventory-heading__actions {
  align-items: stretch;
  margin-top: 2px;
}

#inventoryView .inventory-heading__actions .button {
  min-height: 44px;
}

#inventoryView .inventory-layout__visual {
  grid-area: auto;
  position: relative;
  top: auto;
  width: 100%;
  height: 100%;
  min-height: 330px;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

#inventoryView .inventory-layout__visual img {
  width: 100%;
  height: 100%;
  min-height: 330px;
  object-fit: cover;
  object-position: 72% center;
}

#inventoryView .inventory-layout__content {
  display: grid;
  min-width: 0;
  gap: 22px;
}

#inventoryView .inventory-layout__content > #onboarding,
#inventoryView .inventory-stats,
#inventoryView .inventory-stock {
  grid-area: auto;
}

#inventoryView .inventory-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#inventoryView .inventory-stat {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 116px;
  gap: 4px;
  padding: 18px clamp(16px, 2.4vw, 28px);
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#inventoryView .inventory-stat:first-child {
  border-left: 0;
}

#inventoryView .inventory-stat strong {
  color: var(--accent);
  font: 700 clamp(1.8rem, 3vw, 2.55rem) / 1 "Fraunces", serif;
  font-variant-numeric: tabular-nums;
}

#inventoryView .inventory-panel {
  min-width: 0;
  border-radius: 8px 28px 28px 28px;
}

#inventoryView .yarn-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}

#inventoryView .yarn-card {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#matchesView .matches-hero {
  grid-template-columns: minmax(0, 0.8fr) minmax(420px, 1.2fr);
  min-width: 0;
  min-height: 300px;
  border-radius: 28px 8px 8px 8px;
}

#matchesView .matches-hero__copy {
  min-width: 0;
  padding: clamp(30px, 4vw, 52px);
}

#matchesView .matches-hero__copy .page-heading {
  align-items: flex-start;
  flex-direction: column;
}

#matchesView .matches-hero__visual,
#matchesView .matches-hero__visual img {
  min-width: 0;
  min-height: 300px;
}

#matchesView .matches-hero__visual img {
  object-fit: cover;
  object-position: 72% center;
}

#matchesView .matches-workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.72fr) minmax(0, 1.28fr);
  gap: 22px;
  align-items: start;
  min-width: 0;
}

#matchesView .matches-criteria,
#matchesView .matches-results {
  min-width: 0;
}

#matchesView .matches-criteria {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 18px;
  border-radius: 8px 24px 24px 24px;
}

#matchesView .matches-criteria > .button {
  width: 100%;
  min-height: 44px;
}

#matchesView .matches-criteria .summary {
  margin: 0;
}

#matchesView .matches-results {
  border-radius: 24px 8px 24px 24px;
}

#matchesView .matches-results > .panel__header {
  margin-bottom: 18px;
}

#matchesView .result-card {
  box-shadow: none;
}

[data-theme="dark"] #inventoryView .inventory-hero,
[data-theme="dark"] #inventoryView .inventory-stats,
[data-theme="dark"] #inventoryView .inventory-panel,
[data-theme="dark"] #matchesView .matches-hero,
[data-theme="dark"] #matchesView .matches-criteria,
[data-theme="dark"] #matchesView .matches-results {
  border-radius: 20px;
}

[data-theme="dark"] #inventoryView .inventory-heading,
[data-theme="dark"] #inventoryView .inventory-stat {
  background: transparent;
}

[data-theme="dark"] #inventoryView .inventory-stat strong {
  color: var(--accent-2);
}

[data-theme="dark"] #inventoryView .button:not(.button--ghost),
[data-theme="dark"] #matchesView .button:not(.button--ghost) {
  color: var(--on-accent);
  background: var(--accent-2);
}

[data-theme="dark"] #inventoryView .inventory-layout__visual,
[data-theme="dark"] #matchesView .matches-hero__visual {
  background: none;
}

[data-theme="dark"] #inventoryView .inventory-layout__visual img,
[data-theme="dark"] #matchesView .matches-hero__visual img {
  opacity: 1;
}

[data-theme="dark"] #inventoryView .inventory-layout__visual::after,
[data-theme="dark"] #matchesView .matches-hero__visual::after {
  background: none;
}

@media (max-width: 768px) {
  #inventoryView .inventory-hero,
  #matchesView .matches-hero,
  #matchesView .matches-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  #inventoryView .inventory-hero,
  #matchesView .matches-hero {
    border-radius: 24px;
  }

  #inventoryView .inventory-heading,
  #matchesView .matches-hero__copy {
    padding: 30px 24px;
  }

  #inventoryView .inventory-layout__visual,
  #inventoryView .inventory-layout__visual img,
  #matchesView .matches-hero__visual,
  #matchesView .matches-hero__visual img {
    height: 260px;
    min-height: 260px;
  }

  #inventoryView .inventory-layout__visual,
  #matchesView .matches-hero__visual {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  #inventoryView .inventory-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #inventoryView .inventory-stat:nth-child(odd) {
    border-left: 0;
  }

  #inventoryView .inventory-stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  #inventoryView .yarn-list {
    grid-template-columns: minmax(0, 1fr);
  }

  #matchesView .matches-criteria {
    position: static;
  }
}

@media (max-width: 420px) {
  #inventoryView .inventory-heading__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  #inventoryView .inventory-layout__visual,
  #inventoryView .inventory-layout__visual img,
  #matchesView .matches-hero__visual,
  #matchesView .matches-hero__visual img {
    height: 220px;
    min-height: 220px;
    object-position: 74% center;
  }

  #inventoryView .inventory-stat {
    min-height: 104px;
    padding: 14px;
  }
}

/* Żywa pracownia: panoramiczny Katalog i krótsza droga do Konta. */
#catalogView .catalog-panel {
  display: grid;
  gap: 22px;
  margin-top: 0;
  overflow: visible;
}

#catalogView .catalog-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(420px, 1.18fr);
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px 8px 8px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#catalogView .catalog-hero__copy {
  display: grid;
  align-content: center;
  align-items: start;
  min-width: 0;
  padding: clamp(30px, 4vw, 52px);
}

#catalogView .catalog-theme-visual {
  min-width: 0;
  height: 100%;
  min-height: 300px;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
}

#catalogView .catalog-theme-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  object-position: 72% center;
}

#catalogView .catalog-workspace {
  min-width: 0;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--border);
  border-radius: 8px 28px 28px 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#catalogView .catalog-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

#catalogView .catalog-search {
  max-width: 720px;
}

#catalogView .catalog-secondary-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

#catalogView .catalog-secondary-filters[hidden] {
  display: none;
}

#catalogView .catalog-filters-toggle {
  display: none;
}

#catalogView .catalog-summary-row {
  margin-top: 20px;
}

[data-theme="dark"] #catalogView .catalog-hero,
[data-theme="dark"] #catalogView .catalog-workspace {
  border-radius: 20px;
}

[data-theme="dark"] #catalogView .button:not(.button--ghost) {
  color: var(--on-accent);
  background: var(--accent-2);
}

.auth-visual > .auth-visual__image {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% center;
  opacity: 0.28;
  pointer-events: none;
}

#accountView:not(.is-authenticated) .auth-visual > .auth-visual__image {
  opacity: 1;
}

[data-theme="dark"] #accountView:not(.is-authenticated) .auth-visual,
[data-theme="dark"] #accountView:not(.is-authenticated) .auth-visual h1 {
  color: var(--on-hero);
}
#accountView.is-authenticated .auth-layout {
  display: grid;
  grid-template-columns: 1fr;
  width: auto;
  min-height: 0;
  max-width: 760px;
  margin: 60px auto 0;
}

#accountView.is-authenticated .auth-visual {
  display: none;
}

#accountView.is-authenticated .auth-panel {
  width: auto;
  min-height: 0;
  padding: 34px;
  background: var(--panel);
}

#accountView.is-authenticated .auth-logged-in {
  position: static;
  z-index: auto;
  display: flex;
  grid-template-columns: none;
  max-width: none;
  margin: 0;
  padding: 0;
}

#accountView .account-danger-zone {
  flex-basis: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--surface-danger);
  box-shadow: none;
  backdrop-filter: none;
}

@media (max-width: 960px) {
  #catalogView .catalog-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  #catalogView .catalog-theme-visual {
    min-height: 230px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  #catalogView .catalog-secondary-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #catalogView .catalog-hero {
    min-height: 0;
    border-radius: 24px;
  }

  #catalogView .catalog-hero__copy {
    padding: 26px 22px;
  }

  #catalogView .catalog-theme-visual,
  #catalogView .catalog-theme-visual img {
    height: 190px;
    min-height: 190px;
  }

  #catalogView .catalog-workspace {
    padding: 18px;
    border-radius: 24px;
  }

  #catalogView .catalog-filters-toggle {
    display: inline-flex;
    width: 100%;
    justify-content: space-between;
  }

  #catalogView .catalog-secondary-filters {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel-soft);
  }

  #catalogView .catalog-summary-row {
    margin-top: 16px;
  }

  .account-view .auth-layout {
    min-height: 0;
  }

  .account-view .auth-visual {
    min-height: 220px;
    padding: 24px 22px;
  }

  .account-view .auth-visual h1 {
    max-width: 16ch;
    font-size: clamp(2rem, 10vw, 2.75rem);
    line-height: 1;
  }

}

/*
 * Reference fidelity pass — szerokie, spokojne powierzchnie z Designs.
 * Ten blok jest celowo scoped do czterech widoków, aby nie zmieniać
 * komponentów formularzy i logiki aplikacji poza ich kompozycją.
 */
.shell,
.app-header__inner {
  max-width: 1400px;
}

#inventoryView .inventory-hero,
#matchesView .matches-hero,
#catalogView .catalog-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 16px;
  box-shadow: none;
}

#inventoryView .inventory-hero {
  min-height: clamp(390px, 39vw, 540px);
  background: var(--panel);
}

#inventoryView .inventory-heading {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  min-height: clamp(390px, 39vw, 540px);
  max-width: 58%;
  margin: 0;
  padding: clamp(36px, 5vw, 76px);
}

#inventoryView .inventory-heading > div:first-child {
  max-width: 38rem;
  padding: 18px 20px 22px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  backdrop-filter: blur(4px);
}

#inventoryView .inventory-heading__actions {
  align-self: flex-start;
  flex-wrap: wrap;
}

#inventoryView .inventory-layout__visual {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: inherit;
  background: none;
}

#inventoryView .inventory-layout__visual img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: 72% center;
}

#inventoryView .inventory-layout__visual::after,
#matchesView .matches-hero__visual::after,
#catalogView .catalog-theme-visual::after {
  background: none;
}

#inventoryView .inventory-layout__content {
  gap: 24px;
}

#inventoryView .inventory-stats,
#inventoryView .inventory-panel,
#matchesView .matches-criteria,
#matchesView .matches-results,
#catalogView .catalog-workspace {
  border-radius: 16px;
  box-shadow: none;
}

#matchesView .matches-hero {
  display: block;
  min-height: clamp(360px, 36vw, 500px);
  margin-bottom: 24px;
  background: var(--panel);
}

#matchesView .matches-hero__copy {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  width: 54%;
  min-height: clamp(360px, 36vw, 500px);
  padding: clamp(36px, 5vw, 76px);
}

#matchesView .matches-hero__copy .page-heading {
  align-items: flex-start;
}

#matchesView .matches-hero__visual {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
  border: 0;
  background: none;
}

#matchesView .matches-hero__visual img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: 72% center;
}

#matchesView .matches-workspace {
  gap: 24px;
}

#catalogView .catalog-panel {
  box-shadow: none;
}

#catalogView .catalog-hero {
  display: block;
  min-height: clamp(360px, 36vw, 500px);
  background: var(--panel);
  box-shadow: none;
}

#catalogView .catalog-hero__copy {
  position: relative;
  z-index: 2;
  width: 54%;
  min-height: clamp(360px, 36vw, 500px);
  padding: clamp(36px, 5vw, 76px);
}

#catalogView .catalog-theme-visual {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
  border: 0;
  background: none;
}

#catalogView .catalog-theme-visual img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: 72% center;
  opacity: 1;
}

#accountView.is-authenticated .auth-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  max-width: none;
  min-height: 560px;
  margin: 0 0 22px;
  border-radius: 16px;
  box-shadow: none;
}

#accountView.is-authenticated .auth-visual {
  display: flex;
  min-height: 560px;
}

#accountView.is-authenticated .auth-panel {
  min-height: 560px;
  border-left: 1px solid var(--border);
  border-radius: 0;
}

@media (max-width: 768px) {
  #inventoryView .inventory-hero,
  #matchesView .matches-hero,
  #catalogView .catalog-hero {
    min-height: 0;
    border-radius: 14px;
  }

  #inventoryView .inventory-heading,
  #matchesView .matches-hero__copy,
  #catalogView .catalog-hero__copy {
    width: 100%;
    max-width: none;
    min-height: 340px;
    padding: 28px 22px;
  }

  #inventoryView .inventory-heading > div:first-child {
    max-width: 100%;
  }

  #inventoryView .inventory-layout__visual,
  #matchesView .matches-hero__visual,
  #catalogView .catalog-theme-visual {
    min-height: 340px;
  }

  #accountView.is-authenticated .auth-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  #accountView.is-authenticated .auth-visual {
    min-height: 330px;
  }

  #accountView.is-authenticated .auth-panel {
    min-height: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
    border-radius: 0 0 14px 14px;
  }
}

@media (max-width: 420px) {
  .shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  #inventoryView .inventory-heading,
  #matchesView .matches-hero__copy,
  #catalogView .catalog-hero__copy {
    min-height: 300px;
    padding: 24px 18px;
  }

  #inventoryView .inventory-layout__visual,
  #matchesView .matches-hero__visual,
  #catalogView .catalog-theme-visual {
    min-height: 300px;
  }
}

/* Hero copy and typography alignment — final overrides after reference surfaces. */
#inventoryView .inventory-heading h1,
#matchesView .matches-hero__copy h1,
#catalogView .catalog-hero__copy h1 {
  font-family: "Fraunces", serif;
  text-shadow: 0 2px 18px color-mix(in srgb, var(--bg) 42%, transparent);
}

[data-theme="light"] #inventoryView .inventory-heading,
[data-theme="light"] #inventoryView .inventory-heading > div:first-child,
[data-theme="dark"] #inventoryView .inventory-heading,
[data-theme="dark"] #inventoryView .inventory-heading > div:first-child {
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}

#inventoryView .inventory-layout__visual img {
  object-position: 58% center;
}

/* Inventory hero alignment — mirror the shared Dopasowanie/Katalog rhythm. */
#inventoryView .inventory-hero {
  min-height: clamp(360px, 36vw, 500px);
}

#inventoryView .inventory-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: clamp(360px, 36vw, 500px);
  max-width: 54%;
  padding: clamp(36px, 5vw, 76px);
}

#inventoryView .inventory-heading > div:first-child {
  max-width: 100%;
  padding: 0;
  transform: translate(24px, 28px);
}

#inventoryView .inventory-heading__actions {
  display: flex;
  align-self: flex-start;
  gap: 12px;
  max-width: 100%;
  margin-top: 30px;
  margin-left: 24px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  #inventoryView .inventory-hero {
    min-height: 0;
  }

  #inventoryView .inventory-heading {
    width: 100%;
    max-width: none;
    min-height: 340px;
    padding: 28px 22px;
  }

  #inventoryView .inventory-heading > div:first-child {
    max-width: calc(100% - 8px);
    transform: translate(8px, 10px);
  }

  #inventoryView .inventory-heading__actions {
    max-width: calc(100% - 8px);
    margin-top: 24px;
    margin-left: 8px;
  }
}

@media (max-width: 420px) {
  #inventoryView .inventory-heading {
    min-height: 300px;
    padding: 24px 18px;
  }
}

/* Compact, self-contained account controls after authentication. */
.app-header__actions > #themeToggle {
  order: 0;
}

.app-header__actions > #headerAuthAction {
  order: 1;
}

.header-auth-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: var(--panel);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.header-auth-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--nav-active);
}

.header-auth-action:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

#accountView.is-authenticated .auth-layout {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 680px);
  min-height: 0;
  margin: 0 auto 22px;
  border-radius: 16px;
}

#accountView.is-authenticated .auth-visual {
  display: none;
}

#accountView.is-authenticated .auth-panel {
  min-height: 0;
  padding: clamp(24px, 4vw, 36px);
  border: 0;
  border-radius: 16px;
}

#accountView.is-authenticated .auth-panel .panel__header .eyebrow {
  display: none;
}

#accountView.is-authenticated .auth-logged-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

#accountView.is-authenticated .account-security-zone {
  grid-column: 1 / -1;
}

#accountView.is-authenticated #authProfileSummary {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#accountView.is-authenticated .account-danger-disclosure {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  background: var(--surface-danger);
}

#accountView.is-authenticated .account-danger-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

#accountView.is-authenticated .account-danger-disclosure__title {
  flex: 0 0 auto;
}

#accountView.is-authenticated .account-danger-disclosure__warning {
  margin-right: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

#accountView.is-authenticated .account-danger-disclosure summary::-webkit-details-marker {
  display: none;
}

#accountView.is-authenticated .account-danger-disclosure summary::after {
  content: "+";
  font-size: 1.25rem;
  line-height: 1;
}

#accountView.is-authenticated .account-danger-disclosure[open] summary {
  border-bottom: 1px solid var(--danger-border);
}

#accountView.is-authenticated .account-danger-disclosure[open] summary::after {
  content: "−";
}

#accountView.is-authenticated .account-danger-disclosure summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

#accountView.is-authenticated .account-danger-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-danger) 82%, var(--panel));
  color: var(--text);
}

#accountView.is-authenticated .account-danger-zone .button--danger {
  min-height: 44px;
}

@media (max-width: 640px) {
  #accountView.is-authenticated .auth-layout {
    width: 100%;
    margin-bottom: 18px;
  }

  #accountView.is-authenticated .auth-panel {
    padding: 22px 18px;
    border-radius: 14px;
  }

  #accountView.is-authenticated .auth-logged-in {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  #accountView.is-authenticated #logoutBtn {
    width: 100%;
  }

  #accountView.is-authenticated .account-danger-zone .button--danger {
    width: 100%;
  }
}

/* New staging features retain the production theme. */
.yarn-save-hint {
  margin: 0 0 8px;
  max-width: 34rem;
  font-size: 0.88rem;
}

.match-freshness {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
}

#matchesView .active-project {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 12px;
  background: var(--panel);
}

#matchesView .active-project[hidden] {
  display: none;
}

#matchesView .active-project__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

#matchesView .active-project__yarns {
  display: grid;
  gap: 0.25rem;
  padding-left: 1.1rem;
}

#matchesView .active-project__progress {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

#matchesView .active-project__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

#matchesView .active-project__count {
  min-width: 2.5ch;
  text-align: center;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

#matchesView .active-project__fields {
  display: grid;
  gap: 0.5rem;
}

#matchesView .active-project__field {
  display: grid;
  gap: 0.2rem;
  font-size: 0.9rem;
}

@media (min-width: 641px) {
  #matchesView .active-project__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#matchesView .match-variant__start {
  justify-self: start;
  margin-top: 0.5rem;
}

.pattern-add-panel {
  margin: 12px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel, var(--surface));
}

.pattern-add-panel h2 {
  margin: 0 0 6px;
}

.pattern-requirements {
  margin: 4px 0 12px;
}

.pattern-requirements h3 {
  margin: 8px 0 4px;
}

.pattern-role-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.pattern-role-row__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pattern-role-row__options {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.pattern-role-row__options fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.92rem;
}

.pattern-inline-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 10px;
  white-space: nowrap;
}

@media (min-width: 641px) {
  .pattern-role-row__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
