/* MegaMotors — каркас и компоненты кабинета (графит + фирменный коралловый #F4543C) */
:root {
  --bg: #f4f3ef; --surface: #fff; --surface-2: #faf9f6; --text: #16191f; --muted: #737884; --line: #e9e6df;
  --line-2: #f1eee8; --ink: #0e1117; --ink-2: #161a22; --ink-line: #242a36; --side-text: #a8aebb;
  --brand: #f4543c; --brand-2: #ff8a75; --brand-soft: #fdece8; --brand-ink: #c2381f;
  --accent: #16191f; --accent-2: #fdece8;
  --ok: #2c8a56; --ok-soft: #e6f4ec; --warn: #b07418; --warn-soft: #fbf1dd; --bad: #c03a2b; --bad-soft: #fbe9e6;
  --info: #2f6fdb; --info-soft: #e9f0fd; --fire: #d24a0e; --fire-soft: #fdebdd; --violet: #7a3fc2; --violet-soft: #f2e9fb;
  --radius: 16px; --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(14, 17, 23, .04), 0 8px 24px rgba(14, 17, 23, .05);
  --shadow-lg: 0 24px 60px rgba(14, 17, 23, .14);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Manrope", "Inter", -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { color: var(--brand); }
h1 { font: 800 26px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 18px; }
h2 { font: 700 17px/1.3 var(--display); letter-spacing: -.01em; margin: 0 0 14px; }
h3 { font: 700 14px/1.3 var(--display); margin: 18px 0 8px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.code { background: var(--brand-soft); color: var(--brand-ink); padding: 2px 8px; border-radius: 6px; font-weight: 600; }
::selection { background: var(--brand-2); color: var(--ink); }
.ico { width: 18px; height: 18px; flex-shrink: 0; }

/* Каркас */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(420px 260px at 0 0, rgba(244, 84, 60, .20), transparent 70%), linear-gradient(180deg, var(--ink), var(--ink-2));
  color: var(--side-text); border-right: 1px solid #0b0d12; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: #fff; }
.logo-img { display: block; object-fit: contain; }
.brand:hover { color: #fff; }
.brand-text b { display: block; font: 800 18px/1.1 var(--display); letter-spacing: -.01em; }
.brand-text small { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-2); margin-top: 3px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #2a303c transparent; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: #646b7a; margin: 18px 12px 6px; font-weight: 600; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 12px; margin: 1px 0; border-radius: 10px;
  color: var(--side-text); font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(244, 84, 60, .22), rgba(244, 84, 60, .05)); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-2); }
