/* === DESIGN SYSTEM === */
:root {
  /* Extended color scale — auto-derived from whatever --primary Sonnet picks */
  --primary-50: color-mix(in srgb, var(--primary, #3b82f6) 8%, white);
  --primary-100: color-mix(in srgb, var(--primary, #3b82f6) 16%, white);
  --primary-200: color-mix(in srgb, var(--primary, #3b82f6) 30%, white);
  --primary-300: color-mix(in srgb, var(--primary, #3b82f6) 50%, white);
  --primary-400: color-mix(in srgb, var(--primary, #3b82f6) 75%, white);
  --primary-500: var(--primary, #3b82f6);
  --primary-600: color-mix(in srgb, var(--primary, #3b82f6) 90%, black);
  --primary-700: color-mix(in srgb, var(--primary, #3b82f6) 72%, black);
  --primary-800: color-mix(in srgb, var(--primary, #3b82f6) 56%, black);
  --primary-900: color-mix(in srgb, var(--primary, #3b82f6) 40%, black);

  /* Shadow system — layered multi-stop, not single-layer */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Spacing scale */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  /* Radius tokens */
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px;
  --radius-xl: 12px; --radius-2xl: 16px; --radius-full: 9999px;

  /* Transition tokens */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
}

/* Typography polish */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; line-height: 1.15; }
p, li, td, th { letter-spacing: -0.005em; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border, #e2e8f0); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light, #94a3b8); }

/* Selection color */
::selection { background: var(--primary-100, rgba(59,130,246,0.15)); color: var(--primary-900, #1e3a5f); }

/* Focus ring */
:focus-visible { outline: 2px solid var(--primary, #3b82f6); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px var(--primary-100, rgba(59,130,246,0.12));
}

/* Dark mode shadow + transition */
body.dark {
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.35), 0 4px 6px -4px rgba(0,0,0,0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.4), 0 8px 10px -6px rgba(0,0,0,0.2);
}
body { transition: background-color var(--duration-normal, 200ms) ease, color var(--duration-normal, 200ms) ease; }
.sidebar, .card, .modal, nav, header, .stat-card, input, select, textarea, button, table, thead, th, td, .nav-btn {
  transition: background-color var(--duration-normal, 200ms) ease, color var(--duration-normal, 200ms) ease, border-color var(--duration-normal, 200ms) ease, box-shadow var(--duration-normal, 200ms) ease;
}

/* Smooth image rendering */
img { image-rendering: auto; }

/* Base link styling */
a { transition: color var(--duration-fast, 150ms) ease; }
/* === END DESIGN SYSTEM === */

/* === CLINT FORCED CSS FIXES APPLIED === */
html { scroll-padding-top: 90px; scroll-behavior: smooth; }
@media (max-width: 768px) { html { scroll-padding-top: 70px; } }
/* === VARIABLES === */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #64748b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --danger: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius: 8px;
  --sidebar-width: 240px;
}

body.dark {
  --background: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-light: #94a3b8;
  --border: #334155;
  --primary-light: #1e3a5f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.25), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -4px rgba(0,0,0,0.2);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
p { line-height: 1.6; }

/* === APP LAYOUT === */
#mainApp {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.logo i {
  font-size: 20px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  min-height: 40px;
}

.nav-btn i {
  width: 16px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--background);
  color: var(--text);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  transition: all 150ms ease;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  min-height: 40px;
}

.logout-btn:hover {
  background: #fef2f2;
  color: var(--error);
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--background);
}

.page {
  padding: 28px 32px;
  min-height: 100%;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* === BUTTONS === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--background);
  border-color: var(--secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  background: #fef2f2;
  color: var(--error);
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-danger:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 150ms ease;
  font-size: 12px;
}

.icon-btn:hover {
  background: var(--background);
  color: var(--text);
  border-color: var(--secondary);
}

/* === CALENDAR NAV === */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 130px;
  text-align: center;
}

/* === NLP BAR === */
.nlp-bar {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.nlp-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nlp-icon {
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
}

.nlp-input-wrap input {
  flex: 1;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--background);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  min-height: 44px;
}

.nlp-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.nlp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.nlp-btn:hover {
  background: var(--primary-dark);
}

.nlp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nlp-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 6px;
  transition: all 150ms ease;
  font-size: 14px;
}

.nlp-close:hover {
  background: var(--background);
  color: var(--text);
}

.nlp-preview {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.nlp-preview-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.nlp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.nlp-chip i {
  font-size: 11px;
}

.nlp-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* === CALENDAR GRID === */
.calendar-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

.calendar-header-row span {
  text-align: center;
  padding: 10px 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

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

.cal-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 110px;
  padding: 8px;
  transition: background 150ms ease;
  position: relative;
}

.cal-day:nth-child(7n) { border-right: none; }

.cal-day.other-month {
  background: var(--background);
  opacity: 0.5;
}

.cal-day.today .cal-day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.cal-day.today .cal-day-num {
  color: #fff;
}

.cal-jobs {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-job {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-left: 3px solid var(--primary);
}

.cal-job:hover {
  background: var(--primary);
  color: #fff;
  transform: translateX(1px);
}

.cal-job.past {
  opacity: 0.4;
  background: var(--border);
  color: var(--text-light);
  border-left-color: var(--text-light);
}

.cal-job.past:hover {
  opacity: 0.7;
  background: var(--border);
  color: var(--text-light);
}

.cal-job.completed {
  background: #dcfce7;
  color: #15803d;
  border-left-color: var(--success);
}

.cal-job.cancelled {
  background: #fef2f2;
  color: #b91c1c;
  border-left-color: var(--error);
  text-decoration: line-through;
  opacity: 0.6;
}

.cal-job-time {
  font-weight: 600;
  font-size: 10px;
  flex-shrink: 0;
}

.cal-more {
  font-size: 10px;
  color: var(--text-light);
  padding: 2px 6px;
  font-weight: 500;
  cursor: pointer;
}

/* === JOBS LIST === */
.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-card {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 200ms ease;
  cursor: pointer;
}

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.job-card.past {
  opacity: 0.6;
}

.job-card-accent {
  width: 4px;
  background: var(--primary);
  flex-shrink: 0;
}

.job-card.past .job-card-accent { background: var(--text-light); }
.job-card.completed .job-card-accent { background: var(--success); }
.job-card.cancelled .job-card-accent { background: var(--error); }

.job-card-body {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.job-card-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  flex-shrink: 0;
}

.job-date-day {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
}

.job-date-month {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.job-card-info {
  flex: 1;
  min-width: 0;
}

.job-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.job-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
}

.job-meta-item i {
  font-size: 11px;
}

.job-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 0 4px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.scheduled, .status-badge.active, .status-badge.pro {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-badge.completed, .status-badge.success {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.cancelled, .status-badge.canceled, .status-badge.error {
  background: #fef2f2;
  color: #b91c1c;
}

.status-badge.free {
  background: #f1f5f9;
  color: #475569;
}

.status-badge.trialing {
  background: #fef9c3;
  color: #a16207;
}

.gcal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #4285f4;
  background: #e8f0fe;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}

/* === SEARCH / FILTER === */
.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 12px;
}

.search-input {
  height: 38px;
  padding: 0 12px 0 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  width: 200px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.filter-select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms ease;
}

.filter-select:focus {
  border-color: var(--primary);
  outline: none;
}

/* === EMPTY STATES === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-light);
  max-width: 300px;
  margin-bottom: 20px;
}

/* === SETTINGS === */
.account-settings-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 600px;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.account-card-header i {
  font-size: 18px;
  color: var(--primary);
}

.card-description {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
  line-height: 1.5;
}

.account-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.account-detail:last-of-type {
  border-bottom: none;
}

.account-detail-label {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}

.account-detail-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.account-manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 0 18px;
  height: 38px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
}

.account-manage-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.gcal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.gcal-connect-btn {
  background: #4285f4;
}

.gcal-connect-btn:hover {
  background: #3367d6;
}

/* === PREFERENCES === */
.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  gap: 16px;
}

.pref-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.pref-desc {
  font-size: 12px;
  color: var(--text-light);
}

.pref-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-btns {
  display: flex;
  gap: 6px;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-light);
  transition: all 150ms ease;
}

.theme-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* === MODALS === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.18);
  animation: modalIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.modal-sm {
  max-width: 400px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-light);
  cursor: pointer;
  font-size: 14px;
  transition: all 150ms ease;
}

.modal-close:hover {
  background: var(--background);
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 70vh;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.confirm-text {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
}

/* === FORMS === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-group textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* === TOAST === */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 340px;
  pointer-events: all;
  animation: toastIn 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--error); }
.toast.toast-info { border-left: 3px solid var(--primary); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

.toast-icon { font-size: 14px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-info .toast-icon { color: var(--primary); }
.toast-warning .toast-icon { color: var(--warning); }

/* === LOADING SPINNER === */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 200;
    transition: left 0.3s ease;
  }

  .sidebar.open { left: 0; }

  .main-content { width: 100%; }

  .page { padding: 16px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-nav { flex-wrap: wrap; }

  .form-row { grid-template-columns: 1fr; }

  .cal-day { min-height: 70px; padding: 4px; }

  .modal { max-width: 100%; }
}

@media (max-width: 480px) {
  .cal-day { min-height: 50px; padding: 2px 3px; }
  .cal-job-time { display: none; }
}

/* body.dark overrides */
body.dark .cal-job {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

body.dark .cal-job.past {
  background: rgba(100, 116, 139, 0.2);
  color: #64748b;
}

body.dark .cal-job.completed {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

body.dark .cal-job.cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

body.dark .gcal-badge {
  background: rgba(66, 133, 244, 0.2);
  color: #93c5fd;
}

body.dark .logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

body.dark .btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

body.dark .btn-danger:hover {
  background: var(--error);
  color: #fff;
}

body.dark .status-badge.scheduled,
body.dark .status-badge.active,
body.dark .status-badge.pro {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

body.dark .status-badge.completed,
body.dark .status-badge.success {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

body.dark .status-badge.cancelled,
body.dark .status-badge.canceled {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

body.dark .status-badge.free {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

body.dark .status-badge.trialing {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}
/* System fix: force modal children visible — CSS animations unreliable */
.modal[style*="display: flex"] .modal-box,
.modal[style*="display: flex"] .modal-content,
.modal[style*="display: flex"] .modal-inner,
.modal[style*="display:flex"] .modal-box,
.modal[style*="display:flex"] .modal-content,
.modal[style*="display:flex"] .modal-inner {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}
/* System fix: modal body must scroll, never clip */
.modal-body { overflow-y: auto !important; max-height: 70vh !important; }
.modal-box { overflow: visible !important; }
.modal-box-wide { max-width: 700px !important; }

/* === CLINT NAV HEIGHT NORMALIZER === */
.sidebar [data-page], .sidebar-link, .sidebar > a, .sidebar > button, .sidebar nav a, .sidebar nav button,
nav.sidebar [data-page], aside [data-page], aside > a, aside > button,
[class*="sidebar"] [data-page], [class*="sidebar-item"], [class*="nav-item"] {
  display: flex !important; align-items: center !important; gap: 10px !important;
  white-space: nowrap !important; box-sizing: border-box !important;
  height: 40px !important; min-height: 40px !important; max-height: 40px !important;
  padding: 0 12px !important; line-height: 1 !important;
  overflow: hidden !important;
}
.sidebar [data-page] > svg, .sidebar-link > svg, .sidebar > a > svg, .sidebar > button > svg,
.sidebar [data-page] > img, .sidebar-link > img, .sidebar > a > img, .sidebar > button > img,
nav.sidebar svg, nav.sidebar img, aside [data-page] svg, aside [data-page] img,
[class*="sidebar"] svg, [class*="sidebar"] img,
[class*="nav-item"] svg, [class*="nav-item"] img {
  width: 18px !important; height: 18px !important; flex-shrink: 0 !important;
}
/* === END CLINT NAV HEIGHT NORMALIZER === */


/* === LEGAL LINKS === */
.legal-agree { display:flex; align-items:flex-start; gap:0.5rem; margin:0.75rem 0; font-size:0.8rem; color:#6b7280; }
.legal-agree input[type="checkbox"] { margin-top:0.2rem; accent-color:#667eea; }
.legal-agree a { color:#667eea; text-decoration:underline; cursor:pointer; }
.legal-agree a:hover { color:#4f46e5; }
/* === END LEGAL LINKS === */

/* === COMPONENT POLISH === */
/* Low-specificity defaults — Sonnet's more-specific selectors override these */

/* Buttons — micro-interactions */
button, .btn, [class*="btn-"] {
  transition: transform var(--duration-fast, 150ms) var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
              box-shadow var(--duration-fast, 150ms) var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
              background-color var(--duration-fast, 150ms) ease,
              border-color var(--duration-fast, 150ms) ease,
              color var(--duration-fast, 150ms) ease;
  cursor: pointer;
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
button:active:not(:disabled), .btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Cards — hover lift */
.card, [class*="-card"], .stat-card, [class*="Card"] {
  transition: transform var(--duration-normal, 200ms) var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
              box-shadow var(--duration-normal, 200ms) var(--ease-out, cubic-bezier(0.16,1,0.3,1)),
              border-color var(--duration-normal, 200ms) ease,
              background-color var(--duration-normal, 200ms) ease;
}
.card:hover, [class*="-card"]:hover, .stat-card:hover, [class*="Card"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0,0,0,0.08));
}

/* Tables — polished headers and row hover */
table { border-collapse: separate; border-spacing: 0; width: 100%; }
thead th {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-light, #6b7280);
}
tbody tr { transition: background-color var(--duration-fast, 150ms) ease; }
tbody tr:hover { background-color: var(--primary-50, rgba(59,130,246,0.04)); }

/* Nav items — transition */
.nav-btn, .nav-item, [data-page] {
  transition: background-color var(--duration-fast, 150ms) ease,
              color var(--duration-fast, 150ms) ease;
}

/* Badges / Status pills */
.badge, .status-badge, [class*="badge"], .tag, .chip, .pill {
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--radius-full, 9999px);
  padding: 2px 10px;
  display: inline-flex; align-items: center;
}

/* Toast / notification — slide in animation */
.toast, .notification, [class*="toast"] {
  box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0,0,0,0.1));
  border-radius: var(--radius-lg, 8px);
  animation: ds-slideIn var(--duration-slow, 300ms) var(--ease-out, cubic-bezier(0.16,1,0.3,1));
}
@keyframes ds-slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Form inputs — consistent sizing and focus */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select, textarea {
  font-family: inherit;
  transition: border-color var(--duration-fast, 150ms) ease, box-shadow var(--duration-fast, 150ms) ease;
}

/* Modal backdrop */
.modal, [class*="modal-overlay"], .overlay {
  transition: opacity var(--duration-normal, 200ms) ease;
}

/* Empty states */
.empty-state, [class*="empty"], .no-data, .no-results { opacity: 0.7; }

/* Loading skeleton shimmer */
@keyframes ds-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton, [class*="skeleton"], .loading-placeholder {
  background: linear-gradient(90deg, var(--border, #e2e8f0) 25%, var(--background, #f8fafc) 50%, var(--border, #e2e8f0) 75%);
  background-size: 200% 100%;
  animation: ds-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md, 6px);
}

/* Smooth page transitions */
.page, [class*="Page"], section[id$="Page"] {
  animation: ds-fadeIn var(--duration-slow, 300ms) ease;
}
@keyframes ds-fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
/* === END COMPONENT POLISH === */