/* Store Companion Studio — product-quality local workspace */
:root {
  color-scheme: light;
  --studio-canvas: #f3f4f0;
  --studio-surface: #ffffff;
  --studio-surface-soft: #f7f8f5;
  --studio-ink: #17251f;
  --studio-muted: #65736b;
  --studio-line: #dfe5df;
  --studio-line-strong: #cbd5cd;
  --studio-green: #173d32;
  --studio-green-2: #28654a;
  --studio-green-soft: #e8f0e9;
  --studio-red: #bd3d37;
  --studio-amber: #805b18;
  --studio-amber-bg: #fff5df;
  --studio-danger: #9b332e;
  --studio-danger-bg: #fff0ee;
  --studio-shadow: 0 10px 28px rgba(19,45,33,.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--studio-ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--studio-canvas); }
body { min-width: 320px; margin: 0; background: var(--studio-canvas); color: var(--studio-ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 3px solid #e5a43b; outline-offset: 3px; }
.skip-link { position: fixed; left: 12px; top: 10px; z-index: 100; transform: translateY(-160%); padding: 12px 15px; border-radius: 8px; background: #fff; color: var(--studio-green); font-weight: 800; text-decoration: none; box-shadow: var(--studio-shadow); }
.skip-link:focus { transform: translateY(0); }

/* Top-level chrome */
.studio-topbar { position: sticky; top: 0; z-index: 30; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 28px; border-bottom: 1px solid rgba(215,223,216,.9); background: rgba(255,255,255,.95); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.studio-brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.studio-mark { position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px 12px 5px 12px; background: var(--studio-green); color: #fff; font-size: 25px; font-style: italic; font-weight: 950; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14); }
.studio-brand-copy { display: grid; gap: 4px; line-height: 1; }
.studio-brand strong { display: block; color: var(--studio-ink); font-size: 15px; font-weight: 900; letter-spacing: -.4px; }
.studio-brand small { display: flex; align-items: center; gap: 7px; color: #77847c; font-size: 9px; font-weight: 850; letter-spacing: 1.05px; }
.studio-brand small i { width: 3px; height: 3px; border-radius: 50%; background: var(--studio-green-2); }
.top-actions { display: flex; align-items: center; gap: 13px; }
.save-state { display: inline-flex; align-items: center; gap: 7px; max-width: 280px; min-height: 34px; padding: 7px 10px; overflow: hidden; border: 1px solid var(--studio-line); border-radius: 7px; background: var(--studio-surface-soft); color: var(--studio-muted); font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.save-state::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #5d9d70; }
.studio-shell { width: min(100%, 1600px); min-height: calc(100vh - 72px); margin: 0 auto; display: grid; grid-template-columns: 248px minmax(0,1fr); }
.studio-sidebar { position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px); min-height: 560px; display: flex; flex-direction: column; padding: 25px 15px 18px; border-right: 1px solid rgba(255,255,255,.08); background: #18392f; color: #fff; }
.sidebar-label { padding: 0 12px 12px; color: #a5bdb0; font-size: 9px; font-weight: 900; letter-spacing: 1.4px; }
.studio-nav { display: grid; gap: 4px; }
.nav-item { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #d4e1d9; text-align: left; font-size: 12px; font-weight: 750; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.nav-item span { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; color: #d7e5dc; font-size: 13px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { border-color: rgba(255,255,255,.12); background: #f4f6f1; color: var(--studio-green); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.nav-item.active span { border-color: #d8e4da; background: #e8f0e9; color: var(--studio-green); }
.sidebar-note { margin-top: auto; padding: 14px 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; background: rgba(255,255,255,.055); }
.sidebar-note-icon { display: grid; place-items: center; width: 26px; height: 26px; margin-bottom: 9px; border-radius: 7px; background: rgba(255,255,255,.12); color: #e6f0e9; font-size: 15px; }
.sidebar-note strong { color: #fff; font-size: 10px; }
.sidebar-note p { margin: 6px 0 0; color: #bfd0c5; font-size: 9px; line-height: 1.55; }
.studio-main { min-width: 0; padding: 34px clamp(18px,3.5vw,52px) 68px; }
.studio-main-inner { width: min(100%, 1240px); margin: 0 auto; }

/* Page structure */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.eyebrow { color: var(--studio-green-2); font-size: 9px; font-weight: 950; letter-spacing: 1.25px; }
.page-head h1 { margin: 7px 0 6px; color: #142b22; font-size: clamp(26px,3.2vw,36px); line-height: 1.05; letter-spacing: -1.2px; font-weight: 900; }
.page-head p { max-width: 720px; margin: 0; color: var(--studio-muted); font-size: 12px; line-height: 1.6; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.card { min-width: 0; padding: 20px; border: 1px solid var(--studio-line); border-radius: 10px; background: var(--studio-surface); box-shadow: var(--studio-shadow); }
.card h2, .card h3 { margin: 0 0 9px; color: #1a3027; }
.card h2 { font-size: 16px; font-weight: 900; letter-spacing: -.25px; }
.card h3 { font-size: 13px; font-weight: 850; }
.muted { color: var(--studio-muted); }
.small { font-size: 11px; line-height: 1.55; }
.metric { color: #15392e; font-size: 33px; line-height: 1; font-weight: 950; letter-spacing: -1.4px; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 4px 8px; border: 1px solid #d9e7dc; border-radius: 5px; background: #edf4ee; color: #315e3e; font-size: 9px; font-weight: 900; }
.status.warn { border-color: #ead8b0; background: #fff5df; color: #79561b; }
.status.bad { border-color: #efceca; background: #fff0ee; color: #963b34; }
.status.gray { border-color: var(--studio-line); background: #f4f6f3; color: #5d6a62; }
.notice { padding: 13px 15px; border: 1px solid #e8d8b7; border-radius: 8px; background: #fff8e9; color: #6c531d; font-size: 11px; line-height: 1.6; }
.notice.info { border-color: #d7e5da; background: #f0f6f1; color: #365f46; }
.notice.danger { border-color: #efceca; background: #fff0ee; color: #8e3933; }
.notice strong { font-weight: 900; }

/* Buttons and form controls */
.btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--studio-line-strong); border-radius: 7px; background: #fff; color: #26382f; font-size: 11px; font-weight: 850; text-decoration: none; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.btn:hover { border-color: #9db4a4; background: #f7faf7; }
.btn:active { transform: translateY(1px); }
.btn-dark, .btn-primary { border-color: var(--studio-green); background: var(--studio-green); color: #fff; }
.btn-dark:hover, .btn-primary:hover { border-color: #245642; background: #245642; color: #fff; }
.btn-danger { border-color: #e9c8c4; background: #fff; color: var(--studio-danger); }
.btn-danger:hover { border-color: #d99c96; background: var(--studio-danger-bg); }
.btn-small { min-height: 36px; padding: 7px 10px; font-size: 10px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label { color: #34483d; font-size: 10px; font-weight: 900; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d6dfd8; border-radius: 7px; background: #fff; color: var(--studio-ink); font-size: 13px; line-height: 1.4; }
.field textarea { min-height: 88px; resize: vertical; }
.field input[readonly] { background: #f5f7f4; color: #65736b; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .price-table input:focus { outline: 3px solid rgba(218,157,55,.28); border-color: #c28a2e; }
.field small { color: var(--studio-muted); font-size: 9px; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--studio-line); }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 15px 0; }
.toolbar input { width: min(100%,360px); min-height: 43px; padding: 9px 12px; border: 1px solid var(--studio-line-strong); border-radius: 7px; background: #fff; color: var(--studio-ink); font-size: 12px; }

/* Catalogue and media */
.product-list { display: grid; gap: 8px; }
.product-row { min-width: 0; display: grid; grid-template-columns: 58px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 11px; border: 1px solid var(--studio-line); border-radius: 8px; background: #fff; transition: border-color .14s ease, box-shadow .14s ease; }
.product-row:hover { border-color: #c4d3c7; box-shadow: var(--studio-shadow); }
.product-row img, .product-placeholder { width: 58px; height: 58px; object-fit: contain; border: 1px solid #edf0eb; border-radius: 7px; background: #f5f6f2; }
.product-placeholder { display: grid; place-items: center; color: var(--studio-green); font-size: 23px; }
.product-row strong { display: block; color: #1f352b; font-size: 11px; font-weight: 900; }
.product-row small { display: block; margin-top: 4px; color: var(--studio-muted); font-size: 9px; line-height: 1.45; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 5px 8px; border: 1px solid var(--studio-line); border-radius: 5px; background: #f7f9f6; color: #53645a; font-size: 9px; font-weight: 850; }
.media-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.media-card { min-width: 0; padding: 11px; border: 1px solid var(--studio-line); border-radius: 8px; background: #fff; }
.media-card img { width: 100%; height: 126px; object-fit: contain; border: 1px solid #edf0eb; border-radius: 6px; background: #f5f6f2; }
.media-card strong { display: block; margin: 9px 0 4px; color: #263b30; font-size: 10px; overflow-wrap: anywhere; }
.media-card small { color: var(--studio-muted); font-size: 9px; line-height: 1.4; }
.image-preview { max-width: 180px; max-height: 150px; object-fit: contain; border: 1px solid var(--studio-line); border-radius: 8px; background: #f4f6f2; }

/* Promotion editing, tables and locale review */
.role-group { margin: 14px 0; padding: 14px; border: 1px solid var(--studio-line); border-radius: 8px; background: #fbfcfa; }
.role-group h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; color: #243b30; font-size: 11px; }
.check-grid { max-height: 280px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 12px; overflow: auto; }
.check-row { display: flex; align-items: flex-start; gap: 8px; padding: 7px 2px; color: #45584c; font-size: 10px; line-height: 1.4; }
.check-row input { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; accent-color: var(--studio-green); }
.table-wrap { overflow: auto; border: 1px solid var(--studio-line); border-radius: 8px; background: #fff; }
.price-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.price-table th, .price-table td { padding: 10px 8px; border-bottom: 1px solid var(--studio-line); text-align: left; vertical-align: middle; }
.price-table th { color: var(--studio-muted); background: #f7f9f6; font-size: 9px; font-weight: 900; white-space: nowrap; }
.price-table td { color: #33463b; }
.price-table input { width: 100%; min-width: 88px; min-height: 39px; padding: 7px 8px; border: 1px solid var(--studio-line); border-radius: 6px; font-size: 11px; }
.lang-tabs { display: flex; gap: 6px; margin: 16px 0 13px; overflow-x: auto; padding-bottom: 3px; }
.lang-tab { min-height: 40px; flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--studio-line); border-radius: 7px; background: #fff; color: #53645a; font-size: 10px; font-weight: 850; white-space: nowrap; }
.lang-tab.active { border-color: var(--studio-green); background: var(--studio-green-soft); color: var(--studio-green); }
.diff-list { display: grid; gap: 0; }
.diff-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--studio-line); color: var(--studio-muted); font-size: 10px; line-height: 1.45; }
.diff-row strong { max-width: 58%; color: #33483c; font-size: 10px; text-align: right; overflow-wrap: anywhere; }
.empty { padding: 28px 18px; border: 1px dashed #cbd6ce; border-radius: 8px; color: var(--studio-muted); background: #fbfcfa; font-size: 11px; text-align: center; }
.divider { height: 1px; margin: 15px 0; background: var(--studio-line); }
.price-preview { padding: 17px; border: 1px solid #254b3b; border-radius: 9px; background: var(--studio-green); color: #fff; }
.price-preview .big { color: #fff; font-size: 35px; line-height: 1; font-weight: 950; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.price-preview .line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.18); color: #dbe8de; font-size: 10px; }

/* Notifications */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 100; max-width: min(560px,calc(100% - 28px)); padding: 12px 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; background: #17392f; color: #fff; font-size: 11px; line-height: 1.45; box-shadow: 0 14px 36px rgba(0,0,0,.18); transform: translate(-50%,14px); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { transform: translate(-50%,0); opacity: 1; }

/* Responsive Studio */
@media (max-width: 980px) {
  .studio-shell { grid-template-columns: 216px minmax(0,1fr); }
  .studio-main { padding: 28px 22px 56px; }
  .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .studio-topbar { min-height: 64px; padding: 9px 14px; }
  .studio-mark { width: 36px; height: 36px; flex-basis: 36px; font-size: 22px; }
  .studio-brand strong { font-size: 12px; }
  .studio-brand small { font-size: 7px; letter-spacing: .7px; }
  .save-state { display: none; }
  .studio-shell { display: flex; flex-direction: column; min-height: calc(100vh - 64px); }
  .studio-sidebar { position: sticky; top: 64px; z-index: 25; width: 100%; height: auto; min-height: 0; display: block; padding: 7px 10px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.11); }
  .sidebar-label, .sidebar-note { display: none; }
  .studio-nav { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .studio-nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; min-width: max-content; min-height: 44px; flex: 0 0 auto; gap: 7px; margin: 0; padding: 7px 10px; font-size: 10px; }
  .nav-item span { width: 21px; height: 21px; flex-basis: 21px; font-size: 11px; }
  .studio-main { padding: 22px 14px 48px; }
  .page-head { display: block; margin-bottom: 18px; }
  .head-actions { margin-top: 13px; }
  .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-head h1 { font-size: 29px; }
}
@media (max-width: 520px) {
  .studio-topbar { gap: 8px; }
  .studio-brand { gap: 8px; }
  .top-actions { gap: 0; }
  .top-actions .btn { min-height: 44px; padding: 8px 10px; font-size: 10px; }
  .studio-brand small { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-2, .field-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .card { padding: 15px; }
  .metric { font-size: 27px; }
  .product-row { grid-template-columns: 48px minmax(0,1fr); gap: 9px; }
  .product-row img, .product-placeholder { width: 48px; height: 48px; }
  .row-actions { grid-column: 2; }
  .check-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .media-card { padding: 8px; }
  .media-card img { height: 94px; }
  .price-table { min-width: 620px; }
  .diff-row { display: grid; gap: 4px; }
  .diff-row strong { max-width: none; text-align: left; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1 1 auto; }
  .notice { font-size: 10px; }
  .field input, .field select, .field textarea, .toolbar input, .price-table input { font-size: 16px; }
  .toolbar input, .price-table input { min-height: 44px; }
}
@media (max-width: 350px) {
  .studio-brand strong { font-size: 11px; }
  .studio-brand small { font-size: 6px; }
  .studio-mark { width: 32px; height: 32px; flex-basis: 32px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .nav-item { padding: 7px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
