/* --- WORKTRACK PRO V8.3 - 100% VANILLA CSS SYSTEM --- */
:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-white: #ffffff;
  --green: #22c55e;
  --red: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Layout Utilities */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  flex-grow: 1;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.flex-1 {
  flex: 1;
}

.gap-2 {
  gap: 8px;
}

.gap-4 {
  gap: 16px;
}

.space-y-6>*+* {
  margin-top: 24px;
}

.hidden {
  display: none !important;
}

/* Components */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 20px);
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 4px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.month-selector {
  background: var(--bg-main);
  padding: 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.month-display {
  width: 120px;
  text-align: center;
  font-weight: 700;
  text-transform: capitalize;
  font-size: 14px;
  color: var(--text-main);
  background: none;
  border: none;
  padding: 6px 0;
}

.icon-btn {
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.icon-btn:active {
  background: white;
  box-shadow: var(--shadow-sm);
  color: var(--primary);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.earnings {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}

.stat-icon.hours {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

/* Actions */
.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-danger-outline {
  background: white;
  border: 1px solid #fee2e2;
  color: var(--red);
}

.btn-danger-outline:active {
  background: #fef2f2;
}

/* Calendar Shadow/Box */
.calendar-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.calendar-header-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 12px 0;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
}

.day-cell {
  background: white;
  min-height: 90px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s;
}

.day-cell:active {
  background: #f1f5f9;
}

.day-cell.today {
  background: #eff6ff;
}

.day-number {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.today .day-number {
  background: var(--primary);
  color: white;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.day-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.badge-earnings {
  font-size: 9px;
  font-weight: 900;
  color: var(--green);
}

.badge-hours {
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  width: fit-content;
  font-weight: 700;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 400px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-pop 0.2s ease-out;
}

@keyframes modal-pop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
}

.modal-header.primary {
  background: var(--primary);
  color: white;
}

.modal-header.muted {
  background: var(--bg-main);
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

textarea.input {
  min-height: 100px;
  resize: none;
  font-weight: 500;
  font-size: 14px;
}

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-main);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}