/* KabanMarket admin. Бренд из баннеров бота: коралл, бумага ценника, чернила. */

@font-face {
  font-family: "Unbounded";
  src: url("fonts/Unbounded.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("fonts/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --coral: #ff6584;
  --coral-strong: #f04d6f;
  --coral-soft: #ffe1e7;
  --paper: #ffecde;
  --ink: #121a33;

  --bg: #fbf5f0;
  --surface: #ffffff;
  --surface-2: #fff8f3;
  --line: #efe2d8;
  --line-strong: #e2d1c4;
  --text: #121a33;
  --muted: #6b6f82;
  --faint: #9a9cab;

  --ok: #1f9d6b;
  --ok-soft: #dff5ec;
  --warn: #c47a12;
  --warn-soft: #fdf0d9;
  --bad: #d23a4f;
  --bad-soft: #fde3e7;

  --side: #121a33;
  --side-text: #c9cde0;
  --side-active: #ffffff;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(18, 26, 51, 0.05), 0 6px 24px -12px rgba(18, 26, 51, 0.18);
  --ring: 0 0 0 3px rgba(255, 101, 132, 0.28);

  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1122;
    --surface: #141b31;
    --surface-2: #10172b;
    --line: #222b46;
    --line-strong: #2e3858;
    --text: #eef0f7;
    --muted: #9aa0b8;
    --faint: #6e7591;
    --coral-soft: rgba(255, 101, 132, 0.14);
    --ok-soft: rgba(31, 157, 107, 0.16);
    --warn-soft: rgba(196, 122, 18, 0.18);
    --bad-soft: rgba(210, 58, 79, 0.18);
    --side: #080c19;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -16px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1122;
  --surface: #141b31;
  --surface-2: #10172b;
  --line: #222b46;
  --line-strong: #2e3858;
  --text: #eef0f7;
  --muted: #9aa0b8;
  --faint: #6e7591;
  --coral-soft: rgba(255, 101, 132, 0.14);
  --ok-soft: rgba(31, 157, 107, 0.16);
  --warn-soft: rgba(196, 122, 18, 0.18);
  --bad-soft: rgba(210, 58, 79, 0.18);
  --side: #080c19;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -16px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}
h1 {
  font-size: 22px;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 13px;
}
code,
.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

/* ---------- каркас ---------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--side);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 6px;
  text-decoration: none;
}
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}
.brand b {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff;
}
.brand small {
  display: inline-block;
  margin-top: 6px;
  padding: 1px 8px 1px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border-radius: 3px 8px 8px 3px;
  position: relative;
}
.brand small::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 50%;
  background: var(--coral);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav a svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.75;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav a[aria-current="page"] {
  background: rgba(255, 101, 132, 0.14);
  color: var(--side-active);
}
.nav a[aria-current="page"] svg {
  color: var(--coral);
  opacity: 1;
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}
.side-foot .who {
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-foot .role {
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}
.side-foot .row {
  display: flex;
  gap: 8px;
}
.side-foot button {
  flex: 1;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: var(--side-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.side-foot button:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.main {
  padding: 28px 32px 64px;
  max-width: 1240px;
  width: 100%;
}
.topbar {
  display: none;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}
.crumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.crumbs a {
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--coral-strong);
}

/* ---------- блоки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad {
  padding: 18px 20px;
}
.card-pad > * {
  margin: 0;
}
.card-pad > * + * {
  margin-top: 14px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.stack {
  display: grid;
  gap: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* KPI-ценники: дырочка как у бирки на баннере */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  position: relative;
  padding: 16px 18px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px var(--radius) var(--radius) 6px;
  box-shadow: var(--shadow);
}
.kpi::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.kpi .label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.kpi .value {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.kpi .hint {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.kpi.accent {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}
.kpi.accent .label,
.kpi.accent .hint {
  color: rgba(255, 255, 255, 0.85);
}
.kpi.accent::after {
  background: var(--coral-strong);
  box-shadow: none;
}
.kpi.paper {
  background: var(--paper);
  border-color: #f4d9c5;
  color: var(--ink);
}
.kpi.paper .label,
.kpi.paper .hint {
  color: #6f5f58;
}

/* сегменты периодов и вкладки */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  flex-wrap: wrap;
}
.seg a {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}
.seg a:hover {
  color: var(--text);
}
.seg a[aria-current="true"] {
  background: var(--ink);
  color: #fff;
}
:root[data-theme="dark"] .seg a[aria-current="true"] {
  background: var(--coral);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg a[aria-current="true"] {
    background: var(--coral);
  }
}

/* график */
.chart {
  padding: 8px 20px 16px;
}
.chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart rect {
  fill: var(--coral);
  transition: fill 0.15s;
}
.chart rect.empty {
  fill: var(--line);
}
.chart rect:hover {
  fill: var(--coral-strong);
}
.chart .axis {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--faint);
  margin-top: 6px;
}

/* таблицы */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-2);
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--surface-2);
}
td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}
td a.row-link {
  text-decoration: none;
  font-weight: 700;
}
td a.row-link:hover {
  color: var(--coral-strong);
}
.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 13px;
}
.nowrap {
  white-space: nowrap;
}

