/* Pixel Hub — Platform Admin Portal. Premium Light: белый / ivory / жёлтый / графит.
   Цвета, шрифты и отступы — только из токенов Amber Ledger (/shared/styles/tokens.css).
   Отличие от Seller Portal: графитовая метка ADMIN и графитовая полоса активного пункта меню. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: var(--t-md)/1.5 var(--f-ui); color: var(--text);
  background: radial-gradient(1200px 600px at 100% 0%, var(--bg-glow), transparent 60%), var(--bg);
}
a { color: var(--orange-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--t-2xl); } h2 { font-size: var(--t-xl); } h3 { font-size: var(--t-lg); }
.muted { color: var(--muted); } .small { font-size: var(--t-xs); } .bad { color: var(--bad); } .num { text-align: right; white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- каркас */
#app { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-5); }
.brand b { font-family: var(--f-display); display: block; }
.brand small { color: var(--muted); font-size: var(--t-xs); }
.logo {
  width: 40px; height: 40px; border-radius: var(--r-2); background: var(--ink); color: var(--yellow);
  display: grid; place-items: center; font: 700 15px var(--f-display);
}
#nav { display: flex; flex-direction: column; padding: 0 var(--s-3); gap: 2px; flex: 1; overflow: auto; }
#nav a {
  display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-3); border-radius: var(--r-2);
  color: var(--text); font-weight: 500; position: relative;
}
#nav a:hover { background: var(--hover); text-decoration: none; }
#nav a.active { background: var(--yellow-soft); font-weight: 650; }
#nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--ink); }
#nav .ic { width: 22px; text-align: center; color: var(--muted); }
#nav a.active .ic { color: var(--orange-deep); }
.badge { margin-left: auto; background: var(--yellow); color: var(--on-yellow); border-radius: var(--r-pill); font-size: var(--t-2xs); font-weight: 700; padding: 1px 8px; }
.side-foot { border-top: 1px solid var(--line); padding: var(--s-4); display: flex; align-items: center; gap: var(--s-2); }
.me { display: flex; gap: var(--s-2); align-items: center; flex: 1; min-width: 0; }
.me b { display: block; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); font-size: var(--t-2xs); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  height: var(--top-h); display: flex; align-items: center; gap: var(--s-4); padding: 0 var(--s-7);
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-r { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }
.admin-tag { background: var(--ink); color: var(--yellow); font: 700 var(--t-2xs) var(--f-display); letter-spacing: .12em; padding: 4px 10px; border-radius: var(--r-pill); }
.env { font-size: var(--t-2xs); text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: var(--r-pill); background: var(--info-soft); color: var(--info); }
.env-production { background: var(--bad-soft); color: var(--bad); }
.view { padding: var(--s-6) var(--s-7) var(--s-8); display: flex; flex-direction: column; gap: var(--s-5); max-width: 1600px; width: 100%; }
.loading, .empty { padding: var(--s-7); text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--r-3); }
.empty.bad { color: var(--bad); border-color: var(--bad); }

/* ---------- блоки */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-card); padding: var(--s-5); min-width: 0; }
.card-h { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-a { margin-left: auto; display: flex; gap: var(--s-2); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: var(--s-5); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-4); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-5); box-shadow: var(--shadow-card); }
.kpi-t { color: var(--muted); font-size: var(--t-sm); }
.kpi-v { font: 700 var(--t-2xl)/1.2 var(--f-display); margin: 6px 0 4px; }
.kpi-s { color: var(--muted); font-size: var(--t-xs); }
.kpi.accent { background: var(--grad-amber-soft); border-color: var(--amber); }
.kpi.warn .kpi-v { color: var(--yellow-text); }
.kpi.muted .kpi-v { color: var(--faint); font-size: var(--t-xl); }
.dl { display: grid; grid-template-columns: minmax(160px, 45%) 1fr; gap: 8px var(--s-4); margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; word-break: break-word; }
.note { background: var(--yellow-soft); border: 1px solid var(--amber); border-radius: var(--r-2); padding: var(--s-3) var(--s-4); white-space: pre-wrap; }
.note.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.head-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.crumbs { font-size: var(--t-sm); }
.chip { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 8px; font-size: var(--t-2xs); margin: 2px 0; }

