html {
  min-width: 375px;
  /* Отключение масштабирования на Android */
  touch-action: pan-x pan-y;
  -webkit-touch-callout: none;
  -ms-touch-action: pan-x pan-y;
}

body {
  font-family: 'Onest', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  margin: 0;
  background: #f6f7fb;
  color: #333;
  min-width: 375px;
  /* Поддержка pull-to-refresh */
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  /* Отключение масштабирования на Android */
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
  -ms-touch-action: pan-x pan-y;
}

/* Разрешаем выделение текста в полях ввода */
input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 80px; /* Отступ для нижнего меню */
  /* Для pull-to-refresh */
  will-change: transform;
}
header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e0e0e0;
}
header h1 {
  margin: 0;
  font-size: 24px;
  color: #111;
}

/* Нижнее мобильное меню */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  z-index: 1000;
  /* Поддержка safe area для устройств с вырезом */
  padding-bottom: max(8px, calc(8px + env(safe-area-inset-bottom)));
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: #999;
  transition: all 0.2s;
  padding: 4px 12px;
  flex: 1;
  text-align: center;
}

.bottom-nav .nav-item svg {
  stroke: currentColor;
  display: block;
  margin: 0 auto;
}

.bottom-nav .nav-item span {
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  display: block;
}

.bottom-nav .nav-item.active {
  color: #111;
}

.bottom-nav .nav-item:hover {
  color: #111;
}

/* Pull to Refresh индикатор */
#pull-refresh-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  background: transparent;
}

#pull-refresh-indicator.active {
  opacity: 1;
}

#pull-refresh-indicator.refreshing {
  opacity: 1;
}

.pull-refresh-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e0e0e0;
  border-top-color: #111;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

#pull-refresh-indicator.refreshing .pull-refresh-spinner {
  animation: spin 0.6s linear infinite;
}

.pull-refresh-text {
  font-size: 12px;
  color: #666;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Profile page styles */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  flex-shrink: 0;
}

.profile-name-section {
  flex: 1;
}

.profile-name-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-name-text {
  font-size: 20px;
  font-weight: 600;
  color: #111;
}

.edit-name-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.edit-name-btn:hover {
  background: #f0f0f0;
  color: #111;
}

.profile-name-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-name-edit .form-control {
  flex: 1;
  min-width: 200px;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #c82333;
  opacity: 1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
h1, h2 {
  margin: 0 0 16px;
  color: #111;
}
h2 {
  font-size: 18px;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}
/* Обертка для таблиц для responsive */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
  position: relative;
}

/* Исключаем datepicker из влияния table-wrapper */
.table-wrapper .custom-datepicker,
.custom-datepicker {
  position: absolute !important;
  z-index: 10000;
  overflow: visible !important;
}

/* Стили для скроллбара в таблицах */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  min-width: 600px; /* Минимальная ширина для корректного отображения */
}

/* Исключаем datepicker из min-width */
.custom-datepicker .datepicker-table {
  min-width: auto !important;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  text-align: left;
  white-space: nowrap; /* Предотвращаем перенос текста в ячейках */
}

th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
  white-space: normal;
  text-align: center;
}

.table-header-hint th {
  background: #f5f5f5;
  font-weight: 400;
  font-size: 11px;
  color: #888;
  padding: 4px 12px;
  line-height: 1.3;
  border-top: none;
  font-style: italic;
  white-space: normal;
  text-align: center;
}

tbody tr:hover {
  background: #f9f9f9;
}

/* Центрирование значений в таблице monthly */
#monthly td {
  text-align: center;
}

/* Центрирование значений в таблице daily-table */
#daily-table td {
  text-align: center;
}

/* Анимация появления новых строк в daily-table */
/* Анимация появления управляется через JavaScript inline стили */

/* Мигание зеленым цветом (3 раза) для новой строки */
#daily-table .daily-row.blink-green {
  animation: blinkGreen 1.8s ease-in-out !important;
  -webkit-animation: blinkGreen 1.8s ease-in-out !important; /* Для Safari */
}