/* метки */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}
.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: transparent;
}
.pill.coral {
  background: var(--coral-soft);
  color: var(--coral-strong);
  border-color: transparent;
}

/* списки */
.list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 20px;
}
.list li + li {
  border-top: 1px solid var(--line);
}
.list a {
  text-decoration: none;
  font-weight: 600;
}
.list a:hover {
  color: var(--coral-strong);
}
.empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
}
.empty img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 10px;
  opacity: 0.9;
}

/* ---------- формы и кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--coral);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.08s, border-color 0.15s;
}
.btn:hover {
  background: var(--coral-strong);
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn.ghost:hover {
  border-color: var(--text);
}
.btn.dark {
  background: var(--ink);
}
.btn.dark:hover {
  background: #1f2a4f;
}
.btn.danger {
  background: var(--surface);
  color: var(--bad);
  border-color: var(--bad-soft);
}
.btn.danger:hover {
  background: var(--bad-soft);
}
.btn.sm {
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 8px;
}
.btn.block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.form {
  display: grid;
  gap: 14px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-size: 13px;
  font-weight: 700;
}
.field small {
  color: var(--muted);
  font-size: 12.5px;
}
input[type="text"],
input[type="number"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}
textarea.code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  min-height: 220px;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: var(--ring);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--coral);
}
.money-input {
  display: flex;
  gap: 8px;
}
.money-input select {
  width: 84px;
  flex: none;
}

/* зона загрузки */
.drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop b {
  color: var(--text);
}
.drop.over {
  border-color: var(--coral);
  background: var(--coral-soft);
}
.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.counter {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.counter b {
  color: var(--text);
}

/* фильтры и страницы */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.toolbar input[type="search"] {
  flex: 1 1 220px;
  width: auto;
}
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0;
  font-size: 14px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.payload {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* сообщения */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  font-weight: 600;
  background: var(--ok-soft);
  color: var(--ok);
}
.flash.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.flash.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.note {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}

/* дерево каталога */
.tree {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}
.tree ul {
  list-style: none;
  margin: 0;
  padding-left: 22px;
}
.tree li > .node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
}
.tree .node:hover {
  background: var(--surface-2);
}
.tree .node a {
  text-decoration: none;
  font-weight: 700;
}
.tree .node a:hover {
  color: var(--coral-strong);
}
.tree .node .grow {
  flex: 1;
}

/* вход */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--coral);
}
.login-card {
  width: min(420px, 100%);
  padding: 32px 28px 28px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px 22px 22px 10px;
  box-shadow: 0 30px 60px -30px rgba(18, 26, 51, 0.55);
  position: relative;
}
.login-card::before {
  content: "";
  position: absolute;
  top: 22px;
  right: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--coral);
}
.login-card img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin-bottom: 18px;
}
.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.login-card p {
  color: #4b4f63;
  margin: 10px 0 0;
}
.login-card .steps {
  margin: 18px 0 0;
  padding-left: 20px;
  color: #33384d;
}
.login-card .steps li + li {
  margin-top: 6px;
}
.login-card code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 5px;
}
.login-card .err {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  color: var(--bad);
  font-weight: 700;
}
.login-card .barcode {
  margin-top: 22px;
  height: 22px;
  width: 120px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    transparent 2px 5px,
    var(--ink) 5px 6px,
    transparent 6px 9px
  );
  opacity: 0.85;
}
.login-card form {
  margin-top: 22px;
}
.login-card .btn {
  padding: 12px 18px;
  font-size: 15px;
}

/* ---------- телефон ---------- */

@media (max-width: 1100px) {
  .grid-main {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.menu-open .side {
    transform: none;
  }
  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 25, 0.45);
    z-index: 20;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--side);
    color: #fff;
  }
  .topbar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
  }
  .topbar b {
    font-family: var(--display);
    font-size: 14px;
    letter-spacing: 0.02em;
  }
  .topbar button {
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
  }
  .main {
    padding: 20px 16px 48px;
  }
  .grid-2,
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
  h1 {
    font-size: 19px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi .value {
    font-size: 18px;
  }
  .hide-sm {
    display: none;
  }
  th,
  td {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.contents {
  display: contents;
}
.inline {
  display: inline;
}

.ok-text {
  color: var(--ok);
}
details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}
