:root {
  --primary: #7B2D8E;
  --primary-dark: #5E2270;
  --primary-light: #9B4DB8;
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--surface);
  border-bottom: 3px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 100%;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: opacity 0.15s;
}

.site-title:hover { opacity: 0.8; }

.mobile-title { display: none; }

@media (max-width: 768px) {
  .desktop-title { display: none; }
  .mobile-title { display: inline; }
}

.header-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary);
  color: white;
}

.main {
  width: 100%;
  padding: 32px 24px;
  flex: 1;
}

.container {
  width: 100%;
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.report-card-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.report-card-title {
  font-size: 18px;
  font-weight: 600;
}

.report-card-link {
  color: var(--primary);
  font-weight: 500;
  font-size: 14px;
}

.loading, .empty {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
  font-size: 16px;
}

.error {
  color: var(--danger);
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.month-selector {
  display: flex;
  gap: 8px;
}

.month-selector select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  cursor: pointer;
}

.info-banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 14px;
}

.info-banner-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-banner-label {
  font-size: 12px;
  opacity: 0.85;
}

.info-banner-value {
  font-weight: 600;
  font-size: 15px;
}

.filter-section {
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.filter-toggle {
  padding: 12px 16px;
  background: var(--bg);
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}

.filter-toggle:hover {
  background: var(--border);
}

.filter-toggle .arrow {
  transition: transform 0.2s;
}

.filter-toggle.open .arrow {
  transform: rotate(180deg);
}

.filter-content {
  padding: 12px 16px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-content.open {
  display: flex;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: all 0.15s;
}

.filter-checkbox:hover {
  border-color: var(--primary);
}

.filter-checkbox input {
  accent-color: var(--primary);
}

.table-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 32px;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 800px;
}

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

.data-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  font-weight: 500;
  min-width: 160px;
}

.data-table th:first-child {
  z-index: 3;
  background: var(--bg);
}

.data-table .row-branch {
  font-weight: 600;
  background: #F8F0FC;
}

.data-table .row-branch td:first-child {
  background: #F8F0FC;
}

.inline-dyn {
  font-size: 12px;
  font-weight: 500;
  display: block;
  margin-top: 2px;
}

.dyn-positive { color: var(--success); }
.dyn-negative { color: var(--danger); }
.dyn-zero { color: var(--warning); }

.val-green { color: var(--success); font-weight: 600; }
.val-yellow { color: var(--warning); font-weight: 600; }
.val-red { color: var(--danger); font-weight: 600; }
.val-neutral { color: var(--text); }

.bi-date-cell {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

.chart-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 32px;
}

.chart-scroll {
  overflow-x: auto;
  min-height: 400px;
}

.chart-scroll canvas {
  min-width: 800px;
  height: 400px !important;
}

.mobile-toggle {
  display: none;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 16px;
}

.mobile-toggle:hover {
  background: var(--primary-dark);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123, 45, 142, 0.15);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-login {
  max-width: 400px;
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-login h2 {
  margin-bottom: 24px;
  font-size: 20px;
}

.upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-upload {
  max-width: 600px;
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #FEF2F2;
  border-radius: var(--radius);
}

.upload-status {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.upload-status.success {
  background: #ECFDF5;
  color: var(--success);
  border: 1px solid #A7F3D0;
}

.upload-status.error {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
}

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.footer-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-contact-name {
  font-weight: 500;
  color: var(--text);
}

.footer-contact a {
  color: var(--primary);
  text-decoration: none;
}

.footer-contact a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .site-title { font-size: 15px; }
  .header-content { padding: 0 12px; }
  .main { padding: 20px 12px; overflow-x: hidden; }
  .page-title { font-size: 22px; }
  .report-header { flex-direction: column; align-items: flex-start; }
  .info-banner { flex-direction: column; gap: 12px; }
  .footer-contacts { flex-direction: column; gap: 16px; }

  .mobile-toggle { display: inline-block; }
  .desktop-only { display: none; }
  .mobile-full-table { display: none; }
  .mobile-hide { display: none !important; }
}
