/* ============================================================
   QarzdorlikPro — Complete Styles
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  /* Dark theme (default) */
  --bg-main: #0f0f1a;
  --bg-card: #161625;
  --bg-card-2: #1a1a2e;
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.35);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --scrollbar-thumb: rgba(99, 102, 241, 0.25);
  --table-head-bg: #1e1e35;
  --table-row-hover: rgba(99, 102, 241, 0.05);
  --sidebar-w: 200px;
}

[data-theme="light"] {
  --bg-main: #f0f2f8;
  --bg-card: #ffffff;
  --bg-card-2: #f4f6fc;
  --bg-glass: rgba(0, 0, 0, 0.03);
  --border: rgba(0, 0, 0, 0.09);
  --border-hover: rgba(99, 102, 241, 0.4);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --scrollbar-thumb: rgba(99, 102, 241, 0.2);
  --table-head-bg: #eef0fb;
  --table-row-hover: rgba(99, 102, 241, 0.04);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Layout ---- */
.dashboard-screen {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR REMOVED */

/* ======================================================
   TOPBAR
   ====================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-card);
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}



.page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.analytics-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.1));
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}

.analytics-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(52, 211, 153, 0.15));
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.2);
}

.analytics-toggle-btn.active {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}


.topbar-upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.14));
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  user-select: none;
}

.topbar-upload-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(139, 92, 246, 0.22));
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
}

.theme-icon-sun,
.theme-icon-moon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.logout-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.07);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}


/* ======================================================
   SMART FILTERS BAR
   ====================================================== */
.smart-filters-bar {
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  flex-shrink: 0;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

/* Sheet tab buttons */
.sheet-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.sheet-tab-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-transform: capitalize;
}

.sheet-tab-btn:hover {
  border-color: var(--border-hover);
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.07);
}

.sheet-tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

/* Rayon select */
.filter-select {
  padding: 6px 28px 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 140px;
  max-width: 220px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Search box */
.search-box-sm {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  transition: all 0.2s;
}

.search-box-sm:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box-sm svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box-sm input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.search-box-sm input::placeholder {
  color: var(--text-muted);
}

/* Reset button */
.reset-filters-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.reset-filters-btn:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Only debtors toggle */
.only-debtors-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: transparent;
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.only-debtors-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
}

.only-debtors-btn.active {
  background: rgba(239, 68, 68, 0.18);
  border-color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

/* Date inputs */
.filter-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.filter-dash {
  font-size: 12px;
  color: var(--text-muted);
}

.filter-date {
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-date:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Colorize date picker icon for dark mode */
[data-theme="dark"] .filter-date::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Quick day buttons */
.quick-day-btns {
  display: flex;
  gap: 4px;
}

.quick-day-btn {
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.quick-day-btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.07);
}

.quick-day-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: var(--primary-light);
}



/* Debt range */
.debt-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-input-sm {
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  transition: all 0.2s;
  width: 110px;
  -moz-appearance: textfield;
  /* Firefox: remove spinners */
}

.filter-input-sm::-webkit-outer-spin-button,
.filter-input-sm::-webkit-inner-spin-button {
  -webkit-appearance: none;
  /* Chrome/Edge/Safari: remove spinners */
  margin: 0;
}

.filter-input-sm:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.filter-input-sm::placeholder {
  color: var(--text-muted);
}

/* ======================================================
   VIEWS CONTAINER
   ====================================================== */
.views-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  scroll-behavior: smooth;
}

.views-container::-webkit-scrollbar {
  width: 5px;
}

.views-container::-webkit-scrollbar-track {
  background: transparent;
}

.views-container::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

/* ======================================================
   SUMMARY CARDS
   ====================================================== */
.summary-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* ======================================================
   MONTHLY RAYON ALERTS
   ====================================================== */
.monthly-rayon-alerts-wrapper {
  margin-bottom: 16px;
}

