:root{
  --ink:#202625;
  --muted:#6d7470;
  --line:#dfe4df;
  --paper:#fbfaf7;
  --panel:#ffffff;
  --sage:#718277;
  --gold:#b78b42;
  --rose:#b76963;
  --danger:#9f3b32;
  --shadow:0 18px 55px rgba(32,38,37,.12);
}
*{box-sizing:border-box}
body{margin:0;background:var(--paper);color:var(--ink);font-family:Inter,Arial,sans-serif}
button,input,textarea{font:inherit}
button{cursor:pointer}
a{color:inherit}
.shell{min-height:100vh;display:grid;grid-template-columns:76px minmax(0,1fr)}
.sidebar{background:#202625;color:white;padding:28px 16px;display:flex;flex-direction:column;gap:28px;min-width:0;width:76px;max-width:280px;height:100vh;position:sticky;top:0;z-index:40;overflow:hidden;transition:width .22s ease,box-shadow .22s ease}
.sidebar:is(:hover,:focus-within){width:280px;box-shadow:18px 0 45px rgba(32,38,37,.18)}
.brand{display:flex;gap:12px;align-items:center;text-decoration:none;white-space:nowrap}
.brand-mark{width:44px;height:44px;border-radius:8px;background:var(--gold);display:grid;place-items:center;font-weight:800}
.brand span:last-child,.sidebar-note,.nav a{opacity:0;transition:opacity .16s ease .05s}
.sidebar:is(:hover,:focus-within) .brand span:last-child,.sidebar:is(:hover,:focus-within) .sidebar-note,.sidebar:is(:hover,:focus-within) .nav a{opacity:1}
.brand strong,.brand small{display:block}.brand small{color:rgba(255,255,255,.68);margin-top:3px}
.nav{display:grid;gap:8px}.nav a{padding:12px 14px;border-radius:8px;text-decoration:none;color:rgba(255,255,255,.78);white-space:nowrap}
.nav a.is-active,.nav a:hover{background:rgba(255,255,255,.12);color:white}
.sidebar-note{margin-top:auto;color:rgba(255,255,255,.68);line-height:1.5;font-size:.92rem}
.workspace{padding:28px;min-width:0;width:100%;max-width:1480px;margin:0 auto}
.topbar{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:24px}
.topbar h1,.panel h2,.auth-box h2{margin:.2rem 0;font-size:clamp(1.5rem,3vw,2.4rem);letter-spacing:0}
.topbar p{margin:.2rem 0;color:var(--muted)}
.eyebrow{text-transform:uppercase;letter-spacing:.18em;font-size:.72rem;color:var(--gold);font-weight:800;margin:0}
.topbar-actions,.toolbar-actions,.editor-actions{display:flex;gap:10px;flex-wrap:wrap}
.primary-button,.secondary-button,.ghost-button,.danger-button{border:0;border-radius:8px;padding:12px 16px;font-weight:800;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;min-height:46px;white-space:nowrap}
.primary-button{background:var(--ink);color:white}.secondary-button{background:#edf1ed;color:var(--ink)}
.ghost-button{background:white;color:var(--ink);box-shadow:0 0 0 1px var(--line) inset}.danger-button{background:#f7e7e4;color:var(--danger)}
.primary-button:disabled,.secondary-button:disabled,.danger-button:disabled{opacity:.45;cursor:not-allowed}
.auth-panel{min-height:55vh;display:grid;place-items:center}
.auth-box{background:white;border:1px solid var(--line);border-radius:8px;padding:32px;width:min(460px,100%);box-shadow:var(--shadow)}
.auth-box p{color:var(--muted);line-height:1.5}.auth-error{background:#fff1ef;color:var(--danger);border:1px solid #f1c8c1;border-radius:8px;padding:12px;margin:14px 0}
.toolbar,.panel{background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:0 12px 34px rgba(32,38,37,.07)}
.toolbar{display:flex;align-items:end;justify-content:space-between;gap:16px;padding:18px;margin-bottom:14px}
.field{display:grid;gap:7px}.field label{font-weight:800;font-size:.84rem;color:#38413d}
.field input,.field textarea{width:100%;border:1px solid var(--line);border-radius:8px;background:white;padding:12px 13px;color:var(--ink);font-size:16px;min-height:46px}
.field textarea{resize:vertical}.search-field{min-width:min(460px,100%)}
.status-line{min-height:26px;color:var(--muted);font-weight:700;margin:8px 0 14px}.status-line.is-error{color:var(--danger)}
.inventory-layout{display:grid;grid-template-columns:minmax(300px,420px) minmax(0,1fr);gap:16px;align-items:start}
.panel{padding:18px}.panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px}
.panel-head h2{font-size:1.22rem}.product-list{display:grid;gap:9px;max-height:72vh;overflow:auto;padding-right:4px}
.product-row{display:grid;grid-template-columns:64px minmax(0,1fr) auto;gap:12px;align-items:center;border:1px solid var(--line);border-radius:8px;padding:9px;background:#fff}
.product-row.is-active{border-color:var(--gold);box-shadow:0 0 0 2px rgba(183,139,66,.12)}
.product-row img{width:64px;height:64px;object-fit:cover;border-radius:6px;background:#eef0ee}
.product-row button{all:unset;cursor:pointer;display:contents}
.product-title{font-weight:900;font-size:.94rem;line-height:1.25;overflow-wrap:anywhere}.product-meta{color:var(--muted);font-size:.84rem;margin-top:3px;display:block;overflow-wrap:anywhere}
.sold-pill{background:#f7e7e4;color:var(--danger);border-radius:999px;padding:4px 8px;font-size:.72rem;font-weight:900}
.editor-grid{display:grid;grid-template-columns:minmax(220px,280px) minmax(0,1fr);gap:18px}
.image-editor{display:grid;gap:12px;align-content:start}.image-preview{aspect-ratio:1;border-radius:8px;background:#eef0ee;overflow:hidden;display:grid;place-items:center}
.image-preview img{width:100%;height:100%;object-fit:cover}.image-preview img[src=""]{display:none}
.image-editor input[type=file]{width:100%;max-width:100%;font-size:.92rem}
.three-fields{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.fields{display:grid;gap:12px}.check-row{display:flex;align-items:center;gap:10px;font-weight:800}
.check-row input{width:22px;height:22px}
.log-panel{margin-top:16px}.log-list{display:grid;gap:8px}.log-entry{border-top:1px solid var(--line);padding:10px 0;color:var(--muted)}
.log-entry strong{display:block;color:var(--ink);margin-bottom:4px}.empty{color:var(--muted);padding:18px;text-align:center}
@media(max-width:1400px){
  .shell{display:block}
  .sidebar{position:sticky;top:0;z-index:30;display:grid;grid-template-columns:auto 1fr;align-items:center;gap:14px;padding:14px 20px;width:auto;max-width:none;height:auto;overflow:visible;transition:none;box-shadow:0 10px 28px rgba(32,38,37,.16)}
  .sidebar:is(:hover,:focus-within){width:auto;box-shadow:0 10px 28px rgba(32,38,37,.16)}
  .brand span:last-child,.sidebar-note,.nav a{opacity:1;transition:none}
  .brand-mark{width:40px;height:40px}
  .nav{display:flex;justify-content:flex-end;gap:8px}
  .nav a{min-height:42px;display:flex;align-items:center;padding:10px 13px}
  .sidebar-note{display:none}
  .workspace{padding:22px}
  .topbar{margin-bottom:18px}
  .toolbar{position:sticky;top:76px;z-index:20}
  .inventory-layout{grid-template-columns:minmax(286px,34vw) minmax(0,1fr)}
  .product-list{max-height:calc(100dvh - 285px)}
  .editor-grid{grid-template-columns:minmax(190px,230px) minmax(0,1fr)}
}
@media(max-width:900px){
  .workspace{padding:18px}
  .topbar{align-items:stretch;flex-direction:column;gap:14px}
  .topbar-actions,.toolbar-actions{width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
  .topbar-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .topbar-actions a,.topbar-actions button,.toolbar-actions button{width:100%}
  .toolbar{top:68px;align-items:stretch;flex-direction:column;margin-inline:-18px;border-left:0;border-right:0;border-radius:0;padding:14px 18px}
  .search-field{min-width:0}
  .inventory-layout{grid-template-columns:1fr}
  .product-list{max-height:42dvh}
  .editor-grid{grid-template-columns:minmax(180px,240px) minmax(0,1fr)}
  .log-panel{margin-bottom:calc(18px + env(safe-area-inset-bottom))}
}
@media(max-width:680px){
  .sidebar{grid-template-columns:1fr;gap:12px}
  .brand{justify-content:center}
  .nav{justify-content:center}
  .workspace{padding:16px}
  .topbar h1{font-size:1.65rem}
  .topbar-actions,.toolbar-actions{grid-template-columns:1fr}
  .editor-grid{grid-template-columns:1fr}
  .image-preview{max-height:360px}
  .three-fields{grid-template-columns:1fr}
  .product-row{grid-template-columns:58px minmax(0,1fr)}
  .product-row img{width:58px;height:58px}
  .sold-pill{grid-column:2;justify-self:start}
}
