:root {
  color-scheme: dark;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --bg: #050816;
  --bg-elevated: #0f172a;
  --surface: #111b2e;
  --surface-variant: #16233a;
  --outline: #1f2a40;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --primary: #7dd3fc;
  --primary-dark: #38bdf8;
  --accent: #c084fc;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem;
  background: radial-gradient(circle at 20% 0%, #1e1b4b 0%, transparent 55%),
    radial-gradient(circle at 80% 10%, #0f766e 0%, transparent 45%), var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

body.auth-locked .page {
  filter: blur(4px);
  pointer-events: none;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, border 0.2s;
}

button.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #051524;
  box-shadow: 0 10px 25px rgba(125, 211, 252, 0.25);
}

button.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--accent));
}

button.ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--outline);
}

button.ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

button.icon-button {
  background: var(--surface-variant);
  color: var(--text-secondary);
  padding: 0.35rem 0.9rem;
  border-radius: 0.8rem;
  font-size: 0.85rem;
  border: 1px solid var(--outline);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(5, 8, 22, 0.8);
  z-index: 10;
}

.auth-overlay.hidden {
  display: none;
}

.auth-overlay-card {
  max-width: 420px;
  background: var(--surface);
  padding: 2rem;
  border-radius: 1.25rem;
  text-align: center;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.65);
}

.page .auth-locked {
  filter: blur(4px);
}

.auth-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: 1.25rem;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--outline);
}

.auth-bar .eyebrow.small {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.auth-bar #auth-status {
  font-weight: 600;
}

.auth-bar-actions {
  display: flex;
  gap: 0.75rem;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  border-radius: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--outline);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  margin-bottom: 2rem;
}

.eyebrow {
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle {
  margin: 0;
  color: var(--text-secondary);
  max-width: 60ch;
}

.layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border-radius: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--outline);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.card-header h2 {
  margin: 0;
}

.card-header p {
  margin: 0.4rem 0 0;
  color: var(--text-secondary);
}

.dropzone {
  border: 2px dashed var(--outline);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface-variant);
  transition: border 0.2s, background 0.2s;
  display: grid;
  gap: 0.4rem;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--primary);
  background: #162844;
}

.dropzone input {
  display: none;
}

.hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.upload-meta {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.filter-card label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 500;
}

input,
select {
  border-radius: 0.75rem;
  border: 1px solid var(--outline);
  background: var(--surface-variant);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #1f2937;
  border-radius: 999px;
  transition: background 0.2s;
}

.switch span::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #e2e8f0;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::before {
  transform: translateX(20px);
}

.auth-connections {
  display: flex;
  gap: 0.75rem;
}

.preview-meta {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--surface-variant);
  color: var(--text-secondary);
  border: 1px solid var(--outline);
  margin-bottom: 1rem;
}

.timeline-card {
  border: 1px solid var(--outline);
  background: var(--surface);
  border-radius: 1.2rem;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.timeline-header.main {
  border-bottom: 1px solid var(--outline);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.timeline-header.main h2 {
  margin: 0;
}

.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.timeline-header h3 {
  margin: 0;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.calendar-select-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.calendar-select-row label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

#google-calendar-select {
  width: 100%;
  border-radius: 0.9rem;
  padding: 0.55rem 0.85rem;
  background: var(--surface-variant);
  border: 1px solid var(--outline);
  color: var(--text-primary);
  font-size: 0.95rem;
}

#google-calendar-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.timeline-entry {
  border-radius: 1rem;
  border: 1px solid var(--outline);
  padding: 0.9rem 1rem;
  background: rgba(15, 23, 42, 0.7);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.timeline-entry .meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.timeline-entry .event {
  font-weight: 600;
}

.timeline-entry .tag {
  align-self: flex-start;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.18);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.timeline-entry.nd .tag {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5f5;
}

.timeline-entry .details {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.person-pill {
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.25);
  color: #67e8f9;
  font-weight: 600;
}

.detail-chip {
  padding: 0.2rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(129, 140, 248, 0.18);
  color: #c7d2fe;
}

.summary-card .preview-meta {
  margin-bottom: 1rem;
}

.service-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.service-list li {
  border: 1px solid var(--outline);
  border-radius: 0.8rem;
  padding: 0.65rem 0.8rem;
  background: var(--surface-variant);
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.9rem;
}

.service-list li span:first-child {
  font-weight: 600;
}

.service-list .service-empty {
  justify-content: center;
  color: var(--text-secondary);
}

.timeline-card .ooo-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px dashed var(--outline);
  border-radius: 0.8rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.page ::selection {
  background: rgba(125, 211, 252, 0.35);
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    padding: 1.5rem 1rem;
  }

  .auth-bar,
  .hero {
    padding: 1.25rem;
  }

  .timeline-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
