* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0; padding: 0;
  background: #f5f7fa; color: #1a202c;
}

.hidden { display: none !important; }
.screen { min-height: 100vh; }
.container { max-width: 1500px; margin: 0 auto; padding: 24px; }

/* ===== ЛОГИН (в стиле procurement — GitHub-inspired dark card) ===== */
:root {
  --auth-bg:  #0d1117;
  --auth-sf:  #161b22;
  --auth-sf2: #1c2129;
  --auth-bd:  #30363d;
  --auth-tx:  #e6edf3;
  --auth-tx2: #8b949e;
  --auth-ac:  #58a6ff;
  --auth-ac2: #388bfd;
  --auth-rd:  #f85149;
}
#screen-login {
  display: flex; justify-content: center;
  padding-top: 60px;
  background: var(--auth-bg);
  color: var(--auth-tx);
}
.login-wrap { width: 100%; display: flex; justify-content: center; }
.card.login-card {
  background: var(--auth-sf);
  border: 1px solid var(--auth-bd);
  border-radius: 10px;
  padding: 24px 28px;
  min-width: 320px; max-width: 400px;
  color: var(--auth-tx);
}
.login-card h1 {
  margin: 0 0 6px; font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em;
}
.login-card .sub {
  font-size: .82rem; color: var(--auth-tx2);
  margin: 0 0 16px; line-height: 1.5;
}
.login-card label {
  display: block; font-size: .78rem; color: var(--auth-tx2); margin-bottom: 10px;
}
.login-card label + label { margin-top: 10px; }
.login-card input {
  display: block; width: 100%; margin-top: 4px;
  background: var(--auth-sf2); color: var(--auth-tx);
  border: 1px solid var(--auth-bd); border-radius: 6px;
  padding: 8px 10px; font-size: .92rem;
  font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--auth-ac); }
