/* Professional Calendar Styles - Exact Implementation */
:root {
  --fc-bg: #f6f8fa;
  --fc-surface: #fff;
  --fc-surface-2: #f8fafc;
  --fc-border: #e2e8f0;
  --fc-text: #0f172a;
  --fc-muted: #64748b;
  --fc-primary: #0f2246;
  --fc-info: #1d4ed8;
  --fc-success: #16a34a;
  --fc-danger: #dc2626;
  --cell-min-h: 100px;
  --chip-h: 26px;
  --pad-xxs: 4px;
  --pad-xs: 8px;
  --rad: 6px;
  --font: "Segoe UI", Inter, system-ui, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Hide loading spinners */
.loading-spinner,
#fc-spinner,
[class*="loading"],
.spinner,
.loading {
  display: none !important;
}

/* Ensure calendar shows full month */
.fc-cal-wrap {
  overflow: visible !important;
  height: auto !important;
}

.fc-cal tbody {
  height: auto !important;
}

.fc-cal {
  height: auto !important;
  table-layout: fixed !important;
  width: 100% !important;
}

.fc-cal td {
  width: 14.28% !important; /* 100% / 7 days */
  vertical-align: top !important;
  min-height: var(--cell-min-h);
  height: auto;
}

/* Layout & Table */
.fc-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  font-family: var(--font);
  color: var(--fc-text);
  font-size: 14px;
  line-height: 1.35;
}

.fc-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
}

.fc-toolbar {
  display: flex;
  align-items: center;
  gap: var(--pad-xs);
  margin-bottom: var(--pad-xs);
  padding: var(--pad-xs) 0;
  border-bottom: 1px solid var(--fc-border);
}

.fc-toolbar__label {
  font-size: 18px;
  font-weight: 600;
  color: var(--fc-text);
  min-width: 120px;
  text-align: center;
}

.fc-cal-wrap {
  position: relative;
}

.fc-cal {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--fc-surface);
}

.fc-cal tbody tr {
  height: auto;
}

.fc-cal thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--fc-primary);
  color: #fff;
  font-size: 12px;
  height: 36px;
  padding: 0 var(--pad-xs);
  text-align: center;
  letter-spacing: .2px;
  font-weight: 600;
}

.fc-cal td {
  vertical-align: top;
  padding: var(--pad-xs);
  min-height: var(--cell-min-h);
  height: auto;
  border-left: 1px solid var(--fc-border);
  border-bottom: 1px solid var(--fc-border);
  background: #fff;
  position: relative;
}

.fc-cal td:first-child {
  border-left: none;
}

.fc-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fc-day__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fc-muted);
  font-size: 12px;
}

/* Стили для номера дня */
.fc-day__num {
  font-weight: 600;
  color: var(--fc-text);
  font-size: 13px;
  text-align: right;
  display: block;
  margin-bottom: 4px;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  min-width: 20px;
  text-align: center;
  transition: all 0.2s ease;
}

.fc-day__sum {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
}

.fc-day--today {
  outline: 2px solid var(--fc-info);
  outline-offset: -2px;
  background: #f8fbff;
}

.fc-day--weekend {
  background: var(--fc-surface-2);
}

/* Стили для номера дня в выходные */
.fc-day--weekend .fc-day__num {
  color: #e53e3e;
  font-weight: 700;
  background: rgba(254, 202, 202, 0.3);
  border-color: rgba(252, 165, 165, 0.6);
}

/* Стили для номера дня сегодня */
.fc-day--today .fc-day__num {
  color: #2563eb;
  font-weight: 700;
  background: rgba(147, 197, 253, 0.4);
  border: 2px solid rgba(96, 165, 250, 0.6);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Стили для дней других месяцев */
.fc-day--other-month .fc-day__num {
  color: #94a3b8;
  font-weight: 500;
  background: rgba(248, 250, 252, 0.4);
  border-color: rgba(203, 213, 225, 0.5);
  opacity: 0.7;
}

/* Эффект при наведении на ячейку календаря */
.calend1:hover .fc-day__num {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Специальные стили для выходных при наведении */
.fc-day--weekend:hover .fc-day__num {
  background: rgba(254, 202, 202, 0.5);
  border-color: rgba(252, 165, 165, 0.8);
  transform: scale(1.05);
}

/* Event list (kept compact) */
.fc-day__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 110px;
  overflow: hidden;
}

.fc-day__more {
  margin-top: 4px;
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
  user-select: none;
}

.fc-row {
  border: 1px solid var(--fc-border);
  border-radius: var(--rad);
  background: #fff;
  margin-bottom: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.fc-row__sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--chip-h);
  padding: var(--pad-xxs) var(--pad-xs);
  font-size: 11px;
  cursor: pointer;
  line-height: 1.2;
}

.fc-row__sum:hover {
  background: #eef1f6;
}

.fc-row__det {
  display: none;
  padding: 8px 10px;
  border-top: 1px solid var(--fc-border);
  font-size: 12px;
}

.fc-row[aria-expanded="true"] .fc-row__det {
  display: block;
}

.fc-row--in {
  background: #ecfdf5;
}

.fc-row--out {
  background: #fef2f2;
}

.fc-row--msg {
  background: #eff6ff;
}

.fc-row--btc {
  background: #fff7ed;
}

.amount {
  font-family: var(--mono);
  font-weight: 700;
}

.amount--pos {
  color: var(--fc-success);
}

.amount--neg {
  color: var(--fc-danger);
}

.ellipsis {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Detail items */
.fc-detail {
  display: flex;
  margin: 2px 0;
  font-size: 12px;
}

.fc-detail__label {
  font-weight: 600;
  min-width: 50px;
  margin-right: var(--pad-xs);
  color: var(--fc-muted);
}

.fc-detail__value {
  color: var(--fc-text);
  font-family: var(--mono);
}

/* Spinner */
.fc-spinner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.fc-spinner-inner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--fc-info);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Sidebar accordion */
.fc-sidebar {
  font-size: 12px;
}

.fc-acc {
  margin-bottom: var(--pad-xs);
}

.fc-acc__hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--pad-xs) var(--pad-xs);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.fc-acc__hdr:hover {
  background: rgba(255, 255, 255, 0.10);
}

.fc-acc__body {
  display: block;
  padding: var(--pad-xs) 0;
}

.fc-acc:not(.is-active) .fc-acc__body {
  display: none;
}

.fc-acc__menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fc-acc__item {
  margin: 0;
}

.fc-acc__link {
  display: flex;
  align-items: center;
  gap: var(--pad-xs);
  padding: var(--pad-xs) var(--pad-xs);
  color: #e2e8f0;
  text-decoration: none;
  font-size: 12px;
  transition: background-color 0.2s ease;
  border-left: 3px solid transparent;
}

.fc-acc__link:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

.fc-acc__link.is-active {
  background: #1f2a44;
  color: #ffffff;
  border-left-color: #3b82f6;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive design */
@media (max-width: 1199px) {
  .fc-cal-wrap {
    overflow-x: auto;
  }
  
  .fc-cal {
    min-width: 1100px;
  }
}

@media (max-width: 600px) {
  .fc-cal {
    display: block;
  }
  
  .fc-cal thead {
    display: none;
  }
  
  .fc-cal tr,
  .fc-cal td {
    display: block;
    width: auto;
  }
  
  .fc-cal td {
    min-height: auto;
    margin-bottom: 12px;
  }
}

/* Accessibility */
.fc-row__sum:focus {
  outline: 2px solid var(--fc-info);
  outline-offset: 2px;
}

.fc-acc__link:focus {
  outline: 2px solid var(--fc-info);
  outline-offset: 2px;
}