/* Poizon Market — панель администратора.
   Тёмная тема в фирменных цветах: чёрный графит и бирюзовый. Без внешних шрифтов и библиотек. */
:root {
  color-scheme: dark;
  --bg: #060a0c; --bg2: #0a1013;
  --surface: #0e171b; --surface2: #121e23; --surface3: #182830;
  --line: #1b2b32; --line2: #27414b;
  --text: #e8f4f5; --muted: #86a1a8; --faint: #5a747b;
  --cyan: #19e6e1; --cyan2: #00b9c0; --cyan-ink: #032427;
  --green: #2ee59d; --amber: #ffb84d; --red: #ff5c7a; --blue: #5ba8ff; --violet: #a184ff;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .38);
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); min-height: 100vh;
  font: 14px/1.55 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(25, 230, 225, .10), transparent 62%),
    radial-gradient(900px 480px at 100% 0, rgba(161, 132, 255, .06), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(25, 230, 225, .28); }
.ic { flex: none; vertical-align: -3px; }

/* ------------------------------------------------------------ каркас */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px 20px;
  background: linear-gradient(180deg, rgba(14, 23, 27, .96), rgba(8, 13, 16, .98));
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 6px 22px rgba(25, 230, 225, .28); }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 11.5px; letter-spacing: .3px; }
.nav-group { margin: 14px 10px 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--faint); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--muted);
  font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav a.on { background: linear-gradient(90deg, rgba(25, 230, 225, .16), rgba(25, 230, 225, .04)); color: var(--cyan);
  box-shadow: inset 2px 0 0 var(--cyan); }
.badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700;
  text-align: center; background: var(--surface3); color: var(--text); }
.badge.hot { background: var(--red); color: #fff; }
.badge.warm { background: var(--amber); color: #2a1b00; }
.badge.cool { background: rgba(25, 230, 225, .18); color: var(--cyan); }
.side-foot { margin-top: auto; padding: 14px 10px 0; color: var(--faint); font-size: 12px; line-height: 1.6; }
.side-foot .env { font-family: var(--mono); font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.side-foot .dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); vertical-align: 1px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
  background: rgba(6, 10, 12, .72); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.burger { display: none; padding: 8px; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding-left: 38px; background: var(--surface); }
.search .ic { position: absolute; left: 12px; top: 11px; color: var(--faint); }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; background: var(--surface);
  border: 1px solid var(--line); color: var(--muted); font-size: 13px; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--line2); text-decoration: none; }
.chip .badge { margin-left: 2px; }
/* переход в соседнюю панель (например, Shopify ⇄ Poizon) */
.chip.switch { color: var(--cyan); border-color: rgba(25, 230, 225, .32); background: rgba(25, 230, 225, .06); }
.chip.switch:hover { border-color: var(--cyan); }
.login-switch { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.login-switch:hover { color: var(--cyan); }
.content { padding: 26px 28px 70px; max-width: 1640px; width: 100%; }

h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.2px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 30px 0 12px; color: var(--text); display: flex; align-items: center; gap: 9px; }
h2 .ic { color: var(--cyan); }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 920px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------ карточки и сетки */
.card {
  background: linear-gradient(180deg, var(--surface2), var(--surface)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.card.flat { background: var(--surface); }
.card h3 { margin: 0 0 12px; font-size: 14px; }
.grid2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); align-items: start; }
.grid3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.stack { display: grid; gap: 14px; }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 6px 0 4px; }
.kpi { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 15px; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(25, 230, 225, .16), transparent 68%); pointer-events: none; }
.kpi .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 27px; font-weight: 750; margin: 6px 0 2px; letter-spacing: -.5px; }
.kpi .sub { color: var(--muted); font-size: 12.5px; }
.kpi-spark { margin-top: 10px; }
.kpi-spark .spark { display: block; width: 100%; height: 28px; color: var(--cyan); opacity: .9; }
.kpi.accent { border-color: rgba(25, 230, 225, .35); }
.delta { font-weight: 650; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }

.alerts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.alert { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); transition: transform .12s, border-color .12s; }
.alert:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--line2); }
.alert .n { font-size: 22px; font-weight: 750; min-width: 34px; }
.alert .t { color: var(--muted); font-size: 13px; line-height: 1.25; }
.alert.bad.on { border-color: rgba(255, 92, 122, .5); background: rgba(255, 92, 122, .07); }
.alert.bad.on .n { color: var(--red); }
.alert.warn.on { border-color: rgba(255, 184, 77, .45); background: rgba(255, 184, 77, .06); }
.alert.warn.on .n { color: var(--amber); }
.alert.info.on .n { color: var(--cyan); }
.alert:not(.on) { opacity: .62; }

/* ------------------------------------------------------------ таблицы */
.wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; background: var(--surface2); color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td, table tr:hover > td { background: rgba(25, 230, 225, .035); }
td.empty { text-align: center; color: var(--faint); padding: 28px; }
table.kv th { position: static; width: 190px; background: transparent; text-transform: none; letter-spacing: 0; font-size: 13px;
  font-weight: 500; color: var(--muted); }

