/* Компоненты: панели, заголовки, кнопки, чипы, карточки */

/* ---------- Заголовок страницы ---------- */
.page-head {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
}

.page-title {
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 0 28px rgba(0, 229, 255, 0.25);
}

.page-sub {
  max-width: 68ch;
  color: var(--text-dim);
}

.hl {
  color: var(--magenta);
  text-shadow: var(--glow-magenta);
  font-weight: 600;
}

.footnote {
  margin-top: 32px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* ---------- Стеклянная панель с HUD-уголками ---------- */
.panel {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(230, 247, 255, 0.05),
    var(--shadow-panel);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border-color: var(--accent, var(--cyan));
  border-style: solid;
  opacity: 0.9;
  filter: drop-shadow(0 0 4px var(--accent, var(--cyan)));
}

.panel::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: var(--radius);
}

.panel::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: var(--radius);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel__title {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}

.panel__title::before {
  content: "// ";
  color: var(--text-faint);
}

.panel__meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 229, 255, 0.08);
  color: var(--cyan);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background var(--t-fast),
    box-shadow var(--t-fast),
    border-color var(--t-fast);
}

.btn:hover {
  background: rgba(0, 229, 255, 0.16);
  box-shadow: var(--glow-cyan);
  border-color: var(--cyan);
}

.btn--ghost {
  background: transparent;
}

.btn--icon {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.btn__icon {
  width: 18px;
  height: 18px;
}

.btn__icon svg,
.btn--icon svg {
  width: 18px;
  height: 18px;
}

/* ---------- Чипы-фильтры ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  --c: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 14px 6px 10px;
  border: 1px solid rgba(143, 166, 186, 0.3);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1.5px solid var(--c);
}

.chip[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  box-shadow: 0 0 12px -4px var(--c);
}

.chip[aria-pressed="true"] .chip__dot {
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}

/* ---------- Сегментный переключатель ---------- */
.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(5, 7, 15, 0.5);
}

.seg__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 16px 6px 8px;
  border-radius: 10px;
  color: var(--text-dim);
  transition: all var(--t-fast);
}

.seg__item:hover {
  color: var(--text);
}

.seg__item.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}

.seg__glyph {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}

.seg__text {
  display: grid;
  line-height: 1.15;
}

.seg__name {
  font-weight: 600;
}

.seg__age {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- Метки ---------- */
.tag {
  --c: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 6px;
  color: var(--c);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag--vaccine { --c: var(--c-vaccine); }
.tag--checkup { --c: var(--c-checkup); }
.tag--feeding { --c: var(--c-feeding); }
.tag--screening { --c: var(--c-screening); }
.tag--optional { --c: var(--text-dim); border-style: dashed; }
.tag--risk { --c: var(--amber); }
.tag--soon { --c: var(--magenta); }
.tag--done { --c: var(--mint); }

/* ---------- Сетки ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 899px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Карточки семьи ---------- */
.crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  gap: 20px;
}

.member {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  grid-template-areas:
    "avatar head"
    "avatar stats"
    "avatar cta";
  grid-template-rows: auto auto 1fr;
  gap: 6px 22px;
  align-items: start;
}

.member__avatar {
  grid-area: avatar;
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}

.orbit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.orbit__track {
  fill: none;
  stroke: rgba(143, 166, 186, 0.16);
  stroke-width: 4;
}

.orbit__bar {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px var(--accent));
  transition: stroke-dashoffset 1.2s var(--ease);
}

