/* ===== Base ===== */
* {
  box-sizing: border-box;
}

:root {
  --nav-height: 56px;      /* реальная высота glass-nav */
  --nav-offset: 16px;     /* bottom: 16px */
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  background: var(--tg-theme-secondary-bg-color, #f2f2f2);
  color: #111;
}

/* ===== Glass Navigation ===== */
.glass-nav {
  position: fixed;            /* ✅ ТОЛЬКО fixed */
  bottom: calc(var(--nav-offset) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  align-items: center;

  padding: 8px;
  width: calc(100% - 32px);
  max-width: 420px;

  border-radius: 999px;
  z-index: 100;
}



/* Blur background layer */
.glass-bg {
  position: absolute;
  inset: 0;

  background: rgba(30, 30, 34, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 30px rgba(0, 0, 0, 0.4);

  pointer-events: none;
  z-index: 0;
}

/* ===== Navigation Item ===== */
.nav-item {
  flex: 1;
  position: relative;
  z-index: 1;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 4px;
  padding: 10px 0;

  font-size: 12px;
  line-height: 1;
  text-align: center;

  color: rgba(255, 255, 255, 0.7);
  border-radius: 999px;

  cursor: pointer;
  user-select: none;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  transition: background 0.2s ease, color 0.2s ease;
}

/* ===== Icon wrapper (SVG & Avatar) ===== */
.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* SVG icons */
.nav-item svg {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  color: currentColor;
}

/* ===== Avatar ===== */
.nav-profile .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
}

.nav-profile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Active State ===== */
.nav-item.active {
  background: rgba(80, 160, 255, 0.25);
  color: #4da3ff;
}

.nav-item.active svg {
  filter: drop-shadow(0 0 6px rgba(77, 163, 255, 0.6));
}

.nav-item.active .avatar {
  outline: 2px solid rgba(77, 163, 255, 0.6);
  outline-offset: 2px;
}

/* ===== Optional: hover (desktop only) ===== */
@media (hover: hover) {
  .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}


.progress-svg {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  display: block;
  overflow: visible;
}


.progress-ring {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;

  /* 🔑 КЛЮЧ */
  height: 260px; /* подбирается под дизайн */
}


/* фон */
#progressBg {
  fill: none;
  stroke: rgba(122, 122, 122, 0.08);
  stroke-width: 20;
  stroke-linecap: round;
}

/* прогресс */
#progressArc {
  fill: none;
  stroke: #4da3ff;
  stroke-width: 20;
  stroke-linecap: round;

transition: stroke-dasharray 0.8s cubic-bezier(.2,.8,.2,1);
}

/* ===== Center content ===== */
.progress-center {
  position: absolute;
  inset: 0;
  transform: translateY(40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;
  pointer-events: none;
}


.progress-percent {
  font-size: 48.34px;
  font-weight: 700;
  color: var(--tg-theme-text-color, #fff);
}

.progress-sub {
  margin-top: 2px;
  font-size: 16px;
  color: var(--tg-theme-text-color, #fff);
  opacity: 0.8;
}

.progress-days {
  margin-top: 4px;
  font-size: 14px;
  color: var(--tg-theme-link-color, #4da3ff);
}


/* Для оверлея Progress Chart */
.metric-switch {
  display: flex;
  gap: 12px;

  overflow-x: auto;
  overflow-y: hidden;

  -webkit-overflow-scrolling: touch; /* iOS */
  scroll-behavior: smooth;

  padding-bottom: 4px; /* чтобы тень не резалась */
}

.metric-switch::-webkit-scrollbar {
  display: none;
}

.metric-switch {
  scrollbar-width: none; /* Firefox */
}

.chart-btn {
  display: flex;
  flex-direction: column;

  flex: 0 0 auto;      /* 🔥 НЕ растягиваться */
  width: 110px;        /* подбери под UI */
  min-width: 110px;    /* обязательно */

  justify-content: center;
  align-items: center;
  gap: 5px;

  padding: 5px 6px;
  border-radius: 14px;

  background: var(--card-bg, #000);
  border: 1px solid rgba(255, 255, 255, 0.08);

  color: var(--tg-theme-accent-text-color);
  font-size: 14px;
  font-weight: 500;

  cursor: pointer;
  white-space: nowrap;
}

.chart-btn.active {
  background: var(--tg-theme-secondary-bg-color, rgba(255,255,255,0.06));
  border-color: var(--tg-theme-accent-text-color);
  font-weight: 700;
}

.chart-btn:not(.active) {
  opacity: 0.6;
}

.metric-switch {
  scroll-snap-type: x proximity;
}

.chart-btn {
  scroll-snap-align: start;
}

.chart-btn .title {
  white-space: normal;      /* 🔥 разрешаем перенос */
  text-align: center;
  line-height: 1.2;
  word-break: break-word;   /* на всякий случай */
}

.m-divider{
    background: var(--card-bg, #000);
    height: 12px;
    border: none;
}

  .overlay[data-overlay="addDailyWeight"] .modal-content {
        background: var(--bg-color, #fff);
        padding: 20px;
        border-radius: 15px;
        width: 90%;
        max-width: 400px;
        margin: auto;
    }
    .input-group {
        margin-bottom: 15px;
        display: flex;
        flex-direction: column;
    }
    .input-group label {
        font-size: 0.9rem;
        margin-bottom: 5px;
        color: var(--text-secondary);
    }
    .input-group input {
        padding: 12px;
        border: 1px solid var(--border-color, #ccc);
        border-radius: 8px;
        font-size: 1rem;
    }
    .btn-primary {
        width: 100%;
        padding: 12px;
        background: #0088cc; /* Telegram Blue */
        color: white;
        border: none;
        border-radius: 8px;
        font-weight: bold;
        cursor: pointer;
    }
    .btn-primary:disabled {
        opacity: 0.6;
    }