:root {
  --bg: #0f1724;
  --panel: #151f2f;
  --panel-2: #1b273a;
  --text: #e8eef9;
  --muted: #8fa1ba;
  --line: rgba(255,255,255,.08);
  --red: #ff4d67;
  --yellow: #f8c449;
  --blue: #4f8cff;
  --green: #35d07f;
  --violet: #7c5cff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #20304a 0, #0f1724 38%, #0a101b 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 280px;
  padding: 24px;
  background: rgba(13, 21, 34, .9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 34px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--violet), var(--blue));
  font-size: 22px;
  box-shadow: 0 12px 35px rgba(79, 140, 255, .25);
}
.brand-title { font-weight: 850; font-size: 18px; }
.brand-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.nav { display: grid; gap: 10px; }
.nav-item {
  border: 0; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: 14px;
  background: transparent; color: var(--muted);
  cursor: pointer; font-weight: 650; text-decoration: none;
}
.nav-item:hover, .nav-item.active {
  background: linear-gradient(135deg, rgba(79,140,255,.22), rgba(124,92,255,.12));
  color: var(--text);
}
.kpi-explainer { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 0; }
.system-card {
  margin-top: 34px; padding: 18px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(79,140,255,.16), rgba(255,255,255,.04));
  border: 1px solid var(--line);
}
.system-label { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.system-status { font-weight: 750; display: flex; gap: 8px; align-items: center; }
.system-status span { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 18px var(--green); }
.system-small { color: var(--muted); font-size: 12px; margin-top: 10px; }
.main { flex: 1; padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
h1 { margin: 0; font-size: 31px; letter-spacing: -0.04em; }
p { color: var(--muted); margin: 8px 0 0; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.updated, .refresh-btn {
  padding: 10px 14px; border-radius: 14px; background: rgba(21,31,47,.85);
  color: var(--muted); border: 1px solid var(--line);
}
.refresh-btn { cursor: pointer; color: var(--text); }
.refresh-btn:hover { border-color: rgba(79,140,255,.45); color: #cfe0ff; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  text-align: left; cursor: pointer;
  padding: 20px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025));
  border: 1px solid var(--line);
  color: var(--text);
  transition: transform .15s ease, border-color .15s ease;
}
.kpi-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.2); }
.kpi-label { color: var(--muted); font-size: 14px; }
.kpi-value { font-size: 36px; line-height: 1; margin-top: 12px; font-weight: 900; }
.kpi-card.critical .kpi-value { color: var(--red); }
.kpi-card.waiting .kpi-value { color: var(--yellow); }
.kpi-card.working .kpi-value { color: var(--blue); }
.kpi-card.done .kpi-value { color: var(--green); }
.content-card {
  background: rgba(21, 31, 47, .84);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 22px; border-bottom: 1px solid var(--line); gap: 16px; }