.user { display: inline-flex; align-items: center; gap: 9px; color: var(--text); }
.user .av { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: var(--cyan-ink); background: linear-gradient(135deg, #86fff8, #00a4b6); }
.user:hover { text-decoration: none; color: var(--cyan); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line2); color: var(--muted); background: var(--surface2); white-space: nowrap; }
.tag.ok { color: var(--green); border-color: rgba(46, 229, 157, .35); background: rgba(46, 229, 157, .08); }
.tag.warn { color: var(--amber); border-color: rgba(255, 184, 77, .35); background: rgba(255, 184, 77, .08); }
.tag.bad { color: var(--red); border-color: rgba(255, 92, 122, .38); background: rgba(255, 92, 122, .09); }
.tag.info { color: var(--cyan); border-color: rgba(25, 230, 225, .32); background: rgba(25, 230, 225, .07); }
.tag.blue { color: var(--blue); border-color: rgba(91, 168, 255, .35); background: rgba(91, 168, 255, .08); }
.tag.mute { color: var(--faint); }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ------------------------------------------------------------ формы и кнопки */
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--surface2); border: 1px solid var(--line2);
  border-radius: var(--radius-sm); padding: 8px 12px; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(25, 230, 225, .16); }
select { padding-right: 28px; }
textarea { width: 100%; min-height: 96px; resize: vertical; line-height: 1.5; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--cyan); vertical-align: -3px; margin-right: 6px; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 650; text-decoration: none;
  color: var(--cyan-ink); background: linear-gradient(180deg, #4ff3ee, #19d4d6); border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 6px 18px rgba(25, 230, 225, .16);
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:active { transform: translateY(1px); }
button.ghost, .btn.ghost { color: var(--text); background: var(--surface2); border-color: var(--line2); box-shadow: none; font-weight: 550; }
button.ghost:hover { border-color: var(--cyan); filter: none; }
button.danger { color: #fff; background: linear-gradient(180deg, #ff6c88, #e8416a); box-shadow: 0 6px 18px rgba(255, 92, 122, .16); }
button.good { color: #03261a; background: linear-gradient(180deg, #5af0b8, #25cf8d); }
button.sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.row.end { justify-content: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.field .hint { color: var(--faint); font-size: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0 16px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg a { padding: 5px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 550; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.on { background: var(--surface3); color: var(--cyan); }

/* ------------------------------------------------------------ сообщения, страницы, прочее */
.toasts { position: fixed; right: 20px; top: 76px; z-index: 60; display: grid; gap: 10px; width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: 12px; box-shadow: var(--shadow);
  border: 1px solid var(--line2); background: var(--surface2); animation: pop .25s ease-out; }
.toast.ok { border-color: rgba(46, 229, 157, .45); } .toast.ok .ic { color: var(--green); }
.toast.err { border-color: rgba(255, 92, 122, .5); } .toast.err .ic { color: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.pager { display: flex; gap: 16px; align-items: center; padding: 14px 2px; color: var(--muted); font-size: 13px; }
.empty-state { text-align: center; padding: 38px 20px; color: var(--muted); }

.chat { display: grid; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.msg { max-width: 82%; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface3); white-space: pre-wrap; word-break: break-word; }
.msg.admin, .msg.seller { margin-left: auto; border-radius: 14px 14px 4px 14px; background: rgba(25, 230, 225, .11); border: 1px solid rgba(25, 230, 225, .22); }
.msg .meta { color: var(--faint); font-size: 11.5px; margin-bottom: 3px; }
pre { background: #070d10; border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: 0;
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-all; }

.timeline { display: flex; align-items: center; gap: 0; margin: 10px 0 4px; flex-wrap: wrap; max-width: 780px; }
.timeline .step { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); min-width: 92px; }
.timeline .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface3); color: var(--faint);
  border: 1px solid var(--line2); }
.timeline .step.done .dot { background: rgba(46, 229, 157, .14); color: var(--green); border-color: rgba(46, 229, 157, .5); }
.timeline .step.now .dot { background: rgba(255, 184, 77, .14); color: var(--amber); border-color: rgba(255, 184, 77, .55); box-shadow: 0 0 0 4px rgba(255, 184, 77, .1); }
.timeline .step.bad .dot { background: rgba(255, 92, 122, .14); color: var(--red); border-color: rgba(255, 92, 122, .55); }
.timeline .bar { flex: 1; height: 2px; min-width: 24px; background: var(--line2); margin-bottom: 22px; }

.chart { width: 100%; height: 220px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.chart .axis { fill: var(--faint); font-size: 11px; }
.chart .line { fill: none; stroke: var(--amber); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; gap: 11px; }
.hbar .it { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan2), var(--cyan)); }

.listing-note { color: var(--muted); font-size: 12.5px; max-width: 260px; }
details.edit > summary { cursor: pointer; color: var(--cyan); list-style: none; font-weight: 600; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary { margin-bottom: 10px; }

/* ------------------------------------------------------------ вход */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login { width: min(400px, 100%); padding: 34px 30px 28px; text-align: center; background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--line2); border-radius: 22px; box-shadow: var(--shadow), 0 0 80px rgba(25, 230, 225, .08); }
.login img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 34px rgba(25, 230, 225, .35); }
.login h1 { justify-content: center; font-size: 22px; margin: 16px 0 4px; }
.login .sub { color: var(--muted); margin-bottom: 22px; }
.login .field { text-align: left; }
.login button { width: 100%; padding: 11px; font-size: 15px; }

/* ------------------------------------------------------------ адаптив */
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 270px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 560px) {
  /* шапка на телефоне: у кнопок остаются значки, подписи прячутся (переключатель панелей виден по цвету и подсказке) */
  .top { gap: 8px; }
  .top .right { gap: 6px; }
  .top .right .chip { padding: 8px 10px; }
  .top .right .chip > span:not(.badge) { display: none; }
  .search { min-width: 0; }
  h1 { font-size: 20px; }
  .hbar .it { grid-template-columns: 1fr auto; } .hbar .track { grid-column: 1 / -1; }
  th, td { padding: 9px 10px; }
}
