:root {
  color-scheme: light;
  --bg: #f3f2ee;
  --surface: #fbfaf7;
  --surface-raised: #ffffff;
  --image-well: #e8e5df;
  --text: #20211f;
  --muted: #73736e;
  --soft: #989790;
  --border: #dcdad3;
  --accent: #80583f;
  --accent-hover: #69452f;
  --accent-contrast: #ffffff;
  --shadow: 0 16px 38px rgb(34 32 28 / 8%);
  --focus: #2f78a5;
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171816;
  --surface: #20221f;
  --surface-raised: #262824;
  --image-well: #292b27;
  --text: #efeee9;
  --muted: #a7a69e;
  --soft: #85857e;
  --border: #383a35;
  --accent: #c99a78;
  --accent-hover: #dfb28f;
  --accent-contrast: #211a15;
  --shadow: 0 18px 44px rgb(0 0 0 / 24%);
  --focus: #7dbde1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select {
  touch-action: manipulation;
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
}

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

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 60px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px) saturate(135%);
}

.brand {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 11px;
  color: var(--text);
}

.brand__mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}

.brand__wordmark {
  display: grid;
  gap: 1px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.brand__wordmark small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.15em;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(10px, 2vw, 22px);
}

.header-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 560;
}

.header-link:hover {
  color: var(--text);
}

.theme-toggle,
.user-chip {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}

.theme-toggle {
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle > span:first-child {
  color: var(--accent);
  font-size: 16px;
}

.logout-form {
  display: inline-flex;
  margin: 0;
}

.site-main {
  width: min(100%, 1600px);
  flex: 1;
  margin-inline: auto;
  padding: clamp(24px, 3.2vw, 44px) clamp(18px, 4vw, 60px) 64px;
}

.site-footer {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(20px, 4vw, 60px);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.catalog-heading {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.4;
}

.catalog-heading h1,
.page-heading h1,
.login-panel h1 {
  margin: 0;
  font-size: clamp(40px, 5.5vw, 68px);
  font-weight: 570;
  letter-spacing: -0.065em;
  line-height: 0.99;
}

.catalog-heading > p:last-child,
.page-heading > p:last-child {
  max-width: 660px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(230px, 2fr) repeat(4, minmax(125px, 1fr)) auto;
  align-items: end;
  gap: 11px;
  margin: 0 0 18px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-field,
.form-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.filter-field label,
.form-field label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-field input,
.filter-field select,
.form-field input,
.price-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--text);
}

.filter-field input::placeholder {
  color: var(--soft);
  opacity: 1;
}

.filter-field input:focus,
.filter-field select:focus,
.form-field input:focus,
.price-input:focus {
  border-color: var(--accent);
}

.filter-actions {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.button--primary:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.filter-actions > a,
.back-link,
.pagination a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 620;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 5px 0 13px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.view-switch__link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 630;
}

.view-switch__link[aria-current="page"] {
  background: var(--text);
  color: var(--bg);
}

.result-count {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 12px;
}

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

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr));
  align-items: start;
  gap: clamp(13px, 1.8vw, 23px);
}

.model-card {
  position: relative;
  min-width: 0;
  padding: 11px 11px 14px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: var(--surface);
  transition: transform 190ms ease, border-color 190ms ease, box-shadow 190ms ease;
}