/* ---------- таблицы */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-2); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tbl th { background: var(--panel-2); text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl.compact td, .tbl.compact th { padding: 6px 10px; }
.thumb { width: 36px; height: 36px; object-fit: contain; border-radius: var(--r-1); background: var(--panel-2); }
.pager { display: flex; gap: var(--s-2); align-items: center; justify-content: flex-end; padding-top: var(--s-3); font-size: var(--t-sm); }

/* ---------- статусы */
.pill { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--yellow-soft); color: var(--yellow-text); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- элементы управления */
.btn {
  font: 600 var(--t-sm) var(--f-ui); border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: 9px 16px; border-radius: var(--r-2); cursor: pointer; transition: background var(--fast) var(--ease), box-shadow var(--fast);
}
.btn:hover { background: var(--hover); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 5px 10px; font-size: var(--t-xs); }
.btn-primary { background: var(--yellow); border-color: var(--amber); color: var(--on-yellow); box-shadow: var(--shadow-amber); }
.btn-primary:hover { background: var(--amber); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; padding: 12px; }
.icon-btn { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
input, select, textarea {
  font: var(--t-sm) var(--f-ui); color: var(--text); background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--r-1); padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
.toolbar { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-3); }
.toolbar input:not([type=checkbox]), .toolbar select { width: auto; min-width: 200px; }
.toolbar .search { flex: 1; min-width: 260px; max-width: 520px; }
.toolbar-r { display: flex; justify-content: flex-end; margin-top: calc(-1 * var(--s-7)); }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: var(--t-sm); white-space: nowrap; }
.check input { width: auto; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; width: max-content; max-width: 100%; overflow: auto; }
.tab { border: 0; background: none; padding: 7px 14px; border-radius: var(--r-pill); cursor: pointer; font: 500 var(--t-sm) var(--f-ui); color: var(--muted); white-space: nowrap; }
.tab.active { background: var(--ink); color: var(--on-ink); }

/* ---------- окна */
.modal-scrim { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: var(--s-4); }
.modal { background: var(--panel); border-radius: var(--r-4); box-shadow: var(--shadow-pop); width: min(720px, 100%); max-height: 90vh; overflow: auto; padding: var(--s-6); }
.modal header, .modal footer { display: flex; align-items: center; gap: var(--s-3); }
.modal header { justify-content: space-between; margin-bottom: var(--s-4); }
.modal footer { justify-content: flex-end; margin-top: var(--s-5); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: var(--t-xs); color: var(--muted); font-weight: 600; }
.field small { color: var(--faint); font-size: var(--t-2xs); }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: var(--r-1); }
#toasts { position: fixed; right: var(--s-5); bottom: var(--s-5); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: var(--r-2); box-shadow: var(--shadow-pop); max-width: 420px; }
.toast-bad { background: var(--bad); } .toast-warn { background: var(--yellow); color: var(--on-yellow); }

/* ---------- мониторинг, каталог, обращения */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-4); }
.health { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--r-3); padding: var(--s-4) var(--s-5); box-shadow: var(--shadow-card); }
.health.bad { border-left-color: var(--bad); }
.health-t { font: 650 var(--t-md) var(--f-display); display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.health small { color: var(--muted); }
.dup { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3); }
.dup-h { margin-bottom: 6px; } .dup-row { display: flex; gap: var(--s-2); align-items: center; padding: 4px 0; }
.events { display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-3) 0; }
.event { border-left: 3px solid var(--amber); padding: 4px var(--s-3); background: var(--panel-2); border-radius: 0 var(--r-1) var(--r-1) 0; white-space: pre-wrap; }

/* ---------- вход */
.login { min-height: 100vh; width: 100%; display: grid; place-items: center; padding: var(--s-4); }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-4); box-shadow: var(--shadow-pop); padding: var(--s-7); display: flex; flex-direction: column; gap: var(--s-4); }
.login-card .brand { padding: 0 0 var(--s-2); }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.login-card input { font-size: var(--t-md); padding: 11px 12px; }
.secret { background: var(--yellow-soft); border: 1px dashed var(--amber); border-radius: var(--r-2); padding: var(--s-3); text-align: center; font-size: var(--t-lg); letter-spacing: .08em; word-break: break-all; }

/* ---------- адаптив */
@media (max-width: 960px) {
  #app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  #nav { flex-direction: row; overflow-x: auto; padding-bottom: var(--s-2); }
  #nav a.active::before { display: none; }
  #nav a { white-space: nowrap; }
  .side-foot { padding: var(--s-2) var(--s-4); }
  .view, .top { padding-left: var(--s-4); padding-right: var(--s-4); }
  .grid2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar-r { margin-top: 0; }
}
