.cp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cp-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cp-month-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cp-month-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.cp-month-btn svg {
  width: 16px;
  height: 16px;
}

.cp-month-label {
  min-width: 120px;
  text-align: center;
  font-family: "Rajdhani", "DM Sans", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
}

.cp-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.cp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.cp-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cp-toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cp-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.cp-toggle input:checked + .cp-toggle-track {
  background: rgba(244, 114, 182, 0.25);
  border-color: #f472b6;
}

.cp-toggle input:checked + .cp-toggle-track::after {
  transform: translateX(16px);
  background: #f472b6;
}

.cp-calendar-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.cp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.cp-weekday {
  padding: 10px 8px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cp-day {
  min-height: 118px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cp-day:nth-child(7n) {
  border-right: 0;
}

.cp-day.is-other-month {
  opacity: 0.45;
  background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .cp-day.is-other-month {
  background: rgba(15, 23, 42, 0.03);
}

.cp-day-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2px;
}

.cp-day-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.cp-day.is-today .cp-day-num {
  background: #3b82f6;
  color: #fff;
}

.cp-day-entries {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.cp-entry {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 1px 0;
}

.cp-entry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cp-entry-dot.is-despesa { background: #f87171; }
.cp-entry-dot.is-receita { background: #4ade80; }

.cp-entry-label {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-entry-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}

.cp-entry-status {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.62rem;
  line-height: 1;
}

.cp-entry-status.is-paid { color: #4ade80; }
.cp-entry-status.is-pending { color: #fb923c; }

.cp-more-link {
  margin-top: auto;
  padding-top: 2px;
  border: 0;
  background: transparent;
  color: #60a5fa;
  font-size: 0.64rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding-left: 13px;
}

.cp-more-link:hover { text-decoration: underline; }

.cp-list-view {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.cp-list-view.is-active { display: flex; }

.cp-calendar-wrap.is-list-hidden .cp-weekdays,
.cp-calendar-wrap.is-list-hidden .cp-grid {
  display: none;
}

.cp-list-day {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.cp-list-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
}

.cp-list-day-head span:last-child {
  color: var(--muted);
  font-weight: 500;
}

.cp-list-day-body {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cp-list-entry {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.76rem;
}

.cp-list-entry:last-child { border-bottom: 0; }

.cp-entry-panel {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  overflow: hidden;
}

.cp-entry-toggle {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "Rajdhani", "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cp-entry-toggle:hover { background: rgba(0, 229, 255, 0.04); }

.cp-entry-body {
  padding: 0 16px 16px;
  display: none;
}

.cp-entry-panel.is-open .cp-entry-body { display: block; }

.cp-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.cp-form-grid label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.cp-form-grid input,
.cp-form-grid select {
  width: 100%;
  min-width: 0;
}

.cp-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.cp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.cp-table th,
.cp-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.cp-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.7rem;
}

.cp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}

.cp-modal-overlay.is-open { display: flex; }

.cp-modal {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 18px;
}

.cp-modal h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.cp-modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 960px) {
  .cp-day { min-height: 96px; }
  .cp-entry-value { display: none; }
}

@media (max-width: 640px) {
  .cp-grid { font-size: 0.9em; }
  .cp-day { min-height: 82px; padding: 6px 4px; }
  .cp-entry-label { max-width: 52px; }
}
