/* Pet Space — палитра «Тёплый свет». Спокойный минимализм.
   Mobile-first, с полноценной десктоп-версией (sidebar + bento). */

:root {
  /* Canvas — тёплый кремовый свет */
  --bg:            #F4EFE6;
  --bg-2:          #EFE7DA;

  /* Поверхности — белые карточки, элевация мягкой тенью */
  --surface:       #FFFFFF;
  --surface-2:     #FBF7EF;
  --surface-hi:    #F2EBDE;
  --stroke:        #E9E1D2;
  --stroke-hi:     #D8CEBB;
  --track:         #EBE4D6;

  /* Текст — тёплый почти-чёрный */
  --text:          #23201C;
  --text-dim:      #726B60;
  --text-faint:    #A69D8F;

  /* Акценты */
  --green:         #2C7856;
  --green-soft:    rgba(44, 120, 86, 0.10);
  --green-grad:    linear-gradient(135deg, #369268 0%, #2C7856 100%);
  --amber:         #BC5F2B;   /* терракота */
  --amber-soft:    rgba(188, 95, 43, 0.10);
  --amber-grad:    linear-gradient(135deg, #DD8348 0%, #C96A34 100%);
  --red:           #C4553F;
  --red-soft:      rgba(196, 85, 63, 0.10);

  /* Размеры */
  --r-lg:          24px;
  --r-md:          18px;
  --r-sm:          13px;
  --shadow:        0 8px 24px -12px rgba(74, 56, 33, 0.22);
  --shadow-sm:     0 4px 14px -8px rgba(74, 56, 33, 0.16);
  --blur:          saturate(115%) blur(20px);

  /* Сетка отступов (база 4px) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* Движение */
  --dur-fast: 150ms; --dur-base: 220ms; --dur-slow: 450ms;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Фоновые тёплые тинты — очень мягко, для «живости» */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 40% at 12% 0%, rgba(44, 120, 86, 0.06), transparent 70%),
    radial-gradient(52% 42% at 100% 100%, rgba(188, 95, 43, 0.06), transparent 70%),
    var(--bg);
}

/* ── Оболочка ─────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  flex-direction: column;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}
.sidebar { display: none; }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.screen { flex: 1; overflow-y: auto; padding: 0 18px; }
.screen.hidden { display: none; }

/* ── Header ───────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 22px) 18px 10px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--green-grad);
  box-shadow: 0 6px 16px -6px rgba(44, 120, 86, 0.45);
}
.brand .logo svg { width: 22px; height: 22px; color: #fff; }
.brand h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.03em; }

.bell {
  position: relative; width: 42px; height: 42px;
  display: grid; place-items: center; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--stroke);
  color: var(--text-dim); cursor: pointer; transition: background .2s, color .2s;
  box-shadow: var(--shadow-sm);
}
.bell:hover { color: var(--text); }
.bell svg { width: 20px; height: 20px; }
.bell .dot {
  position: absolute; top: 9px; right: 10px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--red); border: 2px solid var(--surface);
}

/* ── Переключатель питомцев ───────────────────────── */
.pet-switch {
  display: flex; gap: 11px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 18px 6px;
}
.pet-switch::-webkit-scrollbar { display: none; }
.pet-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 11px;
  padding: 9px 17px 9px 9px;
  background: var(--surface);
  border: 1px solid var(--stroke); border-radius: 999px;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .2s, box-shadow .2s;
}
.pet-chip:active { transform: scale(0.97); }
.pet-chip.active { border-color: var(--green); box-shadow: 0 4px 16px -8px rgba(44, 120, 86, 0.4); }
.ava-wrap { position: relative; flex: 0 0 auto; }
.pet-chip .avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 21px;
  background: var(--surface-hi); border: 1px solid var(--stroke);
}
.pet-chip .avatar.has-photo { background-size: cover; background-position: center; font-size: 0; }
.pet-chip .cam {
  position: absolute; right: -3px; bottom: -3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  border: 2px solid var(--surface); transition: transform var(--dur-fast) var(--ease);
}
.pet-chip .cam:hover { transform: scale(1.1); }
.pet-chip .cam:active { transform: scale(0.9); }
.pet-chip .cam svg { width: 11px; height: 11px; }
.pet-chip .meta { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.pet-chip .meta .nm { font-weight: 600; font-size: 15px; }
.pet-chip .meta .kd { font-size: 12px; color: var(--text-dim); }
.pet-chip .led {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-left: 3px;
}

/* ── Секции ───────────────────────────────────────── */
.section { margin-top: 26px; }
.section-title {
  font-size: 12px; letter-spacing: 0.12em; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; margin: 0 4px 12px;
}

/* Карта */
.card {
  background: var(--surface);
  border: 1px solid var(--stroke); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* ── Focus-zone «Сегодня» ─────────────────────────── */
.focus-row { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.focus-row::-webkit-scrollbar { display: none; }
.focus-card {
  flex: 0 0 47%;
  background: var(--surface);
  border: 1px solid var(--stroke); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 15px; display: flex; flex-direction: column; gap: 5px; min-height: 132px;
  position: relative; overflow: hidden;
}
.focus-card::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--green-grad);
}
.focus-card.attention { border-color: rgba(188, 95, 43, 0.3); background: linear-gradient(180deg, var(--amber-soft), var(--surface)); }
.focus-card.attention::after { background: var(--amber-grad); }
.focus-card .ic { width: 26px; height: 26px; color: var(--green); margin-bottom: 2px; }
.focus-card.attention .ic { color: var(--amber); }
.focus-card .time { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.focus-card .ttl { font-size: 15px; font-weight: 600; }
.focus-card .who { font-size: 13px; color: var(--text-dim); }
.focus-card .check {
  margin-top: auto; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--stroke-hi); background: transparent; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  display: grid; place-items: center;
}
.focus-card .check:active { transform: scale(0.9); }
.focus-card .check svg { width: 15px; height: 15px; color: #fff; opacity: 0; transition: opacity .2s; }
.focus-card .check.done { background: var(--green-grad); border-color: transparent; }
.focus-card.attention .check.done { background: var(--amber-grad); }
.focus-card .check.done svg { opacity: 1; }

/* ── Трекер запасов ───────────────────────────────── */
.supplies { padding: 6px 18px; }
.supply { padding: 16px 0; }
.supply + .supply { border-top: 1px solid var(--stroke); }
.supply .top { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.supply .ic {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--green);
  background: var(--green-soft); border: 1px solid rgba(44, 120, 86, 0.18);
}
.supply.low .ic { color: var(--amber); background: var(--amber-soft); border-color: rgba(188, 95, 43, 0.2); }
.supply .ic svg { width: 20px; height: 20px; }
.supply .info { flex: 1; min-width: 0; }
.supply .nm { font-weight: 600; }
.supply .nm .pet { color: var(--text-dim); font-weight: 400; font-size: 14px; }
.supply .eta { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.supply.low .eta { color: var(--amber); }
.supply .pct { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.supply.low .pct { color: var(--amber); }
.bar { height: 9px; border-radius: 6px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--green-grad); transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.supply.low .bar > i { background: var(--amber-grad); }

/* ── Нижние карточки ──────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.mini-card { padding: 17px; }
.mini-card > h3 {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600; margin-bottom: 14px; line-height: 1.35;
}
.mini-row { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.mini-row:last-child { margin-bottom: 0; }
.mini-row .ic {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--text-dim);
  background: var(--surface-hi); border: 1px solid var(--stroke);
}
.mini-row .ic svg { width: 18px; height: 18px; }
.mini-row .lab { font-size: 14px; font-weight: 600; }
.mini-row .sub { font-size: 13px; color: var(--text-dim); }
.mini-row .sub b { color: var(--green); font-weight: 600; }

/* ── Пустые состояния ─────────────────────────────── */
.empty { text-align: center; padding: 56px 24px; color: var(--text-dim); }
.empty .em {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
  display: grid; place-items: center; font-size: 30px;
  background: var(--surface); border: 1px solid var(--stroke); box-shadow: var(--shadow-sm);
}
.empty h3 { color: var(--text); font-size: 18px; margin-bottom: 7px; font-weight: 600; }
.empty p { font-size: 14px; line-height: 1.55; max-width: 320px; margin: 0 auto; }

/* ── Нижняя навигация (мобилка) ───────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 480px; margin: 0 auto; display: flex;
  background: rgba(250, 247, 240, 0.88); backdrop-filter: var(--blur);
  border-top: 1px solid var(--stroke);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 11px 0 13px; background: none; border: none; cursor: pointer;
  color: var(--text-faint); position: relative; transition: color .2s;
}
.tab svg { width: 22px; height: 22px; }
.tab span { font-size: 10px; letter-spacing: 0.03em; font-weight: 500; }
.tab.active { color: var(--green); }
.tab.active::before {
  content: ''; position: absolute; top: 0; width: 30px; height: 3px;
  border-radius: 0 0 4px 4px; background: var(--green-grad);
}

.section:last-child { margin-bottom: 26px; }

/* ── Личный кабинет ───────────────────────────────── */
.profile-card { display: flex; align-items: center; gap: 15px; padding: 18px; }
.profile-avatar {
  width: 58px; height: 58px; border-radius: 17px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff;
  background: var(--green-grad); box-shadow: 0 8px 20px -8px rgba(44, 120, 86, 0.5);
}
.profile-info { flex: 1; min-width: 0; }
.profile-info .p-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.profile-info .p-contact { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 14px; margin-top: 3px; }
.profile-info .p-contact svg { width: 15px; height: 15px; flex: 0 0 auto; }
.profile-info .p-contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto;
  display: grid; place-items: center; cursor: pointer;
  background: var(--red-soft); border: 1px solid rgba(196, 85, 63, 0.25); color: var(--red);
  transition: background .2s;
}
.logout:hover { background: rgba(196, 85, 63, 0.16); }
.logout svg { width: 20px; height: 20px; }

.auth-card { padding: 6px 18px 18px; }
.auth-row { display: flex; align-items: center; gap: 13px; padding: 16px 0; }
.auth-row + .auth-row { border-top: 1px solid var(--stroke); }
.auth-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--text-dim);
  background: var(--surface-hi); border: 1px solid var(--stroke);
}
.auth-ic.tg { color: #2A8BC4; background: rgba(42, 139, 196, 0.1); border-color: rgba(42, 139, 196, 0.22); }
.auth-ic.max { color: #5A6CF0; background: rgba(90, 108, 240, 0.1); border-color: rgba(90, 108, 240, 0.22); }
.auth-ic.mail { color: var(--amber); background: var(--amber-soft); border-color: rgba(188, 95, 43, 0.22); }
.auth-ic svg { width: 21px; height: 21px; }
.auth-info { flex: 1; }
.auth-info .a-name { font-weight: 600; }
.auth-info .a-sub { font-size: 13px; color: var(--text-dim); }
.badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; color: var(--green);
  background: var(--green-soft); border: 1px solid rgba(44, 120, 86, 0.28);
  padding: 5px 11px; border-radius: 999px;
}
.a-linked { font-size: 12.5px; color: var(--text-faint); }
.auth-note {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 6px; padding-top: 15px;
  border-top: 1px solid var(--stroke); font-size: 13px; color: var(--text-dim); line-height: 1.5;
}
.auth-note svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--green); margin-top: 1px; }

