/* Telemetry Oxy — Summary clean v1
   Один владелец экрана: dashboard_v3.js.
   Без app.js, без backend, без CSS-пирога.
*/

.dashboard-v3,
.premium-summary-v1 {
  display: grid;
  gap: 10px;
  max-width: 100%;
  color: #0f172a;
  font-size: 14px;
}

/* Sidebar auth */
#sidebarAuth.auth-card.sidebar-auth {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 14px 0 16px;
  padding: 8px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
  color: #0f172a;
  position: relative;
  z-index: 2;
}

#authUserCard.auth-user-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#authUserCard.auth-user-card > div {
  min-width: 0;
}

#sidebarAuth .auth-user-label {
  display: block;
  margin: 0 0 3px;
  color: #64748b;
  font-size: 10px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#sidebarAuth .auth-user-email {
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 12.5px;
  line-height: 1.1;
  font-weight: 950;
}

#sidebarAuth #logoutBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 66px;
  height: 30px;
  padding: 0 12px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  box-shadow: none;
  font-size: 11.5px;
  line-height: 1;
  font-weight: 950;
}

/* Loading / error */
.summary-loading,
.summary-error {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(148,163,184,.16);
  color: #64748b;
  font-weight: 850;
}

.summary-error h2 {
  margin: 0 0 8px;
  color: #dc2626;
  font-size: 17px;
  font-weight: 950;
}

/* Period row */
.summary-control-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.70);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.025);
}

.summary-control-title {
  color: #64748b;
  font-size: 12px;
  font-weight: 950;
}

.summary-period {
  display: flex;
  gap: 8px;
  align-items: center;
}

.summary-period input,
.summary-period button {
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 11px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
}

.summary-period button {
  border: 0;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(135deg, #7dd3fc, #8b5cf6);
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.14);
}

/* Metrics */
.summary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-metric {
  min-height: 72px;
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(148,163,184,.13);
  box-shadow: 0 8px 22px rgba(15,23,42,.035);
}

.summary-metric.warn {
  background: rgba(255,251,235,.88);
  border-color: rgba(245,158,11,.20);
}

.summary-metric-label {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12.4px;
  font-weight: 900;
}

.summary-metric-value {
  color: #0f172a;
  font-size: 25px;
  line-height: 1;
  font-weight: 950;
}

.summary-metric.warn .summary-metric-value {
  color: #b45309;
}

.summary-metric-note {
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Layout */
.summary-workspace-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(330px, .72fr);
  gap: 10px;
  align-items: start;
}

.summary-left-column,
.summary-right-column {
  display: grid;
  gap: 10px;
  align-content: start;
}

.summary-panel {
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.90);
  border: 1px solid rgba(148,163,184,.13);
  box-shadow: 0 10px 28px rgba(15,23,42,.035);
}

.summary-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.summary-panel-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 17px;
  font-weight: 950;
}

.summary-panel-head p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 12.4px;
  font-weight: 750;
  line-height: 1.25;
}

/* Daily sales table */
.summary-day-list {
  display: grid;
  gap: 4px;
}

.summary-day-header,
.summary-day-header-clean-v1,
.summary-day-row,
.summary-day-row-clean-v1 {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 1fr 150px !important;
  gap: 8px;
  align-items: center;
}

