﻿:root {
  color-scheme: dark;
  --bg: #0b1117;
  --surface: #121a23;
  --surface-soft: #182330;
  --surface-strong: #1f2d3b;
  --line: #263544;
  --line-strong: #344657;
  --text: #eef4f8;
  --muted: #92a2b2;
  --brand: #d3182a;
  --brand-dark: #a90f1e;
  --accent: #24b47e;
  --warning: #f5b84b;
  --danger: #ff5c5c;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at top left, #17212c 0, var(--bg) 36%, #080c11 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 18, 25, 0.94);
  backdrop-filter: blur(12px);
  color: var(--text);
  padding: 12px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.nav-item {
  width: auto;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
}

.nav-item.active,
.nav-item:hover {
  background: var(--surface-strong);
  border-color: var(--line-strong);
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  margin-bottom: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

.topbar p,
.detail-head p {
  margin-top: 4px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.primary-button,
.secondary-button,
.success-button,
.danger-button {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.primary-button {
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.success-button {
  background: var(--accent);
  color: #ffffff;
}

.danger-button {
  background: #331719;
  border-color: #673038;
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  text-align: left;
}

.metric.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  margin-top: 8px;
  font-size: 24px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(360px, 440px);
  gap: 14px;
  align-items: start;
}

.list-pane,
.detail-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 240px;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 190px;
  line-height: 1.45;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 214px);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th:nth-child(1),
td:nth-child(1) {
  width: 36%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 26%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 18%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 20%;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

tr.case-row {
  background: var(--surface);
}

tr.case-row:hover,
tr.case-row.selected {
  background: #172637;
}

.case-main strong,
.case-main span {
  display: block;
}

.case-main span {
  margin-top: 4px;
  color: var(--muted);
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge {
  background: #223143;
  color: #314255;
}

.status-pill {
  background: #152941;
  color: var(--brand);
}

.status-pill.warning {
  background: #3a2b12;
  color: var(--warning);
}

.status-pill.success {
  background: #123528;
  color: var(--accent);
}

.status-pill.danger {
  background: #3a1717;
  color: var(--danger);
}

.due {
  font-weight: 700;
}

.due.overdue {
  color: var(--danger);
}

.detail-pane {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-head h2 {
  margin-top: 8px;
  font-size: 19px;
  line-height: 1.25;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.facts div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 9px;
}

.facts dt {
  color: var(--muted);
  font-size: 12px;
}

.facts dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.mail-preview,
.timeline {
  display: grid;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title h3,
.timeline h3 {
  font-size: 15px;
}

.timeline ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.timeline li {
  color: var(--muted);
}

.timeline strong {
  color: var(--text);
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 380px;
  min-height: 40px;
  border-radius: 8px;
  background: #1f2d3b;
  color: #ffffff;
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .report-layout {
    grid-template-columns: 1fr;
  }


  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-pane {
    position: static;
  }
}

@media (max-width: 720px) {
  .report-form,
  .report-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .workspace {
    padding: 12px;
  }

  .topbar,
  .sidebar,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .toolbar,
  .facts,
  .action-bar {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 21px;
  }
}

.view-hidden {
  display: none !important;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: start;
}

.report-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.report-panel h2,
.report-panel h3 {
  margin-bottom: 8px;
}

.report-panel p {
  color: var(--muted);
  margin-bottom: 16px;
}

.report-form {
  display: grid;
  grid-template-columns: 180px minmax(260px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.report-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.command-preview {
  min-height: 42px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d141c;
  color: var(--text);
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.report-facts div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 10px;
}

.report-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.report-facts dd {
  margin: 5px 0 0;
  font-weight: 700;
}

.module-layout {
  display: grid;
  gap: 14px;
}

.module-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #172330, #101820 62%, #240b12);
  box-shadow: var(--shadow);
  padding: 20px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.module-hero h2 {
  margin-top: 8px;
  font-size: 24px;
}

.module-hero p {
  margin-top: 8px;
  color: var(--muted);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.module-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.module-card h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.module-card p {
  color: var(--muted);
  line-height: 1.45;
}

.module-card code {
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d141c;
  color: var(--text);
  padding: 8px;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .module-grid {
    grid-template-columns: 1fr;
  }
}


.dashboard-layout {
  display: grid;
  gap: 14px;
}

.dashboard-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #182432, #101821 62%, #260c14);
  box-shadow: var(--shadow);
  padding: 18px;
}

.dashboard-headline h2 {
  margin-top: 6px;
  font-size: 24px;
}

.dashboard-headline p {
  margin-top: 6px;
  color: var(--muted);
}

.refresh-chip {
  display: grid;
  gap: 4px;
  min-width: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 20, 28, 0.82);
  padding: 10px;
  text-align: right;
}

.refresh-chip span {
  color: var(--muted);
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.kpi-card.primary {
  border-color: rgba(211, 24, 42, 0.58);
  background: linear-gradient(145deg, rgba(211, 24, 42, 0.18), var(--surface) 56%);
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
}

.kpi-card strong {
  font-size: 31px;
  line-height: 1;
}

.good { color: #53d769 !important; }
.warn { color: #ffc400 !important; }
.bad { color: #ff4d4f !important; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-grid.bottom {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.chart-panel,
.table-panel,
.alert-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.chart-panel.wide {
  min-height: 312px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
}

.line-chart {
  position: relative;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d141c;
  overflow: hidden;
}

.line-chart svg {
  position: absolute;
  inset: 18px 18px 48px 54px;
  width: calc(100% - 72px);
  height: calc(100% - 66px);
}

.success-line {
  fill: none;
  stroke: #53d769;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.target-line {
  stroke: rgba(255, 196, 0, 0.56);
  stroke-dasharray: 4 4;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.daily-bars {
  position: absolute;
  left: 54px;
  right: 18px;
  bottom: 14px;
  height: 44px;
}

.daily-bars span {
  position: absolute;
  bottom: 0;
  border-radius: 4px 4px 0 0;
  background: rgba(80, 145, 255, 0.52);
}

.zone-bars {
  display: grid;
  gap: 12px;
}

.zone-bars.compact {
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 48px;
  gap: 10px;
  align-items: center;
}

.bar-meta strong,
.bar-meta span {
  display: block;
}

.bar-meta span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: #0d141c;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.bar-row b {
  text-align: right;
}

.dashboard-table-wrap {
  max-height: none;
}

.dashboard-table-wrap th:nth-child(1),
.dashboard-table-wrap td:nth-child(1) { width: 34%; }
.dashboard-table-wrap th:nth-child(2),
.dashboard-table-wrap td:nth-child(2),
.dashboard-table-wrap th:nth-child(3),
.dashboard-table-wrap td:nth-child(3),
.dashboard-table-wrap th:nth-child(4),
.dashboard-table-wrap td:nth-child(4) { width: 16%; }
.dashboard-table-wrap th:nth-child(5),
.dashboard-table-wrap td:nth-child(5) { width: 18%; }

.rate-pill {
  display: inline-flex;
  min-width: 52px;
  justify-content: center;
  border-radius: 999px;
  background: #0d141c;
  padding: 4px 8px;
  font-weight: 800;
}

.alerts {
  display: grid;
  gap: 10px;
}

.alert-card {
  border: 1px solid var(--line);
  border-left: 4px solid #5091ff;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.alert-card.warning { border-left-color: #ffc400; }
.alert-card.success { border-left-color: #53d769; }
.alert-card p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .dashboard-grid,
  .dashboard-grid.bottom {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-headline,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .dashboard-grid,
  .dashboard-grid.bottom {
    grid-template-columns: 1fr;
  }

  .bar-row,
  .daily-detail {
    grid-template-columns: 1fr;
  }

  .refresh-chip {
    text-align: left;
  }
}

.daily-visual {
  position: relative;
  min-height: 192px;
  border-bottom: 1px solid var(--line);
}

.chart-scale {
  position: absolute;
  inset: 18px auto 48px 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.daily-detail {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, minmax(92px, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 35, 48, 0.72);
}

.daily-detail div {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d141c;
  padding: 9px;
}

.daily-detail span {
  color: var(--muted);
  font-size: 12px;
}

.daily-detail strong {
  font-size: 18px;
}

.daily-chip-row {
  display: grid;
  grid-template-columns: repeat(31, minmax(70px, 1fr));
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
}

.daily-chip {
  display: grid;
  gap: 3px;
  min-width: 70px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d141c;
  color: var(--text);
  padding: 7px;
  text-align: left;
}

.daily-chip:hover,
.daily-chip.selected {
  border-color: var(--brand);
  background: #1b2430;
}

.daily-chip span,
.daily-chip small {
  color: var(--muted);
  font-size: 11px;
}

.daily-chip strong {
  font-size: 16px;
}

.daily-bar {
  position: absolute;
  bottom: 0;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: rgba(80, 145, 255, 0.52);
  padding: 0;
}

.daily-bar:hover,
.daily-bar.selected {
  background: var(--brand);
}

.refresh-box {
  display: grid;
  gap: 8px;
  min-width: 156px;
}

.force-refresh-button {
  min-height: 36px;
  border: 1px solid rgba(211, 24, 42, 0.6);
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  padding: 0 12px;
  font-weight: 800;
  white-space: nowrap;
}

.force-refresh-button:hover {
  background: var(--brand-dark);
}

.force-refresh-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #0d141c;
  color: var(--muted);
  padding: 16px;
  line-height: 1.45;
}
