/* Тендерим — кабинет, дизайн-система 2026 */
:root {
  --bg: #070b14;
  --bg2: #0b1120;
  --panel: rgba(148, 163, 184, 0.06);
  --panel-border: rgba(148, 163, 184, 0.14);
  --text: #e6ecf7;
  --muted: #8593ab;
  --accent: #6d5dfc;
  --accent2: #22d3ee;
  --grad: linear-gradient(135deg, #6d5dfc 0%, #22d3ee 100%);
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(2, 6, 23, 0.55);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(109, 93, 252, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- вход ---------- */
.login-view {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  width: 400px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.logo-mark {
  width: 44px; height: 44px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff;
}
.login-glass h1 { font-size: 26px; margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 28px; }
.login-hint { color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--panel-border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand .logo-mark { margin: 0; width: 34px; height: 34px; font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-btn {
  background: transparent; border: none; color: var(--muted);
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  font-size: 14px; white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-btn:hover { color: var(--text); background: var(--panel); }
.nav-btn.active { color: #fff; background: var(--panel); box-shadow: inset 0 0 0 1px var(--panel-border); }
.nav-btn .badge {
  font-size: 10px; color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 99px; padding: 1px 6px; margin-left: 4px;
}
.user-area { display: flex; align-items: center; gap: 10px; }
.balance-pill {
  padding: 6px 12px; border-radius: 99px; font-weight: 700; font-size: 13px;
  background: rgba(52, 211, 153, 0.12); color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.35);
}
.balance-pill.danger { background: rgba(251, 113, 133, 0.12); color: var(--red); border-color: rgba(251, 113, 133, 0.4); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; text-transform: uppercase; font-size: 13px;
}
.logout {
  background: transparent; border: 1px solid var(--panel-border); color: var(--muted);
  border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 14px;
}
.logout:hover { color: var(--red); border-color: rgba(251, 113, 133, 0.5); }

/* ---------- виды ---------- */
.view { max-width: 1360px; margin: 0 auto; padding: 20px; }

/* ---------- поиск ---------- */
.search-row { margin-bottom: 16px; }
.search-box { display: flex; gap: 8px; }
.search-box input {
  flex: 1; padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; color: var(--text); font-size: 15px; outline: none;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.2); }
.select {
  padding: 0 12px; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; color: var(--text); outline: none;
}
.btn-grad {
  border: none; padding: 12px 22px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 4px 18px rgba(109, 93, 252, 0.35);
}
.btn-grad:hover { transform: translateY(-1px); }
.btn-grad:disabled { opacity: .55; cursor: wait; }
.ghost-btn {
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--muted); border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
.chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip {
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--muted); border-radius: 99px; padding: 5px 13px; cursor: pointer; font-size: 12.5px;
  transition: color .15s, border-color .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }

/* ---------- раскладка тендеры ---------- */
.tenders-layout {
  display: grid; grid-template-columns: 460px 1fr; gap: 16px;
  align-items: start; height: calc(100vh - 190px);
}
.list-pane {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; height: 100%;
}
.list-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--panel-border);
  color: var(--muted); font-size: 13px;
}
.list { flex: 1; overflow-y: auto; }
.list-item {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  transition: background .12s;
}
.list-item:hover { background: rgba(148, 163, 184, 0.06); }
.list-item.active { background: rgba(109, 93, 252, 0.12); box-shadow: inset 3px 0 0 var(--accent); }
.list-item .t-name {
  font-weight: 600; font-size: 13.5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.list-item .t-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.list-item .t-foot {
  display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px;
}
.list-item .t-nmck { font-weight: 700; color: var(--text); }
.list-item .t-date { color: var(--muted); }
.btn-more {
  margin: 12px; padding: 9px; background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); border-radius: 10px; cursor: pointer;
}
.skeleton {
  height: 84px; margin: 10px 14px; border-radius: 10px;
  background: linear-gradient(90deg, rgba(148,163,184,0.05) 25%, rgba(148,163,184,0.12) 50%, rgba(148,163,184,0.05) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- карточка тендера ---------- */
.detail-pane {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); height: 100%; overflow-y: auto; padding: 24px;
}
.empty-detail {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); gap: 12px;
}
.empty-icon { font-size: 42px; opacity: .6; }
.detail-head { margin-bottom: 16px; }
.detail-head h2 { font-size: 19px; line-height: 1.35; margin-bottom: 10px; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.m-chip {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 4px 11px; border-radius: 99px; font-size: 12px; color: var(--muted);
}
.m-chip b { color: var(--text); font-weight: 600; }
.detail-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.btn-ghost {
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); padding: 10px 18px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
}
.btn-ghost:hover { border-color: var(--accent); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--panel-border); margin-bottom: 18px; }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 9px 14px; cursor: pointer; font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: #fff; border-bottom-color: var(--accent); font-weight: 600; }

.sec-title { font-size: 14px; font-weight: 700; color: var(--text); margin: 14px 0 8px; }
.sec-title:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 5px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); }
.markdown-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: #c9d4e8; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--panel-border); font-size: 12px;
}
.table td { padding: 9px 12px; border-bottom: 1px solid rgba(148,163,184,0.08); }
.table .num { text-align: right; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }

