:root {
  color-scheme: dark;
  --bg: #0d0b0a;
  --panel: #151210;
  --panel-2: #1c1815;
  --panel-3: #251f1b;
  --text: #f3ece3;
  --muted: #a99d90;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .18);
  --gold: #d2ad6a;
  --gold-light: #f0d4a0;
  --green: #29d576;
  --blue: #3188f4;
  --red: #db6a55;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .45);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 90% -10%, rgba(210, 173, 106, .13), transparent 32%), radial-gradient(circle at 0 100%, rgba(41, 213, 118, .08), transparent 28%), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ambient { position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, #000, transparent 80%); }

.auth-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 440px); padding: clamp(28px, 6vw, 46px); border: 1px solid var(--line-strong); border-radius: 28px; background: linear-gradient(145deg, rgba(30, 25, 21, .96), rgba(16, 14, 12, .98)); box-shadow: var(--shadow); }
.auth-card .brand { margin-bottom: 54px; }
.auth-card h1 { margin: 10px 0 12px; font-family: Georgia, serif; font-size: clamp(2rem, 8vw, 3rem); line-height: .98; }
.auth-card > p { color: var(--muted); line-height: 1.6; margin: 0 0 30px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(240, 212, 160, .42); border-radius: 50%; color: #130e06; background: linear-gradient(145deg, var(--gold-light), #9e7438); box-shadow: 0 7px 24px rgba(210, 173, 106, .2); font-family: Georgia, serif; font-size: 20px; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.stack { display: grid; gap: 18px; }

label { display: grid; gap: 8px; color: #d5ccc1; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--text); background: rgba(255, 255, 255, .035); transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
input, select { min-height: 46px; padding: 0 13px; }
textarea { resize: vertical; min-height: 110px; padding: 12px 13px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #746b63; }
input:focus, select:focus, textarea:focus { border-color: rgba(210, 173, 106, .7); background: rgba(255, 255, 255, .055); box-shadow: 0 0 0 3px rgba(210, 173, 106, .11); }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--gold); }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; font-weight: 800; font-size: 13px; cursor: pointer; transition: transform .16s ease, filter .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: #161006; background: linear-gradient(145deg, var(--gold-light), #bd8d46); box-shadow: 0 10px 28px rgba(210, 173, 106, .17); }
.button.secondary { color: #dff9eb; border-color: rgba(41, 213, 118, .25); background: rgba(41, 213, 118, .1); }
.button.ghost { color: #d8cfc5; border-color: var(--line); background: rgba(255,255,255,.025); }
.button.danger { color: #ffb4a5; border-color: rgba(219, 106, 85, .25); background: rgba(219, 106, 85, .1); }
.button.compact { min-height: 38px; padding: 0 13px; font-size: 12px; }
.button.full { width: 100%; }
.text-button { padding: 0; border: 0; color: var(--gold-light); background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--gold-light); background: rgba(255,255,255,.03); cursor: pointer; font-size: 25px; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(20px, calc((100vw - 1320px) / 2)); border-bottom: 1px solid var(--line); background: rgba(13, 11, 10, .78); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.account { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.workspace { max-width: 1320px; margin: 0 auto; padding: 42px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head h1 { margin: 7px 0 3px; font-family: Georgia, serif; font-size: clamp(2.3rem, 5vw, 4rem); line-height: 1; }
.page-head p { margin: 0; color: var(--muted); }
.head-actions { display: flex; gap: 10px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metrics article { min-height: 106px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.042), rgba(255,255,255,.015)); }
.metrics span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.metrics strong { display: block; margin-top: 7px; font-size: 2rem; letter-spacing: -.04em; }

.catalog-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(20, 17, 15, .78); box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 230px 190px; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.toolbar input, .toolbar select { min-height: 42px; }
.table-head, .product-row { display: grid; grid-template-columns: minmax(330px, 1.7fr) minmax(130px, .55fr) minmax(150px, .65fr) 92px; align-items: center; gap: 18px; }
.table-head { min-height: 44px; padding: 0 18px; color: #83786f; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.product-row { min-height: 96px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.product-row:last-child { border-bottom: 0; }
.product-summary { min-width: 0; display: flex; align-items: center; gap: 14px; }
.product-thumb { width: 68px; height: 68px; flex: 0 0 68px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; color: #7b7168; background: #f5f2ed; font-size: 10px; text-align: center; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-copy { min-width: 0; }
.product-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.product-copy span, .price-cell small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.price-cell strong { display: block; font-size: 15px; }
.status-stack { display: flex; align-items: flex-start; flex-direction: column; gap: 6px; }
.status-pill { display: inline-flex; align-items: center; min-height: 27px; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; font-weight: 800; }
.status-pill.published { color: #86ebb3; border-color: rgba(41,213,118,.25); background: rgba(41,213,118,.09); }
.status-pill.draft { color: #f2cf8d; border-color: rgba(210,173,106,.25); background: rgba(210,173,106,.08); }
.status-pill.archived, .status-pill.out { color: #c4bab0; background: rgba(255,255,255,.04); }
.edit-button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(255,255,255,.035); cursor: pointer; font-weight: 800; font-size: 12px; }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: 6px; color: var(--muted); font-size: 13px; }

dialog { color: var(--text); }
.editor-dialog { width: min(940px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); }
.editor-dialog.medium { width: min(860px, calc(100vw - 24px)); }
.editor-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(7px); }
.editor { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.editor-head h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 1.8rem; }
.editor-body { overflow-y: auto; padding: 22px; }
.editor-footer { display: flex; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--line); background: rgba(0,0,0,.12); }
.footer-spacer { flex: 1; }
.form-section { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { margin-bottom: 0; border-bottom: 0; }
.form-section h3, .category-layout h3 { margin: 0 0 14px; font-size: 14px; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-title p { margin: -7px 0 14px; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; align-self: end; min-height: 46px; flex-direction: row; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); }
.field-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.image-guidance { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.image-guidance b { width: 100%; color: var(--text); font-size: 12px; }
.image-guidance span { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.025); }
.verification-check { margin-top: 12px; align-self: auto; }
.form-message { min-height: 18px; margin: 7px 0 0; color: #ff9e8b; font-size: 12px; font-weight: 700; }

.image-list { display: grid; gap: 9px; }
.image-item { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 72px; padding: 7px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.022); }
.image-item img { width: 58px; height: 58px; object-fit: contain; border-radius: 9px; background: #f3f0eb; }
.image-item-copy { min-width: 0; }
.image-item-copy strong, .image-item-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-item-copy strong { font-size: 12px; }
.image-item-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.image-item-actions { display: flex; gap: 5px; }
.mini-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.025); cursor: pointer; }
.mini-button.remove { color: #ff9f8d; }
.image-actions { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin-top: 13px; }
.upload-button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; border: 1px dashed rgba(210,173,106,.42); border-radius: 10px; color: var(--gold-light); background: rgba(210,173,106,.06); cursor: pointer; }
.upload-button input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.url-adder { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.category-layout { display: grid; grid-template-columns: 300px 1fr; gap: 28px; }
.category-form { display: grid; align-content: start; gap: 13px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.022); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.category-list { display: grid; gap: 8px; }
.category-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; }
.category-icon { width: 44px; height: 44px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; color: var(--gold-light); background: var(--panel-3); font-weight: 900; }
.category-icon img { width: 100%; height: 100%; object-fit: contain; }
.category-copy strong, .category-copy span { display: block; }
.category-copy strong { font-size: 13px; }
.category-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: min(92vw, 520px); padding: 12px 17px; border: 1px solid var(--line-strong); border-radius: 12px; color: #f4ece2; background: #29221d; box-shadow: var(--shadow); transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; font-weight: 750; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.success { border-color: rgba(41,213,118,.35); background: #153426; }
.toast.error { border-color: rgba(219,106,85,.4); background: #3b211c; }

@media (max-width: 820px) {
  .topbar { padding: 0 14px; }
  .account { display: none; }
  .workspace { padding: 28px 12px 60px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .head-actions { display: grid; grid-template-columns: 1fr 1.2fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics article { min-height: 88px; padding: 15px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .table-head { display: none; }
  .product-row { grid-template-columns: 1fr auto; gap: 12px; min-height: 102px; padding: 13px; }
  .price-cell, .status-stack { grid-column: 1; margin-left: 82px; }
  .price-cell { margin-top: -42px; }
  .status-stack { flex-direction: row; margin-top: -16px; }
  .edit-button { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar .brand > span:last-child, .topbar-actions .button:first-child { display: none; }
  .page-head h1 { font-size: 2.5rem; }
  .toolbar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .product-thumb { width: 58px; height: 58px; flex-basis: 58px; }
  .price-cell, .status-stack { margin-left: 72px; }
  .editor-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: 0; border-radius: 0; }
  .editor { max-height: 100dvh; }
  .editor-head, .editor-body, .editor-footer { padding-left: 15px; padding-right: 15px; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .image-actions { grid-template-columns: 1fr; }
  .url-adder { grid-template-columns: 1fr; }
  .editor-footer { flex-wrap: wrap; }
  .editor-footer .button.primary { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
