.calendar-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.calendar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 35px;
}

.calendar-heading h1 {
  font-family: "Manrope", sans-serif;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -1px;
  margin: 0 0 7px;
}

.calendar-heading .eyebrow {
  display: block;
  margin-bottom: 9px;
}

.calendar-heading .page-description {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0;
}

.calendar-heading .primary-button {
  text-decoration: none;
}

.calendar-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.calendar-summary-card {
  min-width: 0;
  padding: 17px 19px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.summary-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 11px;
}

.summary-icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
}

.summary-icon svg {
  width: 15px;
  height: 15px;
}

.summary-icon.profit-icon {
  color: var(--positive);
  background: rgba(169, 232, 108, 0.08);
}

.summary-icon.loss-icon {
  color: var(--negative);
  background: rgba(240, 120, 120, 0.08);
}

.calendar-summary-card > strong {
  display: block;
  margin-top: 13px;
  color: var(--text-primary);
  font-family: "Manrope", sans-serif;
  font-size: 23px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.calendar-summary-card > small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 16px;
}

.calendar-panel,
.selected-day-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.calendar-panel {
  padding: 21px;
}

.calendar-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.calendar-panel-header h2,
.selected-day-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.calendar-panel-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.calendar-navigation {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-nav-button,
.calendar-today-button {
  display: inline-grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #20262d;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.calendar-nav-button:hover,
.calendar-today-button:hover {
  border-color: var(--accent);
}

.calendar-nav-button svg {
  width: 15px;
  height: 15px;
}

.calendar-today-button {
  display: inline-flex;
  padding: 0 11px;
  color: var(--text-secondary);
  font-size: 10px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 22px 0 15px;
  color: var(--text-secondary);
  font-size: 10px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.legend-profit {
  background: #65cf91;
}

.legend-loss {
  background: #f07878;
}

.legend-even {
  background: #aab2bc;
}

.legend-empty {
  background: #414951;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.calendar-weekdays {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.calendar-weekdays span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.calendar-grid {
  padding-top: 9px;
}

.calendar-day {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 88px;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #20262d;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.calendar-day:hover {
  border-color: #68737e;
  transform: translateY(-1px);
}

.calendar-day.outside-month {
  border-color: transparent;
  background: transparent;
  color: #59616b;
  cursor: default;
  pointer-events: none;
}

.calendar-day.is-profit {
  border-color: rgba(101, 207, 145, 0.32);
  background: rgba(49, 164, 100, 0.16);
}

.calendar-day.is-loss {
  border-color: rgba(240, 120, 120, 0.32);
  background: rgba(220, 75, 75, 0.16);
}

.calendar-day.is-even {
  border-color: rgba(170, 178, 188, 0.25);
  background: rgba(137, 145, 155, 0.12);
}

.calendar-day.is-selected {
  outline: 1px solid var(--accent);
  outline-offset: -2px;
}

.calendar-day.is-today .day-number {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #17210f;
}

.day-number {
  color: inherit;
  font-size: 11px;
  font-weight: 700;
}

.day-result {
  max-width: 100%;
  overflow: hidden;
  color: #aab2bc;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-profit .day-result {
  color: #65cf91;
}

.is-loss .day-result {
  color: #f07878;
}

.is-even .day-result {
  color: #aab2bc;
}

.day-marker {
  position: absolute;
  top: 13px;
  right: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.is-profit .day-marker {
  background: #65cf91;
}

.is-loss .day-marker {
  background: #f07878;
}

.is-even .day-marker {
  background: #aab2bc;
}

.selected-day-panel {
  padding: 20px;
}

.selected-day-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.selected-day-header .eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

.selected-day-header h2 {
  font-size: 14px;
}

.selected-day-status {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.selected-day-status.status-profit {
  border-color: rgba(101, 207, 145, 0.3);
  background: rgba(49, 164, 100, 0.12);
  color: #65cf91;
}

.selected-day-status.status-loss {
  border-color: rgba(240, 120, 120, 0.3);
  background: rgba(220, 75, 75, 0.12);
  color: #f07878;
}

.selected-day-status.status-even {
  color: #aab2bc;
}

.selected-day-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 19px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #20262d;
}

.selected-day-result > span,
.selected-day-result > small {
  color: var(--text-muted);
  font-size: 10px;
}

.selected-day-result > strong {
  color: var(--text-primary);
  font-family: "Manrope", sans-serif;
  font-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.selected-day-result > strong.pnl-positive {
  color: var(--positive);
}

.selected-day-result > strong.pnl-negative {
  color: var(--negative);
}

.selected-day-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.selected-day-stats > div {
  padding: 10px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.selected-day-stats span,
.selected-day-stats strong {
  display: block;
}

.selected-day-stats span {
  color: var(--text-muted);
  font-size: 9px;
}

.selected-day-stats strong {
  margin-top: 6px;
  color: var(--text-primary);
  font-size: 14px;
}

.selected-day-notes {
  margin-top: 18px;
}

.selected-day-notes > span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.selected-day-notes p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.selected-day-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.selected-day-action:hover {
  border-color: var(--accent);
  background: rgba(182, 243, 107, 0.06);
}

.selected-day-action svg {
  width: 14px;
  height: 14px;
}

.calendar-no-account {
  padding: 35px 15px;
  text-align: center;
}

.calendar-no-account[hidden] {
  display: none;
}

.calendar-no-account > svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.calendar-no-account h3 {
  margin: 12px 0 6px;
  color: var(--text-primary);
  font-size: 14px;
}

.calendar-no-account p {
  max-width: 320px;
  margin: 0 auto 16px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .calendar-layout {
    grid-template-columns: minmax(0, 1fr) 270px;
  }

  .calendar-day {
    min-height: 75px;
  }
}

@media (max-width: 850px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .selected-day-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
  }

  .selected-day-header,
  .selected-day-notes,
  .selected-day-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .calendar-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-heading .primary-button {
    width: 100%;
  }

  .calendar-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .calendar-panel {
    padding: 15px 10px;
  }

  .calendar-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-legend {
    gap: 10px;
    font-size: 9px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 60px;
    padding: 7px 5px;
    gap: 7px;
  }

  .day-number {
    font-size: 10px;
  }

  .day-result {
    font-size: 8px;
  }

  .day-marker {
    top: 9px;
    right: 6px;
    width: 5px;
    height: 5px;
  }

  .calendar-weekdays span {
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .calendar-summary-card {
    padding: 13px;
  }

  .calendar-summary-card > strong {
    font-size: 19px;
  }

  .calendar-navigation {
    gap: 4px;
  }

  .selected-day-panel {
    display: block;
  }
}

/* Calendar page spacing and width correction */
.calendar-page {
  width: 100%;
  max-width: 1200px;
  min-width: 0;
  margin: 0 auto;
  padding: 0 20px 24px;
  box-sizing: border-box;
}

.calendar-layout,
.calendar-panel,
.selected-day-panel {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.calendar-summary-grid {
  width: 100%;
  min-width: 0;
}

.calendar-panel {
  overflow: hidden;
}

.calendar-grid,
.calendar-weekdays {
  width: 100%;
  min-width: 0;
}

@media (max-width: 600px) {
  .calendar-page {
    padding-right: 12px;
    padding-left: 12px;
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 10px;
  padding: 15px 0;
  border-top: 1px solid var(--border);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--accent);
  color: #17210f;
  padding: 11px 13px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  transition: background 0.2s;
  white-space: nowrap;
  height: 37px;
}

.primary-button:hover {
  background: var(--accent-hover);
}