.nav-link.active .ico { color: var(--brand-2); }
.nav-link span { flex: 1; }
.count { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #262c38; color: #d7dbe3; }
.count.hot { background: var(--brand); color: #fff; }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 14px 14px 16px; border-top: 1px solid var(--ink-line); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; }
.me:hover { color: #fff; }
.me-text { min-width: 0; }
.me-text b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--brand-2); font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: linear-gradient(135deg, #ff8a75, #e2402a); color: #fff; font: 800 14px var(--display); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: inherit; cursor: pointer; }
.sidebar .icon-btn { color: var(--side-text); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 32px;
  background: rgba(244, 243, 239, .82); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
.menu-btn, .top-brand, .me-mini { display: none; }
.top-brand { align-items: center; gap: 8px; color: var(--text); font: 800 16px var(--display); }
.top-status { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.pill .ico { width: 15px; height: 15px; }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); background: var(--bad-soft); border-color: #f3cfc9; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: #f0dcb3; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.live { box-shadow: 0 0 0 0 rgba(44, 138, 86, .5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(44, 138, 86, .45); } 70% { box-shadow: 0 0 0 8px rgba(44, 138, 86, 0); } 100% { box-shadow: 0 0 0 0 rgba(44, 138, 86, 0); } }
.content { flex: 1; padding: 28px 32px 64px; min-width: 0; max-width: 1480px; width: 100%; }

/* Блоки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.head .actions { margin-top: 0; }
.actions.sticky { position: sticky; bottom: 0; background: rgba(244, 243, 239, .92); backdrop-filter: blur(8px); padding: 12px 0; border-top: 1px solid var(--line); z-index: 5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .grid2, .grid2 + .card, .card + .grid2 { margin-top: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.good { color: var(--ok); }
.warn-text { color: var(--warn); }
.dim { opacity: .5; }
.inline { display: inline; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.plain li:last-child { border-bottom: 0; }
.pre { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 13.5px var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s, box-shadow .15s, transform .05s; }
.btn:hover { border-color: #d6d1c6; background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 6px 16px rgba(14, 17, 23, .18); }
.btn.primary:hover { background: #1d222c; color: #fff; box-shadow: 0 6px 18px rgba(244, 84, 60, .25); }
.btn.brand { background: linear-gradient(135deg, #ff6a50, #e2402a); border-color: #e2402a; color: #fff; box-shadow: 0 8px 20px rgba(244, 84, 60, .28); }
.btn.brand:hover { color: #fff; filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #f0c4bd; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.disabled, .btn:disabled { opacity: .55; cursor: default; }
button.link { background: none; border: 0; color: var(--brand-ink); cursor: pointer; padding: 0; font: inherit; font-weight: 600; }
button.link:hover { color: var(--brand); }

/* Метки и статусы */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; background: #f0eee9; color: #4a4f5a;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge.ok, .st-bought, .ps-applied, .ns-sent, .chs-connected, .cs-active, .ss-active, .hs-active, .ls-active { background: var(--ok-soft); color: var(--ok); }
.badge.warn, .st-awaiting, .st-offered, .ps-pending, .ns-pending { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .st-rejected, .ps-rejected, .ns-failed, .chs-disconnected, .chs-blocked, .hs-gone, .ls-sold { background: var(--bad-soft); color: var(--bad); }
.st-new { background: var(--info-soft); color: var(--info); }
.st-favorite { background: var(--brand-soft); color: var(--brand-ink); }
.st-interesting { background: #e5f4fb; color: #16709a; }
.st-to_auction { background: var(--violet-soft); color: var(--violet); }
.ns-skipped { background: #f0eee9; color: var(--muted); }
.tier-4, .tier-3 { background: var(--fire-soft); color: var(--fire); }
.tier-2 { background: var(--warn-soft); color: var(--warn); }
.tier-1 { background: var(--ok-soft); color: var(--ok); }
.tier-nomv { background: #f0eee9; color: var(--muted); }
.badge.ch { background: var(--brand-soft); color: var(--brand-ink); }
.badge.ev { background: #f0eee9; font-size: 11px; }

/* Таблицы */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th { position: sticky; top: 60px; background: var(--surface); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); z-index: 1; }
.table tr:last-child td { border-bottom: 0; }
.content > .table, .content > form > .table, .content > .results > .table, .content > section > .table:only-child { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: clip; margin-bottom: 20px; }
:is(.content, .results) > .table th:first-child, :is(.content, .results) > .table td:first-child { padding-left: 18px; }
.table tbody tr, .table tr { transition: background .12s; }
.table tr:hover td { background: #fbfaf7; }
.table tr.attention td { background: #fff8ea; }
.table tr.lvl-error td { background: #fff3f1; }
.table tr.lvl-warning td { background: #fffaee; }
.table td a { font-weight: 600; color: var(--text); }
.table td a:hover { color: var(--brand); }
.kv { border-collapse: collapse; width: 100%; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 7px 14px 7px 0; width: 38%; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }

/* Формы — static/forms.css */

/* Уведомления на странице */
.toasts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--ok); box-shadow: var(--shadow); font-weight: 500; }
.flash::before { content: "✓"; font-weight: 800; color: var(--ok); }
.flash-error { border-left-color: var(--bad); } .flash-error::before { content: "!"; color: var(--bad); }
.flash-warn { border-left-color: var(--warn); } .flash-warn::before { content: "!"; color: var(--warn); }

/* Вкладки, пагинация */
.tabs { display: inline-flex; gap: 2px; margin-bottom: 16px; flex-wrap: wrap; padding: 4px; background: #ebe8e1; border-radius: 12px; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: #4a4f5a; font-weight: 600; font-size: 13px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(14, 17, 23, .1); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.pager a, .pager .cur { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; }
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .gap { color: var(--muted); padding: 0 2px; }
.star { background: none; border: 0; font-size: 20px; cursor: pointer; color: #c9c4b8; }
.star.on { color: var(--brand); }

/* Мобильная версия: меню — выезжающая панель */
@media (max-width: 1000px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .layout .sidebar { transform: none; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(14, 17, 23, .45); z-index: 25; }
  .nav-toggle:checked ~ .layout .scrim { display: block; }
  .menu-btn, .top-brand, .me-mini { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .top-status .pill:not(.bad) { display: none; }
  .content { padding: 18px 16px 48px; }
  .grid2, .row2, .row3 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  .table th { position: static; }
  h1 { font-size: 22px; }
}