@keyframes blinkGreen {
  0% {
    background-color: transparent;
  }
  11.11% {
    background-color: #acccb5; /* Самый светлый зеленый - мигание 1 */
  }
  22.22% {
    background-color: transparent;
  }
  33.33% {
    background-color: #acccb5; /* Самый светлый зеленый - мигание 2 */
  }
  44.44% {
    background-color: transparent;
  }
  55.55% {
    background-color: #acccb5; /* Самый светлый зеленый - мигание 3 */
  }
  66.66% {
    background-color: transparent;
  }
  100% {
    background-color: transparent;
  }
}

@-webkit-keyframes blinkGreen {
  0% {
    background-color: transparent;
  }
  11.11% {
    background-color: #acccb5; /* Самый светлый зеленый - мигание 1 */
  }
  22.22% {
    background-color: transparent;
  }
  33.33% {
    background-color: #acccb5; /* Самый светлый зеленый - мигание 2 */
  }
  44.44% {
    background-color: transparent;
  }
  55.55% {
    background-color: #acccb5; /* Самый светлый зеленый - мигание 3 */
  }
  66.66% {
    background-color: transparent;
  }
  100% {
    background-color: transparent;
  }
}

/* Responsive стили для мобильных устройств */
@media (max-width: 768px) {
  .table-wrapper {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  table {
    font-size: 12px;
    min-width: 500px;
  }
  
  th, td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .table-header-hint th {
    font-size: 9px;
    padding: 3px 6px;
  }
  
  /* Для некоторых таблиц можно уменьшить минимальную ширину */
  .table-compact {
    min-width: 400px;
  }
}

@media (max-width: 480px) {
  .table-wrapper {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  
  th, td {
    padding: 6px 4px;
    font-size: 11px;
  }

  .table-header-hint th {
    font-size: 8px;
    padding: 2px 4px;
    line-height: 1.2;
  }
  
  table {
    min-width: 400px;
  }
  
  .table-compact {
    min-width: 300px;
  }
}
.daily-row.has-accordion:hover {
  background: #f0f0f0;
}
.accordion-icon {
  display: inline-block;
  font-size: 10px;
  color: #666;
  transition: transform 0.2s;
  line-height: 1;
}
.accordion-row {
  background: #f9f9f9;
}
.accordion-row td {
  border-top: none;
  border-bottom: 1px solid #e0e0e0;
}
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-primary {
  background: #111;
  color: #fff;
}
.btn-danger {
  background: #c0392b;
  color: #fff;
}
.btn-secondary {
  background: #95a5a6;
  color: #fff;
}
.close-month-btn {
  margin-top: 10px;
}
.small {
  color: #666;
  font-size: 13px;
}
input, select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
input:focus, select:focus {
  outline: none;
  border-color: #111;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #555;
}
.form-control {
  width: 100%;
  padding: 10px;
}
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.summary-item {
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}
.summary-item label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-item .value {
  font-size: 24px;
  font-weight: 600;
  color: #111;
}
.summary-item .value.positive {
  color: #27ae60;
}
.summary-item .value.negative {
  color: #e74c3c;
}
.positive {
  color: #27ae60;
  font-weight: 500;
}
.negative {
  color: #e74c3c;
  font-weight: 500;
}
.pagination {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
}
td.pagination {
  text-align: center;
}
.pagination button {
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.pagination button:hover {
  background: #f9f9f9;
}
.pagination span {
  color: #666;
  margin: 0 20px;
}
form {
  margin-top: 16px;
}
form .form-group:last-child {
  margin-bottom: 0;
}

/* Tabs styles */
.tabs {
  width: 100%;
}
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
  position: relative;
  bottom: -2px;
}
.tab-btn:hover {
  color: #111;
  background: #f9f9f9;
}
.tab-btn.active {
  color: #111;
  border-bottom-color: #111;
  background: transparent;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 500px;
  padding: 14px 20px;
  background: #333;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease-out;
  font-size: 14px;
  line-height: 1.4;
}

.toast.success {
  background: #27ae60;
}

.toast.error {
  background: #e74c3c;
}

.toast.warning {
  background: #f39c12;
}

.toast.info {
  background: #3498db;
}

.toast-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.fade-out {
  animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Custom DatePicker - PayPal inspired */
.custom-datepicker {
  position: absolute;
  z-index: 10000;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 16px;
  font-family: 'Onest', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  min-width: 280px;
  box-sizing: border-box;
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px 16px;
  position: relative;
}

.datepicker-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #111;
  padding: 0 40px; /* Отступы для кнопок навигации */
}

.datepicker-month-year {
  display: block;
}

.datepicker-month-select,
.datepicker-year-select {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  cursor: pointer;
  transition: all 0.2s ease;
}

.datepicker-month-select:hover,
.datepicker-year-select:hover {
  border-color: #0070ba;
}

.datepicker-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #666;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.datepicker-prev {
  left: 15px;
}

.datepicker-next {
  right: 15px;
}

.datepicker-nav:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

.datepicker-body {
  margin-top: 8px;
}

.datepicker-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  margin: 0;
}