h2 { margin: 0 0 6px; }
.table-header span { color: var(--muted); font-size: 14px; }
.search {
  width: 340px; max-width: 100%;
  border: 1px solid var(--line); outline: none;
  background: rgba(255,255,255,.055); color: var(--text);
  border-radius: 14px; padding: 12px 14px;
}
.search:focus { border-color: rgba(79,140,255,.45); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td { font-size: 14px; }
.appeal-row { cursor: pointer; }
.appeal-row:hover { background: rgba(255,255,255,.035); }
.number { color: #9fc0ff; font-weight: 850; }
.appeal-text { max-width: 440px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.critical { color: #ffd9df; background: rgba(255,77,103,.18); }
.badge.waiting { color: #fff1c5; background: rgba(248,196,73,.18); }
.badge.working { color: #dbe8ff; background: rgba(79,140,255,.18); }
.badge.repair { color: #ffe0b8; background: rgba(255,157,66,.18); }
.badge.done { color: #d2ffe6; background: rgba(53,208,127,.18); }
.actions { display: flex; gap: 8px; align-items: center; }
.open-link, .details-btn, .drawer-link {
  display: inline-flex; align-items: center; justify-content: center;
  color: #b8ceff; text-decoration: none; font-weight: 800;
  background: rgba(79,140,255,.1); border: 1px solid rgba(79,140,255,.22);
  padding: 8px 10px; border-radius: 10px;
}
.details-btn { cursor: pointer; }
.open-link:hover, .details-btn:hover, .drawer-link:hover { border-color: rgba(79,140,255,.55); background: rgba(79,140,255,.16); }
.empty { text-align: center; color: var(--muted); padding: 34px; }
.drawer {
  position: fixed; inset: 0; background: rgba(0,0,0,.48);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
  display: flex; justify-content: flex-end; z-index: 50;
}
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-panel {
  width: min(460px, 100%); height: 100%; overflow: auto;
  background: rgba(18, 27, 43, .98); border-left: 1px solid var(--line);
  padding: 26px; transform: translateX(20px); transition: transform .18s ease;
  box-shadow: -20px 0 80px rgba(0,0,0,.35);
}
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-close {
  float: right; width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text);
  cursor: pointer; font-size: 24px; line-height: 1;
}
.drawer-status { color: var(--muted); font-weight: 800; margin-bottom: 14px; }
.drawer-text {
  color: var(--text); font-size: 18px; line-height: 1.45;
  padding: 16px; border-radius: 16px; background: rgba(255,255,255,.045);
  border: 1px solid var(--line); margin-bottom: 18px;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.detail-grid div { padding: 14px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.detail-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.detail-grid strong { font-size: 14px; }
.drawer-link { width: 100%; padding: 12px; }
@media (max-width: 1100px) {
  .layout { display: block; }
  .sidebar { width: auto; height: auto; position: static; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar, .table-header { flex-direction: column; align-items: stretch; }
}

/* Dashboard v0.3 */
.drawer-head { margin-bottom: 18px; }
.drawer-head h2 { margin: 10px 0 0; letter-spacing: -0.02em; }
.drawer-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 900; margin-bottom: 0;
}
.drawer-status.critical { color: #ffd9df; background: rgba(255,77,103,.18); }
.drawer-status.waiting { color: #fff1c5; background: rgba(248,196,73,.18); }
.drawer-status.working { color: #dbe8ff; background: rgba(79,140,255,.18); }
.drawer-status.repair { color: #ffe0b8; background: rgba(255,157,66,.18); }
.drawer-status.done { color: #d2ffe6; background: rgba(53,208,127,.18); }
.drawer-section { margin-bottom: 18px; }
.drawer-section-title { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.timeline { display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; }
.timeline-dot { width: 10px; height: 10px; border-radius: 999px; margin-top: 5px; background: var(--blue); box-shadow: 0 0 16px rgba(79,140,255,.45); }
.timeline-item.created .timeline-dot { background: var(--yellow); box-shadow: 0 0 16px rgba(248,196,73,.35); }
.timeline-item.accepted .timeline-dot { background: var(--blue); }
.timeline-item.done .timeline-dot { background: var(--green); box-shadow: 0 0 16px rgba(53,208,127,.35); }
.timeline-item.repair .timeline-dot { background: #ff9d42; box-shadow: 0 0 16px rgba(255,157,66,.35); }
.timeline-item strong { display:block; font-size: 14px; }
.timeline-item span { display:block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.timeline-empty { color: var(--muted); }
.row-new { animation: rowPulse 2.2s ease-out; }
@keyframes rowPulse {
  0% { background: rgba(79,140,255,.18); }
  100% { background: transparent; }
}

.row-new {
  animation: rowPulseNew 2.2s ease;
}
.row-updated {
  animation: rowPulseUpdated 2.2s ease;
}
@keyframes rowPulseNew {
  0% { background: rgba(53, 208, 127, .22); }
  100% { background: transparent; }
}
@keyframes rowPulseUpdated {
  0% { background: rgba(79, 140, 255, .22); }
  100% { background: transparent; }
}
.drawer-status.critical { color: var(--red); }
.drawer-status.waiting { color: var(--yellow); }
.drawer-status.working { color: var(--blue); }
.drawer-status.repair { color: #ffb566; }
.drawer-status.done { color: var(--green); }

/* Dashboard v0.6: аналитика и графики */
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.45fr) minmax(240px, .8fr) minmax(360px, 1.25fr);
  gap: 14px;
  margin-bottom: 20px;
}
.analytics-card {
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  min-height: 150px;
}
.analytics-card h2 { margin: 0 0 8px; font-size: 18px; }
.analytics-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.analytics-head span { color: var(--muted); font-size: 13px; }
.period-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.period-card {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.period-title { color: var(--text); font-weight: 850; margin-bottom: 10px; }
.period-row { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; margin-top: 7px; }
.period-row strong { color: var(--text); font-size: 16px; }
.metric-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.metric-line:first-of-type { border-top: 0; }
.metric-line span { color: var(--muted); }
.metric-line strong { color: var(--text); font-size: 20px; }
.mini-chart {
  height: 145px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  padding-top: 6px;
}
.chart-day { min-width: 0; }
.chart-bars {
  height: 108px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  padding: 0 2px;
}
.bar {
  width: 12px;
  min-height: 6px;
  border-radius: 999px 999px 4px 4px;
  display: inline-block;
  transition: height .25s ease;
}
.bar.created { background: linear-gradient(180deg, var(--blue), rgba(79,140,255,.38)); }
.bar.done { background: linear-gradient(180deg, var(--green), rgba(53,208,127,.36)); }
.chart-label {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  margin-top: 8px;
  white-space: nowrap;
}
.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-created { background: var(--blue); }
.legend-done { background: var(--green); }
.empty-chart { color: var(--muted); display: grid; place-items: center; height: 100%; }
@media (max-width: 1300px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .period-grid { grid-template-columns: 1fr; }
  .mini-chart { gap: 6px; }
  .bar { width: 10px; }
}


/* Dashboard v0.7: финальная аналитика и сортировка */
.kpi-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  min-height: 16px;
}
.analytics-head.compact { align-items: center; }
.period-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.period-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.period-tab:hover { color: var(--text); }
.period-tab.active {
  color: #eaf1ff;
  background: rgba(79,140,255,.2);
  box-shadow: inset 0 0 0 1px rgba(79,140,255,.25);
}
.period-row.subtle {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed rgba(255,255,255,.09);
}
.period-row.subtle strong { color: #9fc0ff; font-size: 14px; }
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color .15s ease, background .15s ease;
}
th.sortable:hover { color: #dce8ff; background: rgba(255,255,255,.025); }
th.sortable span { opacity: .45; margin-left: 4px; }
th.sortable.active { color: #a9c5ff; }
th.sortable.active span { opacity: 1; }
.refresh-btn.loading { opacity: .65; pointer-events: none; }
@media (max-width: 900px) {
  .period-tabs { max-width: 100%; overflow-x: auto; }
}


/* Release Candidate: стабильная геометрия аналитики */
.analytics-grid {
  align-items: stretch;
}
.analytics-card {
  height: 248px;
  min-height: 248px;
  overflow: hidden;
}
.analytics-card.chart-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.analytics-card.chart-card .analytics-head {
  min-height: 48px;
  margin-bottom: 8px;
}
.mini-chart {
  --chart-columns: 7;
  width: 100%;
  height: 132px;
  min-height: 132px;
  max-height: 132px;
  display: grid;
  grid-template-columns: repeat(var(--chart-columns), minmax(36px, 1fr));
  grid-template-rows: 132px;
  gap: 8px;
  align-items: end;
  padding: 0 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(143,161,186,.35) transparent;
}
.mini-chart::-webkit-scrollbar { height: 5px; }
.mini-chart::-webkit-scrollbar-thumb { background: rgba(143,161,186,.35); border-radius: 999px; }
.mini-chart.is-empty { display: grid; grid-template-columns: 1fr; }
.chart-day {
  min-width: 36px;
  height: 132px;
  display: grid;
  grid-template-rows: 104px 20px;
  align-items: end;
}
.chart-bars {
  width: 100%;
  height: 104px;
  min-height: 104px;
  max-height: 104px;
}
.chart-label {
  height: 20px;
  line-height: 20px;
  margin-top: 0;
}
.chart-legend {
  height: 22px;
  min-height: 22px;
  margin-top: 6px;
  align-items: center;
}
.content-card { position: relative; z-index: 1; }
.table-header { min-height: 82px; }

@media (max-width: 1300px) {
  .analytics-card { height: auto; min-height: 220px; }
  .analytics-card.chart-card { height: 248px; min-height: 248px; }
}
@media (max-width: 720px) {
  .analytics-card.chart-card { height: 244px; min-height: 244px; }
  .mini-chart { grid-template-columns: repeat(var(--chart-columns), minmax(42px, 1fr)); }
}


/* Уровни обращений */
.priority-badge { display:inline-flex; min-width:42px; justify-content:center; padding:6px 9px; border-radius:999px; font-size:12px; font-weight:900; border:1px solid rgba(255,255,255,.08); background:rgba(255,255,255,.06); }
.priority-badge.priority-1 { color:#ffd9df; background:rgba(255,77,103,.18); }
.priority-badge.priority-2 { color:#fff1c5; background:rgba(248,196,73,.18); }
.priority-badge.priority-3 { color:#dbe8ff; background:rgba(79,140,255,.18); }

[hidden] { display: none !important; }
.report-card { background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025)); border:1px solid var(--line); border-radius:20px; padding:20px; margin-bottom:20px; }
.report-header { display:flex; justify-content:space-between; gap:16px; align-items:center; margin-bottom:18px; }
.report-header h2 { margin:0 0 5px; }
.report-header span { color:var(--muted); font-size:13px; }
.report-summary { display:grid; grid-template-columns:repeat(6,minmax(110px,1fr)); gap:10px; margin-bottom:18px; }
.report-summary div { padding:14px; border:1px solid var(--line); background:rgba(255,255,255,.04); border-radius:14px; }
.report-summary span { display:block; color:var(--muted); font-size:12px; margin-bottom:6px; }
.report-summary strong { font-size:22px; }
.report-groups { display:grid; gap:18px; }
.report-group { border-top:1px solid var(--line); padding-top:16px; }
.report-group h3 { margin:0 0 12px; }
.report-item { padding:14px; border:1px solid var(--line); border-left:4px solid var(--blue); border-radius:14px; background:rgba(255,255,255,.035); margin-bottom:10px; }
.report-item.critical { border-left-color:var(--red); }
.report-item.waiting { border-left-color:var(--yellow); }
.report-item.working { border-left-color:var(--blue); }
.report-item.repair { border-left-color:#ff9d42; }
.report-item.done { border-left-color:var(--green); }
.report-item-top { display:flex; justify-content:space-between; gap:12px; color:var(--muted); font-size:13px; }
.report-item-top strong { color:var(--text); }
.report-item-text { margin:10px 0; font-size:15px; }
.report-item-meta { display:flex; flex-wrap:wrap; gap:8px 16px; color:var(--muted); font-size:12px; margin-bottom:10px; }
.report-empty { color:var(--muted); padding:10px 0; }
@media (max-width:800px) { .report-summary { grid-template-columns:repeat(2,1fr); } .report-header { align-items:stretch; flex-direction:column; } }

/* Управление обращениями */
.status-select {
  min-width: 112px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.status-select option { color: #111827; background: #fff; }
.delete-btn {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255,77,103,.35);
  background: rgba(255,77,103,.10);
  color: #ffd9df;
  font: inherit;
  cursor: pointer;
}
.delete-btn:hover { background: rgba(255,77,103,.20); border-color: rgba(255,77,103,.65); }
.status-select:disabled, .delete-btn:disabled { opacity: .55; cursor: wait; }
.actions { flex-wrap: wrap; min-width: 320px; }

.report-item-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(79,140,255,.35);
  background: rgba(79,140,255,.12);
  color: #dbe8ff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}
.report-item-link:hover { background: rgba(79,140,255,.22); }

/* Автоматический полный скрин существующего отчёта. */
body.report-only-mode .sidebar,
body.report-only-mode .topbar,
body.report-only-mode .kpi-grid,
body.report-only-mode .analytics-grid,
body.report-only-mode .content-card,
body.report-only-mode .drawer { display: none !important; }
body.report-only-mode .layout { display: block; min-height: auto; }
body.report-only-mode .main { margin: 0; padding: 24px; max-width: none; }
body.report-only-mode:not(.report-screenshot-mode) #reportSection { display: block !important; margin: 0; }
body.report-only-mode .report-header .refresh-btn { display: none !important; }

body.report-screenshot-mode { min-width: 1100px; background: #0d1424; }
body.report-screenshot-mode .main { width: 1100px; padding: 24px; }
body.report-screenshot-mode #reportSection { display:none !important; }
body.report-screenshot-mode #reportScreenshotSection { display:block !important; margin:0; }
body.report-screenshot-mode .report-card { border-radius: 18px; }
body.report-screenshot-mode .report-item { break-inside: avoid; page-break-inside: avoid; }
.report-screenshot-title { display:flex; justify-content:space-between; gap:16px; align-items:flex-end; margin-bottom:8px; }
.report-screenshot-title h2 { margin:0; }
.report-screenshot-title span { color:var(--muted); font-size:12px; }
.report-screenshot-empty { padding:30px 18px; text-align:center; color:var(--muted); font-size:17px; }

/* Изолированная страница, которая используется только для PNG в Bitrix24. */
body.report-screenshot-page { margin:0; min-width:1100px; background:#0d1424; }
.report-screenshot-shell { width:1100px; padding:24px; }
body.report-screenshot-page .report-screenshot-card { margin:0; border-radius:18px; }
body.report-screenshot-page .report-screenshot-title { align-items:flex-start; margin-bottom:16px; }
body.report-screenshot-page .report-screenshot-title > div span { display:block; margin-top:6px; }
.report-screenshot-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.report-screenshot-summary > div { padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.04); }
.report-screenshot-summary > div.critical { border-left:4px solid var(--red); }
.report-screenshot-summary > div.waiting { border-left:4px solid var(--yellow); }
.report-screenshot-summary span { display:block; color:var(--muted); font-size:12px; margin-bottom:5px; }
.report-screenshot-summary strong { font-size:24px; }
.report-screenshot-groups { gap:14px; }
body.report-screenshot-page .report-screenshot-empty { padding:18px 14px 8px; }

/* KPI сотрудников — единый тёмный стиль дашборда */
.date-cell { white-space: normal; min-width: 126px; line-height: 1.35; }
.employee-kpi-section {
  background: rgba(21,31,47,.84);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.employee-kpi-header { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.employee-kpi-header h2 { margin:0 0 5px; }
.employee-kpi-header span { color:var(--muted); font-size:14px; }
.employee-kpi-grid { display:grid; gap:14px; }
.employee-kpi-card {
  border:1px solid var(--line);
  border-radius:19px;
  overflow:hidden;
  background:linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
  transition:border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.employee-kpi-card:hover { border-color:rgba(79,140,255,.3); }
.employee-kpi-card.is-open { border-color:rgba(79,140,255,.45); box-shadow:0 16px 50px rgba(0,0,0,.22); }
.employee-kpi-summary { width:100%; border:0; background:transparent; color:var(--text); padding:18px; text-align:left; cursor:pointer; }
.employee-kpi-summary:hover { background:rgba(255,255,255,.025); }
.employee-kpi-topline { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:15px; }
.employee-kpi-title { display:flex; align-items:center; gap:12px; min-width:0; }
.employee-kpi-title strong { display:block; font-size:18px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.employee-kpi-title div > span { display:block; color:var(--muted); font-size:12px; margin-top:4px; }
.employee-rank { display:inline-flex; flex:0 0 34px; width:34px; height:34px; border-radius:12px; align-items:center; justify-content:center; background:linear-gradient(135deg, rgba(124,92,255,.28), rgba(79,140,255,.24)); color:#c8d9ff; font-weight:900; border:1px solid rgba(79,140,255,.24); }
.employee-kpi-score { flex:0 0 auto; min-width:116px; padding:9px 12px; border-radius:13px; border:1px solid var(--line); text-align:right; }
.employee-kpi-score span { display:block; color:var(--muted); font-size:11px; }
.employee-kpi-score strong { display:block; font-size:21px; margin-top:2px; }
.employee-kpi-score.high { background:rgba(53,208,127,.12); border-color:rgba(53,208,127,.28); color:#9af1bf; }
.employee-kpi-score.medium { background:rgba(248,196,73,.12); border-color:rgba(248,196,73,.28); color:#ffe39a; }
.employee-kpi-score.low { background:rgba(255,77,103,.11); border-color:rgba(255,77,103,.25); color:#ffabb8; }
.employee-kpi-stats { display:grid; grid-template-columns:repeat(4,minmax(130px,1fr)); gap:10px; }
.employee-kpi-stats div { background:rgba(255,255,255,.035); border:1px solid var(--line); border-radius:13px; padding:11px 12px; min-width:0; }
.employee-kpi-stats span { display:block; font-size:11px; color:var(--muted); margin-bottom:6px; }
.employee-kpi-stats strong { font-size:16px; color:var(--text); overflow-wrap:anywhere; }
.load-bar { height:7px; background:rgba(255,255,255,.065); border-radius:999px; overflow:hidden; margin-top:14px; }
.load-bar i { display:block; height:100%; background:linear-gradient(90deg,var(--violet),var(--blue)); border-radius:999px; transition:width .25s ease; }
.employee-toggle { display:flex; align-items:center; gap:7px; margin-top:11px; color:#a9c5ff; font-size:13px; font-weight:800; }
.employee-toggle i { font-style:normal; }
.employee-task-list { border-top:1px solid var(--line); background:rgba(7,12,21,.28); padding:14px; }
.employee-task-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:14px; }
.employee-task-table { min-width:1120px; width:100%; border-collapse:collapse; }
.employee-task-table th,.employee-task-table td { padding:11px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
.employee-task-table th { font-size:11px; color:var(--muted); background:rgba(255,255,255,.025); position:sticky; top:0; }
.employee-task-table tbody tr:hover { background:rgba(255,255,255,.025); }
.employee-task-text { min-width:280px; max-width:480px; line-height:1.4; }
.kpi-empty { padding:34px; text-align:center; color:var(--muted); border:1px dashed var(--line); border-radius:16px; }
@media (max-width: 1180px) { .employee-kpi-stats { grid-template-columns:repeat(2,1fr); } }
@media (max-width: 720px) {
  .employee-kpi-section { padding:14px; border-radius:18px; }
  .employee-kpi-header, .employee-kpi-topline { align-items:stretch; flex-direction:column; }
  .employee-kpi-score { width:100%; text-align:left; }
  .employee-kpi-stats { grid-template-columns:1fr; }
}

.employee-kpi-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; flex-wrap:wrap; }
.employee-kpi-tabs { margin:0; }

.downtime-section { display:grid; gap:20px; }
.downtime-section[hidden] { display:none; }
.downtime-summary {
  display:grid;
  grid-template-columns:repeat(3,minmax(180px,1fr));
  gap:14px;
}
.downtime-summary > div {
  padding:18px 20px;
  border:1px solid var(--line);
  border-radius:18px;
  background:linear-gradient(180deg,rgba(255,255,255,.065),rgba(255,255,255,.025));
}
.downtime-summary span { display:block; color:var(--muted); font-size:13px; margin-bottom:8px; }
.downtime-summary strong { font-size:24px; }
.downtime-equipment-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(280px,1fr));
  gap:14px;
}
.downtime-equipment-card {
  padding:18px;
  border:1px solid var(--line);
  border-left:4px solid #52627c;
  border-radius:18px;
  background:rgba(255,255,255,.035);
}
.downtime-equipment-card.active {
  border-left-color:var(--red);
  box-shadow:0 0 0 1px rgba(255,86,119,.12);
}
.downtime-equipment-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:16px; }
.downtime-equipment-head h3 { margin:0; }
.downtime-equipment-head span { color:var(--muted); font-size:12px; }
.downtime-equipment-card.active .downtime-equipment-head span { color:#ff9caf; font-weight:800; }
.downtime-equipment-metrics { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.downtime-equipment-metrics div { padding:11px; border-radius:12px; background:rgba(255,255,255,.035); }
.downtime-equipment-metrics span { display:block; color:var(--muted); font-size:11px; margin-bottom:5px; }
.downtime-equipment-metrics strong { font-size:14px; }
.downtime-table-card { margin:0; }
.downtime-table { min-width:1540px; }
.downtime-table th,.downtime-table td { padding:12px 10px; vertical-align:top; }
.downtime-text { min-width:260px; max-width:380px; white-space:normal; }
.downtime-active-row { background:rgba(255,86,119,.055); }
.report-downtime { margin-bottom:18px; }
.report-downtime-row {
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
}
.report-downtime-row span { color:var(--muted); text-align:right; }
.report-downtime-total {
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:14px 12px 0;
}

.repair-section { display:grid; gap:20px; }
.repair-section[hidden] { display:none; }
.repair-table-card { margin:0; }
.repair-table { min-width:1780px; }
.repair-table th,.repair-table td { padding:12px 10px; vertical-align:top; }
.repair-text { min-width:260px; max-width:380px; white-space:normal; }
.repair-reason { min-width:210px; max-width:320px; white-space:normal; }
.repair-complete-btn {
  padding:8px 12px;
  border-radius:10px;
  border:1px solid rgba(53,208,127,.38);
  background:rgba(53,208,127,.13);
  color:#caffdf;
  font:inherit;
  font-weight:800;
  cursor:pointer;
}
.repair-complete-btn:hover { background:rgba(53,208,127,.23); }
.repair-complete-btn:disabled { opacity:.55; cursor:wait; }
.repair-start-btn {
  padding:8px 11px; border-radius:9px; border:1px solid rgba(255,180,72,.45);
  background:rgba(255,180,72,.14); color:#ffe4b7; font:inherit; font-weight:750; cursor:pointer;
}
.date-filter { display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:13px; }
.date-filter input {
  border:1px solid var(--line); background:var(--card); color:var(--text);
  border-radius:9px; padding:7px 9px; color-scheme:dark;
}

@media (max-width:900px) {
  .downtime-summary { grid-template-columns:1fr; }
  .downtime-equipment-grid { grid-template-columns:1fr; }
  .downtime-tabs { width:100%; overflow-x:auto; }
  .downtime-tabs .period-tab { flex:0 0 auto; }
  .repair-tabs { width:100%; overflow-x:auto; }
  .repair-tabs .period-tab { flex:0 0 auto; }
  .date-filter { width:100%; }
}

@media (max-width:560px) {
  .downtime-equipment-metrics { grid-template-columns:1fr; }
  .downtime-equipment-head,.report-downtime-row,.report-downtime-total { align-items:flex-start; flex-direction:column; }
  .report-downtime-row span { text-align:left; }
}
@media (max-width: 720px) {
  .employee-kpi-actions { width:100%; justify-content:flex-start; }
  .employee-kpi-tabs { width:100%; }
  .employee-kpi-tabs .period-tab { flex:1; text-align:center; }
}

/* Dashboard authentication */
.current-user {
  display:grid;
  gap:2px;
  min-width:150px;
  padding:9px 13px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(21,31,47,.85);
}
.current-user span { color:var(--text); font-size:13px; font-weight:750; overflow-wrap:anywhere; }
.current-user strong { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
.profile-link { display:flex; align-items:center; gap:10px; min-width:185px; color:var(--text); text-decoration:none; transition:border-color .15s,background .15s; }
.profile-link:hover { border-color:rgba(79,140,255,.5); background:rgba(45,65,97,.8); }
.profile-link .profile-avatar { display:grid; place-items:center; flex:0 0 34px; width:34px; height:34px; border-radius:11px; background:linear-gradient(135deg,var(--blue),var(--violet)); color:#fff; font-size:16px; font-weight:850; }
.profile-link .profile-identity { display:grid; gap:2px; min-width:0; }
.profile-link .profile-identity span { color:var(--text); font-size:13px; font-weight:750; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-link .profile-chevron { margin-left:auto; color:var(--muted); font-size:22px; line-height:1; }
.logout-form { margin:0; }
.logout-btn {
  height:100%;
  min-height:42px;
  padding:9px 14px;
  border:1px solid rgba(255,77,103,.28);
  border-radius:14px;
  background:rgba(255,77,103,.1);
  color:#ffd9df;
  font:inherit;
  font-weight:750;
  cursor:pointer;
}
.logout-btn:hover { background:rgba(255,77,103,.18); border-color:rgba(255,77,103,.48); }

.login-page {
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}
.login-shell { width:min(440px,100%); }
.login-card {
  padding:30px;
  border:1px solid var(--line);
  border-radius:26px;
  background:rgba(21,31,47,.94);
  box-shadow:0 28px 90px rgba(0,0,0,.38);
  backdrop-filter:blur(18px);
}
.login-brand { display:flex; align-items:center; gap:14px; margin-bottom:30px; }
.login-brand .brand-mark { flex:0 0 auto; }
.login-heading h1 { font-size:30px; }
.login-heading p { line-height:1.5; }
.login-form { display:grid; gap:18px; margin-top:24px; }
.login-form label { display:grid; gap:8px; color:var(--muted); font-size:13px; font-weight:700; }
.login-form input[type="text"],
.login-form input[type="password"] {
  width:100%;
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  outline:none;
  background:rgba(255,255,255,.055);
  color:var(--text);
}
.login-form input:focus { border-color:rgba(79,140,255,.62); box-shadow:0 0 0 3px rgba(79,140,255,.12); }
.remember-row {
  display:flex !important;
  align-items:center;
  gap:10px !important;
  width:max-content;
  max-width:100%;
  color:var(--text) !important;
  cursor:pointer;
  user-select:none;
}
.remember-row input {
  width:18px;
  height:18px;
  margin:0;
  accent-color:var(--blue);
  cursor:pointer;
}
.remember-row span { font-size:14px; }
.login-submit {
  padding:13px 16px;
  border:1px solid rgba(79,140,255,.5);
  border-radius:14px;
  background:linear-gradient(135deg,var(--blue),var(--violet));
  color:#fff;
  font:inherit;
  font-weight:850;
  cursor:pointer;
}
.login-submit:hover { filter:brightness(1.08); }
.login-message { margin-top:18px; padding:12px 14px; border-radius:13px; line-height:1.45; font-size:13px; }
.login-message.error { color:#ffd9df; background:rgba(255,77,103,.14); border:1px solid rgba(255,77,103,.28); }
.login-message.warning { color:#fff1c5; background:rgba(248,196,73,.12); border:1px solid rgba(248,196,73,.25); }

@media (max-width:720px) {
  .top-actions { align-items:stretch; flex-wrap:wrap; }
  .current-user { flex:1 1 100%; }
  .logout-form { flex:1; }
  .logout-btn { width:100%; }
}
@media (max-width:480px) {
  .login-page { padding:16px; }
  .login-card { padding:22px; border-radius:20px; }
  .login-heading h1 { font-size:27px; }
}
