:root {
  --tressel-ink: #1d2b29;
  --tressel-forest: #2f5d50;
  --tressel-sage: #7aa68f;
  --tressel-sand: #f2ede5;
  --tressel-cloud: #f7f5f0;
  --tressel-coral: #d4744a;
  --tressel-sun: #f0b46a;
  --tressel-shadow: rgba(29, 43, 41, 0.12);
  --tressel-shadow-strong: rgba(29, 43, 41, 0.2);
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--tressel-ink);
  background: radial-gradient(circle at 20% 10%, rgba(122, 166, 143, 0.25), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(240, 180, 106, 0.25), transparent 50%),
    linear-gradient(160deg, #fdfbf7, var(--tressel-cloud));
  margin-bottom: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(47, 93, 80, 0.08) 1px, transparent 0);
  background-size: 26px 26px;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Fraunces", "Georgia", serif;
  color: var(--tressel-forest);
}

main {
  animation: fade-up 0.6s ease-out;
  flex: 1 0 auto;
}

.navbar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(47, 93, 80, 0.12);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 20;
}

.navbar-brand {
  font-family: "Fraunces", "Georgia", serif;
  font-weight: 700;
  color: var(--tressel-forest);
}

.nav-link {
  font-weight: 600;
  color: var(--tressel-ink);
}

.navbar .dropdown-toggle {
  color: inherit;
}

.navbar .dropdown-toggle:hover,
.navbar .dropdown-toggle:focus {
  color: var(--tressel-forest);
}

.nav-link:hover,
.nav-link:focus {
  color: var(--tressel-forest);
}

.card {
  border: none;
  border-radius: 18px;
  box-shadow: 0 16px 40px var(--tressel-shadow);
}

.card-title {
  font-weight: 600;
}

.btn-primary {
  background: var(--tressel-forest);
  border-color: var(--tressel-forest);
  box-shadow: 0 10px 20px rgba(47, 93, 80, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
  background: #244a40;
  border-color: #244a40;
}

.btn-outline-secondary {
  border-color: var(--tressel-forest);
  color: var(--tressel-forest);
}

.btn-outline-secondary:hover {
  background: var(--tressel-forest);
  color: #fff;
}

.badge.bg-primary {
  background-color: var(--tressel-coral) !important;
}

.table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table thead th {
  color: var(--tressel-forest);
  font-weight: 600;
  border-bottom: none;
}

.table tbody tr {
  background: #fff;
  box-shadow: 0 10px 20px rgba(29, 43, 41, 0.08);
}

.table tbody tr.table-dropped {
  box-shadow: 0 6px 12px rgba(29, 43, 41, 0.08);
}

.table tbody tr.table-dropped td {
  background: rgba(47, 93, 80, 0.08);
}

.table tbody td {
  border-top: none;
  vertical-align: middle;
}

.wellness-progress {
  height: 14px;
  border-radius: 999px;
  background: rgba(47, 93, 80, 0.15);
}

.progress-default {
  background: var(--tressel-forest);
}

.progress-bronze {
  background: #b8744c;
}

.progress-silver {
  background: #a8b0b7;
}

.progress-gold {
  background: #d6a84a;
}

.progress-markers {
  position: relative;
  height: 24px;
}

.progress-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.8rem;
  color: rgba(29, 43, 41, 0.7);
  white-space: nowrap;
}

.progress-marker::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 2px;
  height: 8px;
  background: rgba(29, 43, 41, 0.4);
  transform: translateX(-50%);
}

.sparkline {
  width: 100%;
  height: 48px;
  color: var(--tressel-forest);
}

.trend-chart {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  color: var(--tressel-forest);
}