.datepicker-table th {
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  border: none;
  background: transparent;
}

.datepicker-table td {
  padding: 4px;
  border: none;
  text-align: center;
}

.datepicker-day {
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #333;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.datepicker-day:hover:not([disabled]):not(.selected) {
  background: #f0f7ff;
  color: #0070ba;
}

.datepicker-day.today {
  background: #f0f7ff;
  color: #0070ba;
  font-weight: 600;
}

.datepicker-day.selected {
  background: #0070ba;
  color: #ffffff;
  font-weight: 600;
}

.datepicker-day.selected:hover {
  background: #005ea6;
}

.datepicker-day.other-month {
  opacity: 0.3;
  color: #999;
}

.datepicker-day[disabled] {
  opacity: 0.3;
  cursor: default;
  color: #ccc;
}

.datepicker-day[disabled]:hover {
  background: transparent;
}

.month-picker, .date-picker {
  cursor: pointer;
  background: #ffffff;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.month-picker:hover, .date-picker:hover {
  border-color: #0070ba;
  box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.1);
}

.month-picker:focus, .date-picker:focus {
  outline: none;
  border-color: #0070ba;
  box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.15);
}

/* Responsive DatePicker styles */
@media (max-width: 768px) {
  .custom-datepicker {
    min-width: 260px;
    padding: 12px;
    font-size: 13px;
    max-width: calc(100vw - 40px);
  }

  .datepicker-header {
    padding: 10px 12px;
  }

  .datepicker-title {
    font-size: 14px;
  }

  .datepicker-nav {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .datepicker-month-select,
  .datepicker-year-select {
    font-size: 13px;
    padding: 3px 6px;
    margin: 0 2px;
  }

  .datepicker-table {
    border-spacing: 2px;
  }

  .datepicker-table th {
    padding: 6px 2px;
    font-size: 10px;
  }

  .datepicker-table td {
    padding: 2px;
  }

  .datepicker-day {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .custom-datepicker {
    width: calc(100vw - 40px);
    padding: 10px;
    font-size: 12px;
    border-radius: 10px;
  }

  .datepicker-header {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .datepicker-title {
    font-size: 13px;
    width: 100%;
    order: 2;
    margin-top: 4px;
    padding: 0; /* На мобильных padding не нужен, так как кнопки сверху */
  }

  .datepicker-nav {
    width: 32px;
    height: 32px;
    font-size: 20px;
    position: relative;
    top: auto;
    transform: none;
    order: 1;
  }

  .datepicker-prev {
    left: auto;
    margin-right: auto;
  }

  .datepicker-next {
    right: auto;
    margin-left: auto;
  }

  .datepicker-month-select,
  .datepicker-year-select {
    font-size: 12px;
    padding: 4px 6px;
    margin: 0;
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .datepicker-body {
    margin-top: 4px;
  }

  .datepicker-table {
    border-spacing: 3px;
    width: 100%;
  }

  .datepicker-table th {
    padding: 6px 1px;
    font-size: 9px;
    letter-spacing: 0.3px;
  }

  .datepicker-table td {
    padding: 2px 1px;
  }

  .datepicker-day {
    width: 100%;
    min-width: 36px;
    height: 36px;
    font-size: 13px;
    padding: 0;
  }

  /* На очень маленьких экранах делаем календарь на всю ширину */
  @media (max-width: 360px) {
    .custom-datepicker {
      width: calc(100vw - 20px);
      padding: 8px;
    }

    .datepicker-day {
      min-width: 32px;
      height: 32px;
      font-size: 12px;
    }

    .datepicker-table th {
      font-size: 8px;
      padding: 4px 1px;
    }
  }

  /* Улучшения для touch-устройств */
  .datepicker-nav {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .datepicker-day {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Минимальный размер для удобного нажатия */
  }

  .datepicker-month-select,
  .datepicker-year-select {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Минимальный размер для удобного нажатия */
  }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.badge-success {
  background-color: #d4edda;
  color: #155724;
}

.badge-warning {
  background-color: #fff3cd;
  color: #856404;
}

.badge-danger {
  background-color: #f8d7da;
  color: #721c24;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 32px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #4CAF50;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Print styles - Printer friendly reports */
@media print {
  @page {
    margin: 1.5cm;
    size: A4;
  }

  /* Скрываем ненужные элементы */
  .bottom-nav,
  .toast-container,
  #pull-refresh-indicator,
  button,
  .btn,
  .pagination,
  .form-group,
  .tabs-nav,
  .tab-btn,
  .date-picker,
  .month-picker,
  .custom-datepicker {
    display: none !important;
  }

  /* Общие стили для печати */
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.4;
  }

  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  header {
    border-bottom: 2px solid #000;
    margin-bottom: 20px;
    page-break-after: avoid;
  }

  header h1 {
    font-size: 18pt;
    margin-bottom: 10px;
  }

  .card {
    background: white;
    border: 1px solid #000;
    border-radius: 0;
    box-shadow: none;
    padding: 15px;
    margin-bottom: 20px;
    page-break-inside: avoid;
  }

  .card h2 {
    font-size: 14pt;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
    margin-bottom: 10px;
    page-break-after: avoid;
  }

  /* Таблицы для печати */
  .table-wrapper {
    overflow: visible;
    margin: 0;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000;
    font-size: 10pt;
    page-break-inside: auto;
    min-width: auto !important;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  th, td {
    border: 1px solid #000;
    padding: 6px 8px;
    text-align: left;
    background: white !important;
    color: black !important;
    font-size: 9pt;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: 600;
    border-bottom: 2px solid #000;
  }

  .table-header-hint th {
    background: #e8e8e8 !important;
    font-size: 7pt;
    padding: 3px 6px;
    border-top: none;
  }

  tbody tr:nth-child(even) {
    background: #f9f9f9 !important;
  }

  tbody tr:hover {
    background: #f9f9f9 !important;
  }

  /* Summary grid */
  .summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
  }

  .summary-item {
    border: 1px solid #000;
    padding: 10px;
    background: white;
  }

  .summary-item label {
    font-size: 9pt;
    color: #666;
    display: block;
    margin-bottom: 5px;
  }

  .summary-item .value {
    font-size: 14pt;
    font-weight: 600;
    color: black;
  }

  .summary-item .value.positive {
    color: black;
  }

  .summary-item .value.negative {
    color: black;
  }

  /* Цвета для печати - конвертируем в черно-белые */
  .positive,
  .negative {
    color: black !important;
  }

  /* Accordion rows - раскрываем все */
  .accordion-row {
    display: table-row !important;
  }

  .daily-row.has-accordion {
    cursor: default;
  }

  /* Убираем иконки и стрелки */
  .accordion-icon {
    display: none;
  }

  /* Разрывы страниц */
  .card:not(:last-child) {
    page-break-after: always;
  }

  /* Заголовки таблиц на каждой странице */
  thead tr {
    page-break-inside: avoid;
    page-break-after: avoid;
  }

  /* Избегаем разрыва строк таблицы */
  tbody tr {
    page-break-inside: avoid;
  }

  /* Печать ссылок */
  a {
    color: black;
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #666;
  }

  /* Скрываем пустые элементы */
  .empty,
  .no-data {
    display: none;
  }
}

