:root {
  --ink: #1c1915;
  --ink-soft: #5c564e;
  --paper: #f3eee6;
  --paper-2: #e7e0d4;
  --card: rgba(255, 252, 247, 0.86);
  --line: rgba(28, 25, 21, 0.1);
  --copper: #b85c38;
  --copper-deep: #8c4126;
  --sage: #3d6a54;
  --ebay: #1f4e9b;
  --amazon: #b86a12;
  --shopify: #2f6b45;
  --warn: #9a6230;
  --shadow: 0 18px 50px rgba(60, 42, 24, 0.08);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Outfit", "Avenir Next", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 10% -10%, rgba(184, 92, 56, 0.08), transparent 50%),
    radial-gradient(800px 500px at 100% 0%, rgba(61, 106, 84, 0.08), transparent 46%),
    var(--paper);
  letter-spacing: -0.011em;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(243, 238, 230, 0.72);
  backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.mark {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--ink); color: #f6f1e8;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 20px;
}
.brand b { display: block; font-size: 15px; font-weight: 560; }
.brand span { color: var(--ink-soft); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { text-align: left; text-decoration: none; padding: 10px 12px; border-radius: 12px; color: var(--ink-soft); display: flex; justify-content: space-between; }
.nav a.active, .nav a:hover { background: #fff; color: var(--ink); }
a.folder, a.product { display: block; text-decoration: none; color: inherit; }
.nav em { font-style: normal; font-size: 11px; color: var(--ink-soft); }
.rail-foot { margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fffaf4; }
.rail-foot strong { display: block; font-size: 13px; }
.rail-foot p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.4; }

.main { padding: 28px 32px 64px; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; }
.kicker { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--copper-deep); margin: 0 0 6px; }
h1 { font-family: var(--serif); font-weight: 520; font-size: 40px; margin: 0; letter-spacing: -0.03em; }
.sub { color: var(--ink-soft); margin: 6px 0 0; max-width: 560px; line-height: 1.45; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 10px 14px; box-shadow: 0 1px 0 rgba(28,25,21,0.04);
}
.btn.primary { background: var(--ink); color: #f6f1e8; border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 16px;
}
.stat b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 520; margin-top: 8px; }
.stat span, .muted { color: var(--ink-soft); font-size: 13px; }
.channels { grid-template-columns: 1.4fr 1fr; margin-top: 14px; }
.channel-row, .list-row, .account-row {
  display: grid; gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.channel-row { grid-template-columns: 1fr auto auto; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 8px; font-size: 12px;
  background: var(--paper-2); color: var(--ink);
}
.pill.ok { background: #e5f0e8; color: var(--sage); }
.pill.warn { background: #f6eadc; color: var(--warn); }
.pill.ebay { background: #e7eef8; color: var(--ebay); }
.pill.amazon { background: #f8efe2; color: var(--amazon); }
.pill.shopify { background: #e7f0ea; color: var(--shopify); }
.dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }

.library { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.folder { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 10px; color: var(--ink-soft); }
.folder.active, .folder:hover { background: #fff; color: var(--ink); }
.catalog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.product {
  padding: 0; overflow: hidden; text-align: left; border: 1px solid var(--line);
  background: #fff; border-radius: 18px; box-shadow: var(--shadow); cursor: pointer;
}
.product img { height: 220px; width: 100%; object-fit: cover; background: #ece6dc; }
.product div { padding: 12px 14px 14px; }
.product strong { display: block; font-size: 15px; }
.product em { font-style: normal; color: var(--ink-soft); font-size: 12px; }

.detail { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; }
.hero-img { width: 100%; height: 460px; object-fit: cover; border-radius: 18px; background: #ece6dc; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; }
.thumbs button { padding: 0; border-radius: 10px; border: 2px solid transparent; overflow: hidden; background: #fff; }
.thumbs button.on { border-color: var(--ink); }
.thumbs img { width: 72px; height: 72px; object-fit: cover; }
label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px;
}
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; background: #ece6dc; }
.templates { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.tpl { text-align: left; }
.tpl.on { outline: 2px solid var(--ink); }
iframe.preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.split { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.keys label { margin-top: 10px; }
.toast {
  position: fixed; bottom: 18px; right: 18px; background: var(--ink); color: #f6f1e8;
  padding: 12px 14px; border-radius: 14px; max-width: 360px; box-shadow: var(--shadow); z-index: 20;
}
.modal-back {
  position: fixed; inset: 0; background: rgba(28, 25, 21, 0.35);
  display: grid; place-items: center; z-index: 15; padding: 20px;
}
.modal { width: min(560px, 100%); background: #fbf8f3; border-radius: 20px; padding: 18px; border: 1px solid var(--line); }
.log { font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.log div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.search { min-width: 220px; }
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: relative; height: auto; }
  .stats, .catalog, .split, .detail, .library, .templates, .channels { grid-template-columns: 1fr; }
  .hero-img { height: 280px; }
}
