/* Allow scrolling, but no pinch or double-tap zoom, including inside modals
   and nested scrollers (touch-action is not inherited). */
* {
    touch-action: pan-x pan-y;
}

/* Keep touch-device form controls large enough to avoid iOS focus zoom.
   Override compact text utilities used by the shared forms. */
@media (any-pointer: coarse) {
    input,
    select,
    textarea {
        font-size: max(16px, 1rem) !important;
    }
}

/* Installed iPhone PWAs can draw under the notch and home indicator. */
:root {
    --app-header-height: 3.5rem;
    --bottom-nav-inset: max(0px, calc(env(safe-area-inset-bottom, 0px) - 24px));
}
.app-header { padding-top: env(safe-area-inset-top, 0px); }
/* iOS PWA toolbar tinting: a painted, fixed top edge lets WebKit sample the
   status-bar colour independently of the header. Do not clip its background
   or size it from safe-area-inset-top, which can be zero in standalone mode.
   See https://www.reddit.com/r/PWA/comments/1wr2ucw/ */
.ios-status-bar-tint { display: none; }
@supports (-webkit-touch-callout: none) {
    @media (display-mode: standalone) {
        html[data-native="false"] .ios-status-bar-tint {
            display: block;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 11px;
            z-index: 2147483647;
            pointer-events: none;
        }
    }
}
body .app-main {
    padding-top: calc(var(--app-header-height) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(5rem + var(--bottom-nav-inset));
}
.app-bottom-nav {
    padding-bottom: var(--bottom-nav-inset);
}
.sidebar {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.connection-notice {
    position: fixed;
    z-index: 1000;
    bottom: calc(5rem + var(--bottom-nav-inset));
    left: 1rem;
    right: 1rem;
    max-width: 30rem;
    margin-inline: auto;
    padding: 1rem;
    border: 1px solid #c7d2fe;
    border-radius: 1rem;
    background: #eef2ff;
    color: #312e81;
    box-shadow: 0 8px 30px #0002;
    font: 0.9rem/1.5 system-ui, sans-serif;
}
.connection-notice[hidden] { display: none; }
.connection-notice strong, .connection-notice span { display: block; }
.connection-notice button {
    min-height: 44px;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: #4f46e5;
    color: white;
    font-weight: 600;
}

/* CSS Variables - Modern indigo/violet theme */
:root {
  /*--background: 240 20% 97%;*/
    --background: 0 0% 100%;
  --foreground: 224 71% 4%;
  --card: 0 0% 100%;
  --card-foreground: 224 71% 4%;
  --primary: 239 84% 67%;
  --primary-foreground: 0 0% 100%;
  --secondary: 240 5% 96%;
  --secondary-foreground: 224 71% 4%;
  --muted: 240 5% 96%;
  --muted-foreground: 220 9% 46%;
  --accent: 240 100% 97%;
  --accent-foreground: 239 84% 67%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 6% 90%;
  --input: 240 6% 90%;
  --ring: 239 84% 67%;
  --success: 142 76% 36%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
}

/* Base Styles */
body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

hr {
  border-color: hsl(var(--border));
}

.app-header-row {
    height: var(--app-header-height);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background-color: hsl(var(--primary) / 0.2);
  color: hsl(var(--foreground));
}

/* Button animations */
.btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.25);
}
.btn:active {
  transform: translateY(0) scale(0.98);
}

/* Primary button style */
.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(250 84% 60%) 100%);
  color: hsl(var(--primary-foreground));
  font-weight: 500;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  box-shadow: 0 2px 8px hsl(var(--primary) / 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px hsl(var(--primary) / 0.4);
}

/* Card hover effects */
.card-hover {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid hsl(var(--border));
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -12px hsl(var(--foreground) / 0.15);
  border-color: hsl(var(--primary) / 0.2);
}

/* Glass effect for cards */
.glass {
  background: hsl(var(--card) / 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Ripple effect */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, hsl(var(--foreground)) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.4s, opacity 0.4s;
}
.ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.15;
  transition: 0s;
}

