/* ─── CORE LAYOUT (GRID & ROWS) ──────────────────────────── */
.grid-wrapper { display: flex; flex-direction: column; gap: 0; }

.grid-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--divider);
}
.grid-row:has(.this-week-day) {
  grid-template-columns: repeat(4, 1fr);
}
.grid-row:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

/* Day column — no harsh borders, use space and tint instead */
.day {
  padding: 0 24px 0 0;
  position: relative;
  transition: background 0.2s ease;
}

.day + .day {
  padding-left: 24px;
  border-left: 1px solid var(--divider);
}

/* Subtle alternate tint on even columns */
.day:nth-child(even) { background: transparent; }

.day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.date {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1;
}

.weekday {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.divider {
  height: 1.5px;
  background: var(--divider-strong);
  margin-bottom: 14px;
  border-radius: 2px;
}

/* ─── ROW SLOTS ──────────────────────────────────────────── */
.row {
  height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.18s ease;
  position: relative;
  overflow: visible;
  border-radius: var(--r-sm);
  margin: 1px 0;
}
.row:hover { background: rgba(107,86,232,0.04); }
.row.drag-over {
  background: var(--today-soft);
  border-radius: var(--r-sm);
  outline: 1.5px dashed var(--today-accent);
  outline-offset: -1px;
}
.row.empty-row { cursor: default; }
.row.empty-row:hover { background: transparent; }

/* Locked rows — not the next sequential slot, cannot be clicked */
.row.locked-row {
  cursor: not-allowed;
  opacity: 0.28;
  background-image: none;
  pointer-events: auto;
}
.row.locked-row:hover {
  background: transparent;
  opacity: 0.38;
}
.row.empty-row:hover::after {
  content: '+';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px dashed var(--divider-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  pointer-events: none;
  font-weight: 300;
  transition: border-color 0.2s ease;
}
/* Smooth compact transitions */
.rows-container {
  transition: all 0.2s ease;
}
/* Empty rows styling */
.row.empty-row {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s ease, background 0.15s ease;
  min-height: 40px;
}
.row.empty-row:hover {
  opacity: 0.8;
  background: rgba(107, 86, 232, 0.04);
}
/* Locked rows (beyond first empty) */
.row.locked-row {
  cursor: not-allowed;
  opacity: 0.25;
  pointer-events: auto;
}
.row.locked-row:hover {
  opacity: 0.3;
  background: transparent;
}
.locked-row-tooltip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--text-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: var(--z-tooltip);
  animation: tooltipFadeIn 0.15s ease;
  box-shadow: var(--shadow-sm);
}
@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translate(-50%, -46%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
@keyframes lockedShake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-3px); }
  75%       { transform: translateX(3px); }
}
@keyframes nudgePulse {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}
.locked-row-shake {
  animation: lockedShake 0.4s ease;
}

/* ─── TRANSACTION CHIPS — the hero element ───────────────── */
.txn-chip {
  padding: 5px 10px 5px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  cursor: grab;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

/* will-change only on actively dragged chip to limit repaint */
.txn-chip.dragging {
  will-change: transform;
}
.txn-chip:active { cursor: grabbing; }
.txn-chip.dragging { opacity: 0.35; transform: scale(0.97); }
.txn-chip {
  will-change: auto;
}

/* BNPL Group Visual Grouping */
.txn-chip[data-bnpl-group] {
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: var(--bnpl-group-color, #6C63FF);
  padding-left: 7px;
}
.txn-chip[data-bnpl-group]::before {
  content: attr(data-bnpl-index) '/' attr(data-bnpl-total);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--bnpl-group-color, #6C63FF);
  opacity: 0.85;
  margin-right: 3px;
  flex-shrink: 0;
}

/* Income chip — frosted mint */
.txn-income {
  background: var(--income-bg);
  border: 1px solid var(--income-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 0 rgba(34,197,94,0.06),
    var(--shadow-xs);
}
.txn-income:hover {
  background: var(--income-bg-hover);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.90),
    var(--shadow-sm);
}

/* Expense chip — pale lavender */
.txn-expense {
  background: var(--expense-bg);
  border: 1px solid var(--expense-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 0 rgba(124,92,191,0.06),
    var(--shadow-xs);
}
.txn-expense:hover {
  background: var(--expense-bg-hover);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.90),
    var(--shadow-sm);
}

.chip-amount {
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  font-size: 11.5px;
  letter-spacing: 0.1px;
  font-variant-numeric: tabular-nums;
}
.txn-income .chip-amount {
  background: var(--income-amount-bg);
  color: var(--income-amount);
}
.txn-expense .chip-amount {
  background: var(--expense-amount-bg);
  color: var(--expense-amount);
}

.chip-emoji {
  font-size: 13px;
  flex-shrink: 0;
  line-height: 1;
}

.chip-category {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  letter-spacing: 0.1px;
}

.recurring-badge {
  font-size: 10.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.instance-badge { color: var(--accent-mid); }

/* Recurring delete overlay — uses z-index scale */
.recurring-delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 24px;
}

.chip-actions {
  display: none;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  margin-left: auto;
}
.txn-chip:hover .chip-actions { display: flex; }

.chip-action-btn {
  min-width: 32px;
  min-height: 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--divider-strong);
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  padding: 0;
}
.chip-action-btn:hover { transform: scale(1.1); }
.chip-action-btn.add-btn:hover { border-color: var(--today-accent); color: var(--today-accent); background: var(--today-soft); }
.chip-action-btn.del-btn:hover { border-color: var(--error); color: var(--error); background: var(--error-bg); } 