.month-alerts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.month-alert-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.month-alert-col-header {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-light);
  background: rgba(99,102,241,0.07);
  border-bottom: 1px solid var(--border);
}

.month-alert-col-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: none;
}
.month-alert-col-cards::-webkit-scrollbar { display: none; }

.r-mini-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}

.r-mini-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.r-mini-info {
  flex: 1;
  min-width: 0;
}

.r-mini-rayon {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-mini-stats {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.r-mini-perc {
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.r-no-data {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

.sum-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.25s;
}

.sum-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

/* ======================================================
   RAYON ALERT CARDS (integrated into summary row)
   ====================================================== */
.r-alert-card {
  background: rgba(239, 68, 68, 0.05) !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
  cursor: default;
}

.r-alert-card:hover {
  border-color: rgba(239, 68, 68, 0.45) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

.r-alert-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.r-alert-info {
  flex: 1;
  min-width: 0;
}

.r-alert-rayon {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-alert-stats {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.r-alert-perc {
  font-size: 22px;
  font-weight: 900;
  color: #ef4444;
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 4px;
}

.sum-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sum-card-info {
  flex: 1;
  min-width: 0;
}

.sum-card-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.sum-card-value {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ======================================================
   TABLE CONTROLS
   ====================================================== */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.result-count {
  font-size: 13px;
  color: var(--text-muted);
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 8px;
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.export-btn:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.38);
}

/* ======================================================
   DATA TABLE
   ====================================================== */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: calc(100vh - 290px);
}

.table-wrapper::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

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

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.data-table th {
  padding: 11px 14px;
  background: var(--table-head-bg);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  transition: color 0.2s;
}

.data-table th:hover {
  color: var(--text-primary);
}

.data-table th.sort-asc::after {
  content: ' ↑';
  color: var(--primary-light);
}

.data-table th.sort-desc::after {
  content: ' ↓';
  color: var(--primary-light);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--table-row-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Column-specific styles */
.data-table th.th-idx,
.data-table td.cell-idx {
  width: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
}

.data-table th.th-num {
  text-align: right;
}

.data-table td.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.cell-name {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.cell-rayon {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
}

.cell-debt {
  color: #f87171;
}

.cell-pay {
  color: #34d399;
}

.cell-date {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  padding-right: 16px;
}

/* Итоговая Сумма coloring */
.total-pos {
  color: #10b981 !important;
  font-weight: 700;
}

.total-neg {
  color: #ef4444 !important;
  font-weight: 700;
}

/* ======================================================
   DUPLICATE CLIENT ROW
   ====================================================== */
.data-table tbody tr.duplicate-row {
  background: rgba(234, 179, 8, 0.06);
  border-left: 3px solid rgba(234, 179, 8, 0.6);
}

.data-table tbody tr.duplicate-row:hover {
  background: rgba(234, 179, 8, 0.12);
}

[data-theme="light"] .data-table tbody tr.duplicate-row {
  background: rgba(234, 179, 8, 0.08);
}

[data-theme="light"] .data-table tbody tr.duplicate-row:hover {
  background: rgba(234, 179, 8, 0.15);
}

/* Badge: "N ta rayon" */
.dup-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 7px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  cursor: default;
  vertical-align: middle;
  transition: background 0.15s;
}

.dup-badge:hover {
  background: rgba(234, 179, 8, 0.28);
}

/* Modal: duplicate rayons info panel */
.dup-rayons-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: 10px;
  font-size: 12px;
  color: #fbbf24;
}

.dup-rayons-info svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.dup-rayons-info-text {
  line-height: 1.5;
}

.dup-rayons-info strong {
  color: #fde68a;
}

/* ======================================================
   EMPTY STATES
   ====================================================== */
.empty-state {
  text-align: center;
  padding: 50px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 14px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
}

.empty-dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.empty-dashboard-icon {
  margin-bottom: 24px;
  animation: iconBob 3s ease-in-out infinite;
}

@keyframes iconBob {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-8px)
  }
}

.empty-dashboard h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.empty-dashboard p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.empty-dashboard p strong {
  color: var(--primary-light);
}

.empty-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  user-select: none;
}

.empty-upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

/* ======================================================
   UPLOAD TOAST
   ====================================================== */
.upload-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
  from {
    transform: translateY(20px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

.toast-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-width: 260px;
}

.toast-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
}

.toast-bar-wrap {
  height: 4px;
  background: var(--bg-glass);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.toast-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0;
}

/* ======================================================
   MOBILE OVERLAY
   ====================================================== */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(4px);
}

.mobile-overlay.visible {
  display: block;
}

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 768px) {
  .debt-range {
    margin-left: 0;
  }

  /* Filter bar: gorizontal scroll */
  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    padding-bottom: 2px;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  /* Kichik elementlar */
  .filter-select {
    min-width: 120px;
  }

  .search-box-sm {
    min-width: 140px;
  }

  .debt-range {
    flex-shrink: 0;
  }

  /* Touch-friendly minimum o'lchami */
  .quick-day-btn,
  .sheet-tab-btn,
  .only-debtors-btn,
  .reset-filters-btn {
    min-height: 36px;
  }
}

