html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}


body {
  background: #f7fafd;
  color: #22324a;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.app-container {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  /*overflow: hidden; */
  box-sizing: border-box;
  /* ВАЖНО: margin и padding убраны, чтобы ничего не выпирало */
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 4px 32px rgba(36,130,255,0.07);
}

.main-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 36px 32px 32px 32px;
}

#tabs-container {
  flex: 0 0 auto;
}

.controls {
  margin-bottom: 34px;
  padding: 22px 22px 8px 22px;
  border-radius: 15px;
  background: rgba(232,245,255,0.63);
  box-shadow: 0 2px 12px rgba(64,174,255,0.05);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  border: 1px solid #e0ecfb;
  position: relative;
  flex: 0 0 auto;
}

.controls label {
  color: #3b82f6;
  font-weight: 500;
  margin-right: 5px;
}

input[type="text"], input[type="number"], select {
  background: rgba(255,255,255,0.5);
  border: 1.5px solid #b8dcfa;
  border-radius: 10px;
  color: #22324a;
  padding: 10px 14px;
  font-size: 16px;
  outline: none;
  margin-bottom: 4px;
  box-shadow: none;
  transition: border 0.18s, background 0.18s, box-shadow 0.18s;
  min-width: 140px;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: #3b82f6;
  background: #f4faff;
  box-shadow: 0 0 0 2px #bfdbfe66;
}
input[type="text"]:not(:focus):not(:placeholder-shown):not([value=""]),
input[type="number"]:not(:focus):not(:placeholder-shown):not([value=""]) {
  background: #f4faff;
  border-color: #e0ecfb;
  color: #8ba3c7;
}
select:not(:focus):not(:placeholder-shown):not([value=""]) {
  background: #f4faff;
  border-color: #e0ecfb;
  color: #8ba3c7;
}

/* Кнопки */
button, .btn {
  background: linear-gradient(90deg,#3b82f6 0%, #6ec1fa 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 8px;
  box-shadow: 0 2px 10px rgba(76,173,255,0.11);
  transition: background 0.18s, box-shadow 0.18s, transform 0.13s;
  letter-spacing: 0.01em;
}
button:hover, .btn:hover {
  background: linear-gradient(90deg,#2563eb 0%, #6ec1fa 100%);
  transform: translateY(-1px) scale(1.03);
}

/* ТАБЛИЦА */
.table-finance {
  min-width: 1200px;
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 18px;
  background: #fafdff;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(64,125,255,0.07);
  /*overflow: hidden; */
  animation: fadeIn 0.6s cubic-bezier(.22,.68,.45,1.11);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(22px);}
  to { opacity: 1; transform: none;}
}

.table-finance th, .table-finance td {
  text-align: left;
  vertical-align: middle;
  padding: 13px 10px;
  border: none;
  background: #fafdff;
  font-size: 16px;
  transition: background 0.18s, color 0.15s;
  min-width: 95px;
  position: relative;
}

.table-finance th {
  background: #eaf4ff;
  color: #3b82f6;
  font-weight: 600;
  border-bottom: 2px solid #dbeafe;
}

.table-finance tr:not(:last-child) td {
  border-bottom: 1.5px solid #e9eff7;
}

.table-finance tr:hover td {
  background: #e7f5ff;
}

.table-finance td.positive {
  color: #12b76a;
  font-weight: 600;
}
.table-finance td.negative {
  color: #f04438;
  font-weight: 600;
}

.table-finance td.current-day {
  background: #d6eaff;
  color: #0e5fff;
  font-weight: bold;
}

/* Сальдо день и счет */
.receipts-row, .saldo-day-row, .saldo-account-row {
  background: #ecf7fe !important;
  color: #1d70b8 !important;
}

/* ОТРИЦАТЕЛЬНОЕ САЛЬДО — вся ячейка ярко-красная */
.saldo-negative, .table-finance td.saldo-negative {
  background: linear-gradient(90deg,#fd6161 0%,#ff8c8c 100%) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 0 8px 0 rgba(255,70,70,0.11) inset;
  text-shadow: 0 1px 4px rgba(255,255,255,0.12);
  transition: background 0.16s, color 0.16s;
}

/* Если нужно сделать всю строку красной, просто добавь класс saldo-negative к tr */
.table-finance tr.saldo-negative td {
  background: linear-gradient(90deg,#fd6161 0%,#ff8c8c 100%) !important;
  color: #fff !important;
}

.toggle-incomes, .toggle-articles {
  color: #3b82f6;
  font-size: 17px;
  margin-right: 4px;
  vertical-align: middle;
  transition: color 0.14s;
  cursor: pointer;
  user-select: none;
  font-weight: bold;
}
.toggle-incomes:hover, .toggle-articles:hover {
  color: #1d70b8;
}

.hidden { display: none !important; }

/* Loader */
#table-loader {
  display: none;
  justify-content: center;
  align-items: center;
  height: 180px;
  background: transparent;
}
.loader {
  border: 5px solid #e2f2ff;
  border-top: 5px solid #3b82f6;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  animation: spinLoader 1.1s linear infinite;
}
@keyframes spinLoader {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}

/* Tabs */
.tabs-header {
  background: #f6faff;
  border-radius: 12px 12px 0 0;
  display: flex;
  gap: 4px;
  padding: 0 0 4px 0;
}
.tab-title {
  color: #2563eb;
  background: #e6f3ff;
  padding: 9px 18px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: -1px;
  border: 1px solid #e0ecfb;
  border-bottom: none;
  transition: background 0.14s, color 0.12s;
}
.tab-title[style*="background:#fff"] {
  color: #22324a !important;
  background: #fff !important;
  border-bottom: 1px solid #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
  height: 10px;
  width: 8px;
  background: #e6f3ff;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: #c4e1fc;
  border-radius: 8px;
}

/* Flatpickr tweaks */
.flatpickr-calendar {
  background: #fff;
  border: 1.5px solid #3b82f6;
  border-radius: 12px;
  color: #22324a;
  box-shadow: 0 4px 32px rgba(44,124,255,0.13);
}
.flatpickr-months .flatpickr-month {
  background: #eaf4ff;
  color: #3b82f6;
}
.flatpickr-day.today {
  border-color: #3b82f6;
  background: #d7eaff;
}
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: linear-gradient(90deg,#3b82f6 0%, #6ec1fa 100%);
  color: #fff;
  border-radius: 7px;
}
.flatpickr-day:hover {
  background: #e7f5ff;
  color: #3b82f6;
}

.table-finance thead {
  position: sticky;
  top: 0;
  background: #eaf4ff;
  z-index: 10;
}


.table-scroll-wrapper {
    flex: 1 1 auto;
    overflow: auto;
    height: auto;
}

#main-table-wrapper {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

/*.toggle-incomes, .toggle-articles {
    position: sticky;
    left:0;
    z-index: 10;
}*/