.orbit__inner {
  fill: color-mix(in srgb, var(--accent) 7%, transparent);
  stroke: color-mix(in srgb, var(--accent) 40%, transparent);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.member__glyph {
  position: relative;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 40px;
  color: var(--accent);
  text-shadow: 0 0 18px var(--accent);
}

.member__pct {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  font-size: 10px;
  color: var(--accent);
}

.member__head {
  grid-area: head;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.member__head .eyebrow {
  color: var(--accent);
}

.member__name {
  font-size: 30px;
  font-weight: 800;
}

.member__stats {
  grid-area: stats;
}

.member__cta {
  grid-area: cta;
  justify-self: start;
  margin-top: 10px;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 10px 0 0;
}

.stat {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stat dt {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat dd {
  margin: 0;
  font-weight: 500;
}

@media (max-width: 560px) {
  .member {
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-areas:
      "avatar head"
      "stats stats"
      "cta cta";
    grid-template-rows: auto;
    align-items: center;
    gap: 6px 16px;
  }
  .member__avatar {
    width: 84px;
    height: 84px;
  }
  .member__glyph {
    font-size: 28px;
  }
  .member__name {
    font-size: 26px;
  }
  .stats {
    gap: 12px 14px;
  }
  .stat dd {
    font-size: 15px;
  }
}

/* ---------- Мостик ---------- */
.hero {
  display: grid;
  gap: 8px;
  margin-bottom: 26px;
}

.hero__title {
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 800;
}

.hero__title b {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

.crew-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.crew-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 6%, rgba(5, 7, 15, 0.5));
  color: var(--text);
  transition: background var(--t-fast);
}

a.crew-chip:hover {
  background: color-mix(in srgb, var(--accent) 12%, rgba(5, 7, 15, 0.5));
}

.crew-chip__glyph {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: 0 0 12px -3px var(--accent);
}

.crew-chip__text {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.crew-chip__name {
  font-weight: 700;
}

.crew-chip__age {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 899px) {
  .crew-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Питомцы — вторая линия под экипажем: та же сетка, пунктирная рамка, иконка вместо инициала */
.pet-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: -8px 0 20px;
}

.pet-chip {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 4%, rgba(5, 7, 15, 0.45));
  color: var(--text);
  transition: background var(--t-fast);
}

.pet-chip:hover {
  background: color-mix(in srgb, var(--accent) 10%, rgba(5, 7, 15, 0.45));
}

.pet-chip__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px -3px var(--accent);
}

.pet-chip__icon svg {
  width: 24px;
  height: 24px;
}

.pet-chip__text {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.pet-chip__name,
.pet-chip__age {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-chip__name {
  font-weight: 700;
}

.pet-chip__name small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
}

.pet-chip__age {
  font-size: 13px;
  color: var(--text-dim);
}

.pet-chip__bday {
  display: grid;
  grid-template-columns: 18px auto;
  column-gap: 8px;
  align-items: center;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
}

.pet-chip__bday svg {
  grid-row: span 2;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.pet-chip__in {
  font-size: 12px;
  color: var(--text-dim);
}

.pet-chip__bday.is-now {
  color: var(--magenta);
  font-weight: 600;
}

.pet-chip__bday.is-now svg {
  grid-row: auto;
  color: var(--magenta);
}

@media (max-width: 899px) {
  .pet-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Узко: день рождения — третьей строкой под возрастом */
  .pet-chip {
    grid-column: auto;
    grid-template-columns: 38px minmax(0, 1fr);
    row-gap: 2px;
  }
  .pet-chip__icon {
    grid-row: span 2;
  }
  .pet-chip__bday {
    grid-column: 2;
    display: flex;
    gap: 6px;
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
  }
  .pet-chip__bday svg {
    flex: none;
    width: 14px;
    height: 14px;
  }
  .pet-chip__in::before {
    content: "· ";
  }
}

@media (max-width: 559px) {
  .pet-chip {
    column-gap: 10px;
    padding: 10px 12px;
  }
  .pet-chip__name small,
  .pet-chip__in {
    display: none;
  }
}

.bridge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.bridge-col {
  display: grid;
  gap: 20px;
  min-width: 0;
}

@media (max-width: 1023px) {
  .bridge-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  /* В одну колонку: фокус → ближайшее → дни рождения → модули */
  .bridge-col {
    display: contents;
  }
  .bridge-focus { order: 1; }
  .bridge-upcoming { order: 2; }
  .bridge-bdays { order: 3; }
  .bridge-modules { order: 4; }
}

/* Список ближайших событий */
.upcoming {
  display: grid;
  gap: 2px;
}

.up-item {
  display: grid;
  grid-template-columns: 74px 32px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background var(--t-fast);
}

.up-item:hover {
  background: rgba(0, 229, 255, 0.05);
}

.up-item__date {
  display: grid;
  line-height: 1.2;
}

.up-item__day {
  font-size: 15px;
  font-weight: 700;
}

.up-item__rel {
  font-size: 11px;
  color: var(--text-dim);
}

.up-item.is-soon .up-item__rel {
  color: var(--magenta);
}

.up-item__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}

.up-item__icon svg {
  width: 18px;
  height: 18px;
}

.up-item__body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.up-item__title {
  font-weight: 600;
}

.up-item__who {
  font-size: 12px;
  color: var(--text-dim);
}

.up-item__who b {
  color: var(--accent);
  font-weight: 600;
}

.empty {
  padding: 18px 8px;
  color: var(--text-dim);
}

.nudge {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed rgba(255, 200, 87, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
}

.nudge svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--amber);
  margin-top: 2px;
}

.nudge a {
  color: var(--amber);
}

/* Дни рождения */
.bday-list {
  display: grid;
  gap: 10px;
}

.bday {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
}

.bday__name {
  font-weight: 600;
}

.bday__name i {
  font-style: normal;
  color: var(--accent);
}

/* Питомец: иконка перед именем */
.bday__pet {
  display: inline-flex;
  margin-right: 6px;
  vertical-align: -3px;
  color: var(--accent);
}

.bday__pet svg {
  width: 17px;
  height: 17px;
}

.bday__when {
  font-size: 13px;
  color: var(--text-dim);
}

.bday__days {
  grid-row: span 2;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}

.bday__days small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.bday__bar {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 3px;
  background: rgba(143, 166, 186, 0.15);
  overflow: hidden;
}

.bday__bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* Фокус-панель */
.focus {
  display: grid;
  gap: 12px;
}

.focus__row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.focus__row svg {
  width: 22px;
  height: 22px;
  color: var(--c, var(--cyan));
}

.focus__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Модули */
.modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.module {
  display: grid;
  gap: 10px;
  padding: 16px;
  min-height: 112px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(0, 229, 255, 0.04);
  color: var(--text);
  transition: all var(--t-fast);
}

a.module:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.module__icon {
  width: 26px;
  height: 26px;
  color: var(--cyan);
}

.module__icon svg {
  width: 100%;
  height: 100%;
}

.module__name {
  font-weight: 700;
}

.module__state {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mint);
}

.module--locked {
  border-style: dashed;
  border-color: rgba(92, 112, 133, 0.45);
  background: transparent;
  color: var(--text-faint);
}

.module--locked .module__icon,
.module--locked .module__state {
  color: var(--text-faint);
}

/* ---------- Дисклеймер и источники ---------- */
.disclaimer {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 200, 87, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 200, 87, 0.05);
  color: var(--text-dim);
  font-size: 14px;
}

