:root {
  --color-bg: #faf7f2;
  --color-bg-alt: #f1ece2;
  --color-surface: #ffffff;
  --color-text: #2b2a26;
  --color-text-muted: #6b6a63;
  --color-primary: #4a6b52;
  --color-primary-dark: #35503c;
  --color-accent: #c96f4a;
  --color-accent-dark: #a8532f;
  --color-border: #e4ddd0;
  --color-locked: #cfc9bb;
  --radius: 14px;
  --max-width: 1180px;
  --header-height: 65px;
  --font-heading: Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: normal;
  color: var(--color-text);
  line-height: 1.25;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

/* Header */

.app-header {
  position: sticky;
  top: 0;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
  z-index: 20;
  height: var(--header-height);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-primary-dark);
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--color-primary-dark);
  text-decoration: none;
}

.progress-pill {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

/* App shell */

.app-shell {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding-top: 32px;
}

/* Sidebar */

.sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--color-text);
  cursor: pointer;
}

.nav-item:hover:not(:disabled) {
  background: var(--color-bg-alt);
}

.nav-item.active {
  background: var(--color-surface);
  border-color: var(--color-primary);
  font-weight: 600;
  color: var(--color-primary-dark);
}

.nav-item.today:not(.active) {
  border-color: var(--color-accent);
}

.nav-item:disabled {
  color: var(--color-locked);
  cursor: default;
}

.nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-status {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.nav-overview {
  margin-bottom: 4px;
}

.nav-prep {
  margin-bottom: 14px;
}

.nav-phase {
  margin-bottom: 14px;
}

.nav-phase-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 6px 12px 4px;
}

.nav-phase-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-backdrop {
  display: none;
}

/* Content pane */

.content-pane {
  flex: 1;
  min-width: 0;
  padding-bottom: 96px;
}

.view h1 {
  font-size: 2rem;
  margin: 0 0 16px;
}

/* Welcome view */

.welcome-sub {
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.progress-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  overflow: hidden;
  max-width: 420px;
  margin-bottom: 20px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.welcome-message {
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* Day / prep eyebrow */

.day-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--color-accent-dark);
  font-weight: 600;
  margin-bottom: 8px;
}

.video-wrapper {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-width: 720px;
}

.video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-placeholder-text {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.day-text {
  margin-bottom: 24px;
  color: var(--color-text);
  max-width: 640px;
}

.task-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
  max-width: 640px;
}

.task-box h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.task-box p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Checklist (prep view) */

.checklist-title {
  font-size: 1.1rem;
  margin: 8px 0 4px;
}

.checklist-counter {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

.checklist {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 4px 4px;
}

.checklist-item label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.95rem;
}

.checklist-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.checklist-item.checked span {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

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

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

.btn-primary:disabled {
  background: var(--color-locked);
  cursor: default;
}

.btn-complete.is-completed {
  background: var(--color-surface);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-primary);
}

/* Mobile */

@media (max-width: 900px) {
  .sidebar-toggle {
    display: block;
  }

  .app-shell {
    padding-top: 20px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-height: none;
    width: min(300px, 82vw);
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 20px 16px 20px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(43, 42, 38, 0.4);
    z-index: 25;
  }
}
