:root {
  --bg:          #0d1a17;
  --bg-card:     #122b24;
  --bg-hover:    #1a3d32;
  --border:      #1f4035;
  --text:        #e8f5f0;
  --text-muted:  #7ab5a0;
  --teal:        #1a6b5a;
  --gold:        #c4a96b;
  --moon:        #a8c5d8;
  --rose:        #c47a7a;
  --sage:        #7a9e7e;
  --amber:       #c49a3c;
  --success:     #4caf82;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 2px 12px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.header-link {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.greeting {
  padding: 12px 16px 0;
}

.greeting-name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.greeting-nakshatra {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.app-main {
  padding: 16px;
  padding-bottom: 80px;
  max-width: 720px;
  margin: 0 auto;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}

.nav-item {
  flex: 1;
  text-align: center;
  padding: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-decoration: none;
}

.nav-item:hover { color: var(--text); text-decoration: none; }
.nav-item--active { color: var(--text); font-weight: 600; }

/* Home card grid */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.home-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: background 0.15s, transform 0.15s;
}

.home-card:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

.home-card-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg);
}

.home-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-card-body {
  padding: 12px;
  position: relative;
}

.home-card-icon { font-size: 1.25rem; }

.home-card-title {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.home-card-sub {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.home-card--teal { border-top: 3px solid var(--teal); }
.home-card--indigo { border-top: 3px solid var(--moon); }
.home-card--sage { border-top: 3px solid var(--sage); }
.home-card--gold { border-top: 3px solid var(--gold); }
.home-card--rose { border-top: 3px solid var(--rose); }
.home-card--amber { border-top: 3px solid var(--amber); }
.home-card--slate { border-top: 3px solid var(--text-muted); }

.home-card.locked {
  opacity: 0.7;
  position: relative;
}
.home-card.locked .lock-badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-deep, #a8823c);
  border: 1px solid var(--gold, #c8a96b);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.upsell-box {
  background: var(--surface-2, #fbf6ea);
  border: 1px dashed var(--gold, #c8a96b);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.membership-unlock-lede {
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.membership-unlock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.75rem 0;
}
.membership-unlock-actions .btn {
  width: auto;
  flex: 1 1 10rem;
}
.membership-plan {
  background: var(--surface-2, #fbf6ea);
  border: 1px solid var(--gold, #c8a96b);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.membership-admin-card {
  border: 1px solid #e4dac6;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.admin-jump {
  margin: 0 0 1rem;
}

.badge {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-new {
  background: rgba(76, 175, 130, 0.2);
  color: var(--success);
}

/* Login */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-icon { font-size: 2.5rem; }
.login-brand h1 { margin: 8px 0 4px; }
.login-sub { color: var(--text-muted); margin: 0; font-size: 0.875rem; }

.login-form label {
  display: block;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.login-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.btn {
  display: inline-block;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
  width: 100%;
}

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

.btn-block { display: block; width: 100%; }

.alert {
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-success { background: rgba(76, 175, 130, 0.15); color: var(--success); }
.alert-error { background: rgba(196, 122, 122, 0.15); color: var(--rose); }

.dev-link-label { margin: 12px 0 4px; font-size: 0.75rem; }
.dev-link { word-break: break-all; font-size: 0.8125rem; }

/* Card detail pages */
.card-detail-header { margin-bottom: 20px; }
.back-link { font-size: 0.875rem; color: var(--text-muted); }
.card-detail-header h1 { margin: 8px 0 0; font-size: 1.375rem; }

.card-hero {
  margin: -16px -16px 16px;
  max-height: 180px;
  overflow: hidden;
}

.card-hero--short { max-height: 120px; }

.card-hero img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-hero--short img { height: 120px; }

.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

/* Weekly insight: cream/ink aligned with Sacred Sovereignty Weekly report */
.detail-section--weekly-insight {
  --weekly-bg: #f4efe4;
  --weekly-surface: #fffdf8;
  --weekly-ink: #2c2620;
  --weekly-muted: #6f6355;
  --weekly-line: #e4dac6;
  --weekly-gold: #c8a96b;
  --weekly-sage: #6f8f86;
  background: var(--weekly-bg);
  color: var(--weekly-ink);
  border: 1px solid var(--weekly-line);
  box-shadow: 0 1px 0 rgba(44, 38, 32, 0.04);
}

.detail-section--weekly-insight h2 {
  margin: 0 0 6px;
  color: var(--weekly-ink);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.detail-section--weekly-insight p {
  margin: 0 0 10px;
  color: var(--weekly-ink);
  line-height: 1.55;
}

.detail-section--weekly-insight p:last-child {
  margin-bottom: 0;
}

.detail-section--weekly-insight .muted {
  color: var(--weekly-muted);
  font-size: 0.875rem;
}

.detail-section--weekly-insight strong {
  color: var(--weekly-sage);
  font-weight: 650;
}

.detail-section--weekly-insight .action-step {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--weekly-surface);
  border: 1px solid var(--weekly-line);
  border-left: 3px solid var(--weekly-gold);
  border-radius: var(--radius-sm);
  color: var(--weekly-ink);
}

.muted { color: var(--text-muted); font-size: 0.875rem; }

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.report-embed {
  background: #fff;
  color: #111;
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

/* Timeline (moon) */
.timeline { position: relative; padding-left: 32px; }

.timeline-item {
  position: relative;
  padding-bottom: 24px;
  border-left: 2px solid var(--border);
  padding-left: 20px;
  margin-left: 8px;
}

.timeline-item--active .timeline-content {
  background: var(--bg-hover);
  border-color: var(--moon);
}

.timeline-marker {
  position: absolute;
  left: -27px;
  top: 0;
  font-size: 1.25rem;
  background: var(--bg);
  padding: 2px;
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.timeline-content h3 { margin: 0 0 4px; font-size: 1rem; }

/* Breathwork practice cards */
.practice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.practice-card--sage { border-left: 4px solid var(--sage); }
.practice-card--gold { border-left: 4px solid var(--gold); }

.mantra-hero {
  text-align: center;
  background: var(--bg-hover);
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0 0 14px;
}

.mantra-hero .mantra-text {
  font-size: 1.125rem;
  color: var(--gold);
  font-style: italic;
  margin: 0 0 6px;
}

.practice-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.practice-card-header h2 { margin: 0; font-size: 1.125rem; }
.practice-date { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.practice-summary { color: var(--text-muted); font-size: 0.9375rem; margin-bottom: 12px; }
.sky-section h2 {
  margin-top: 0;
}

.sky-section .sky-chip {
  max-width: 100%;
}

.sky-subtitle {
  margin: 16px 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.sky-bullet-list {
  margin: 0 0 8px;
  padding-left: 1.15rem;
  color: var(--text);
  line-height: 1.45;
}

.sky-bullet-list li {
  margin: 0 0 8px;
}

.sky-bullet-list li:last-child {
  margin-bottom: 0;
}

.sky-chip {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sage);
  background: rgba(26, 107, 90, 0.12);
  border: 1px solid rgba(26, 107, 90, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
}
.practice-posture-lede { font-size: 0.9375rem; margin: 0 0 6px; }
.practice-posture-cue { font-size: 0.875rem; margin: 0 0 10px; }
.pose-phase-list { margin: 6px 0 0; padding-left: 18px; }
.pose-phase-list li { margin-bottom: 4px; font-size: 0.875rem; }
.pose-phase {
  display: inline-block;
  min-width: 5.5rem;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sage);
  font-weight: 600;
}

.practice-section { margin-bottom: 12px; }
.practice-section h3 {
  margin: 0 0 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sage);
}

.practice-section--caution h3 { color: var(--rose); }

/* Mantra library */
.mantra-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.mantra-text { font-size: 1.0625rem; margin: 0 0 8px; }
.mantra-meta { margin: 4px 0; font-size: 0.875rem; }
.mantra-meta span { color: var(--gold); }

/* Reports list */
.report-group { margin-bottom: 24px; }
.report-group h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
}

.report-row:hover { background: var(--bg-hover); text-decoration: none; }
.report-row-main h3 { margin: 0; font-size: 0.9375rem; }

/* Book */
.book-section { margin-bottom: 24px; }
.iframe-wrap {
  position: relative;
  padding-bottom: 75%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.iframe-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Admin */
.admin-section { margin-bottom: 32px; }
.admin-section h2 { font-size: 1rem; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.admin-form label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.admin-form select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.file-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.file-row span:first-child { flex: 1; }

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 24px 0;
}

.journal-save {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.journal-note-label {
  display: block;
  margin-bottom: 8px;
}
.journal-note-label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.journal-save-btn { width: auto; }
.journal-year { margin-bottom: 20px; }
.journal-year h2 {
  font-size: 1.125rem;
  margin: 0 0 8px;
}
.journal-season {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  padding: 8px 12px 12px;
}
.journal-season summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
}
.journal-entry {
  border-top: 1px solid var(--border);
  padding: 12px 0 4px;
}
.journal-entry-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.journal-entry-header h3 { margin: 0; font-size: 1rem; }
.journal-note {
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.875rem;
}
.journal-delete { margin-top: 8px; }

@media (min-width: 600px) {
  .card-grid { gap: 16px; }
  .app-main { padding: 24px; }
}
