:root {
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #10b981;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.brand-header {
  padding: 0 20px 20px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.nav-links {
  list-style: none;
  margin-top: 15px;
}

.nav-links a {
  display: block;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  background: var(--accent);
  color: #fff;
}

.main-wrapper {
  flex-grow: 1;
  padding: 24px;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 14px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
}

/* ФИЛТЪР ЗА ПЕРИОД */
.filter-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-select, .form-date-input, .form-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-primary-sm {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary-sm:hover {
  background: var(--accent-hover);
}

.range-display {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* 8 KPI КАРТИ В ЕДИН РЕД */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-card {
  background: var(--bg-surface);
  padding: 12px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
}

.kpi-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 4px;
  white-space: nowrap;
}

.card-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

/* КОМПАКТНА ТАБЛИЦА БЕЗ СКРОЛБАР */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table th, .data-table td {
  padding: 8px 5px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th:first-child, .data-table td:first-child {
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  background: rgba(0,0,0,0.15);
  font-weight: 600;
  font-size: 0.73rem;
  letter-spacing: 0.02em;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.user-profile-card {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.4);
  margin-top: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.user-details {
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  width: 100%;
  background: #dc2626;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: #b91c1c;
}