.chart-axis {
  stroke: rgba(29, 43, 41, 0.3);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.chart-point {
  fill: currentColor;
  stroke: #f5f3ee;
  stroke-width: 1;
}

.chart-label {
  fill: rgba(29, 43, 41, 0.6);
  font-size: 9px;
}

.week-streak {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.week-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid rgba(47, 93, 80, 0.25);
  color: rgba(29, 43, 41, 0.6);
  font-size: 0.7rem;
  background: transparent;
}

.week-dot.is-complete {
  background: var(--tressel-forest);
  border-color: var(--tressel-forest);
  color: #fff;
}

.nav-tabs .nav-link {
  font-weight: 600;
  color: rgba(29, 43, 41, 0.7);
}

.nav-tabs .nav-link.active {
  color: var(--tressel-forest);
  background: #fff;
  border-color: rgba(47, 93, 80, 0.2) rgba(47, 93, 80, 0.2) transparent;
}

.auth-shell .badge {
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.auth-page {
  min-height: 70vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 32px;
  align-items: stretch;
}

.auth-hero {
  border-radius: 24px;
  padding: 32px;
  color: var(--tressel-ink);
  background:
    radial-gradient(circle at 20% 20%, rgba(240, 180, 106, 0.35), transparent 50%),
    radial-gradient(circle at 80% 0%, rgba(122, 166, 143, 0.35), transparent 50%),
    linear-gradient(150deg, #fefcf7, #f1ede5);
  box-shadow: 0 18px 50px var(--tressel-shadow-strong);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.auth-hero h1 {
  font-size: 2.4rem;
  margin-bottom: 16px;
}

.auth-hero ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}

.auth-hero li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 600;
  color: rgba(29, 43, 41, 0.8);
}

.auth-hero li::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tressel-sage);
  box-shadow: 0 0 0 4px rgba(122, 166, 143, 0.2);
}

.auth-panel .card {
  border-radius: 22px;
}

@media (max-width: 992px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    order: 2;
  }

  .auth-panel {
    order: 1;
  }
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: rgba(47, 93, 80, 0.2);
}

.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(122, 166, 143, 0.35);
  border-color: var(--tressel-sage);
}

.tooltip-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(47, 93, 80, 0.12);
  color: var(--tressel-forest);
  font-size: 12px;
  font-weight: 700;
  cursor: help;
  position: relative;
  top: -1px;
}

.tooltip-indicator::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 130%;
  transform: translateX(-50%);
  background: #fff;
  color: var(--tressel-ink);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 220px;
  max-width: 280px;
  box-shadow: 0 12px 30px var(--tressel-shadow);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-size: 0.85rem;
  line-height: 1.3;
  z-index: 10;
}

.tooltip-indicator::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 118%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #fff transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9;
}

.tooltip-indicator:hover::after,
.tooltip-indicator:hover::before,
.tooltip-indicator:focus::after,
.tooltip-indicator:focus::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

.tressel-hero {
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(122, 166, 143, 0.2), rgba(242, 237, 229, 0.95));
  box-shadow: 0 18px 50px var(--tressel-shadow-strong);
}

.tressel-pillars .card {
  background: rgba(255, 255, 255, 0.92);
}

.footer {
  background: transparent;
  border-top: 1px solid rgba(47, 93, 80, 0.12);
}

.nav-avatar-btn {
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.nav-avatar-btn.dropdown-toggle::after {
  display: none;
}

.nav-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(47, 93, 80, 0.2);
  box-shadow: 0 6px 16px rgba(29, 43, 41, 0.12);
}

.medal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid transparent;
}

.medal-bronze {
  background: rgba(176, 125, 87, 0.18);
  color: #6b3f1f;
  border-color: rgba(176, 125, 87, 0.35);
}

.medal-silver {
  background: rgba(154, 164, 178, 0.18);
  color: #3f4a57;
  border-color: rgba(154, 164, 178, 0.4);
}

.medal-gold {
  background: rgba(215, 168, 67, 0.2);
  color: #6a4a11;
  border-color: rgba(215, 168, 67, 0.45);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(47, 93, 80, 0.2);
  box-shadow: 0 10px 24px rgba(29, 43, 41, 0.12);
}

.dropdown-menu {
  border: none;
  border-radius: 16px;
  box-shadow: 0 16px 40px var(--tressel-shadow);
  z-index: 30;
}

.navbar .dropdown-menu {
  margin-top: 8px;
}

.profile-danger-toggle {
  cursor: pointer;
  color: rgba(29, 43, 41, 0.7);
  font-weight: 600;
}

.profile-danger-toggle:hover,
.profile-danger-toggle:focus {
  color: var(--tressel-forest);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .tressel-hero {
    padding: 16px;
  }

  .table {
    border-spacing: 0 4px;
  }
}