.login-card .btn-p {
  width: 100%; margin-top: 14px;
  background: var(--auth-ac); color: #fff;
  border: 1px solid var(--auth-ac);
  padding: 8px 16px; border-radius: 6px;
  font-family: inherit; font-size: .92rem; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.login-card .btn-p:hover { background: var(--auth-ac2); }
.login-card .err {
  background: rgba(248,81,73,.12); color: var(--auth-rd);
  border: 1px solid rgba(248,81,73,.3);
  padding: 8px 12px; border-radius: 6px;
  margin-bottom: 12px; font-size: .88rem;
}

/* ===== ШАПКА ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.header-right { display: flex; gap: 16px; align-items: center; }
.subtitle { color: #64748b; font-size: 13px; }

.btn-primary {
  padding: 8px 14px; background: #3b82f6; color: white; border: none;
  border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-block;
}
.btn-primary:hover { background: #2563eb; }
.btn-ghost {
  padding: 6px 12px; background: white; color: #475569;
  border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger {
  padding: 8px 14px; background: #dc2626; color: white; border: none;
  border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }
.btn-icon {
  padding: 4px 8px; background: transparent; color: #94a3b8;
  border: none; border-radius: 4px; cursor: pointer; font-size: 14px;
}
.btn-icon:hover { color: #dc2626; background: #fee2e2; }

/* ===== ПАНЕЛИ ===== */
.panel {
  background: white; border-radius: 8px; padding: 20px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.panel h2 { font-size: 16px; margin: 0 0 16px 0; font-weight: 600; }
.panel h3 { font-size: 14px; margin: 0 0 12px 0; font-weight: 600; }
.panel-warn { border-left: 4px solid #f59e0b; background: #fffbeb; }
.empty-state { text-align: center; padding: 60px; color: #64748b; }
.empty-state h2 { color: #1a202c; margin-bottom: 8px; }

/* ===== Список снапшотов ===== */
.snapshots-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.snapshots-header h2 { margin: 0; }
.snapshot-row {
  display: flex; align-items: center; padding: 10px 0;
  border-bottom: 1px solid #e2e8f0; gap: 12px;
}
.snapshot-row:last-child { border-bottom: none; }
.snapshot-row.active { background: #eff6ff; }
.snapshot-period {
  font-weight: 600; font-size: 14px; min-width: 90px;
}
.snapshot-meta {
  flex: 1; color: #64748b; font-size: 13px;
}
.snapshot-row button { flex-shrink: 0; }

/* ===== Прогресс ===== */
.progress-bar-outer {
  height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar-inner {
  height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.3s; width: 0%;
}

/* ===== ФИЛЬТРЫ (из старого дашборда) ===== */
.filter-bar {
  background: white; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.filter-bar label { font-weight: 600; font-size: 13px; color: #334155; }
.filter-bar .reset {
  padding: 8px 14px; border: 1px solid #cbd5e1; border-radius: 6px;
  background: white; cursor: pointer; font-size: 13px; color: #475569;
}
.filter-bar .reset:hover { background: #f1f5f9; }
.filter-bar .scope-info { margin-left: auto; font-size: 13px; color: #64748b; }
.filter-bar .scope-info b { color: #1a202c; }

/* Multi-select */
.ms { position: relative; display: inline-block; min-width: 240px; }
.ms-toggle {
  padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
  background: white; cursor: pointer; font-size: 14px; min-height: 38px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%;
}
.ms-toggle:hover { border-color: #94a3b8; }
.ms-toggle.open { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.ms-placeholder { color: #94a3b8; flex: 1; }
.ms-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e0e7ff; color: #3730a3; padding: 2px 6px;
  border-radius: 4px; font-size: 12px; font-weight: 500; max-width: 180px;
}
.ms-pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-pill-x { cursor: pointer; padding: 0 2px; font-weight: 700; opacity: 0.6; }
.ms-pill-x:hover { opacity: 1; }
.ms-arrow { margin-left: auto; color: #64748b; font-size: 10px; }
.ms-counter {
  background: #3b82f6; color: white; border-radius: 10px;
  padding: 1px 8px; font-size: 12px; font-weight: 600;
}
.ms-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: white; border: 1px solid #cbd5e1; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100; max-height: 320px; display: none; flex-direction: column;
  min-width: 280px;
}
.ms-dropdown.open { display: flex; }
.ms-search { padding: 8px; border-bottom: 1px solid #e2e8f0; }
.ms-search input {
  width: 100%; padding: 6px 10px; border: 1px solid #cbd5e1;
  border-radius: 4px; font-size: 13px;
}
.ms-actions {
  display: flex; gap: 6px; padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0; font-size: 12px;
}
.ms-action { color: #3b82f6; cursor: pointer; user-select: none; }
.ms-action:hover { text-decoration: underline; }
.ms-list { overflow-y: auto; max-height: 220px; }
.ms-item {
  padding: 6px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.ms-item:hover { background: #f1f5f9; }
.ms-item input { cursor: pointer; }
.ms-item-text { flex: 1; }
.ms-empty { padding: 16px; text-align: center; color: #94a3b8; font-size: 13px; }

/* ===== КАРТОЧКИ РАЗДЕЛОВ ===== */
.sections-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
}
@media (max-width: 1024px) { .sections-grid { grid-template-columns: 1fr; } }
.section-card {
  background: white; border-radius: 8px; padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer; transition: all 0.15s;
  border-top: 4px solid #94a3b8;
}
.section-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); transform: translateY(-1px); }
.section-card.active { box-shadow: 0 0 0 2px #3b82f6; }
.section-card.rd { border-top-color: #8b5cf6; }
.section-card.rd.active { box-shadow: 0 0 0 2px #8b5cf6; }
.section-card.tender { border-top-color: #06b6d4; }
.section-card.tender.active { box-shadow: 0 0 0 2px #06b6d4; }
.section-card.smr { border-top-color: #f97316; }
.section-card.smr.active { box-shadow: 0 0 0 2px #f97316; }
.section-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.section-count { font-size: 13px; color: #64748b; margin-bottom: 12px; }
.section-lights { display: flex; gap: 6px; margin-bottom: 12px; }
.section-lights .pill {
  flex: 1; padding: 6px 10px; border-radius: 6px; font-size: 12px;
  font-weight: 600; text-align: center;
}
.pill.green { background: #d1fae5; color: #065f46; }
.pill.yellow { background: #fef3c7; color: #92400e; }
.pill.red { background: #fee2e2; color: #991b1b; }
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  border-top: 1px solid #e2e8f0; padding-top: 10px;
}
.stat { text-align: center; }
.stat-label { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-size: 16px; font-weight: 700; color: #1a202c; }
.stat-value.warn { color: #ea580c; }
.stat-value.bad { color: #dc2626; }

/* ===== ТАБЛИЦЫ ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f1f5f9; font-weight: 600; color: #334155; position: sticky; top: 0; z-index: 1; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge.green { background: #d1fae5; color: #065f46; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #e2e8f0; color: #475569; }
.bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; display: flex; }
.bar-green { background: #10b981; }
.bar-yellow { background: #f59e0b; }
.bar-red { background: #ef4444; }
.scroll { max-height: 600px; overflow-y: auto; }
.filter-row { margin-bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row select, .filter-row input {
  padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 13px;
}
.name-cell { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell:hover { white-space: normal; word-wrap: break-word; }
.text-mute { color: #64748b; font-size: 12px; }

.dialog-buttons { display: flex; gap: 8px; margin-top: 12px; }