/* Sidebar styles */
.sidebar {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Calendar styles */
#calendar,
#live-calendar {
  overflow: hidden;
  height: 750px;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
#calendar .fc-view-harness {
  touch-action: pan-y;
  will-change: transform, opacity;
}
#calendar .fc-daygrid,
#calendar .fc-daygrid-body,
#calendar .fc-scrollgrid,
#calendar .fc-scrollgrid-section,
#calendar .fc-scrollgrid-section-body,
#calendar table,
#calendar td,
#calendar .fc-daygrid-day,
#calendar .fc-daygrid-day-frame {
  touch-action: pan-y;
}
.fc-view-harness {
  transition: none;
}
.swipe-left {
  animation: slideOutLeft 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
.swipe-right {
  animation: slideOutRight 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
.slide-in-left {
  animation: slideInLeft 0.25s cubic-bezier(0.0, 0, 0.2, 1) forwards;
}
.slide-in-right {
  animation: slideInRight 0.25s cubic-bezier(0.0, 0, 0.2, 1) forwards;
}
@keyframes slideOutLeft {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  100% { transform: translateX(-40%) scale(0.95); opacity: 0; }
}
@keyframes slideOutRight {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  100% { transform: translateX(40%) scale(0.95); opacity: 0; }
}
@keyframes slideInLeft {
  0% { transform: translateX(40%) scale(0.95); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes slideInRight {
  0% { transform: translateX(-40%) scale(0.95); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

/* Form input mobile fixes */
input[type="date"],
input[type="time"] {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  -webkit-appearance: none;
  appearance: none;
}

/* Gentle, inline validation feedback for account settings. */
input.settings-input-error {
  border-color: hsl(var(--destructive) / 0.65);
  background-color: hsl(var(--destructive) / 0.04);
}

input.settings-input-error:focus {
  border-color: hsl(var(--destructive));
  --tw-ring-color: hsl(var(--destructive) / 0.2);
  outline-color: hsl(var(--destructive));
}

.settings-field-errors {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: #b91c1c;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.settings-field-errors li {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.settings-field-errors li + li {
  margin-top: 0.25rem;
}

.settings-field-errors i {
  flex-shrink: 0;
  font-size: 0.75rem;
}

/* Modal form container */
.modal-content form {
  max-width: 100%;
}

.modal-content form > div {
  max-width: 100%;
}

/* FullCalendar theme overrides */
.fc {
  --fc-border-color: hsl(var(--border));
  --fc-today-bg-color: hsl(var(--primary) / 0.08);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: hsl(var(--muted));
  font-family: inherit;
  font-size: 0.9em;
}
.fc .fc-toolbar {
  margin-bottom: 1rem;
}
.fc .fc-toolbar-title {
  color: hsl(var(--foreground));
  font-size: 24px;
  font-weight: 600;
  padding: 0.5rem 6px;
  background: linear-gradient(135deg, hsl(var(--foreground)) 0%, hsl(var(--muted-foreground)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.fc th {
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.50rem 0 0.2rem;
  border: none !important;
}
.fc .fc-scrollgrid {
  border: none !important;
}
.fc .fc-scrollgrid td {
  border-color: hsl(var(--border));
}
.fc .fc-daygrid-day {
  border-radius: 0.75rem;
}
.fc .fc-daygrid-day-number {
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem;
}
.fc .fc-day-other .fc-daygrid-day-number {
  color: hsl(var(--muted-foreground));
  opacity: 0.5;
}
.fc .fc-daygrid-day.fc-day-today {
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1) 0%, hsl(var(--primary) / 0.05) 100%) !important;
  border-radius: 0;
  position: relative;
}
.fc .fc-daygrid-day.fc-day-today::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid hsl(var(--primary) / 0.3);
  border-radius: 0;
  pointer-events: none;
}
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  font-weight: 700;
  color: hsl(var(--primary));
}
.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events {
  min-height: 4.5em;
}
.fc .fc-daygrid-day-frame {
  min-height: 100%;
}
.fc .fc-daygrid-body-balanced .fc-daygrid-day-events {
  min-height: 4.5em;
}
.fc .fc-daygrid-day-events {
  min-height: 4.5em;
}
.fc .fc-day-other .fc-daygrid-day-events {
  opacity: 0.4;
}
.fc .fc-event {
  border: none;
  border-radius: 0.375rem;
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  font-weight: 600;
  transition: transform 0.15s ease;
}
.fc .fc-event:hover {
  transform: scale(1.02);
}
.fc .fc-daygrid-event {
  margin: 1px 3px;
}

/* Remove left/right margins on events */
.fc-direction-ltr .fc-daygrid-event.fc-event-end,
.fc-direction-rtl .fc-daygrid-event.fc-event-start {
  margin-right: 0px;
}
.fc-direction-ltr .fc-daygrid-event.fc-event-start,
.fc-direction-rtl .fc-daygrid-event.fc-event-end {
  margin-left: 0px;
}

.fc .fc-daygrid-more-link {
  color: hsl(var(--primary));
  font-size: 0.7rem;
  font-weight: 600;
}
.fc .fc-scrollgrid-section > td {
  border: none;
}
.fc .fc-col-header {
  border: none !important;
}
.fc .fc-col-header-cell {
  border: none !important;
}
.fc-theme-standard td, .fc-theme-standard th {
  border-color: hsl(var(--border));
}
.fc-theme-standard .fc-scrollgrid {
  border: none;
}
.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: -0.9em;
  margin-top: 0.4em;
}

/* Event dot style (list-item display) */
.fc .fc-daygrid-event.fc-daygrid-dot-event {
  background: transparent !important;
  border: none !important;
  padding: 0.0625rem 0.125rem;
}
.fc .fc-daygrid-event.fc-daygrid-dot-event:hover {
  background: hsl(var(--accent)) !important;
}
.fc .fc-daygrid-dot-event .fc-event-title {
  font-weight: 600;
  font-size: 0.675rem;
  color: hsl(var(--foreground));
}

/* Center shift titles in calendar events */
.fc .fc-daygrid-event {
  display: flex;
  justify-content: center;
  align-items: center;
}
.fc .fc-daygrid-dot-event {
  justify-content: center;
}
.fc .fc-event-main {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.fc .fc-event-main-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.fc .fc-event-title-container {
  text-align: center;
  flex-grow: 1;
}
.fc .fc-daygrid-event-dot {
  border: 3.5px solid var(--fc-event-border-color, currentColor);
  border-radius: 50%;
  width: 0;
  height: 0;
  margin: 0 2px 0 0;
}

/* Enhanced form inputs */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  transition: all 0.2s ease;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

/* Modal enhancements */
.modal-content {
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px hsl(var(--foreground) / 0.25);
}

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(250 84% 60%) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Stat card with icon */
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, hsl(var(--primary) / 0.05) 0%, transparent 70%);
  pointer-events: none;
}

/* Smooth page transitions */
main {
  background-color: hsl(240 20% 97%);
  animation: fadeIn 0.3s ease;
}
/* Native navigation owns screen transitions. Avoid a second content entrance. */
html[data-native="true"] main {
  animation: none;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom nav active indicator animation */
.nav-btn span.absolute {
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { transform: translateX(-50%) scaleX(0); }
  to { transform: translateX(-50%) scaleX(1); }
}

/* Improved scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* Loading skeleton animation */
.skeleton {
  background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--accent)) 50%, hsl(var(--muted)) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Basic badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border-radius: 9999px;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: 1px solid hsl(var(--border));
}

/* Optional colour variants */
.badge-primary {
    background: hsl(var(--primary) / 0.12);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary) / 0.2);
}

