:root {
  --ink: #241a16;
  --red: #8c1d22;
  --red-dark: #681417;
  --deep-blue: #1e4f7a;
  --blue: #4e82c4;
  --sky: #c3d9f4;
  --paper: #f5f0e7;
  --sand: #f2d8c4;
  --white: #fffdfa;
  --line: rgba(36, 26, 22, 0.14);
  --muted: rgba(36, 26, 22, 0.58);
  --shadow: 0 18px 50px rgba(36, 26, 22, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Instrument Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.brand { display: flex; flex-direction: column; gap: 5px; }
.brand__word { font: 900 27px/1 "Archivo", sans-serif; letter-spacing: -0.055em; white-space: nowrap; }
.brand__sub { color: rgba(245, 240, 231, 0.58); font: 700 10px/1 "Space Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.co-mark { position: relative; display: inline-block; width: .78em; height: .62em; margin: 0 .01em; vertical-align: -.05em; }
.co-mark i, .co-mark b { position: absolute; top: .03em; width: .5em; height: .5em; border-radius: 50%; }
.co-mark i { left: 0; background: var(--blue); }
.co-mark b { left: .26em; background: #7e9fd3; opacity: .92; }
.eyebrow { margin: 0 0 12px; color: var(--red); font: 700 10px/1.2 "Space Mono", monospace; letter-spacing: .14em; text-transform: uppercase; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(520px, .92fr) minmax(420px, 1.08fr); }
.login-card { padding: clamp(34px, 6vw, 88px); display: flex; flex-direction: column; justify-content: space-between; gap: 56px; }
.brand--login .brand__sub { color: var(--muted); }
.login-card h1 { margin: 0; max-width: 720px; font: 900 clamp(46px, 5.3vw, 78px)/.94 "Archivo", sans-serif; letter-spacing: -.052em; }
.login-copy { margin: 22px 0 0; max-width: 520px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.login-form { width: min(430px, 100%); display: grid; gap: 15px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font: 700 10px/1 "Space Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.login-form input { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--white); padding: 14px 15px; color: var(--ink); outline: none; font-family: "Instrument Sans", sans-serif; font-size: 16px; text-transform: none; letter-spacing: 0; }
input:focus { border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(78, 130, 196, .15); outline: none; }
.form-message { min-height: 20px; margin: 0; color: var(--red); font-size: 14px; }
.login-art { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: clamp(34px, 6vw, 88px); background: var(--sky); }
.login-art p { position: relative; z-index: 1; margin: 0; color: var(--red); font: 900 clamp(66px, 10vw, 160px)/.76 "Archivo", sans-serif; letter-spacing: -.065em; }
.login-art__rings { position: absolute; left: 12%; top: 8%; width: 74%; aspect-ratio: 1; }
.login-art__rings i, .login-art__rings b { position: absolute; width: 70%; aspect-ratio: 1; border-radius: 50%; }
.login-art__rings i { left: 0; background: var(--deep-blue); }
.login-art__rings b { right: 0; bottom: 0; background: var(--blue); opacity: .72; mix-blend-mode: multiply; }

.btn { border: 0; border-radius: 6px; padding: 13px 17px; cursor: pointer; font: 700 10px/1 "Space Mono", monospace; letter-spacing: .07em; text-transform: uppercase; transition: transform .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn--red { background: var(--red); color: var(--paper); }
.btn--red:hover { background: var(--red-dark); }
.btn--dark { background: var(--ink); color: var(--paper); }

.app { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; display: flex; flex-direction: column; color: var(--paper); background: var(--ink); }
.side-nav { margin-top: 52px; display: grid; gap: 8px; }
.side-nav__item { border: 0; border-radius: 7px; padding: 12px; display: flex; gap: 11px; align-items: center; text-align: left; color: rgba(245, 240, 231, .67); background: transparent; cursor: pointer; font-weight: 600; }
.side-nav__item span { color: #7e9fd3; font: 700 9px/1 "Space Mono", monospace; }
.side-nav__item:hover, .side-nav__item.active { color: var(--paper); background: rgba(255, 255, 255, .08); }
.side-note { margin-top: auto; padding: 14px; border: 1px solid rgba(245, 240, 231, .12); border-radius: 8px; display: grid; gap: 6px; }
.side-note strong { color: var(--sky); font: 700 10px/1 "Space Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.side-note span { color: rgba(245, 240, 231, .55); font-size: 12px; line-height: 1.4; word-break: break-word; }
.text-button { margin-top: 16px; border: 0; padding: 8px 0; color: rgba(245, 240, 231, .54); background: transparent; text-align: left; cursor: pointer; font: 700 10px/1 "Space Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.text-button:hover { color: var(--paper); }

.workspace { min-width: 0; padding: 26px; }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.topbar h1 { margin: 0; font: 900 32px/1 "Archivo", sans-serif; letter-spacing: -.04em; }
.sync-block { display: flex; align-items: center; gap: 14px; }
.sync-block span { color: var(--muted); font-size: 13px; }
.studio-grid { margin-top: 22px; display: grid; grid-template-columns: minmax(290px, 340px) minmax(620px, 1fr); gap: 18px; align-items: start; }
.product-browser, .editor { border: 1px solid var(--line); border-radius: 10px; background: var(--white); box-shadow: var(--shadow); }
.product-browser { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: hidden; }
.browser-head { padding: 19px 19px 10px; display: flex; justify-content: space-between; align-items: center; }
.browser-head h2 { margin: 0; font: 800 21px/1 "Archivo", sans-serif; letter-spacing: -.03em; }
.browser-head span { min-width: 30px; padding: 5px 8px; border-radius: 999px; color: var(--deep-blue); background: #eaf2f7; text-align: center; font: 700 10px/1 "Space Mono", monospace; }
.search { display: block; padding: 8px 14px; }
.search input, .price-tools input { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); padding: 11px 12px; color: var(--ink); }
.filter-row { padding: 4px 14px 12px; display: flex; gap: 7px; }
.filter { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.filter.active { color: var(--paper); border-color: var(--deep-blue); background: var(--deep-blue); }
.product-list { max-height: calc(100vh - 210px); overflow: auto; border-top: 1px solid var(--line); }
.product-item { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; display: grid; grid-template-columns: 48px minmax(0, 1fr) 8px; gap: 11px; align-items: center; text-align: left; color: var(--ink); background: transparent; cursor: pointer; }
.product-item:hover, .product-item.selected { background: #edf4fb; }
.product-thumb { width: 48px; height: 48px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; color: var(--blue); background: var(--paper); font: 800 12px/1 "Archivo", sans-serif; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-item__copy { min-width: 0; display: grid; gap: 3px; }
.product-item__copy strong, .product-item__copy small, .product-item__copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-item__copy strong { font-size: 14px; }
.product-item__copy small { color: var(--muted); font-size: 11px; }
.product-item__copy span { color: var(--blue); font: 700 9px/1.4 "Space Mono", monospace; text-transform: uppercase; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #aaa; }
.status-dot.active { background: #3f8353; }
.status-dot.draft { background: #c78025; }
.list-placeholder { padding: 36px 20px; color: var(--muted); text-align: center; }

.editor { min-height: calc(100vh - 126px); }
.editor.empty { display: grid; place-items: center; }
.empty-state { max-width: 470px; padding: 60px 28px; text-align: center; }
.empty-state h2 { margin: 0; font: 900 clamp(34px, 4vw, 56px)/.96 "Archivo", sans-serif; letter-spacing: -.05em; }
.empty-state > p:last-child { color: var(--muted); }
.empty-state__mark { position: relative; width: 82px; height: 58px; margin: 0 auto 27px; }
.empty-state__mark i, .empty-state__mark b { position: absolute; top: 0; width: 58px; height: 58px; border-radius: 50%; }
.empty-state__mark i { left: 0; background: var(--deep-blue); }
.empty-state__mark b { right: 0; background: var(--blue); opacity: .78; }
.editor-loader { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); }
.editor-loader span { width: 36px; height: 36px; border: 3px solid var(--sky); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.editor-inner { overflow: hidden; border-radius: inherit; }
.product-head { padding: 23px; display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 17px; align-items: center; background: var(--sky); }
.product-head > img { width: 86px; height: 86px; border: 1px solid rgba(36, 26, 22, .12); border-radius: 8px; object-fit: cover; background: var(--paper); }
.product-meta { margin-bottom: 7px; display: flex; align-items: center; gap: 10px; color: rgba(36, 26, 22, .52); font: 700 9px/1.2 "Space Mono", monospace; text-transform: uppercase; }
.status-pill { border-radius: 999px; padding: 5px 8px; background: rgba(36, 26, 22, .08); }
.status-pill.active { color: #245c36; background: rgba(63, 131, 83, .15); }
.status-pill.draft { color: #8d550e; background: rgba(199, 128, 37, .16); }
.product-head h2 { margin: 0; font: 900 28px/1.03 "Archivo", sans-serif; letter-spacing: -.04em; }
.product-head p { margin: 7px 0 0; color: rgba(36, 26, 22, .62); font-size: 13px; }
.product-links { display: grid; gap: 7px; text-align: right; }
.product-links a { color: var(--deep-blue); font: 700 10px/1.4 "Space Mono", monospace; text-decoration: none; text-transform: uppercase; }
.product-links a:hover { color: var(--red); }
.editor-section { padding: 27px; border-top: 1px solid var(--line); scroll-margin-top: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: start; gap: 28px; margin-bottom: 20px; }
.section-head h3 { margin: 0; font: 900 27px/1 "Archivo", sans-serif; letter-spacing: -.04em; }
.section-head p:last-child { max-width: 620px; margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.native-options { margin-bottom: 18px; padding: 12px 14px; border-radius: 7px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--paper); }
.native-options span { margin-right: 5px; color: var(--muted); font: 700 9px/1 "Space Mono", monospace; text-transform: uppercase; }
.native-options b { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-size: 12px; }
.option-groups { display: grid; gap: 13px; }
.option-card { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.option-card__head { padding: 13px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: end; background: var(--paper); }
.option-card label, .value-row label { display: grid; gap: 6px; color: var(--muted); font: 700 9px/1 "Space Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.option-card input, .value-row input { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; color: var(--ink); background: var(--white); font-family: "Instrument Sans", sans-serif; font-size: 15px; text-transform: none; letter-spacing: 0; }
.order-controls { display: flex; gap: 4px; }
.order-controls button, .icon-button { border: 1px solid var(--line); border-radius: 6px; padding: 9px; color: var(--muted); background: var(--white); cursor: pointer; }
.order-controls button:hover { color: var(--deep-blue); border-color: var(--blue); }
.icon-button--danger:hover { color: var(--red); border-color: var(--red); }
.value-list { padding: 12px; display: grid; gap: 9px; }
.value-row { display: grid; grid-template-columns: minmax(180px, 1fr) 190px auto; gap: 10px; align-items: end; }
.money-input { position: relative; display: block; }
.money-input i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-style: normal; }
.money-input input { width: 100%; padding-left: 25px; }
.value-add { margin: 0 12px 12px; border: 1px dashed rgba(36, 26, 22, .28); border-radius: 6px; padding: 10px; color: var(--deep-blue); background: transparent; cursor: pointer; }
.value-add:hover, .add-button:hover { border-color: var(--blue); background: #edf4fb; }
.add-button { width: 100%; margin-top: 13px; border: 2px dashed rgba(36, 26, 22, .2); border-radius: 9px; padding: 15px; color: var(--deep-blue); background: transparent; cursor: pointer; font-weight: 700; }
.add-button span { margin-right: 6px; font-size: 20px; vertical-align: -2px; }
.json-preview { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 13px; }
.json-preview summary { color: var(--blue); cursor: pointer; font: 700 10px/1 "Space Mono", monospace; text-transform: uppercase; }
.json-preview pre { overflow: auto; max-height: 300px; padding: 14px; border-radius: 7px; color: var(--paper); background: var(--ink); font: 12px/1.6 "Space Mono", monospace; }
.price-tools { margin-bottom: 12px; display: grid; grid-template-columns: minmax(220px, 420px) auto; gap: 14px; align-items: center; }
.price-tools span { color: var(--muted); font-size: 13px; text-align: right; }
.price-table-wrap { overflow: auto; max-height: 610px; border: 1px solid var(--line); border-radius: 8px; }
.price-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.price-table th, .price-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.price-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: var(--paper); font: 700 9px/1 "Space Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.price-table td:first-child { min-width: 260px; }
.price-table td strong, .price-table td small { display: block; }
.price-table td strong { font-size: 14px; }
.price-table td small { margin-top: 4px; color: var(--muted); }
.price-table td:nth-child(2) span { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.price-table .money-input { width: 150px; }
.price-table input { border: 1px solid var(--line); border-radius: 6px; padding: 10px 10px 10px 25px; color: var(--ink); background: var(--white); }
.save-message { position: fixed; right: 28px; bottom: 26px; z-index: 10; max-width: 420px; padding: 14px 16px; border-radius: 7px; color: #fff; background: var(--deep-blue); box-shadow: 0 14px 38px rgba(36, 26, 22, .2); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .2s ease; }
.save-message.show { opacity: 1; transform: translateY(0); }
.save-message.error { background: var(--red); }
.save-message.neutral { background: var(--ink); }

@media (max-width: 1050px) {
  .app { grid-template-columns: 86px minmax(0, 1fr); }
  .sidebar { padding: 24px 13px; }
  .brand__sub, .side-note, .text-button, .side-nav__item:not(.active) { display: none; }
  .brand__word { font-size: 20px; }
  .side-nav__item { justify-content: center; padding: 12px 8px; font-size: 0; }
  .side-nav__item span { font-size: 10px; }
  .studio-grid { grid-template-columns: 280px minmax(560px, 1fr); overflow-x: auto; }
}

@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-card { min-height: 100vh; padding: 30px 22px; gap: 42px; }
  .login-card h1 { font-size: 48px; }
  .app { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px 18px; flex-direction: row; align-items: center; justify-content: space-between; }
  .side-nav, .side-note { display: none; }
  .text-button { display: block; margin: 0; }
  .workspace { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .sync-block { width: 100%; justify-content: space-between; }
  .sync-block span { max-width: 52%; }
  .studio-grid { display: block; overflow: visible; }
  .product-browser { position: static; max-height: none; }
  .product-list { max-height: 380px; }
  .editor { margin-top: 16px; min-height: 520px; }
  .product-head { grid-template-columns: 68px minmax(0, 1fr); }
  .product-head > img { width: 68px; height: 68px; }
  .product-links { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; text-align: left; }
  .section-head { flex-direction: column; }
  .section-head .btn { width: 100%; }
  .value-row { grid-template-columns: 1fr; }
  .price-tools { grid-template-columns: 1fr; }
  .price-tools span { text-align: left; }
  .price-table-wrap { max-height: none; overflow: visible; border: 0; }
  .price-table { min-width: 0; }
  .price-table thead { display: none; }
  .price-table tbody, .price-table tr, .price-table td { display: block; width: 100%; }
  .price-table tr { margin-bottom: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
  .price-table td { padding: 4px 0; border: 0; }
  .price-table td:first-child { min-width: 0; }
  .price-table td:nth-child(2) { margin: 4px 0 9px; }
  .price-table td:nth-child(2) span { display: inline; margin-right: 8px; }
  .price-table .money-input { width: 100%; }
  .price-table .money-input input { width: 100%; }
}