.summary-day-header,
.summary-day-header-clean-v1 {
  padding: 0 10px 6px;
  color: #64748b;
  font-size: 11.8px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.summary-day-row,
.summary-day-row-clean-v1 {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(248,250,252,.76);
  border: 1px solid rgba(148,163,184,.10);
  color: #334155;
  font-size: 13.2px;
  font-weight: 800;
}

.summary-day-row.warn,
.summary-day-row-clean-v1.warn {
  background: rgba(255,251,235,.78);
  border-color: rgba(245,158,11,.16);
}

.day-date {
  color: #0f172a;
  font-size: 13.2px;
  font-weight: 950;
}

.summary-day-header > div:nth-child(2),
.summary-day-header > div:nth-child(3),
.summary-day-header > div:nth-child(4),
.summary-day-header-clean-v1 > div:nth-child(2),
.summary-day-header-clean-v1 > div:nth-child(3),
.summary-day-header-clean-v1 > div:nth-child(4),
.summary-day-row > div:nth-child(2),
.summary-day-row > div:nth-child(3),
.summary-day-row > div:nth-child(4),
.summary-day-row-clean-v1 > div:nth-child(2),
.summary-day-row-clean-v1 > div:nth-child(3),
.summary-day-row-clean-v1 > div:nth-child(4) {
  text-align: right;
}

.summary-day-header > div:last-child,
.summary-day-header-clean-v1 > div:last-child,
.summary-day-row > div:last-child,
.summary-day-row-clean-v1 > div:last-child {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  text-align: right;
}

/* Reconciliation badges */
.summary-recon-ok,
.summary-recon-toggle {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 24px;
  min-height: 24px;
  max-width: 142px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: none;
}

.summary-recon-ok {
  min-width: 102px;
  border: 1px solid rgba(16, 185, 129, 0.20);
  background: rgba(236, 253, 245, 0.98);
  color: #059669;
}

.summary-recon-toggle {
  min-width: 118px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(255, 247, 237, 0.98);
  color: #b45309;
  cursor: pointer;
}

.summary-recon-toggle:hover,
.summary-recon-toggle.active {
  background: rgba(254, 243, 199, 0.98);
  border-color: rgba(245, 158, 11, 0.38);
  color: #92400e;
}

/* Reconciliation details */
.summary-recon-details {
  margin: -1px 0 5px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 251, 235, 0.78);
  border: 1px solid rgba(245, 158, 11, 0.18);
}

.summary-recon-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.summary-recon-title b {
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
}

.summary-recon-title span,
.summary-recon-action {
  color: #92400e;
  font-size: 12px;
  font-weight: 850;
}

.summary-recon-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) .7fr .7fr .7fr minmax(190px, 1.4fr);
  gap: 7px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(245, 158, 11, 0.13);
}

.summary-recon-row + .summary-recon-row {
  margin-top: 6px;
}

.summary-recon-row span {
  display: block;
  color: #64748b;
  font-size: 11.6px;
  font-weight: 850;
}

.summary-recon-row b {
  display: block;
  color: #0f172a;
  font-size: 12.4px;
  font-weight: 950;
}

.summary-recon-problem {
  color: #b45309;
  font-size: 11.6px;
  font-weight: 900;
  line-height: 1.25;
}

.summary-recon-action {
  margin-top: 8px;
}

/* Network */
.summary-network-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.summary-network-card,
.summary-network-grid div {
  text-align: left;
  border-radius: 14px;
  padding: 10px;
  background: rgba(248, 250, 252, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.13);
  cursor: pointer;
  box-shadow: none;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}

.summary-network-card:hover,
.summary-network-card.active {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(14, 165, 233, 0.24);
}

.summary-network-card span,
.summary-network-grid div span {
  display: block;
  color: #64748b;
  font-size: 11.6px;
  font-weight: 900;
  margin-bottom: 6px;
}

.summary-network-card b,
.summary-network-grid div b {
  display: block;
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
}

.summary-network-card em,
.summary-network-grid div em {
  display: block;
  margin-top: 6px;
  color: #94a3b8;
  font-style: normal;
  font-size: 10.8px;
  font-weight: 750;
}