.badge-success {
    background: hsl(var(--success) / 0.12);
    color: hsl(var(--success));
    border-color: hsl(var(--success) / 0.2);
}

.badge-warning {
    background: hsl(var(--warning) / 0.12);
    color: hsl(var(--warning));
    border-color: hsl(var(--warning) / 0.2);
}

.badge-destructive {
    background: hsl(var(--destructive) / 0.12);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.2);
}

/* Keep earnings icons and badges available without runtime-generated utilities. */
.earnings-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
}
.earnings-card-icon--indigo { background-color: #eef2ff; color: #6366f1; }
.earnings-card-icon--amber { background-color: #fffbeb; color: #f59e0b; }
.earnings-card-icon--blue { background-color: #eff6ff; color: #3b82f6; }
.earnings-summary-icon { color: #3b82f6; }
.earnings-pro-badge {
    display: inline-flex;
    align-items: center;
    padding: .125rem .375rem;
    border-radius: .25rem;
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .025em;
}

/* Earnings period selector */
.earnings-picker {
    border: 1px solid hsl(var(--border));
    border-radius: 1rem;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: 0 3px 14px hsl(var(--primary) / .04);
}
.earnings-picker-trigger { display: flex; align-items: center; gap: .85rem; padding: 1rem; cursor: pointer; list-style: none; border-radius: 1rem; }
.earnings-picker-trigger::-webkit-details-marker { display: none; }
.earnings-picker-icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex-shrink: 0; border-radius: .85rem; background: hsl(var(--primary) / .1); color: hsl(var(--primary)); }
.earnings-picker-heading { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: .15rem; font-size: .95rem; font-weight: 650; }
.earnings-picker-eyebrow { color: hsl(var(--muted-foreground)); font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.earnings-picker-caption { font-size: .75rem; color: hsl(var(--muted-foreground)); }
.earnings-picker-chevron { color: hsl(var(--primary)); font-size: .75rem; transition: transform .2s; }
.earnings-picker[open] .earnings-picker-chevron { transform: rotate(180deg); }
.earnings-picker[open] { border-color: hsl(var(--primary) / .35); }
.earnings-picker-body { padding: 1rem; border-top: 1px solid hsl(var(--border)); }
.earnings-picker button { cursor: pointer; font: inherit; font-size: .85rem; transition: background .15s, color .15s; }
.earnings-picker button:focus-visible, .earnings-picker summary:focus-visible, .earnings-picker input:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 3px; }
.earnings-picker-modes { display: flex; padding: .25rem; border-radius: .8rem; background: hsl(var(--muted)); }
.earnings-picker-modes button { flex: 1; padding: .65rem; border-radius: .6rem; color: hsl(var(--muted-foreground)); font-weight: 600; }
.earnings-picker-modes button[aria-pressed="true"] { background: hsl(var(--card)); color: hsl(var(--primary)); box-shadow: 0 2px 5px #0000000d; }
.earnings-picker-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.earnings-picker-shortcuts button { border: 1px solid hsl(var(--border)); border-radius: 2rem; padding: .4rem .75rem; font-size: .75rem; }
.earnings-picker button:hover { background: hsl(var(--primary) / .1); color: hsl(var(--primary)); }
.earnings-picker-dates { display: flex; align-items: center; gap: .5rem; max-width: 26rem; padding: .5rem 0; border: 0; background: transparent; }
.earnings-picker-dates[hidden] { display: none; }
.earnings-picker-dates label { flex: 1; min-width: 0; font-size: .7rem; color: hsl(var(--muted-foreground)); }
.earnings-picker-dates input { display: block; width: 100%; min-width: 0; margin-top: .2rem; border: 1px solid hsl(var(--border)); border-radius: .4rem; padding: .3rem .4rem; background: hsl(var(--card)); color: hsl(var(--muted-foreground)); font: inherit; font-size: .8rem; font-weight: 400; }
.earnings-picker-dates > i { align-self: flex-end; margin-bottom: .6rem; color: hsl(var(--muted-foreground)); font-size: .65rem; }
/* Keep the native date picker available without drawing its calendar icon. */
.earnings-picker-dates input::-webkit-calendar-picker-indicator { opacity: 0; cursor: pointer; }
.earnings-picker-navigation { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0 .5rem; font-size: .9rem; }
.earnings-picker-navigation button { height: 2.75rem; width: 2.75rem; border-radius: .7rem; }
/* Keep the library's calendar structure and accessibility; only theme and layout it. */
.earnings-picker-calendar-host { margin-bottom: 1rem; }
/* Override the calendar library's embedded SVG arrows with Font Awesome Solid. */
.earnings-picker .earnings-picker-calendar-host [data-vc-arrow]::before {
    display: grid;
    place-items: center;
    background-image: none;
    transform: none;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-style: normal;
    font-size: .75rem;
    color: hsl(var(--primary));
}
.earnings-picker .earnings-picker-calendar-host [data-vc-arrow="prev"]::before { content: '\f053'; }
.earnings-picker .earnings-picker-calendar-host [data-vc-arrow="next"]::before { content: '\f054'; }
.earnings-picker [data-vc="calendar"] {
    min-width: 0;
    padding: .25rem;
    --vc-bg: hsl(var(--card));
    --vc-color: hsl(var(--foreground));
    --vc-header-color: hsl(var(--foreground));
    --vc-title-color: hsl(var(--foreground));
    --vc-title-color-disabled: hsl(var(--foreground));
    --vc-title-color-hover: hsl(var(--primary));
    --vc-focus-outline-color: hsl(var(--primary));
    --vc-week-day-color: hsl(var(--muted-foreground));
    --vc-week-day-off-color: hsl(var(--muted-foreground));
    --vc-date-bg: transparent;
    --vc-date-color: hsl(var(--foreground));
    --vc-date-weekend-color: hsl(var(--foreground));
    --vc-date-bg-hover: hsl(var(--primary) / .08);
    --vc-date-weekend-bg-hover: hsl(var(--primary) / .08);
    --vc-date-selected-bg: hsl(var(--primary));
    --vc-date-selected-color: hsl(var(--primary-foreground));
    --vc-date-weekend-selected-bg: hsl(var(--primary));
    --vc-date-weekend-selected-color: hsl(var(--primary-foreground));
    --vc-date-range-middle-bg: hsl(var(--primary) / .12);
    --vc-date-range-middle-color: hsl(var(--foreground));
    --vc-date-range-middle-weekend-bg: hsl(var(--primary) / .12);
    --vc-date-range-middle-weekend-color: hsl(var(--foreground));
    --vc-date-hover-bg: hsl(var(--primary) / .08);
    --vc-date-weekend-hover-bg: hsl(var(--primary) / .08);
    --vc-date-hover-edge-bg: hsl(var(--primary) / .2);
    --vc-date-weekend-hover-edge-bg: hsl(var(--primary) / .2);
    --vc-date-today-color: hsl(var(--primary));
    --vc-date-weekend-today-color: hsl(var(--primary));
    --vc-months-years-bg-selected: hsl(var(--primary));
    --vc-months-years-color-selected: hsl(var(--primary-foreground));
}
.earnings-picker [data-period-mode="range"] > [data-vc="controls"] { display: none; }
.earnings-picker [data-period-mode="range"] > [data-vc="grid"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-height: 24rem;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-color: hsl(var(--primary) / .3) transparent;
    scrollbar-width: thin;
    padding: .5rem;
    gap: 1.5rem;
}
.earnings-picker [data-vc="column"] { min-width: 0; }
.earnings-picker [data-vc="header"] { padding: .5rem 0; }
.earnings-picker [data-vc-date] { min-height: 2.75rem; }
.earnings-picker [data-vc-months-month], .earnings-picker [data-vc-years-year] { min-height: 3rem; }
/* Colour the library's day buttons through its theme variables, not their wrappers. */
.earnings-picker [data-vc="header"] button:disabled { opacity: 1; cursor: default; }
.earnings-picker [data-vc="header"] button { font-weight: 600; }
.earnings-picker button.earnings-picker-apply { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: transparent; }
.earnings-picker-navigation[hidden] { display: none; }
.earnings-picker-hint { margin: .85rem 0; color: hsl(var(--muted-foreground)); font-size: .75rem; }
.earnings-picker-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border)); }
.earnings-picker-footer > span { font-size: .7rem; color: hsl(var(--muted-foreground)); }
.earnings-picker-footer > div { display: flex; gap: .5rem; margin-left: auto; }
.earnings-picker-footer button { border-radius: .65rem; padding: .7rem 1rem; font-weight: 600; }
.earnings-picker button.earnings-picker-apply:disabled { opacity: .45; cursor: not-allowed; }
@media (min-width: 640px) {
    .earnings-picker-body { padding: 1.25rem 1.5rem; }
    .earnings-picker [data-period-mode="range"] > [data-vc="grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
    .earnings-picker-caption { display: none; }
    .earnings-picker-dates { gap: .5rem; }
    .earnings-picker-dates > i { display: none; }
}

/* Compact earnings highlights below the existing chart. */
.earnings-insight-cards { container: earnings-highlights / inline-size; width: 100%; max-width: 46rem; margin: 1rem auto 0; }
.earnings-insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.earnings-insight-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 128px;
    padding: 1rem 1rem 1rem 5rem;
    border: 1px solid var(--insight-border);
    border-radius: 1rem;
    background: var(--insight-background);
}
.earnings-insight-card--year { --insight-background: #f7f5ff; --insight-border: #ece7ff; --insight-icon: #eae5ff; --insight-accent: #5940e7; --insight-amount: #5940e7; }
.earnings-insight-card--average { --insight-background: #f3f7ff; --insight-border: #e2ecff; --insight-icon: #deebff; --insight-accent: #0866ed; --insight-amount: #10152d; }
.earnings-insight-card--highest { --insight-background: #f2faf7; --insight-border: #e1f2eb; --insight-icon: #d8f2e6; --insight-accent: #07864a; --insight-amount: #6550ee; }
.earnings-insight-card--increase { --insight-background: #f9faf3; --insight-border: #edf0e3; --insight-icon: #e0f3e5; --insight-accent: #07864a; --insight-amount: #07864a; }
.earnings-insight-card--decrease { --insight-background: #fff6f6; --insight-border: #f7e3e5; --insight-icon: #fbe4e7; --insight-accent: #bb3549; --insight-amount: #bb3549; }
.earnings-insight-card dt { color: #10152d; font-size: .9375rem; font-weight: 600; line-height: 1.4; }
.earnings-insight-icon { position: absolute; top: 50%; left: 1rem; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 50%; background: var(--insight-icon); color: var(--insight-accent); font-size: 1.25rem; }
.earnings-insight-amount { margin-top: .3rem; color: var(--insight-amount); font-size: clamp(1.25rem, 3.2cqi, 1.75rem); font-weight: 700; line-height: 1.25; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.earnings-insight-detail { margin-top: .3rem; color: #6f758d; font-size: .8125rem; line-height: 1.5; }
.earnings-insight-detail i { margin-right: .25rem; }
.earnings-insight-change { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; }
.earnings-insight-percent { color: var(--insight-accent); font-size: .8125rem; font-variant-numeric: tabular-nums; }
@container earnings-highlights (max-width: 640px) {
    .earnings-insight-grid { gap: .75rem; }
    .earnings-insight-card { min-height: 112px; padding: .875rem .75rem .875rem clamp(3rem, 10cqi, 4.25rem); border-radius: .875rem; }
    .earnings-insight-icon { left: .75rem; width: clamp(28px, 7.5cqi, 44px); height: clamp(28px, 7.5cqi, 44px); font-size: clamp(.875rem, 3cqi, 1.125rem); }
    .earnings-insight-card dt { font-size: clamp(.75rem, 2cqi, .875rem); }
    .earnings-insight-amount { font-size: clamp(1rem, 3.6cqi, 1.5rem); }
    .earnings-insight-detail, .earnings-insight-percent { font-size: .75rem; }
}
@container earnings-highlights (max-width: 320px) {
    .earnings-insight-grid { gap: .5rem; }
    .earnings-insight-card { padding: .75rem .5rem .75rem 2.75rem; }
    .earnings-insight-icon { left: .625rem; width: 24px; height: 24px; font-size: .8125rem; }
    .earnings-insight-amount { font-size: .9375rem; }
    .earnings-insight-detail, .earnings-insight-percent { font-size: .6875rem; }
}
/* =========================================================
   Earnings summary
   ========================================================= */

.earnings-summary {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1rem;
}


/* Main take-home figure */
.earnings-summary-total {
    margin-top: .5rem;

    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.025em;

    font-variant-numeric: tabular-nums;

    overflow-wrap: anywhere;
}


/* Gross / deductions description */
.earnings-summary-detail {
    margin-top: .5rem;

    font-size: .75rem;
    line-height: 1.625;
}


/* =========================================================
   Four summary statistics
   ========================================================= */

.earnings-summary-stats {
    display: flex;
    align-items: stretch;

    width: 100%;

    margin: 0;

    border-top: 1px solid hsl(var(--border));

    padding: 1rem 0 0;
}


/* Individual statistic */
.earnings-summary-stat {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;

    min-width: 0;

    gap: .5rem;

    padding: 0 .5rem;
}

/* =========================================================
   Icon
   ========================================================= */

.earnings-summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 2rem;
    height: 2rem;

    border-radius: 50%;

    background: #eff6ff;
    color: #1683f8;

    font-size: .8rem;
}


/* =========================================================
   Statistic content
   ========================================================= */

.earnings-summary-stat-content {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;

    min-width: 0;

    gap: .1rem;

    text-align: left;
}


/* Label */
.earnings-summary-stat-label {
    color: hsl(var(--muted-foreground));

    font-size: .6875rem;
    font-weight: 500;
    line-height: 1.2;

    white-space: nowrap;
}


/* Value */
.earnings-summary-value {
    margin: 0;

    color: hsl(var(--foreground));

    /*
     * Responsive sizing means values such as
     * £1,000.00 / £2,820.25 remain usable.
     */
    font-size: clamp(.72rem, 2.7vw, 1rem);

    font-weight: 700;
    line-height: 1.2;

    letter-spacing: -.025em;

    font-variant-numeric: tabular-nums;

    white-space: nowrap;
}


/* =========================================================
   Phones
   ========================================================= */

@media (max-width: 500px) {

    .earnings-summary {
        gap: 1rem;
    }

    .earnings-summary-stats {
        padding-top: .875rem;
    }

    .earnings-summary-stat {
        gap: .3rem;

        padding: 0 .25rem;
    }

    .earnings-summary-icon {
        width: 1.6rem;
        height: 1.6rem;

        font-size: .65rem;
    }

    .earnings-summary-stat-label {
        font-size: .575rem;
    }

    .earnings-summary-value {
        font-size: clamp(.68rem, 2.7vw, .82rem);
    }

}


/* =========================================================
   Very small phones
   ========================================================= */

@media (max-width: 360px) {

    .earnings-summary-stat {
        gap: .2rem;

        padding: 0 .2rem;
    }

    .earnings-summary-icon {
        width: 1.45rem;
        height: 1.45rem;

        font-size: .6rem;
    }

    .earnings-summary-stat-label {
        font-size: .525rem;
    }

    .earnings-summary-value {
        font-size: .67rem;
    }

}


/* =========================================================
   Tablet / larger screens
   ========================================================= */

@media (min-width: 640px) {

    .earnings-summary {
        gap: 1.5rem;

        padding: 1.5rem;
    }

    .earnings-summary-detail {
        font-size: .875rem;
    }

    .earnings-summary-total {
        font-size: 2.25rem;
    }

    .earnings-summary-stats {
        padding-top: 1.25rem;
    }

    .earnings-summary-stat {
        gap: .65rem;
    }

    .earnings-summary-icon {
        width: 2.5rem;
        height: 2.5rem;

        font-size: 1rem;
    }

    .earnings-summary-stat-label {
        font-size: .75rem;
    }

    .earnings-summary-value {
        font-size: 1rem;
    }

}


/* =========================================================
   Desktop
   ========================================================= */

@media (min-width: 1024px) {

    .earnings-summary-stat {
        gap: .75rem;
    }

    .earnings-summary-icon {
        width: 2.65rem;
        height: 2.65rem;

        font-size: 1.05rem;
    }

    .earnings-summary-stat-label {
        font-size: .8rem;
    }

    .earnings-summary-value {
        font-size: 1.125rem;
    }

}