.disclaimer svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--amber);
}

.sources {
  display: grid;
  gap: 10px;
  font-size: 14px;
}

.sources li {
  display: grid;
  gap: 2px;
}

.sources a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.sources a:hover {
  color: var(--cyan);
}

.sources small {
  color: var(--text-dim);
}

/* ---------- Калькулятор смеси ---------- */
.calc {
  --accent: var(--amber);
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  flex: 1 1 180px;
}

.field__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field__control {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 200, 87, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(5, 7, 15, 0.6);
  transition: box-shadow var(--t-fast);
}

.field__control:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 14px -4px var(--amber);
}

.field__control input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 18px;
  outline: none;
}

.field__unit {
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.calc__out {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.readout {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 200, 87, 0.25);
  background: rgba(255, 200, 87, 0.05);
}

.readout__value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 200, 87, 0.45);
}

.readout__value small {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.readout__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.calc__method {
  font-size: 13px;
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .calc__out {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Показатели: рост и вес ---------- */
.care-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 22px;
}

.care-metrics > .panel {
  margin-bottom: 0;
}

.measures {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

@media (max-width: 1099px) {
  .care-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mtiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mtile {
  display: grid;
  gap: 2px;
  padding: 12px;
  min-width: 0;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 5%, rgba(5, 7, 15, 0.5));
}

.mtile__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.mtile__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.mtile__sub {
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .mtiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mtiles .mtile:last-child {
    grid-column: 1 / -1;
  }
}

.mform {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.mform .field {
  flex: 1 1 120px;
}

.mform .field--date {
  flex: 1.3 1 160px;
}

.mform .field__control {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.mform .field__control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 14px -4px var(--accent);
}

.mform input[type="date"] {
  font-size: 16px;
  color-scheme: dark;
}

.mform__submit {
  flex: 0 0 auto;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.mform__submit svg {
  width: 18px;
  height: 18px;
}

.mform__submit:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: 0 0 14px -2px var(--accent);
  border-color: var(--accent);
}

.mform__error {
  color: var(--magenta);
  font-size: 14px;
  font-weight: 600;
}

.mform__hint {
  font-size: 12.5px;
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .mform__submit {
    flex: 1 1 100%;
  }
}

/* График веса */
.mchart {
  position: relative;
  margin: 0;
  display: grid;
  gap: 6px;
}

.mchart__title {
  font-size: 13px;
  color: var(--text-dim);
}

.mchart__plot {
  position: relative;
  height: 200px;
  overflow: hidden;
  border-radius: var(--radius-xs);
  touch-action: pan-y;
  cursor: crosshair;
}

.mchart__plot svg {
  display: block;
}

.mchart__grid {
  stroke: rgba(143, 166, 186, 0.14);
  stroke-width: 1;
}

.mchart__axis {
  fill: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}

.mchart__line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.mchart__area {
  fill: var(--accent);
  opacity: 0.1;
}

.mchart__dot {
  fill: var(--accent);
  stroke: var(--bg-2);
  stroke-width: 2;
}

.mchart__focus {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
}

.mchart__cross {
  stroke: rgba(230, 247, 255, 0.35);
  stroke-width: 1;
}

.mchart__tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  margin-top: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-dim);
}

.mchart__tip strong {
  font-size: 16px;
  color: var(--text);
}

/* История измерений */
.mhistory summary {
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.mhistory summary:hover {
  color: var(--text);
}

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

.mtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mtable th {
  padding: 6px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line-soft);
}

.mtable td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-faint);
  white-space: nowrap;
}