.model-card:hover {
  z-index: 2;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.model-card__link {
  display: block;
  color: var(--text);
}

.model-card__image {
  display: grid;
  width: 100%;
  aspect-ratio: 1 / 1;
  place-items: center;
  margin-bottom: 14px;
  overflow: visible;
  border-radius: 13px;
  background: var(--image-well);
}

.model-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  transition: transform 220ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

@media (hover: hover) and (pointer: fine) {
  .model-card__link:hover .model-card__image img {
    transform: scale(1.035);
  }
}

.model-card__link > p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.model-card h2 {
  margin: 0 0 9px;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.model-card > p:not(.model-card__prices, .model-card__tags) {
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
}

.model-card__tags {
  min-height: 2px;
  margin: 6px 0;
}

.model-card__prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

table[data-view="table"] {
  min-width: 830px;
}

thead {
  background: var(--surface-raised);
}

thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

td,
th {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

tbody th a {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.table-preview {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--image-well);
}

.table-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-page {
  max-width: 1420px;
  margin: 0 auto;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs a {
  color: var(--accent);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  align-items: start;
  gap: clamp(28px, 5vw, 72px);
}

.detail-media {
  position: sticky;
  top: 102px;
  min-width: 0;
}

.image-zoom {
  position: relative;
  display: block;
  width: 100%;
  padding: clamp(12px, 2vw, 24px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 23px;
  background: var(--image-well);
  cursor: zoom-in;
  text-align: left;
}

.detail-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  transition: transform 220ms ease;
}

.image-zoom:hover .detail-preview {
  transform: scale(1.012);
}

.image-zoom__hint {
  position: absolute;
  right: 17px;
  bottom: 17px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--muted);
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.detail-copy {
  padding-top: 5px;
}

.detail-copy h1 {
  margin: 0 0 17px;
  font-size: clamp(34px, 4.6vw, 62px);
  font-weight: 570;
  letter-spacing: -0.06em;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.detail-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.price-panel {
  margin: 28px 0;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading .eyebrow {
  margin-bottom: 4px;
}

.section-heading h2,
.metadata-block h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 620;
  letter-spacing: -0.03em;
}

.price-note,
.currency-note {
  color: var(--muted);
  font-size: 10px;
}

.detail-prices {
  margin: 16px 0 0;
}

.detail-prices > div {
  display: flex;
  min-height: 47px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
}

.detail-prices dt {
  color: var(--muted);
}

.detail-prices dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.price-unset {
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
}

.currency-note {
  margin: 13px 0 0;
}

.metadata-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.metadata-block h2:not(:first-child) {
  margin-top: 15px;
}

.metadata-block p {
  margin: 0;
}

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

.preview-dialog {
  position: fixed;
  width: min(96vw, 1500px);
  max-width: none;
  max-height: 96vh;
  padding: 18px;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 25px 100px rgb(0 0 0 / 35%);
}

.preview-dialog::backdrop {
  background: rgb(15 15 14 / 78%);
  backdrop-filter: blur(5px);
}

.preview-dialog > img {
  display: block;
  width: 100%;
  max-height: calc(96vh - 36px);
  object-fit: contain;
}

.preview-dialog__close-form {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  margin: 0;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.bulk-price-page {
  max-width: 1440px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  margin-bottom: 28px;
}

.page-heading {
  margin-bottom: 26px;
}

.bulk-price-form {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.price-editor-table {
  min-width: 970px;
}

.price-editor-table th:first-child,
.price-editor-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}

.price-editor-table thead th:first-child {
  z-index: 3;
  background: var(--surface-raised);
}

.price-editor-cell {
  min-width: 165px;
  vertical-align: top;
}

.price-input {
  height: 40px;
  font-variant-numeric: tabular-nums;
}

.clear-price {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.clear-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.bulk-price-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 5px 2px;
  color: var(--muted);
  font-size: 11px;
}

.form-errors,
.field-error,
.errorlist {
  color: #b94c40;
  font-size: 11px;
}

.login-panel {
  width: min(100%, 500px);
  margin: clamp(12px, 5vw, 60px) auto;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 25px;
  font-size: clamp(34px, 5vw, 48px);
}

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

.messages {
  margin-bottom: 18px;
}

.message {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.message--success {
  border-color: color-mix(in srgb, #478762 35%, var(--border));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 1220px) {
  .filter-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-field--search {
    grid-column: span 2;
  }

  .filter-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .header-actions {
    gap: 11px;
  }

  .detail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
    gap: 24px;
  }

  .detail-media {
    top: 90px;
  }
}

@media (max-width: 700px) {
  .site-header {
    position: relative;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding-block: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .site-main {
    padding-top: 30px;
  }

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

  .detail-media {
    position: static;
  }

  .detail-copy {
    max-width: 720px;
  }
}

@media (max-width: 560px) {
  .site-header {
    gap: 7px;
  }

  .brand__mark {
    width: 35px;
    height: 35px;
  }

  .brand__wordmark {
    font-size: 14px;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 5px 13px;
  }

  .header-link {
    min-height: 38px;
    font-size: 12px;
  }

  .theme-toggle,
  .user-chip {
    min-height: 38px;
    padding-inline: 10px;
  }

  .site-main {
    padding-inline: 15px;
  }

  .catalog-heading {
    margin-bottom: 22px;
  }

  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    padding: 12px;
    border-radius: 15px;
  }

  .filter-field--search,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions {
    justify-content: space-between;
  }

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

  .model-card {
    padding: 7px 7px 10px;
    border-radius: 14px;
  }

  .model-card__image {
    margin-bottom: 10px;
    border-radius: 10px;
  }

  .model-card h2 {
    font-size: 13px;
  }

  .model-card__prices {
    gap: 4px;
    font-size: 9px;
  }

  .model-card > p:not(.model-card__prices, .model-card__tags) {
    font-size: 10px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding-block: 15px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .bulk-price-form {
    padding: 8px;
  }

  .bulk-price-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .model-card {
    padding: 10px;
  }
}

@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;
  }
}
