:root {
  --bg: #f2f2ef;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.16);
  --text: #121212;
  --muted: #707070;
  --accent: #111111;
  --danger: #b42318;
  --success: #0f766e;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(17, 24, 39, 0.04), transparent 26%),
    radial-gradient(circle at bottom right, rgba(17, 24, 39, 0.03), transparent 24%),
    linear-gradient(180deg, #f8f8f5, var(--bg));
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 28px;
  background: rgba(248, 248, 245, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.topbar__left,
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar__form {
  display: inline-flex;
}

.topbar__actions {
  margin-left: auto;
  justify-content: flex-end;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 20px;
}

.nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.nav a,
.nav button {
  font-size: 13px;
  color: #3e3e3e;
  text-transform: uppercase;
}

.nav .button,
.nav button.button,
.nav .topbar__button,
.nav .account-switch__toggle,
.nav .user-link {
  color: #fff;
}

.wrap {
  width: min(1080px, calc(100% - 52px));
  margin: 0 auto;
  padding: 32px 0 54px;
}

.hero {
  display: grid;
  justify-items: start;
  text-align: left;
  gap: 15px;
  padding: 32px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.66));
  box-shadow: var(--shadow);
}

.hero h1,
.section-title {
  margin: 0;
  font-size: clamp(30px, 5.3vw, 60px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 11ch;
}

.hero--about h1,
.hero--about .section-title {
  font-size: clamp(26px, 4.2vw, 52px);
  letter-spacing: -0.03em;
}

.muted {
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.55;
  font-size: 15px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.card,
.panel,
.auth-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  padding: 18px;
}

.product-card {
  display: grid;
  gap: 14px;
}

.product-card h2,
.product-card p {
  margin: 0;
}

.product-card__media,
.product-view__media {
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.product-card__media {
  aspect-ratio: 4 / 5;
}

.product-card__media img,
.product-view__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-view__media {
  margin-bottom: 18px;
  aspect-ratio: 4 / 3;
}

.price {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

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

.button.secondary,
.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.topbar__button,
.account-switch__toggle,
.user-link {
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.topbar__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-link__icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1.5px solid #fff;
  border-radius: 999px;
  flex: 0 0 18px;
}

.user-link__icon::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 999px;
  background: #fff;
}

.user-link__icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 8px;
  height: 4px;
  margin-left: -4px;
  border: 1.5px solid #fff;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #111;
}

input[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.auth-card {
  width: min(520px, 100%);
  margin: 40px 0 0;
  padding: 30px;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.flash.error {
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--danger);
}

.flash.success {
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--success);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.split {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.24fr) minmax(250px, 0.62fr);
}

.about-split {
  align-items: stretch;
}

.about-placeholder {
  display: grid;
  place-items: center;
  min-height: 520px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.about-placeholder__inner {
  display: grid;
  place-items: center;
  width: min(82%, 420px);
  aspect-ratio: 1 / 1;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  font-size: clamp(52px, 9vw, 110px);
  font-weight: 700;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.home-split {
  align-items: start;
}

.home-profile-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.home-profile-panel--compact {
  align-self: start;
  justify-self: end;
  width: min(100%, 360px);
  margin-right: -84px;
}

.home-profile-panel__header {
  display: grid;
  gap: 4px;
}

.home-profile-panel__header h2,
.account-profile-card h2,
.account-orders-panel h2 {
  margin: 0;
}

.home-profile-panel__block {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.home-profile-panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.home-profile-panel__row a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
}

.home-profile-panel__text,
.home-profile-panel__meta {
  margin: 0;
}

.home-profile-panel__meta {
  font-size: 13px;
}

.mini-list {
  display: grid;
  gap: 6px;
}

.mini-list__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.mini-list__item:first-child {
  border-top: 0;
  padding-top: 0;
}

.mini-list__item--order {
  display: block;
}

.mini-order {
  display: grid;
  gap: 2px;
}

.mini-order__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mini-order__head strong,
.mini-order__head span {
  font-size: 13px;
}

.mini-order__head span {
  font-weight: 700;
}

.mini-order__status,
.mini-order__payment {
  margin: 0;
  line-height: 1.35;
}

.account-shell .panel,
.account-shell .card {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.account-shell .section-title,
.account-shell h2,
.account-shell td,
.account-shell th,
.account-shell strong,
.account-shell p,
.account-shell a,
.account-shell label {
  color: var(--text);
}

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

.account-shell .table th,
.account-shell .table td {
  border-bottom-color: var(--line);
}

.account-shell input,
.account-shell textarea,
.account-shell select {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.account-shell input:focus,
.account-shell textarea:focus,
.account-shell select:focus {
  border-color: #111;
}

.account-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
}

.account-profile-card,
.account-orders-panel {
  padding: 24px;
}

.account-profile-card__head {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.account-switch {
  position: relative;
  width: fit-content;
}

.account-switch__toggle {
  justify-content: center;
  transform: none !important;
}

.account-switch__toggle:hover,
.topbar__button:hover,
.user-link:hover {
  transform: translateY(-1px);
}

.account-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  min-width: calc(100% + 32px);
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 6px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.account-switch.is-open .account-switch__menu,
.account-switch:focus-within .account-switch__menu {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.account-switch__action {
  padding: 0;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

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

.admin-stats {
  gap: 14px;
}

.admin-stat {
  display: grid;
  gap: 10px;
}

.admin-stat strong {
  font-size: 24px;
  line-height: 1;
}

.admin-top-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
}

.admin-status-list {
  display: grid;
  gap: 10px;
}

.admin-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.admin-status-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.admin-product-grid {
  display: grid;
  gap: 16px;
}

.admin-product-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.admin-product-card__media {
  width: 148px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.admin-product-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-product-card__placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
}

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

.admin-section__head h2 {
  margin: 0 0 6px;
}

.admin-product-card__summary {
  display: grid;
  gap: 12px;
}

.admin-product-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-product-card__title {
  display: grid;
  gap: 6px;
}

.admin-product-card__title strong {
  font-size: 18px;
  line-height: 1.1;
}

.admin-product-card__title p {
  margin: 0;
}

.admin-product-card__price {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-product-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-product-card__meta span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
}

.admin-product-card__actions {
  display: flex;
  justify-content: flex-start;
}

.admin-product-card__actions .button,
.admin-product-card__actions button {
  min-width: 156px;
}

.admin-check {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.admin-check input {
  width: 18px;
  height: 18px;
}

.modal__helper {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.text-link {
  padding: 0;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}

.modal.is-open {
  display: block;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.2);
  backdrop-filter: blur(8px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  margin: 8vh auto 0;
  width: min(520px, calc(100% - 28px));
}

.modal__dialog--wide {
  width: min(760px, calc(100% - 28px));
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.admin-modal {
  display: grid;
  gap: 16px;
}

.admin-modal h2 {
  margin: 0;
  padding-right: 36px;
}

.admin-product-form {
  gap: 16px;
}

.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.site-footer {
  padding: 22px 28px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .grid-3,
  .grid-2,
  .grid-4,
  .split,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__left,
  .topbar__actions {
    width: 100%;
  }

  .wrap {
    width: min(100% - 24px, 100%);
    padding: 24px 12px 48px;
  }

  .hero,
  .auth-card,
  .home-profile-panel,
  .account-profile-card,
  .account-orders-panel {
    padding: 24px;
  }

  .home-profile-panel--compact {
    margin-right: 0;
  }

  .about-placeholder {
    min-height: 320px;
  }

  .account-switch {
    width: 100%;
  }

  .account-switch__toggle,
  .topbar__button,
  .user-link {
    width: 100%;
    justify-content: center;
  }

  .site-footer {
    padding: 18px 12px 26px;
  }

  .admin-product-card {
    grid-template-columns: 1fr;
  }

  .product-card {
    gap: 8px;
  }

  .card.product-card {
    padding: 12px;
  }

  .product-card__media {
    margin-bottom: 2px;
  }

  .product-card .meta,
  .product-card .muted {
    font-size: 12px;
    line-height: 1.35;
  }

  .product-card h2 {
    font-size: 18px;
    line-height: 1.02;
    letter-spacing: -0.03em;
  }

  .product-card .price {
    font-size: 16px;
  }

  .admin-product-card__media {
    width: 100%;
  }

  .admin-product-card__head {
    flex-direction: column;
  }

  .admin-product-card__price {
    white-space: normal;
  }

  .admin-section__head {
    flex-direction: column;
  }
}