.mtable td:last-child {
  width: 1%;
  text-align: right;
}

.mtable__del {
  width: 34px;
  min-height: 34px;
  color: var(--text-dim);
  border-color: transparent;
}

.mtable__del:hover {
  color: var(--magenta);
  border-color: var(--magenta);
  box-shadow: var(--glow-magenta);
  background: transparent;
}

/* Калькулятор: основа расчёта */
.calc__basis,
.calc__empty {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-dim);
}

.calc__basis svg,
.calc__empty svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--amber);
}

.calc__empty {
  padding: 14px;
  border: 1px dashed rgba(255, 200, 87, 0.4);
  border-radius: var(--radius-sm);
}

.mchart__tip[hidden] {
  display: none;
}

.stat--wide {
  grid-column: 1 / -1;
}

.stat__note {
  font-size: 13px;
  color: var(--text-dim);
}

.focus a,
.stat a {
  color: var(--accent, var(--cyan));
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 520px) {
  .panel {
    padding: 18px 16px;
  }
  .mform {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mform .field--date,
  .mform__submit {
    grid-column: 1 / -1;
  }
}

.field {
  min-width: 0;
}

.field__control input {
  width: 100%;
}

.calc__kcal {
  max-width: 320px;
}

/* Калькулятор в узкой колонке: показатели строками */
.calc {
  container-type: inline-size;
}

@container (max-width: 380px) {
  .calc__out {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .calc__out .readout {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
  }
  .calc__out .readout__value {
    font-size: 22px;
  }
}

/* ---------- Формы входа и профиля ---------- */
.authform {
  display: grid;
  gap: 14px;
}

.authform .field__control {
  border-color: var(--line);
}

.authform .field__control:focus-within {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.authform input {
  font-size: 16px;
}

.form-msg {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.form-msg[hidden] {
  display: none;
}

.form-msg--error {
  border: 1px solid rgba(255, 77, 157, 0.55);
  background: rgba(255, 77, 157, 0.08);
  color: #ffc2dc;
}

.form-msg--ok {
  border: 1px solid rgba(124, 255, 203, 0.5);
  background: rgba(124, 255, 203, 0.07);
  color: var(--mint);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn--danger {
  color: var(--magenta);
  border-color: rgba(255, 77, 157, 0.5);
  background: rgba(255, 77, 157, 0.08);
}

.btn--danger:hover {
  background: rgba(255, 77, 157, 0.16);
  border-color: var(--magenta);
  box-shadow: var(--glow-magenta);
}

.btn--danger svg {
  width: 18px;
  height: 18px;
}

/* ---------- Аватар пользователя + точка статуса синхронизации ---------- */
[data-sync="idle"] {
  --sync-color: var(--text-faint);
}
[data-sync="syncing"] {
  --sync-color: var(--cyan);
}
[data-sync="ok"] {
  --sync-color: var(--mint);
}
[data-sync="offline"] {
  --sync-color: var(--amber);
}
[data-sync="error"] {
  --sync-color: var(--magenta);
}

.avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--accent, var(--cyan));
  color: var(--accent, var(--cyan));
  background: color-mix(in srgb, var(--accent, var(--cyan)) 10%, transparent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 0 12px -4px var(--accent, var(--cyan));
}

[data-sync] .avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--sync-color);
  box-shadow: 0 0 8px var(--sync-color);
}

.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

/* ---------- Профиль ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--gap);
  align-items: start;
}

.account-id {
  display: flex;
  align-items: center;
  gap: 18px;
}

.kv-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.kv-list > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.kv-list dt {
  color: var(--text-dim);
}

.kv-list dd {
  margin: 0;
}

.account-note {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.authform .account-actions {
  margin-top: 0;
}

.sync-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-line .dot-live,
.rail__status .dot-live {
  background: var(--sync-color, var(--mint));
  box-shadow: 0 0 10px var(--sync-color, var(--mint));
}

.boot-error {
  display: grid;
  gap: 14px;
  max-width: 520px;
  justify-items: start;
}

/* Кто внёс запись в журнал показателей */
.mtable__by {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
}

/* ---------- Уведомление ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(480px, calc(100vw - 32px));
  padding: 12px 18px;
  border: 1px solid rgba(124, 255, 203, 0.5);
  border-radius: var(--radius-sm);
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  box-shadow: 0 0 22px -8px var(--mint);
  transform: translateX(-50%);
  animation: toast-in var(--t-med) var(--ease);
  transition: opacity var(--t-med);
}

.toast.is-out {
  opacity: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

@media (max-width: 767px) {
  .toast {
    bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  }
}

/* ---------- «Семья»: питомцы ---------- */
.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 20px;
}

.pet-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 4px 16px;
  align-items: center;
}