@media (max-width: 600px) {
  .summary-cards-row {
    grid-template-columns: 1fr 1fr;
  }

  .quick-day-btns {
    gap: 3px;
  }

  .quick-day-btn {
    padding: 4px 7px;
    font-size: 10px;
  }
}

/* ======================================================
   ADVANCED ANALYTICS VIEW
   ====================================================== */
.analytics-header {
  margin-bottom: 24px;
}

.analytics-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.analytics-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.analytics-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.akpi-card {
  background: linear-gradient(145deg, rgba(30, 30, 53, 0.7), rgba(22, 22, 37, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.akpi-card:hover {
  transform: translateY(-3px);
}

.akpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.akpi-info {
  flex: 1;
  min-width: 0;
}

.akpi-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  white-space: nowrap;
}

.akpi-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1100px) {
  .analytics-kpi-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .analytics-kpi-row {
    grid-template-columns: 1fr;
  }
}

.analytics-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.achart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.achart-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.achart-card.full-width {
  grid-column: 1 / -1;
}

.achart-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
}

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

/* ======================================================
   DOCS MODAL 
   ====================================================== */
.doc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.doc-modal-overlay.show {
  display: flex;
  opacity: 1;
}

.doc-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.doc-modal-overlay.show .doc-modal-content {
  transform: scale(1);
}

.doc-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.doc-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.modal-client-rayon {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-glass);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
}

.doc-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  padding: 0 4px;
}

.doc-modal-close:hover {
  color: var(--danger);
}

.doc-modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.doc-modal-body::-webkit-scrollbar {
  display: none;
}

.doc-modal-body .data-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.doc-modal-body table {
  margin: 0;
}

.doc-modal-body table th {
  background: rgba(99, 102, 241, 0.1);
}

#modal-docs-tfoot td {
  background: var(--table-head-bg);
  font-weight: 700;
  color: var(--text-primary);
  border-top: 2px solid var(--border);
}

#debt-tbody tr:hover {
  cursor: pointer;
}

.doc-modal-body tbody tr {
  transition: all 0.2s ease;
}

.doc-modal-body tbody tr:hover td {
  background: rgba(99, 102, 241, 0.08) !important;
}

/* Monthly Stats */
.monthly-stats-container {
  margin-bottom: 20px;
}

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

.m-card {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: default;
}

.m-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

.m-month {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: capitalize;
}

.m-stat {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.show-all-months-btn {
  margin-top: 12px;
  background: transparent;
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: block;
  width: 100%;
  text-align: center;
}

.show-all-months-btn:hover,
.show-all-months-btn.active {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
}