.ok-text { color: #059669 !important; }
.warn-text { color: #b45309 !important; }
.bad-text { color: #dc2626 !important; }

.summary-network-details {
  margin-top: 8px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(239, 246, 255, 0.70);
  border: 1px solid rgba(14, 165, 233, 0.16);
}

.summary-network-details-title {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
}

.summary-network-detail-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) .9fr 1fr 1.5fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.summary-network-detail-row + .summary-network-detail-row {
  margin-top: 6px;
}

.summary-network-detail-row span {
  display: block;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 850;
}

.summary-network-detail-row b {
  display: block;
  color: #0f172a;
  font-size: 11.8px;
  font-weight: 950;
  line-height: 1.25;
}

/* Lists */
.summary-machine-sales,
.summary-attention,
.vendotek-brief {
  display: grid;
  gap: 5px;
}

.summary-machine-sale,
.attention-row,
.vendotek-brief-row,
.vendotek-brief-total {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 12px;
  background: rgba(248,250,252,.76);
  border: 1px solid rgba(148,163,184,.11);
}

.summary-machine-sale b,
.vendotek-brief-row b {
  display: block;
  color: #0f172a;
  font-size: 12px;
  font-weight: 950;
}

.summary-machine-sale span,
.vendotek-brief-row span,
.vendotek-brief-row em,
.vendotek-brief-total span {
  display: block;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 760;
  line-height: 1.25;
  font-style: normal;
}

.summary-machine-sale strong,
.vendotek-brief-total b {
  color: #0f172a;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.attention-row b {
  min-width: 34px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 950;
}

.attention-row span {
  color: #475569;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.25;
}

.attention-row.warn {
  background: rgba(255,251,235,.78);
  border-color: rgba(245,158,11,.17);
}

.attention-row.bad {
  background: rgba(254,242,242,.78);
  border-color: rgba(239,68,68,.17);
}

.attention-row.ok {
  background: rgba(240,253,250,.72);
  border-color: rgba(20,184,166,.14);
}

/* Tags */
.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.summary-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 7px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.summary-tag:hover {
  transform: translateY(-1px);
  background: rgba(15, 118, 110, 0.13);
  border-color: rgba(15, 118, 110, 0.22);
}

.summary-tag b {
  color: #0f766e;
  font-size: 10.5px;
  font-weight: 950;
}

.summary-empty {
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 800;
  padding: 7px;
}

/* Responsive */
@media (max-width: 1280px) {
  .summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-workspace-v2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .summary-control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-period {
    width: 100%;
    flex-wrap: wrap;
  }

  .summary-day-header,
  .summary-day-header-clean-v1 {
    display: none;
  }

  .summary-day-row,
  .summary-day-row-clean-v1,
  .summary-recon-row,
  .summary-network-detail-row {
    grid-template-columns: 1fr !important;
  }

  .summary-day-row > div,
  .summary-day-row-clean-v1 > div {
    text-align: left !important;
    justify-content: flex-start !important;
  }

  .summary-network-grid {
    grid-template-columns: 1fr;
  }
}

/* summary_ui_final_fix_v1 */
/* Финальная правка после clean CSS: убираем пустую полосу периода и перебиваем глобальные стили button */

/* 1. Период не должен быть большой пустой белой плашкой */
body.dashboard-v3-dashboard-active .summary-control-row {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 0 !important;
  height: auto !important;
  margin: -6px 0 8px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.dashboard-v3-dashboard-active .summary-control-title {
  color: #64748b !important;
  font-size: 11.5px !important;
  font-weight: 950 !important;
}

body.dashboard-v3-dashboard-active .summary-period input,
body.dashboard-v3-dashboard-active .summary-period button {
  height: 32px !important;
  border-radius: 11px !important;
  font-size: 11.5px !important;
}

body.dashboard-v3-dashboard-active .summary-period button {
  background: linear-gradient(135deg, #7dd3fc, #8b5cf6) !important;
  color: #ffffff !important;
}

/* 2. Карточки состояния сети — это карточки, не синие кнопки */
body.dashboard-v3-dashboard-active button.summary-network-card,
body.dashboard-v3-dashboard-active .summary-network-card {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: block !important;
  width: 100% !important;
  text-align: left !important;
  border-radius: 14px !important;
  padding: 10px !important;
  background: rgba(248, 250, 252, 0.78) !important;
  border: 1px solid rgba(148, 163, 184, 0.13) !important;
  box-shadow: none !important;
  color: #0f172a !important;
  cursor: pointer !important;
  transform: none !important;
}

body.dashboard-v3-dashboard-active button.summary-network-card:hover,
body.dashboard-v3-dashboard-active button.summary-network-card.active {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(14, 165, 233, 0.24) !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.035) !important;
  transform: translateY(-1px) !important;
}

body.dashboard-v3-dashboard-active button.summary-network-card span {
  display: block !important;
  color: #64748b !important;
  font-size: 11.6px !important;
  font-weight: 900 !important;
  margin-bottom: 6px !important;
}

body.dashboard-v3-dashboard-active button.summary-network-card b {
  display: block !important;
  font-size: 22px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
}

body.dashboard-v3-dashboard-active button.summary-network-card em {
  display: block !important;
  margin-top: 6px !important;
  color: #94a3b8 !important;
  font-style: normal !important;
  font-size: 10.8px !important;
  font-weight: 750 !important;
}

/* 3. Расхождение — бейдж, не кнопка */
body.dashboard-v3-dashboard-active button.summary-recon-toggle,
body.dashboard-v3-dashboard-active .summary-recon-toggle {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: auto !important;
  min-width: 118px !important;
  max-width: 136px !important;
  height: 24px !important;
  min-height: 24px !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
  background: rgba(255, 247, 237, 0.98) !important;
  color: #b45309 !important;
  box-shadow: none !important;
  font-size: 11.5px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  cursor: pointer !important;
  transform: none !important;
}

body.dashboard-v3-dashboard-active button.summary-recon-toggle:hover,
body.dashboard-v3-dashboard-active button.summary-recon-toggle.active {
  background: rgba(254, 243, 199, 0.98) !important;
  border-color: rgba(245, 158, 11, 0.38) !important;
  color: #92400e !important;
  box-shadow: none !important;
  transform: none !important;
}

body.dashboard-v3-dashboard-active .summary-recon-ok {
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-width: 102px !important;
  height: 24px !important;
  min-height: 24px !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(16, 185, 129, 0.20) !important;
  background: rgba(236, 253, 245, 0.98) !important;
  color: #059669 !important;
  font-size: 11.5px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  white-space: nowrap !important;
}

/* 4. Заголовок и контент — без лишнего вертикального разрыва */
body.dashboard-v3-dashboard-active .topbar {
  padding-bottom: 8px !important;
}

body.dashboard-v3-dashboard-active #dashboard {
  margin-top: 0 !important;
  padding-top: 0 !important;
}



/* Поднимаем заголовок “Сводка” к уровню логотипа Telemetry Oxy */

body.dashboard-v3-dashboard-active .topbar {
  margin-top: -4px !important;
  padding-top: 0 !important;
  padding-bottom: 8px !important;
  min-height: auto !important;
}

body.dashboard-v3-dashboard-active #pageTitle {
  margin-top: 0 !important;
  margin-bottom: 4px !important;
  line-height: 1.05 !important;
}

body.dashboard-v3-dashboard-active .topbar p,
body.dashboard-v3-dashboard-active .page-subtitle {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
}

body.dashboard-v3-dashboard-active #dashboard {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Если родительский контейнер дает лишний верхний отступ — сжимаем только на Сводке */
body.dashboard-v3-dashboard-active main,
body.dashboard-v3-dashboard-active .main,
body.dashboard-v3-dashboard-active .content,
body.dashboard-v3-dashboard-active .app-main,
body.dashboard-v3-dashboard-active .page-content {
  padding-top: 14px !important;
}


/* summary_layout_clean_align_v1 */
/* Выравниваем Сводку с логотипом через общий старт main, без отрицательных margin-top */

body.dashboard-v3-dashboard-active main {
  padding-top: 24px !important; /* как .sidebar padding */
}

body.dashboard-v3-dashboard-active .topbar {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  min-height: auto !important;
  align-items: flex-start !important;
}

body.dashboard-v3-dashboard-active #pageTitle {
  margin: 0 0 4px 0 !important;
  padding: 0 !important;
  line-height: 1.05 !important;
}

body.dashboard-v3-dashboard-active #pageSubtitle {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.25 !important;
}

body.dashboard-v3-dashboard-active #dashboard {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

