/* Phone calendar: rounded day tiles with plain merchant dots and repeat-payment dots. The day sheet keeps the local-initial badges (never remote logos). */
#app .calendar-studio { --tile-today:#f97316; --tile-monthly:#8b5cf6; --tile-yearly:#eab308; --tile-weekly:#0ea5e9; --tile-daily:#14b8a6; }
#app .calendar-studio .calendar-day { position:relative; }
.calendar-repeat-dots { position:absolute; top:5px; right:5px; display:flex; gap:2px; }
.calendar-repeat-dots i,.calendar-repeat-legend i { display:block; width:6px; height:6px; border-radius:50%; background:var(--tile-monthly); }
:is(.calendar-repeat-dots,.calendar-repeat-legend) .yearly { background:var(--tile-yearly); }
:is(.calendar-repeat-dots,.calendar-repeat-legend) .weekly { background:var(--tile-weekly); }
:is(.calendar-repeat-dots,.calendar-repeat-legend) .daily { background:var(--tile-daily); }
.calendar-merchants { display:none; }
.calendar-dot { display:block; width:5px; height:5px; border-radius:50%; background:color-mix(in srgb,var(--text) 55%,transparent); flex:none; }
.calendar-dot.income { background:var(--income); }
.calendar-dot.transfer { background:var(--muted); opacity:.7; }
.calendar-dot.scheduled { background:transparent; box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--text) 55%,transparent); }
.calendar-merchant { display:inline-grid; place-items:center; width:20px; height:20px; border-radius:var(--radius-xs); font-size:.5625rem; font-weight:700; line-height:1; letter-spacing:-.02em; color:color-mix(in srgb,var(--badge,#64748b) 78%,var(--text)); background:color-mix(in srgb,var(--badge,#64748b) 20%,var(--surface)); box-shadow:0 0 0 1.5px var(--surface); flex:none; }
.calendar-merchant .icon { width:11px; height:11px; stroke-width:2; }
.calendar-merchant.hue-0 { --badge:#e11d48; }.calendar-merchant.hue-1 { --badge:#ea580c; }.calendar-merchant.hue-2 { --badge:#ca8a04; }.calendar-merchant.hue-3 { --badge:#16a34a; }
.calendar-merchant.hue-4 { --badge:#0891b2; }.calendar-merchant.hue-5 { --badge:#2563eb; }.calendar-merchant.hue-6 { --badge:#7c3aed; }.calendar-merchant.hue-7 { --badge:#db2777; }
.calendar-merchant.transfer { --badge:var(--link); }
.calendar-merchant.scheduled { background:var(--surface); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--badge,#64748b) 60%,transparent); border:0; outline:1px dashed transparent; }
.calendar-repeat-legend { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 14px; margin:12px 14px 0; padding:10px 12px; border-radius:var(--radius-sm); background:var(--subtle); font-size:var(--text-2xs); color:var(--muted); }
.calendar-repeat-kinds { display:flex; gap:12px; }
.calendar-repeat-kinds>span { display:inline-flex; align-items:center; gap:6px; color:var(--text); }
.calendar-repeat-counts strong { color:var(--text); font-variant-numeric:tabular-nums; }
.calendar-day-due { margin:0 0 16px; }
.calendar-day-due h3 { font-size:var(--text-sm); margin:0 0 8px; }
.calendar-day-due ul { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.calendar-day-due li { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; padding:10px 12px; border:1px dashed var(--border); border-radius:var(--radius-sm); }
.calendar-day-due li>span:nth-child(2) { display:grid; min-width:0; }
.calendar-day-due small { color:var(--muted); font-size:var(--text-2xs); }
.calendar-day-due .calendar-merchant { width:32px; height:32px; border-radius:var(--radius-xs); font-size:var(--text-xs); }

/* Tile to sheet morph: drop the stretched tile snapshot early so its badges never smear across the sheet. */
::view-transition-old(calendar-day-morph) { animation:calendar-morph-out var(--motion-press) var(--motion-ease) both; }
::view-transition-new(calendar-day-morph) { animation:calendar-morph-in var(--motion-enter) var(--motion-ease) 40ms both; }
@keyframes calendar-morph-out { to { opacity:0; } }
@keyframes calendar-morph-in { from { opacity:0; } }
@media (prefers-reduced-motion:reduce) { ::view-transition-old(calendar-day-morph),::view-transition-new(calendar-day-morph) { animation:none; } }

@media (max-width:639px) {
  #app .calendar-studio .calendar-weekdays { padding:14px 8px 0; gap:4px; margin-bottom:4px; }
  #app .calendar-studio .calendar-weekdays span { background:transparent; color:var(--muted); font-size:.625rem; letter-spacing:.06em; text-transform:uppercase; }
  #app .calendar-studio .calendar-grid { padding:0 8px; gap:4px; }
  #app .calendar-studio .calendar-day { transition:background-color var(--motion-exit) var(--motion-ease),border-color var(--motion-exit) var(--motion-ease),transform var(--motion-press) var(--motion-ease); display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto 1fr auto; grid-template-areas:none; justify-items:center; align-items:center; min-height:60px; padding:6px 2px 5px; gap:2px; border-radius:var(--radius-sm)!important; border:1px solid transparent!important; }
  #app .calendar-studio .calendar-day .calendar-date-number { justify-self:center; justify-content:center; font-size:.6875rem; font-weight:600; color:var(--muted); min-width:0; height:auto; padding:0; background:none; text-decoration:none; }
  #app .calendar-studio .calendar-day.has-activity .calendar-date-number,#app .calendar-studio .calendar-day.has-scheduled .calendar-date-number { color:var(--text); }
  #app .calendar-studio .calendar-entry-icons { display:none; }
  #app .calendar-studio .calendar-day>* { grid-column:1; }
  #app .calendar-studio .calendar-day>.calendar-date-number { grid-row:1; }
  #app .calendar-studio .calendar-day>.calendar-merchants { grid-row:2; }
  #app .calendar-studio .calendar-day>small { grid-row:3; }
  #app .calendar-studio .calendar-merchants { display:flex; justify-content:center; align-items:center; gap:3px; min-height:8px; }
  #app .calendar-studio .calendar-day small { font-size:.59375rem; min-height:11px; color:var(--muted); }
  #app .calendar-studio .calendar-day small.expense { color:var(--text); }
  #app .calendar-studio .calendar-day small.due { color:var(--muted); font-style:normal; }
  /* Today: soft orange tile, matching the reference. Selection keeps the app's accent outline. */
  #app .calendar-studio .calendar-day.today:not(.selected) { background:color-mix(in srgb,var(--tile-today) 13%,var(--surface)); border-color:color-mix(in srgb,var(--tile-today) 55%,transparent)!important; }
  #app .calendar-studio .calendar-day.today .calendar-date-number { color:var(--tile-today); font-weight:700; min-width:0; height:auto; padding:0; background:none; border-radius:0; }
  #app .calendar-studio .calendar-day.today.selected { background:color-mix(in srgb,var(--tile-today) 18%,var(--surface)); outline:2px solid var(--tile-today); outline-offset:-2px; color:var(--text); }
  #app .calendar-studio .calendar-day.selected { border-radius:var(--radius-sm)!important; }
  /* Future days stay quiet unless a repeat payment is due on them. */
  #app .calendar-studio .calendar-day.future:not(.selected) { opacity:.55; }
  #app .calendar-studio .calendar-day.future.has-scheduled:not(.selected) { opacity:1; background:var(--surface); border:1px dashed var(--border)!important; }
  #app .calendar-studio .calendar-outside { border-radius:var(--radius-sm)!important; opacity:.6; min-height:60px; }
  #app .calendar-studio .calendar-outside { display:flex; justify-content:center; align-items:flex-start; padding-top:6px; }
  /* Outside-month numbers sit where in-month numbers do (top, same line height), so every cell reads the same. */
  #app[data-route=home] .calendar-studio .calendar-day.calendar-outside { justify-content:flex-start; }
  #app .calendar-studio .calendar-outside span { display:block; width:100%; text-align:center; font-size:.6875rem; line-height:1.1; padding-top:1px; }
  .calendar-repeat-legend { margin:12px 8px 0; }
}
@media (max-width:359px) {
  #app .calendar-studio .calendar-grid,#app .calendar-studio .calendar-weekdays { gap:3px; padding-inline:6px; }
  .calendar-merchant { width:17px; height:17px; font-size:.5rem; border-radius:6px; }
}