/* ── Экран входа ──────────────────────────────────── */
#authGate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px calc(24px + env(safe-area-inset-right)) 24px calc(24px + env(safe-area-inset-left));
}
#authGate .login-wrap { width: 100%; }
.login-wrap { max-width: 380px; margin: 0 auto; padding: 40px 4px; text-align: center; }
.login-logo {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 22px;
  display: grid; place-items: center; color: #fff;
  background: var(--green-grad); box-shadow: 0 10px 26px -8px rgba(44, 120, 86, 0.5);
}
.login-logo svg { width: 34px; height: 34px; }
.demo-badge {
  display: inline-block; margin: 0 0 12px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber); background: rgba(188, 95, 43, 0.10);
  border: 1px solid rgba(188, 95, 43, 0.22);
}
.login-title { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
.login-sub { color: var(--text-dim); font-size: 15px; margin: 8px 0 30px; line-height: 1.5; }
.btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; border-radius: 15px; font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; border: none; transition: transform .15s, filter .2s, background .2s;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; }
.btn-tg { background: #2AABEE; color: #fff; box-shadow: 0 8px 20px -8px rgba(42, 171, 238, 0.5); }
.btn-tg:hover { filter: brightness(1.04); }
.login-actions { display: flex; flex-direction: column; gap: 11px; }
.btn-max { background: var(--surface); border: 1px solid var(--stroke); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-max svg { color: #5A6CF0; }
.btn-max:hover { background: var(--surface-2); }
.login-or { display: flex; align-items: center; gap: 14px; color: var(--text-faint); font-size: 13px; margin: 20px 0; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--stroke); }
.email-form { display: flex; flex-direction: column; gap: 11px; }
.field {
  width: 100%; padding: 15px; border-radius: 15px; font-size: 15px; font-family: var(--font);
  background: var(--surface); border: 1px solid var(--stroke); color: var(--text); outline: none;
  box-shadow: var(--shadow-sm); transition: border-color .2s;
}
.field::placeholder { color: var(--text-faint); }
.field:focus { border-color: var(--green); }
.btn-ghost { background: var(--surface); border: 1px solid var(--stroke); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: var(--surface-2); }
.login-legal { font-size: 12px; color: var(--text-faint); margin-top: 24px; line-height: 1.5; }

/* ═══════════════════════════════════════════════════
   ДЕСКТОП / БРАУЗЕРНАЯ ВЕРСИЯ
   ═══════════════════════════════════════════════════ */
@media (min-width: 900px) {
  #app { max-width: 1180px; flex-direction: row; padding: 0; gap: 0; }

  .sidebar {
    display: flex; flex-direction: column; gap: 8px;
    width: 244px; flex: 0 0 244px; padding: 28px 18px;
    border-right: 1px solid var(--stroke); min-height: 100dvh;
    position: sticky; top: 0; background: var(--bg-2);
  }
  .sidebar .brand { padding: 0 10px 22px; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-link {
    display: flex; align-items: center; gap: 13px; padding: 12px 14px;
    border-radius: 13px; color: var(--text-dim); cursor: pointer;
    background: none; border: none; font-size: 15px; font-weight: 500;
    font-family: var(--font); text-align: left; transition: background .2s, color .2s;
  }
  .side-link svg { width: 21px; height: 21px; }
  .side-link:hover { background: var(--surface); color: var(--text); }
  .side-link.active {
    background: var(--green-soft); color: var(--green);
    border: 1px solid rgba(44, 120, 86, 0.22);
  }

  .content { padding: 0; }
  .app-header { display: none; }
  .tabbar { display: none; }
  #app { padding-bottom: 0; }

  .pet-switch { padding: 30px 40px 6px; }
  .screen { padding: 0 40px 40px; }

  #screen-home:not(.hidden) {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    grid-template-areas:
      "focus    focus"
      "supplies health"
      "supplies med";
    gap: 22px; align-content: start;
  }
  #screen-home > .section { margin-top: 0; }
  #focusSection { grid-area: focus; }
  #focusSection.hidden { display: none; }
  .section.supplies-wrap { grid-area: supplies; }
  .section.health-wrap { grid-area: health; }
  .section.med-wrap { grid-area: med; }

  .focus-row { flex-wrap: wrap; }
  .focus-card { flex: 1 1 200px; min-height: 150px; }

  .two-col { display: contents; }

  #screen-account { max-width: 620px; }

  .focus-card, .pet-chip { transition: transform .18s ease, box-shadow .2s, border-color .2s; }
  .focus-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -16px rgba(74, 56, 33, 0.3); }
}

@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  .card, .focus-card { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  /* Каскад появления bento */
  .focus-card:nth-child(2) { animation-delay: .06s; }
  .focus-card:nth-child(3) { animation-delay: .12s; }
  .supplies-wrap .card { animation-delay: .08s; }
  .health-wrap .card   { animation-delay: .14s; }
  .med-wrap .card      { animation-delay: .20s; }
}

/* ═══════════════════════════════════════════════════
   ПОЛИРОВКА: градиенты · переходы · подсветка блоков
   ═══════════════════════════════════════════════════ */

/* Мягкий тёплый «блеск» на карточках (едва заметный градиент) */
.card { background-image: linear-gradient(180deg, #ffffff 0%, #fcf9f2 100%); }
.focus-card:not(.attention) { background-image: linear-gradient(180deg, #ffffff 0%, #fcf9f2 100%); }

/* Плавные переходы для интерактивных блоков */
.card, .mini-card, .bell, .side-link, .tab, .logout, .btn, .field {
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}

/* Подсветка строк-списков на наведение */
.supply, .auth-row {
  padding-left: 10px; padding-right: 10px; margin-left: -10px; margin-right: -10px;
  border-radius: 14px; transition: background var(--dur-fast) var(--ease);
}
.supply:hover, .auth-row:hover { background: var(--surface-2); }
.mini-row { border-radius: 12px; padding: 6px; margin: -6px -6px 8px; transition: background var(--dur-fast) var(--ease); }
.mini-row:last-child { margin-bottom: -6px; }
.mini-row:hover { background: var(--surface-2); }

/* Активный чип питомца — мягкий зелёный градиент-подсветка */
.pet-chip.active { background-image: linear-gradient(180deg, var(--green-soft), transparent); }
.pet-chip:hover { border-color: var(--stroke-hi); }

/* Подсветка блоков на десктопе: подъём + акцентный бордер + тень */
@media (min-width: 900px) {
  .card:hover, .mini-card:hover {
    transform: translateY(-2px);
    border-color: var(--stroke-hi);
    box-shadow: 0 16px 36px -16px rgba(74, 56, 33, 0.30);
  }
  .side-link:hover { transform: translateX(2px); }
}

/* Прогресс-бар: лёгкий блик поверх градиента */
.bar > i { position: relative; }
.bar > i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 55%);
}