/* ---------- счёт ---------- */
.billing-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 22px;
}
.card-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.big-balance { font-size: 40px; font-weight: 800; margin-bottom: 14px; }
.meter { height: 8px; background: rgba(148,163,184,0.12); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.meter-fill { height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 16px; }

/* ---------- тост ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #101827; border: 1px solid var(--panel-border);
  color: var(--text); padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 100; font-size: 14px; max-width: 80vw;
}
.toast.err { border-color: rgba(251, 113, 133, 0.5); color: var(--red); }

/* ---------- меню-гамбургер ---------- */
.burger {
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); border-radius: 10px; padding: 7px 12px; cursor: pointer; font-size: 15px;
}
.menu-drop {
  position: fixed; top: 52px; left: 16px; z-index: 90;
  background: #0f1729; border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 6px; box-shadow: var(--shadow); min-width: 230px;
}
.menu-drop button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.menu-drop button:hover { background: var(--panel); }

/* ---------- топ-бар кнопки и тумблер ---------- */
.top-btn {
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
  white-space: nowrap;
}
.top-btn.grad { background: var(--grad); border: none; color: #fff; font-weight: 700; }
.icon-btn {
  background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: 14px;
}
.spacer { flex: 1; }
.tumbler {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 99px; padding: 5px 12px; margin: 0 8px; user-select: none;
}
.tumb-label { font-size: 12.5px; color: var(--muted); }
.switch {
  width: 34px; height: 18px; border-radius: 99px;
  background: rgba(148,163,184,0.25); position: relative; transition: background .2s;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; transition: left .2s;
}
.switch.on { background: var(--grad); }
.switch.on .knob { left: 18px; }

/* ---------- MoneyBar ---------- */
.money-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 20px; overflow-x: auto;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(11, 17, 32, 0.6);
}
.money-block {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 6px 14px; border-radius: 10px; font-size: 12.5px; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.money-block b { color: var(--text); margin-left: 6px; }
.etp-scroll { display: flex; gap: 8px; overflow-x: auto; flex: 1; }

/* ---------- PipelineBar ---------- */
.pipeline-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 20px; overflow-x: auto;
  border-bottom: 1px solid var(--panel-border);
}
.pp-stage {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 5px 11px; border-radius: 99px; font-size: 12px; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.pp-stage.done { background: rgba(52, 211, 153, 0.12); color: var(--green); border-color: rgba(52, 211, 153, 0.4); }
.pp-arrow { color: var(--muted); font-size: 11px; }

/* ---------- EstimateBar ---------- */
.estimate-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 20px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(109, 93, 252, 0.05);
}
.est-seg {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 5px 12px; border-radius: 9px; font-size: 12px; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.est-seg b { color: var(--text); margin-left: 5px; }
.est-seg.total { border-color: rgba(109, 93, 252, 0.5); color: var(--text); }

/* ---------- вкладки списка слева ---------- */
.list-tabs { display: flex; border-bottom: 1px solid var(--panel-border); }
.ltab {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 9px 4px; cursor: pointer; font-size: 12.5px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.ltab.active { color: #fff; border-bottom-color: var(--accent); }
.list-search { display: flex; gap: 6px; padding: 10px 12px; }
.list-search input {
  flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 9px; color: var(--text); padding: 8px 12px; font-size: 13px; outline: none;
}
.list-search input:focus { border-color: var(--accent); }
.list-search .select { padding: 0 8px; font-size: 12.5px; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- модалка ЛК ---------- */
.modal {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(4, 8, 18, 0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: #0f1729; border: 1px solid var(--panel-border);
  border-radius: 16px; padding: 22px; width: 480px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; margin-bottom: 12px;
}

/* ---------- чат-кнопка ---------- */
.chat-btn {
  margin-left: auto; background: var(--panel); border: 1px solid var(--panel-border);
  color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 13px;
}

/* ---------- Расчёт: песочница, KPI, источники ---------- */
.sandbox {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}
.sandbox .k { color: var(--muted); font-size: 13px; }
.num-input {
  width: 150px; background: var(--bg2); border: 1px solid var(--panel-border);
  border-radius: 8px; color: var(--text); padding: 8px 12px; font-size: 14px; outline: none;
}
.num-input:focus { border-color: var(--accent); }
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px 14px;
}
.kpi-label { color: var(--muted); font-size: 11.5px; margin-bottom: 5px; }
.kpi-value { font-size: 17px; font-weight: 700; }
.src {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: var(--panel); color: var(--muted); white-space: nowrap;
}
.src-факт, .src-supplier { color: var(--green); }
.src-ручную, .src-manual { color: var(--accent2); }
.src-оценка, .src-estimate { color: var(--amber); }
.sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card.mini { padding: 14px 16px; }

@media (max-width: 960px) {
  .tenders-layout { grid-template-columns: 1fr; height: auto; }
  .list-pane { max-height: 45vh; }
  .billing-grid { grid-template-columns: 1fr; }
}
