:root {
  color-scheme: light;
  --ink: #202a37;
  --soft-ink: #564f48;
  --paper: #f9f7f3;
  --white: #fffdf9;
  --line: #e4d9ce;
  --clay: #9c4d3a;
  --clay-dark: #743525;
  --clay-light: #f2dfd4;
  --green: #295544;
  --red: #973f32;
  --focus: #ad5740;
  --sans: "Aptos", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.visually-hidden,
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.topbar { background: var(--ink); color: var(--white); }
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 1280px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 32px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 1.06rem;
  font-weight: 710;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.wordmark-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 7px;
  background: #dc9a7b;
  color: #30231e;
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1;
}
.topbar-section {
  border-left: 1px solid #59616a;
  padding-left: 22px;
  color: #e0d9d2;
  font-size: 0.82rem;
}

.button {
  display: inline-flex;
  min-height: 43px;
  padding: 9px 16px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.button-primary { color: #fffaf6; background: var(--clay); }
.button-primary:hover:enabled { background: var(--clay-dark); }
.button-secondary { color: var(--ink); border-color: #d8cbbb; background: var(--white); }
.button-secondary:hover:enabled { background: #f4eee6; border-color: #b4a18f; }
.button-quiet { color: #f6ede7; border-color: #64707a; background: transparent; }
.button-quiet:hover:enabled { background: #354153; }
.logout { margin-left: auto; min-height: 35px; padding: 7px 14px; }
.button-danger { color: var(--red); background: transparent; }
.button-danger:hover:enabled { background: #fae8e4; }
.button-danger-solid { color: #fffaf6; background: var(--red); }
.button-danger-solid:hover:enabled { background: #742e24; }
.plus { font-size: 1.3rem; font-weight: 400; line-height: 0.8; }
.text-button { padding: 0; border: 0; color: var(--clay-dark); background: transparent; font-weight: 650; text-decoration: underline; }

.session-view {
  display: grid;
  min-height: calc(100svh - 64px);
  padding: 38px 24px;
  place-items: center;
  background: radial-gradient(ellipse at 18% 8%, #f3dfd2, transparent 53%), var(--paper);
}
.session-card {
  display: grid;
  grid-template-columns: 26% 1fr;
  overflow: hidden;
  width: min(100%, 615px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 21px 65px rgb(52 36 20 / 9%);
}
.session-card::before {
  content: "";
  background: repeating-linear-gradient(46deg, transparent 0 15px, rgb(242 223 212 / 22%) 15px 16px),
    radial-gradient(ellipse at 28% 22%, #b8674e, #864534 76%);
}
.session-main { min-width: 0; padding: 40px; }
.session-main h1 { font: 500 clamp(1.8rem, 4vw, 2.35rem)/1.04 var(--serif); letter-spacing: -0.04em; }
.session-main > p { margin-top: 10px; color: var(--soft-ink); font-size: 0.92rem; }
.session-main .form-error { color: var(--red); }
.session-main form { display: grid; gap: 16px; margin-top: 23px; }
.session-main .button { width: 100%; }
#session-retry { margin-top: 13px; }
.setup-link { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.82rem; }

.catalog-view { max-width: 1280px; margin: 0 auto; padding: 32px 32px 55px; }
.catalog-header {
  padding: 31px 34px 26px;
  border: 1px solid #e9d7c9;
  border-radius: 17px;
  background: radial-gradient(ellipse at 95% -65%, #ecc8b2 0%, transparent 64%), #f5ede3;
}
.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px 28px; }
.catalog-heading h1 { font: 500 clamp(2.1rem, 4.8vw, 3.3rem)/1.03 var(--serif); letter-spacing: -0.052em; }
.catalog-heading h1:focus { outline: none; }
.catalog-heading p { margin-top: 8px; color: var(--soft-ink); font-size: 0.94rem; }
.metrics { display: flex; flex-wrap: wrap; gap: 14px 0; margin-top: 24px; padding-top: 18px; border-top: 1px solid #e2cdbb; }
.metrics > div { display: flex; align-items: baseline; gap: 8px; padding-right: 22px; }
.metrics > div + div { padding-left: 22px; border-left: 1px solid #ddc6b3; }
.metrics dt { color: var(--soft-ink); font-size: 0.82rem; }
.metrics dd { order: -1; min-width: 1ch; font-size: 1.22rem; font-weight: 670; font-variant-numeric: tabular-nums; letter-spacing: -0.05em; }

.products-section { margin-top: 25px; }
.catalog-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 11px 20px; }
.search-field { display: flex; align-items: center; gap: 10px; width: min(100%, 345px); min-height: 43px; padding: 0 13px; border: 1px solid #d8cbbb; border-radius: 9px; background: var(--white); }
.search-field:focus-within, .price-input:focus-within { border-color: var(--focus); outline: 2px solid #b9756160; outline-offset: 1px; }
.search-field input { width: 100%; min-width: 0; padding: 8px 0; border: 0; color: var(--ink); background: transparent; outline: none; font-size: 0.88rem; }
.search-field input::placeholder, .field input::placeholder { color: #72665c; opacity: 1; }
.search-icon { position: relative; width: 12px; height: 12px; margin-right: 3px; flex: 0 0 12px; border: 1.5px solid #766b61; border-radius: 50%; }
.search-icon::after { position: absolute; right: -5px; bottom: -3px; width: 6px; height: 1.5px; background: #766b61; transform: rotate(45deg); content: ""; }
.filter-group { display: flex; gap: 3px; padding: 3px; border: 1px solid #e5d9cc; border-radius: 10px; background: #f1ebe3; }
.filter { min-height: 34px; padding: 4px 13px; border: 1px solid transparent; border-radius: 7px; color: #5d5147; background: transparent; font-size: 0.84rem; font-weight: 600; }
.filter:hover { color: var(--ink); background: #f9f4ee; }
.filter[aria-pressed="true"] { color: var(--ink); border-color: #e1d3c5; background: var(--white); box-shadow: 0 1px 2px rgb(52 36 20 / 7%); }
.catalog-message { margin-top: 13px; color: var(--soft-ink); font-size: 0.85rem; }
#catalog-error, #catalog-retry { margin-top: 14px; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 15px; }
.product-card { display: flex; flex-direction: column; overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--white); box-shadow: 0 3px 12px rgb(52 36 20 / 3%); }
.card-media { position: relative; display: grid; aspect-ratio: 1.69; place-items: center; overflow: hidden; background: linear-gradient(142deg, #f1dfd3, #e9cfbd); }
.card-media img, .card-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media video { background: #d8bca9; }
.media-placeholder { color: #926452; font: 500 clamp(2.15rem, 4vw, 3.35rem)/1 var(--serif); }
.media-count { position: absolute; z-index: 1; right: 9px; bottom: 9px; padding: 3px 7px; border-radius: 6px; background: #202a37e8; color: #fffaf6; font-size: 0.72rem; }
.card-body { display: flex; flex: 1; flex-direction: column; gap: 7px; padding: 15px 16px 14px; }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { padding: 3px 7px; border-radius: 5px; color: #655549; background: #f0ebe3; font-size: 0.70rem; font-weight: 650; line-height: 1.35; }
.badge-published { background: #f5e1d6; color: #773c2d; }
.badge-available { background: #e5efe8; color: var(--green); }
.card-title { overflow-wrap: anywhere; font-size: 1.05rem; font-weight: 710; letter-spacing: -0.035em; }
.card-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; min-height: 2.78em; overflow: hidden; overflow-wrap: anywhere; color: var(--soft-ink); font-size: 0.83rem; line-height: 1.39; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 9px; border-top: 1px solid #eee7de; }
.card-price { overflow-wrap: anywhere; color: var(--ink); font-size: 0.96rem; font-weight: 710; font-variant-numeric: tabular-nums; letter-spacing: -0.034em; }
.card-price-muted { color: var(--soft-ink); font-size: 0.8rem; font-weight: 500; letter-spacing: normal; }
.card-footer .button { min-height: 34px; padding: 6px 13px; font-size: 0.81rem; }
.empty-state { min-height: 185px; margin-top: 16px; padding: 30px 22px; border: 1px dashed #d6c1b0; border-radius: 13px; background: #fdfaf5; text-align: center; }
.empty-state h2 { font: 500 1.58rem/1.1 var(--serif); }
.empty-state p { margin: 7px 0 15px; color: var(--soft-ink); font-size: 0.88rem; }

dialog { padding: 0; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--white); box-shadow: 0 24px 95px #1816163d; }
dialog::backdrop { background: #17212cb5; }
.editor-dialog { width: min(calc(100% - 32px), 670px); max-height: min(calc(100dvh - 36px), 820px); }
.editor-dialog form { display: flex; flex-direction: column; max-height: inherit; }
.dialog-header, .dialog-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 9px; padding: 14px 20px; background: var(--white); }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2, .confirm-body h2 { font: 500 1.65rem/1.06 var(--serif); letter-spacing: -0.036em; }
.dialog-body { overflow-y: auto; padding: 17px 20px 20px; }
.dialog-footer { border-top: 1px solid var(--line); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }
.button-icon { display: grid; flex: 0 0 35px; width: 35px; height: 35px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: transparent; font-size: 1.42rem; line-height: 1; }
.button-icon:hover:enabled { background: #f4eee6; }
.editor-fields { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; color: var(--ink); font-size: 0.86rem; font-weight: 655; }
.field input, .field textarea { width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid #d8cbbb; border-radius: 8px; color: var(--ink); background: #fffdf9; font-size: 0.93rem; font-weight: 450; }
.field textarea { resize: vertical; }
.field small { color: var(--soft-ink); font-size: 0.77rem; font-weight: 480; }
.price-field { max-width: 170px; }
.price-input { display: flex; align-items: center; gap: 7px; padding-left: 10px; border: 1px solid #d8cbbb; border-radius: 8px; color: #67594d; background: var(--white); }
.price-input input { padding-left: 1px; border: 0; background: transparent; outline: none; }
.option-grid, .upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option { display: flex; align-items: flex-start; gap: 8px; padding: 10px; border: 1px solid #e7dcd0; border-radius: 8px; background: #fbf7f1; cursor: pointer; }
.option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--clay); }
.option strong { display: block; font-size: 0.85rem; }
.option small { display: block; color: var(--soft-ink); font-size: 0.74rem; line-height: 1.35; }
.media-editor { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.media-editor h3 { margin-bottom: 7px; font-size: 0.97rem; font-weight: 705; }
.upload-option { position: relative; min-width: 0; padding: 10px; border: 1px dashed #d8c4b2; border-radius: 8px; background: #fcf8f3; }
.upload-button { display: inline-block; border-radius: 2px; color: var(--clay-dark); font-size: 0.86rem; font-weight: 690; cursor: pointer; }
.upload-button:hover { text-decoration: underline; }
.upload-option:focus-within .upload-button { outline: 2px solid var(--focus); outline-offset: 3px; }
.upload-option p { margin-top: 2px; color: var(--soft-ink); font-size: 0.74rem; }
.media-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.media-preview { overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 8px; }
.preview-image, .preview-video { display: block; width: 100%; aspect-ratio: 1.56; object-fit: cover; background: #e7d6ca; }
.preview-unavailable { display: grid; aspect-ratio: 1.56; padding: 4px; place-items: center; color: var(--soft-ink); background: #e7d6ca; font-size: 0.73rem; text-align: center; }
.preview-footer { display: grid; gap: 3px; padding: 5px 7px; }
.preview-filename { overflow: hidden; color: var(--soft-ink); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.preview-remove { justify-self: start; min-height: 26px; padding: 0; border: 0; color: var(--red); background: transparent; font-size: 0.76rem; font-weight: 650; }
.preview-remove:hover { text-decoration: underline; }
.form-error { padding: 8px 10px; border: 1px solid #ebc9c1; border-radius: 7px; color: #87392c; background: #fbede8; font-size: 0.85rem; overflow-wrap: anywhere; }
.dialog-body .form-error { margin-top: 9px; }
.confirm-dialog { width: min(calc(100% - 32px), 420px); }
.confirm-body { display: grid; gap: 10px; padding: 20px; }
.confirm-body > p { overflow-wrap: anywhere; color: var(--soft-ink); font-size: 0.9rem; }
.confirm-body .form-error { color: var(--red); }

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .topbar-inner { min-height: 56px; gap: 11px; padding: 0 15px; }
  .topbar-section { padding-left: 11px; }
  .session-view { min-height: calc(100svh - 56px); padding: 24px 14px; }
  .session-card { grid-template-columns: 1fr; border-radius: 14px; }
  .session-card::before { min-height: 10px; }
  .session-main { padding: 27px 21px; }
  .catalog-view { padding: 15px 13px 30px; }
  .catalog-header { padding: 19px 15px 14px; border-radius: 13px; }
  .catalog-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .catalog-heading p { font-size: 0.86rem; }
  .metrics { margin-top: 15px; padding-top: 12px; }
  .metrics > div { align-items: flex-start; flex-direction: column-reverse; gap: 0; padding-right: 12px; }
  .metrics > div + div { padding-left: 12px; }
  .metrics dt { font-size: 0.75rem; }
  .products-section { margin-top: 17px; }
  .search-field { width: 100%; }
  .product-grid { gap: 10px; margin-top: 11px; }
  .card-body { gap: 5px; padding: 9px; }
  .card-title { font-size: 0.96rem; }
  .card-description { font-size: 0.78rem; }
  .card-footer { flex-wrap: wrap; gap: 7px; padding-top: 7px; }
  .card-footer .button { min-height: 31px; padding: 5px 9px; }
  .editor-dialog { width: min(calc(100% - 16px), 670px); max-height: calc(100dvh - 20px); }
  .dialog-header, .dialog-footer { padding: 11px; }
  .dialog-body { padding: 12px 11px; }
  .dialog-footer .button { padding: 7px 9px; }
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