.pet-card__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--accent);
  box-shadow: 0 0 16px -4px var(--accent);
}

.pet-card__icon svg {
  width: 32px;
  height: 32px;
}

.pet-card__head {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pet-card__head .eyebrow {
  color: var(--accent);
}

.pet-card__name {
  font-size: 24px;
  font-weight: 800;
}

.pet-card__stats {
  grid-column: 1 / -1;
}

/* ---------- Модули в разработке (#/soon) ---------- */
a.module--locked:hover {
  color: var(--text-dim);
  border-color: var(--line);
  box-shadow: none;
}

a.module--locked:hover .module__icon {
  color: var(--cyan);
}

.soon-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.soon-title__icon {
  flex: none;
  width: clamp(32px, 4vw, 44px);
  height: clamp(32px, 4vw, 44px);
  color: var(--cyan);
  filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.45));
}

.soon-title__icon svg {
  width: 100%;
  height: 100%;
}

.soon-status {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.soon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--gap);
  align-items: start;
  margin-bottom: var(--gap);
}

.soon-ideas {
  --accent: var(--amber);
}

.soon-ideas .panel__title {
  color: var(--amber);
}

.soon-list {
  display: grid;
  gap: 10px;
}

.soon-list li {
  position: relative;
  padding-left: 20px;
}

.soon-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}

.soon-list--ideas li {
  color: var(--text-dim);
}

.soon-list--ideas li::before {
  border: 1.5px dashed var(--amber);
  background: transparent;
  box-shadow: none;
}

.soon-tracks {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.soon-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.soon-track__text {
  display: grid;
  line-height: 1.3;
  min-width: 0;
}

.soon-track__text span {
  font-size: 14px;
  color: var(--text-dim);
}

.soon-also {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-dim);
}

.soon-also svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--violet);
}
