:root {
  color-scheme: light;
  --ink: #171714;
  --muted: #6f685f;
  --line: #ded5ca;
  --paper: #fffdf9;
  --panel: #f4ede4;
  --forest: #0d2820;
  --gold: #b88652;
  --danger: #9d302b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { font-family: Georgia, serif; font-size: 25px; letter-spacing: .18em; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.message { min-height: 22px; color: var(--muted); font-size: 13px; }
.message.error { color: var(--danger); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 75% 20%, #d8b88e, #173229 35%, #071410 72%); }
.login-card { width: min(440px, 100%); padding: 42px; background: rgba(255,253,249,.98); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.login-card h1 { margin: 14px 0 28px; font-family: Georgia, serif; font-size: 38px; font-weight: 500; line-height: 1.05; }
.login-card label { display: grid; gap: 8px; margin: 18px 0; color: var(--muted); font-size: 12px; font-weight: 600; }

input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); padding: 12px 13px; outline: none; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,82,.12); }
textarea { min-height: 110px; resize: vertical; }

.primary, .secondary, .danger, .icon-button { min-height: 42px; border: 0; padding: 11px 16px; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.primary { background: var(--forest); color: #fff; }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.danger { border: 1px solid rgba(157,48,43,.35); background: #fff; color: var(--danger); }
.icon-button { width: 42px; padding: 0; background: var(--forest); color: #fff; font-size: 23px; }
button:disabled { cursor: not-allowed; opacity: .5; }

.app-shell { min-height: 100vh; }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 10; }
.topbar > div:first-child { display: flex; align-items: baseline; gap: 14px; }
.topbar > div:first-child span, #publish-status { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.workspace { display: grid; grid-template-columns: 360px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.sidebar { border-right: 1px solid var(--line); background: #f8f3ec; padding: 24px 20px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.sidebar h2 { margin: 0; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.search { margin: 20px 0 14px; background: #fff; }
.product-list { display: grid; gap: 8px; }
.product-item { width: 100%; display: grid; grid-template-columns: 58px minmax(0,1fr) auto; align-items: center; gap: 12px; border: 1px solid transparent; background: transparent; padding: 9px; text-align: left; }
.product-item:hover, .product-item.active { border-color: var(--line); background: #fff; }
.thumb { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; background: #e8dbcb; color: var(--gold); font-family: Georgia, serif; font-size: 23px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-item-copy { min-width: 0; display: grid; gap: 5px; }
.product-item-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.product-item-copy small { color: var(--muted); font-size: 10px; }
.badge { padding: 5px 6px; background: var(--forest); color: #fff; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.list-empty { color: var(--muted); font-size: 13px; }

.editor-panel { padding: 34px clamp(28px, 4vw, 64px) 70px; }
.empty-state { min-height: 65vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state h2 { margin: 0 0 8px; color: var(--ink); font-family: Georgia, serif; font-size: 38px; font-weight: 500; }
.editor-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 30px; }
.editor-head h1 { max-width: 700px; margin: 0; font-family: Georgia, serif; font-size: clamp(34px, 4vw, 58px); font-weight: 500; line-height: 1; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid label { display: grid; align-content: start; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .check { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.form-grid .check input { width: auto; margin: 0; }
.image-panel { margin-top: 25px; display: grid; grid-template-columns: minmax(250px, 420px) 1fr; gap: 30px; align-items: center; padding: 25px; border: 1px solid var(--line); background: var(--panel); }
.image-preview { aspect-ratio: 1.25; display: grid; place-items: center; overflow: hidden; background: #ded0c0; color: var(--muted); font-size: 12px; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-panel h2 { margin: 4px 0 9px; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.image-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.image-panel input { margin: 8px 0 12px; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 290px minmax(0,1fr); }
  .editor-head { align-items: flex-start; flex-direction: column; }
  .editor-actions { justify-content: flex-start; }
  .image-panel { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .workspace { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .product-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .editor-panel { padding: 28px 18px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
}
