/* ============================================
   СаратовВет — Тёплый и дружелюбный дизайн
   ============================================ */

/* --- Pico CSS v2 color overrides --- */
:root[data-theme="light"] {
  --pico-primary: #2450B8;
  --pico-primary-background: #2450B8;
  --pico-primary-border: #2450B8;
  --pico-primary-underline: rgba(36, 80, 184, 0.5);
  --pico-primary-hover: #1B3F94;
  --pico-primary-hover-background: #1F47A6;
  --pico-primary-hover-border: #1B3F94;
  --pico-primary-hover-underline: #1B3F94;
  --pico-primary-focus: rgba(36, 80, 184, 0.25);
  --pico-primary-inverse: #fff;
  --pico-secondary: #22703A;
  --pico-secondary-background: #22703A;
  --pico-secondary-border: #22703A;
  --pico-secondary-underline: rgba(34, 112, 58, 0.5);
  --pico-secondary-hover: #1A5A2E;
  --pico-secondary-hover-background: #1E6534;
  --pico-secondary-hover-border: #1A5A2E;
  --pico-secondary-hover-underline: #1A5A2E;
  --pico-secondary-focus: rgba(34, 112, 58, 0.25);
  --pico-secondary-inverse: #fff;
  --pico-background: #F7F8F5;
  --pico-card-background-color: #FFFFFF;
  --pico-card-border-color: #DDE3E8;
  --pico-card-box-shadow: 0 2px 8px rgba(20, 26, 33, 0.08);
  --pico-text: #141A21;
  --pico-text-muted: #5D6670;
  --pico-border-color: #DDE3E8;
  --pico-form-element-border-color: #DDE3E8;
  --pico-form-element-focus-color: #2450B8;
  --pico-form-element-active-border-color: #2450B8;
  --pico-form-element-selected-background-color: rgba(36, 80, 184, 0.1);
}

/* --- Custom properties --- */
:root {
  --primary: #2450B8;
  --primary-hover: #1B3F94;
  --secondary: #22703A;
  --secondary-hover: #1A5A2E;
  --background: #F7F8F5;
  --surface: #FFFFFF;
  --text: #141A21;
  --text-muted: #5D6670;
  --border: #DDE3E8;
  --border-hover: #C8D1D9;
  --success: #5A9E6F;
  --danger: #C0392B;
  --box-shadow: 0 2px 8px rgba(20, 26, 33, 0.08);
  --box-shadow-hover: 0 4px 16px rgba(20, 26, 33, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 50px;
}

/* --- Глобальная типографика --- */
body {
  background: var(--background);
  color: var(--text);
}

.yandex-metrika-pixel {
  position: absolute;
  left: -9999px;
}

.analytics-consent {
  position: fixed;
  z-index: 1000;
  right: 1rem;
  bottom: 1rem;
  width: min(32rem, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--box-shadow-hover);
}

.analytics-consent p {
  margin-bottom: 0.75rem;
}

.analytics-consent-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.analytics-consent-actions button {
  width: auto;
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration-color: transparent;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
  color: var(--primary-hover);
  text-decoration-color: var(--primary);
}

/* --- Кнопки --- */
[role="button"], button, input[type="submit"], input[type="button"] {
  border-radius: var(--radius-sm);
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

button:active, [role="button"]:active, input[type="submit"]:active {
  transform: scale(0.98);
}

/* --- Навигация --- */
nav {
  border-bottom: none;
  margin-bottom: 0;
  padding: 0.8rem 0;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 26, 33, 0.06);
}

nav ul {
  align-items: center;
}

nav ul li {
  display: flex;
  align-items: center;
  padding: 0 0.2rem;
}

nav .logo-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
}

nav .logo-link:hover {
  background: none;
}

nav .logo-link img {
  height: 44px;
  width: auto;
  max-width: none;
}

.logo-text {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-text-accent {
  color: var(--primary);
}

nav strong a {
  color: var(--text);
  font-weight: 700;
}

nav ul li a {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  transition: color 0.2s, background 0.2s;
}

nav ul li a:hover {
  color: var(--primary);
  background: rgba(36, 80, 184, 0.06);
  text-decoration: none;
}

nav ul li a.active {
  color: var(--primary);
  background: rgba(36, 80, 184, 0.1);
}

/* Ссылка на профиль: «Вы вошли @имя» */
nav ul li a.nav-user {
  gap: 0.35rem;
  max-width: 18rem;
}

.nav-user-hint {
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-user-login {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

nav ul li a.nav-user:hover .nav-user-login {
  color: var(--primary);
}

/* Переключатель клиник администратора портала */
.nav-clinic-switch form {
  margin: 0;
}

.nav-clinic-switch select {
  width: auto;
  max-width: 15rem;
  margin: 0;
  padding: 0.35rem 2rem 0.35rem 0.75rem;
  font-size: 0.95rem;
}

/* Плашка «вы в клинике как администратор» */
.acting-banner {
  background: #E2F2E4;
  border-bottom: 1px solid #f0d6a8;
  font-size: 0.92rem;
}

.acting-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.acting-banner form {
  margin: 0;
}

.acting-banner button {
  width: auto;
  margin: 0;
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
}

/* Кнопка «Выйти» в навбаре — выравнивание с ссылками */
.nav-logout-wrap {
  list-style: none;
}

.nav-logout-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.nav-logout-btn {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.4rem 0.8rem;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  line-height: 1.5;
  width: auto;
  box-shadow: none;
  transition: color 0.2s, background 0.2s;
}

.nav-logout-btn:hover {
  color: var(--primary);
  background: rgba(36, 80, 184, 0.06);
}

/* --- Футер --- */
footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer a {
  color: var(--text-muted);
  margin: 0 0.5rem;
}

footer a:hover {
  color: var(--primary);
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

/* --- Hero-секция --- */
.hero {
  background: #F7F8F5;
  border-radius: var(--radius);
  padding: 3rem 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: none;
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  background: none;
  border-radius: 50%;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.hero .hero-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  position: relative;
  z-index: 1;
}

/* --- Карточки клиников --- */
.clinic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
  display: flex;
  flex-direction: column;
}

.clinic-card:hover,
.clinic-card:focus-visible {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.clinic-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.clinic-card-image {
  height: 140px;
  background: #E9EEF4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--primary);
  opacity: 0.6;
}

.clinic-card-body {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.clinic-card-body h3 {
  margin: 0 0 0.4rem 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.clinic-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.clinic-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.clinic-card-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clinic-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: rgba(36, 80, 184, 0.08);
  color: var(--primary);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.tag-more {
  background: rgba(36, 80, 184, 0.04);
  color: var(--text-muted);
}

/* --- Секция «Популярные клиники» --- */
.section-title {
  text-align: center;
  margin-bottom: 1.5rem;
}

.section-title h2 {
  margin-bottom: 0.3rem;
}

.section-title p {
  color: var(--text-muted);
  margin: 0;
}

/* --- Сетка карточек --- */
.clinics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* --- Лендинг клиники --- */
.clinic-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  min-height: 430px;
  margin: 1.5rem 0 1.25rem;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid rgba(36, 80, 184, 0.12);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(20, 26, 33, 0.08);
}

.clinic-hero-content {
  z-index: 1;
  padding: clamp(2rem, 5vw, 4.25rem);
}

.clinic-trust-badge {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1.1rem;
  padding: 0.38rem 0.7rem;
  background: rgba(90, 158, 111, 0.12);
  border-radius: var(--radius-pill);
  color: #3f7650;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.clinic-trust-badge svg,
.clinic-meta-item svg,
.clinic-phone-action svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.clinic-hero h1 {
  max-width: 760px;
  margin: 0 0 0.9rem;
  font-size: clamp(2.25rem, 5vw, 4.2rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.clinic-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.clinic-meta-item,
.clinic-rating {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.clinic-meta-item {
  max-width: 38rem;
}

.clinic-rating {
  padding-left: 1rem;
  border-left: 1px solid rgba(36, 80, 184, 0.22);
  text-decoration: none;
}

.clinic-rating > span:first-child {
  color: var(--secondary);
}

.clinic-rating > span:last-child {
  text-decoration: underline;
  text-decoration-color: rgba(36, 80, 184, 0.28);
  text-underline-offset: 0.18em;
}

.clinic-rating-empty {
  color: var(--text-muted);
}

.clinic-hero-description {
  max-width: 660px;
  margin: 0 0 1.65rem;
  color: #3A4652;
  font-size: 1.02rem;
  line-height: 1.7;
}

.clinic-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.clinic-hero-actions [role="button"] {
  display: inline-flex;
  gap: 0.5rem;
  min-height: 3rem;
  margin: 0;
  padding: 0.72rem 1.1rem;
  align-items: center;
  justify-content: center;
  font-weight: 650;
}

.clinic-primary-action {
  box-shadow: 0 8px 22px rgba(36, 80, 184, 0.2);
}

.clinic-phone-action {
  background: rgba(255, 255, 255, 0.72);
}

.clinic-secondary-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
  font-size: 0.88rem;
}

.clinic-secondary-contacts a {
  text-decoration: underline;
  text-decoration-color: rgba(36, 80, 184, 0.28);
  text-underline-offset: 0.2em;
}

.clinic-hero-media {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: #E9EEF4;
}

.clinic-hero-media::after {
  position: absolute;
  inset: 0;
  background: none;
  content: "";
  pointer-events: none;
}

.clinic-hero-media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clinic-hero-logo,
.clinic-hero-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 430px;
  align-items: center;
  justify-content: center;
}

.clinic-hero-logo img {
  width: min(68%, 260px);
  max-height: 65%;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(20, 26, 33, 0.12));
}

.clinic-hero-placeholder {
  color: rgba(36, 80, 184, 0.62);
  font-size: clamp(6rem, 14vw, 11rem);
  font-weight: 800;
}

.clinic-section-nav {
  position: sticky;
  z-index: 5;
  top: 0;
  margin: 0 0 3.5rem;
  padding: 0;
  overflow-x: auto;
  background: rgba(247, 248, 245, 0.94);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.clinic-section-nav-inner {
  display: flex;
  width: max-content;
  min-width: 100%;
  gap: 1.5rem;
}

.clinic-section-nav a {
  padding: 1rem 0 0.85rem;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 650;
  white-space: nowrap;
}

.clinic-section-nav a:hover,
.clinic-section-nav a:focus-visible {
  border-bottom-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* --- Секции на лендинге --- */
.landing-section {
  margin-bottom: 2rem;
}

.landing-section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.clinic-content-section,
.clinic-booking-section {
  margin-bottom: 4.5rem;
  scroll-margin-top: 4.5rem;
}

.clinic-section-header {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.clinic-section-header h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  letter-spacing: -0.025em;
}

.clinic-section-header > p {
  max-width: 390px;
  margin: 0 0 0.12rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: right;
}

.clinic-section-kicker {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.clinic-section-link {
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  font-weight: 650;
}

/* --- Карточки услуг --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.service-card {
  display: flex;
  min-height: 88px;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.service-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-1px);
}

.service-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
  line-height: 1.3;
}

.service-card .service-price {
  flex: 0 0 auto;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--primary);
  white-space: nowrap;
}

.service-card .service-duration {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* --- Карточки врачей --- */
.doctors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.doctor-card {
  position: relative;
  min-height: 218px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
  padding: 1.35rem;
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.doctor-card:hover,
.doctor-card:focus-visible {
  border-color: var(--border-hover);
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
}

.doctor-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.doctor-avatar {
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: 50%;
  background: #E9EEF4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 750;
  color: var(--primary);
  flex-shrink: 0;
}

.doctor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-info {
  display: flex;
  min-width: 0;
  flex: 1;
  align-self: stretch;
  flex-direction: column;
}

.doctor-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  line-height: 1.25;
}

.doctor-info .doctor-specialty {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 650;
  margin-bottom: 0.25rem;
}

.doctor-info .doctor-desc {
  display: -webkit-box;
  margin: 0 0 0.75rem;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.doctor-card-link {
  margin-top: auto;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 650;
}

/* --- Публичная карточка врача --- */
.doctor-profile-card {
  max-width: 760px;
  margin: 0 auto 2rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
}

.doctor-profile-header {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.doctor-profile-header h1 {
  margin-bottom: 0.3rem;
}

.doctor-profile-photo {
  display: flex;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #E9EEF4;
  border-radius: 50%;
  color: var(--primary);
  font-size: 3.5rem;
}

.doctor-profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-profile-specialty {
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 600;
}

.doctor-profile-clinic {
  color: var(--text-muted);
}

.doctor-profile-section {
  margin-top: 1.5rem;
}

.doctor-profile-section h2 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.doctor-profile-section p {
  margin: 0;
  line-height: 1.65;
}

/* --- Галерея клиники --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 190px;
  gap: 0.75rem;
}

.gallery-thumbnail {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
  color: inherit;
  cursor: zoom-in;
  text-align: left;
}

.gallery-thumbnail figure {
  position: relative;
  height: 100%;
  margin: 0;
}

.gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  transition: transform 0.2s, filter 0.2s;
}

.gallery-thumbnail:first-child {
  grid-row: span 2;
  grid-column: span 2;
}

.gallery-thumbnail:hover img,
.gallery-thumbnail:focus-visible img {
  filter: brightness(0.92);
  transform: scale(1.02);
}

.gallery-thumbnail:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.gallery-thumbnail figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2.5rem 0.75rem 0.65rem;
  background: rgba(13, 18, 24, 0.6);
  color: #fff;
}

.gallery-thumbnail figcaption small {
  color: inherit;
}

.gallery-lightbox {
  width: min(96vw, 1200px);
  max-width: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  color: #fff;
}

.gallery-lightbox::backdrop {
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(3px);
}

.gallery-lightbox-inner {
  position: relative;
  display: flex;
  min-height: min(80vh, 800px);
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-slide {
  margin: 0;
  text-align: center;
}

.gallery-lightbox-image {
  display: block;
  max-width: calc(100vw - 7rem);
  max-height: calc(100vh - 7rem);
  margin: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.gallery-lightbox-slide figcaption {
  margin-top: 0.75rem;
  color: #fff;
}

.gallery-lightbox-control {
  position: absolute;
  z-index: 1;
  display: flex;
  width: 3rem;
  height: 3rem;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.gallery-lightbox-control:hover,
.gallery-lightbox-control:focus-visible {
  background: rgba(36, 80, 184, 0.9);
  border-color: #fff;
}

.gallery-lightbox-close {
  top: 0;
  right: 0;
}

.gallery-lightbox-previous {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.gallery-lightbox-next {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

.gallery-lightbox-counter {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  color: #fff;
  text-align: center;
}

/* --- Онлайн-запись на лендинге --- */
.clinic-booking-section {
  padding: clamp(1.4rem, 4vw, 2.5rem);
  background: #EEF2F7;
  border: 1px solid rgba(36, 80, 184, 0.13);
  border-radius: 20px;
}

.clinic-booking-header {
  border-bottom-color: rgba(36, 80, 184, 0.18);
}

.clinic-booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr);
  gap: 1rem;
}

.clinic-booking-card,
.clinic-booking-note {
  margin: 0;
  padding: clamp(1.1rem, 3vw, 1.7rem);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(36, 80, 184, 0.13);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(20, 26, 33, 0.05);
}

.clinic-booking-card > h3,
.clinic-booking-note h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.clinic-booking-card > p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.clinic-booking-card > [role="button"] {
  width: 100%;
  margin: 0;
}

.clinic-booking-note ol {
  display: grid;
  gap: 1rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.clinic-booking-note li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.clinic-booking-note li > span {
  display: inline-flex;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  background: rgba(36, 80, 184, 0.1);
  border-radius: 50%;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 750;
}

.clinic-booking-note li div {
  display: grid;
  gap: 0.12rem;
}

.clinic-booking-note li strong {
  font-size: 0.86rem;
}

.clinic-booking-note li small {
  color: var(--text-muted);
  line-height: 1.35;
}

.booking-step-label {
  margin: 1rem 0 0.55rem;
  font-size: 0.88rem;
}

.booking-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.booking-option {
  width: auto;
  margin: 0;
  padding: 0.48rem 0.75rem;
  font-size: 0.82rem;
}

.booking-time-option {
  position: relative;
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.booking-time-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.booking-time-option {
  padding: 0.45rem 0.72rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 650;
}

.booking-time-option:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.booking-time-option:has(input:focus-visible) {
  outline: 3px solid var(--pico-primary-focus);
  outline-offset: 2px;
}

.booking-submit {
  width: 100%;
}

/* --- Отзывы на лендинге --- */
.reviews-summary {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
  margin-bottom: 0.15rem;
}

.reviews-summary strong {
  font-size: 1.8rem;
  line-height: 1;
}

.reviews-summary > span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.reviews-summary > span > span,
.review-stars {
  color: var(--secondary);
}

.reviews-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.review-card {
  margin: 0;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.review-card > header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 0.75rem;
  padding: 0;
  background: transparent;
}

.review-card > header > div {
  display: grid;
  gap: 0.12rem;
}

.review-card p {
  margin: 0;
  color: #3A4652;
  font-size: 0.9rem;
  line-height: 1.55;
}

.review-stars {
  white-space: nowrap;
}

.clinic-empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  background: rgba(36, 80, 184, 0.04);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  text-align: center;
}

.clinic-empty-state p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
}

.review-form-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.review-form-panel summary {
  margin: 0;
}

.review-form-panel[open] summary {
  margin-bottom: 1rem;
}

/* --- Формы авторизации --- */
.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
}

.auth-card header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}

.auth-card header p {
  color: var(--text-muted);
  margin: 0;
}

.auth-card form [type="submit"] {
  width: 100%;
}

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  margin: 1rem 0;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 1.5rem);
  height: 1px;
  background: var(--border);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-card .auth-links {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --- Профиль --- */
.profile-card {
  max-width: 520px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #E9EEF4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 auto 1rem;
}

.profile-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin-bottom: 1.5rem;
}

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

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

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.profile-actions a {
  text-align: center;
}

/* --- Дашборд клиники --- */
.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--box-shadow);
}

.dashboard-card h2 {
  margin: 0 0 1rem 0;
}

.dashboard-status {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-active {
  background: rgba(90, 158, 111, 0.12);
  color: var(--success);
}

.status-inactive {
  background: rgba(192, 57, 43, 0.1);
  color: var(--danger);
}

.status-attention {
  background: rgba(34, 112, 58, 0.18);
  color: #9A6412;
}

/* --- Главная кабинета: краткая карточка и две кнопки разделов --- */
.clinic-summary h2 {
  margin-bottom: 0.2rem;
}

.clinic-summary p {
  margin: 0;
  color: var(--text-muted);
}

.section-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1.3rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.section-button:hover,
.section-button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(36, 80, 184, 0.15);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
}

.section-button-icon,
.section-tile-icon {
  display: grid;
  flex: none;
  place-items: center;
  border-radius: var(--radius-sm);
  background: rgba(36, 80, 184, 0.08);
}

.section-button-icon {
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1.7rem;
}

.section-button-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.section-button-body strong {
  font-size: 1.2rem;
}

.section-button-what {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.section-button .dashboard-status {
  gap: 0.4rem;
  margin: 0;
}

.section-button .status-badge {
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
}

.section-button-arrow {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  color: var(--primary);
  font-size: 1.4rem;
}

/* --- Разделы кабинета: плитки страниц --- */
.section-badges {
  gap: 0.5rem;
}

.section-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.section-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

a.section-tile:hover,
a.section-tile:focus-visible {
  background: rgba(36, 80, 184, 0.06);
  border-color: var(--primary);
  color: var(--text);
  text-decoration: none;
}

.section-tile-icon {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.3rem;
}

.section-tile small {
  color: var(--text-muted);
  line-height: 1.35;
}

.section-count {
  display: inline-block;
  padding: 0 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--secondary, #22703A);
  color: #fff;
  font-size: 0.75rem;
  vertical-align: 0.15em;
}

/* С подключённым складом разделов четыре — два ряда по два */
.section-buttons.is-four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-button.is-disabled {
  background: #F4F6F8;
  border-style: dashed;
  box-shadow: none;
  cursor: default;
}

.section-button.is-disabled .section-button-icon {
  filter: grayscale(1);
  opacity: 0.5;
}

.section-button.is-disabled:hover {
  transform: none;
  border-color: var(--border);
}

.section-tile.is-disabled {
  background: #F4F6F8;
  border-style: dashed;
}

.section-tile.is-disabled .section-tile-icon {
  filter: grayscale(1);
  opacity: 0.5;
}

.section-tile.is-disabled strong {
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .section-tiles,
  .section-tiles.is-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

@media (max-width: 640px) {
  .section-buttons {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .section-tiles,
  .section-tiles.is-three {
    grid-template-columns: 1fr;
  }
}

.section-tiles.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* --- Таблица услуг в дашборде --- */
.services-table {
  width: 100%;
  border-collapse: collapse;
}

.services-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
}

.services-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.services-table tr:hover td {
  background: rgba(36, 80, 184, 0.03);
}

.services-table .btn-delete {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.services-table .btn-delete:hover {
  background: var(--danger);
  color: #fff;
}

/* --- Кастомные формы (не form.as_p) --- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border-radius: var(--radius-sm);
}

.form-group .help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.form-actions [role="button"],
.form-actions button {
  flex: 1;
}

/* --- Сообщения (messages) --- */
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.messages li {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.messages .success {
  background: rgba(90, 158, 111, 0.1);
  border: 1px solid rgba(90, 158, 111, 0.25);
  color: #3d7a4f;
}

.messages .error {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.2);
  color: #a93226;
}

.messages .warning {
  background: rgba(34, 112, 58, 0.12);
  border: 1px solid rgba(34, 112, 58, 0.3);
  color: #8a6d20;
}

.messages .info {
  background: rgba(36, 80, 184, 0.08);
  border: 1px solid rgba(36, 80, 184, 0.2);
  color: var(--text);
}

/* --- Кнопка «Назад» --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: var(--primary);
}

/* --- Пустое состояние --- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* --- Адаптивность --- */
@media (max-width: 768px) {
  .nav-clinic-switch select {
    max-width: 9rem;
  }

  nav ul li a.nav-user {
    max-width: 10rem;
  }

  .nav-user-hint {
    display: none;
  }

  .hero {
    padding: 2rem 1.2rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .clinics-grid {
    grid-template-columns: 1fr;
  }

  .clinic-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    margin-top: 1rem;
    border-radius: 18px;
  }

  .clinic-hero-content {
    padding: 1.5rem;
  }

  .clinic-hero h1 {
    font-size: clamp(2rem, 12vw, 3.1rem);
  }

  .clinic-hero-media {
    min-height: 230px;
    order: -1;
  }

  .clinic-hero-media-placeholder-only {
    display: none;
  }

  .clinic-hero-media::after {
    background: none;
  }

  .clinic-hero-logo,
  .clinic-hero-placeholder {
    min-height: 230px;
  }

  .clinic-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .clinic-hero-actions [role="button"] {
    width: 100%;
  }

  .clinic-rating {
    padding-left: 0;
    border-left: 0;
  }

  .clinic-section-nav {
    margin-bottom: 2.5rem;
  }

  .clinic-section-nav-inner {
    gap: 1.15rem;
  }

  .clinic-content-section,
  .clinic-booking-section {
    margin-bottom: 3.2rem;
  }

  .clinic-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .clinic-section-header > p {
    text-align: left;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .doctors-grid {
    grid-template-columns: 1fr;
  }

  .doctor-card {
    min-height: 0;
  }

  .doctor-avatar {
    width: 64px;
    height: 64px;
  }

  .doctor-profile-card {
    padding: 1.25rem;
  }

  .doctor-profile-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .doctor-profile-photo {
    width: 112px;
    height: 112px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 130px;
  }

  .gallery-thumbnail:first-child {
    grid-row: span 2;
    grid-column: span 2;
  }

  .gallery-lightbox-image {
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 8rem);
  }

  .gallery-lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
  }

  .gallery-lightbox-previous {
    left: 0.5rem;
  }

  .gallery-lightbox-next {
    right: 0.5rem;
  }

  .gallery-lightbox-counter {
    bottom: 0.5rem;
  }

  .clinic-booking-section {
    padding: 1.2rem;
  }

  .clinic-booking-layout,
  .reviews-list {
    grid-template-columns: 1fr;
  }

  .reviews-summary {
    margin-top: 0.25rem;
  }

  .auth-card {
    margin: 1rem;
    padding: 1.5rem;
  }

  .profile-card {
    margin: 1rem;
  }

  .dashboard-card {
    padding: 1rem;
  }

  .services-table {
    font-size: 0.85rem;
  }

  .form-actions {
    flex-direction: column;
  }
}
/* Pets and medical history */
.pets-page-header,
.pet-history-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.pets-page-header h1,
.pet-history-header h1 {
    margin-bottom: .35rem;
}

.pet-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.pet-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--box-shadow);
}

.pet-card > header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pet-card h2,
.pet-card p {
    margin-bottom: .25rem;
}

.pet-avatar {
    display: grid;
    width: 4rem;
    height: 4rem;
    flex: 0 0 4rem;
    place-items: center;
    border-radius: 50%;
    background: #EEF2F7;
    font-size: 2rem;
}

.pet-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem 1rem;
    margin: 1rem 0;
}

.pet-facts dt {
    color: var(--text-muted);
}

.pet-facts dd {
    margin: 0;
}

.pet-access-summary {
    min-height: 2.6rem;
    color: var(--text-muted);
    font-size: .9rem;
}

.pet-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.pet-card-actions a,
.pet-card-actions button,
.pet-card-actions form {
    width: auto;
    margin: 0;
}

.pet-dialog article,
.pet-editor-card {
    width: min(100%, 900px);
}

.pet-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.pet-access-picker {
    margin: 1rem 0 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.pet-access-picker summary {
    font-weight: 700;
}

.pet-access-picker [id$="clinics"] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .25rem 1rem;
}

.pet-history-access {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: #EEF2F7;
}

.medical-timeline {
    position: relative;
    display: grid;
    gap: 1rem;
    padding-left: 1.25rem;
}

.medical-timeline::before {
    position: absolute;
    top: .5rem;
    bottom: .5rem;
    left: .25rem;
    width: 2px;
    background: var(--border);
    content: "";
}

.medical-timeline-item {
    position: relative;
    margin: 0;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.medical-timeline-item::before {
    position: absolute;
    top: 1.4rem;
    left: -1.5rem;
    width: .75rem;
    height: .75rem;
    border: 2px solid var(--background);
    border-radius: 50%;
    background: var(--primary);
    content: "";
}

.medical-timeline-item time,
.medical-entry-meta {
    color: var(--text-muted);
    font-size: .85rem;
}

.medical-timeline-item h3 {
    margin: .25rem 0 .5rem;
}

.medical-entry-description p:last-child {
    margin-bottom: 0;
}

/* --- Разделы записи и страница её заполнения --- */
[x-cloak] {
    display: none !important;
}

.medical-entry-section {
    margin-bottom: .85rem;
}

.medical-entry-section:last-child {
    margin-bottom: 0;
}

.medical-entry-section h4 {
    margin: 0 0 .15rem;
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.medical-entry-section p:last-child {
    margin-bottom: 0;
}

.medical-entry-sections-toggle summary {
    color: var(--text-muted);
    font-size: .85rem;
    cursor: pointer;
}

.medical-entry-sections-toggle[open] summary {
    margin-bottom: .6rem;
}

/* Протоколы: «рыба» в форме и заполненные пункты в карте */
.protocol-group {
    margin: 0 0 1.1rem;
    padding: 0;
    border: 0;
}

.protocol-group legend {
    margin-bottom: .6rem;
    padding: 0;
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 700;
}

.protocol-lines {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.protocol-lines:empty {
    display: none;
}

.protocol-line span {
    display: block;
    margin-bottom: .2rem;
    font-size: .9rem;
}

.protocol-line input {
    margin-bottom: .7rem;
}

/* Таблица строками в протоколе (препараты вакцины) */
.protocol-rows {
    margin-bottom: 1rem;
}

.protocol-rows td {
    padding: .3rem .35rem;
}

.protocol-rows input[type="text"] {
    height: auto;
    margin: 0;
    padding: .35rem .5rem;
    font-size: .92rem;
}

.protocol-rows-view {
    table-layout: auto;
}

/* Текстовый пункт среди строк (например, «Кормление») — на всю ширину */
.protocol-wide {
    grid-column: 1 / -1;
}

.protocol-wide textarea {
    margin-bottom: .7rem;
}

/* Пункт с галочками — на всю ширину: варианты в ряд и строка «другое» */
.protocol-choice {
    grid-column: 1 / -1;
    margin-bottom: .8rem;
}

/* Подпись пункта с вариантами — заметнее самих вариантов («Степень наполнения») */
.protocol-line.protocol-choice > span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pico-color);
    margin-bottom: .35rem;
}

/* Раздел протокола над группами: «Репродуктивная система» */
.protocol-section,
.protocol-view-section {
    margin: 1.5rem 0 .5rem;
    font-size: 1.15rem;
}

.protocol-view-section {
    margin-top: 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.protocol-checks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1.1rem;
}

.protocol-check {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    cursor: pointer;
}

.protocol-check input[type="checkbox"],
.protocol-check input[type="radio"] {
    flex: none;
    width: 1.25em;
    height: 1.25em;
    margin: 0;
    padding: 0;
}

.protocol-checks input:not([type="checkbox"]):not([type="radio"]) {
    flex: 1 1 10rem;
    max-width: 18rem;
    height: auto;
    margin: 0;
    padding: .3rem .6rem;
    font-size: .9rem;
}

.protocol-view-line {
    margin: 0 0 .2rem;
}

.protocol-view-text {
    margin-top: .5rem;
}

.protocol-view-text strong {
    display: block;
}

/* Примечание под пунктом протокола: «Данное заключение не является диагнозом…» */
.protocol-note {
    display: block;
    margin: .75rem 0 0;
    font-size: .9rem;
    font-style: italic;
}

.medical-entry-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    float: right;
    margin: -.2rem 0 .4rem 1rem;
}

.medical-entry-action {
    padding: .3rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .85rem;
    text-decoration: none;
    white-space: nowrap;
}

.medical-entry-action:hover {
    border-color: var(--primary);
}

.medical-entry-actions form {
    margin: 0;
}

button.medical-entry-action {
    width: auto;
    margin: 0;
    background: transparent;
    line-height: inherit;
}

.medical-entry-action.is-danger {
    border-color: #E3B5AE;
    color: #A33A2E;
}

.medical-entry-action.is-danger:hover {
    border-color: #B9473A;
    background: #FDEEEC;
}

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

    .medical-entry-actions {
        float: none;
        justify-content: flex-start;
        margin: 0 0 .5rem;
    }
}

/* Анализы: таблица показателей с нормой и отметкой ↑/↓ */
.lab-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.lab-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: .92rem;
}

.lab-table th,
.lab-table td {
    padding: .35rem .6rem;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.lab-table thead th {
    border-top: 0;
    background: var(--background);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.lab-table tbody th {
    font-weight: 400;
}

.lab-table tbody th label {
    margin: 0;
}

.lab-unit,
.lab-norm {
    color: var(--text-muted);
    white-space: nowrap;
}

.lab-table .lab-result {
    width: 8.5rem;
}

.lab-value {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.lab-value input[type="text"] {
    height: auto;
    margin: 0;
    padding: .35rem .5rem;
    font-weight: 600;
    text-align: right;
}

.lab-value input.is-text {
    font-weight: 500;
    text-align: left;
}

.lab-table.is-plain .lab-result {
    width: 16rem;
}

.lab-flag {
    color: #A33A2E;
    font-weight: 700;
}

.lab-table tr.is-out td,
.lab-table tr.is-out th,
.lab-view-table tr.is-out td {
    background: #FDEEEC;
}

.lab-hint {
    margin: .4rem 0 0;
    font-size: .85rem;
}

@media (max-width: 640px) {
    .lab-table th,
    .lab-table td {
        padding: .3rem .35rem;
    }

    .lab-table .lab-result {
        width: 6rem;
    }
}

/* Акт выполненных работ: таблицы услуг и товаров в форме записи */
.act-block {
    margin: 0 0 1.4rem;
}

.act-block-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-bottom: .5rem;
}

.act-block-head h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.05rem;
}

.act-scan {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    padding: 0 .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
}

.act-scan input[type="text"] {
    width: 11rem;
    height: auto;
    margin: 0;
    padding: .4rem 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: .9rem;
}

.act-search {
    position: relative;
    margin-bottom: .5rem;
}

.act-search .act-scan {
    display: flex;
    max-width: 30rem;
}

.act-search .act-scan input[type="text"] {
    flex: 1;
    width: auto;
    padding: .5rem 0;
}

.act-search .act-suggest {
    top: calc(100% + .2rem);
    left: 0;
    min-width: min(30rem, 100%);
}

.act-product {
    display: block;
    padding: .45rem .2rem;
}

.act-empty {
    margin: 0;
    padding: .7rem .8rem;
    color: var(--text-muted);
    font-size: .9rem;
}

.act-table-wrap {
    /* Без overflow: иначе обрезается выпадающий список подсказок */
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.act-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: .92rem;
}

.act-table th {
    padding: .5rem .6rem;
    background: var(--background);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.act-table td {
    padding: .35rem .4rem;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

.act-table input[type="text"] {
    height: auto;
    margin: 0;
    padding: .4rem .55rem;
    font-size: .92rem;
}

.act-table th.act-num,
.act-table td.act-num {
    width: 5.5rem;
    text-align: right;
}

.act-table td.act-num input {
    text-align: right;
}

.act-table td.act-amount {
    padding-top: .75rem;
    padding-right: .7rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.act-name {
    position: relative;
    min-width: 12rem;
}

@media (max-width: 640px) {
    .act-table th.act-num,
    .act-table td.act-num {
        width: 4.2rem;
    }

    .act-name {
        min-width: 8rem;
    }
}

.act-name input.is-invalid {
    border-color: #C2685C;
}

.act-suggest {
    position: absolute;
    z-index: 20;
    top: calc(100% - .2rem);
    left: .4rem;
    width: max-content;
    min-width: calc(100% - .8rem);
    max-width: min(32rem, 90vw);
    max-height: 18rem;
    margin: 0;
    padding: .25rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(20, 26, 33, .12);
    list-style: none;
}

.act-suggest li {
    margin: 0;
    list-style: none;
}

.act-suggest button {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 1rem;
    margin: 0;
    padding: .4rem .55rem;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: .9rem;
    text-align: left;
}

.act-suggest button:hover,
.act-suggest button:focus {
    background: var(--background);
}

.act-suggest small {
    flex: none;
    color: var(--text-muted);
}

.act-hint {
    display: block;
    margin-top: .2rem;
    font-size: .8rem;
}

.act-hint.is-warn,
.act-error {
    color: #A33A2E;
}

.act-error {
    margin: 0 0 .4rem;
    font-size: .88rem;
}

.act-remove-cell {
    width: 2.2rem;
}

.act-remove {
    width: auto;
    margin: .2rem 0 0;
    padding: .15rem .5rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
}

.act-remove:hover {
    border-color: #E3B5AE;
    color: #A33A2E;
}

.act-total {
    margin: .5rem 0 0;
    text-align: right;
}

.act-due {
    margin: 0 0 1rem;
    padding: .7rem 1rem;
    border-radius: var(--radius);
    background: var(--background);
    font-size: 1.05rem;
    text-align: right;
}

.act-due small {
    display: block;
    font-size: .8rem;
}

/* В карте питомца */
.act-view-table {
    width: 100%;
    table-layout: fixed;
    margin: .3rem 0 .4rem;
    font-size: .9rem;
}

.act-view-table th,
.act-view-table td {
    padding: .3rem .5rem;
}

.act-view-table .act-num {
    width: 7rem;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .act-view-table .act-num {
        width: 4.5rem;
    }
}

.act-view-total {
    margin: 0 0 .6rem;
    font-size: .9rem;
    text-align: right;
}

.act-view-due {
    margin: .4rem 0 0;
    font-size: 1.05rem;
    text-align: right;
}

.medical-entry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
    gap: 2rem;
    transition: grid-template-columns .2s ease;
}

/* Правая колонка свёрнута: форма занимает всё место, справа узкая полоска */
.medical-entry-layout.is-aside-collapsed {
    grid-template-columns: minmax(0, 1fr) 3rem;
    gap: 1rem;
}

.medical-entry-editor {
    width: 100%;
}

.medical-entry-history {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    padding: 1.25rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.medical-entry-history h2 {
    margin-bottom: .75rem;
    padding-right: 2.25rem; /* место под кнопкой «свернуть» */
    font-size: 1.05rem;
}

.history-aside-toggle {
    position: absolute;
    top: .9rem;
    right: .9rem;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary);
    font-size: 1.25rem;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
}

.history-aside-toggle:hover,
.history-aside-toggle:focus-visible {
    border-color: var(--primary);
    background: #EEF2F7;
}

.history-aside-arrow {
    margin-top: -.1em;
}

/* Свёрнутая колонка: вся полоска — кнопка, подпись сверху вниз */
.medical-entry-history.is-collapsed {
    padding: 0;
    overflow: hidden;
}

.medical-entry-history.is-collapsed .history-aside-toggle {
    position: static;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    height: auto;
    min-height: 14rem;
    padding: .9rem 0;
    border: 0;
    border-radius: var(--radius);
}

.history-aside-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: var(--text-muted);
    font-size: .9rem;
    letter-spacing: .02em;
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.medical-entry-history h2 ~ h2 {
    margin-top: 1.5rem;
}

.required-mark {
    color: var(--primary);
}

.draft-status-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.draft-status {
    color: var(--text-muted);
    font-size: .85rem;
}

.draft-status-saved {
    color: var(--primary);
}

.draft-status-failed {
    color: #b3261e;
}

.draft-drop-btn {
    width: auto;
    margin: 0;
    padding: .3rem .8rem;
    font-size: .85rem;
}

.pet-history-draft a {
    margin-left: auto;
    font-weight: 700;
}

@media (max-width: 900px) {
    .medical-entry-layout {
        grid-template-columns: 1fr;
    }

    .medical-entry-history {
        position: relative;
        max-height: none;
    }

    /* На узком экране колонка уходит вниз: свёрнутая — короткая полоска */
    .medical-entry-layout.is-aside-collapsed {
        grid-template-columns: 1fr;
    }

    .medical-entry-history.is-collapsed .history-aside-toggle {
        flex-direction: row;
        justify-content: center;
        min-height: 3rem;
    }

    .medical-entry-history.is-collapsed .history-aside-label {
        writing-mode: horizontal-tb;
        transform: none;
    }
}

@media (max-width: 700px) {
    .pets-page-header,
    .pet-history-header {
        align-items: stretch;
        flex-direction: column;
    }

    .pet-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Клиенты клиники: таблица со скроллом на узких экранах */
.clients-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--muted-border-color);
    border-radius: 12px;
    background: #fff;
}

.clients-table {
    margin: 0;
    min-width: 640px;
}

.clients-table th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.clients-table td a {
    white-space: nowrap;
}

/* Строка клиента целиком ведёт в карту; телефон остаётся отдельной ссылкой */
.clients-row {
    position: relative;
    cursor: pointer;
}

.clients-row:hover td {
    background: rgba(36, 80, 184, .06);
}

.clients-row-link {
    color: inherit;
    text-decoration: none;
}

.clients-row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.clients-row a[href^="tel:"] {
    position: relative;
    z-index: 1;
}

/* Подтверждённая запись целиком ведёт в медицинскую карту; ссылки, кнопки
   и формы в строке остаются над общей ссылкой и работают как раньше */
.appointment-row a:not(.clients-row-link),
.appointment-row button,
.appointment-row form {
    position: relative;
    z-index: 1;
}

.appointment-card-link {
    font-size: .85em;
    color: var(--pico-primary);
    white-space: nowrap;
}

.clients-card-mark {
    font-size: .85em;
}

/* «В клиенты клиники» у записи с сайта */
.link-button {
    display: inline;
    width: auto;
    margin: .2rem 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: .82rem;
    text-decoration: underline;
    cursor: pointer;
}

.appointment-to-client {
    margin: 0 0 1rem;
    padding: .7rem .9rem;
    border: 1px dashed var(--muted-border-color);
    border-radius: 10px;
}

.appointment-to-client summary {
    color: var(--primary);
    font-weight: 600;
}

.appointment-to-client form {
    margin: .8rem 0 0;
}

.clients-table td:nth-child(3),
.link-button {
    white-space: nowrap;
}

/* История болезни: дата последнего обращения рядом с заголовком */
.history-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem .9rem;
}

.history-fold-all {
    display: inline-flex;
    gap: .4rem;
    margin-left: auto;
    font-size: 1rem;
    font-weight: 400;
}

.history-fold-all button.medical-entry-action {
    color: var(--text-muted);
}

/* Запись в карте свёрнута до шапки: дата, тип, название, врач */
.medical-entry-fold > summary {
    display: block;
    list-style: none;
    cursor: pointer;
}

.medical-entry-fold > summary::-webkit-details-marker {
    display: none;
}

/* Без стрелки Pico справа — вместо неё «Подробнее ▾» под шапкой */
.medical-entry-fold > summary::after {
    display: none;
}

.medical-entry-fold > summary .medical-entry-meta {
    margin-bottom: 0;
}

.medical-entry-fold-hint {
    display: inline-block;
    margin-top: .45rem;
    color: var(--primary);
    font-size: .88rem;
    font-weight: 600;
}

.medical-entry-fold-hint::after {
    content: "Подробнее ▾";
}

.medical-entry-fold[open] .medical-entry-fold-hint::after {
    content: "Свернуть ▴";
}

.medical-entry-fold[open] > summary {
    margin-bottom: .8rem;
}

.medical-entry-fold > summary:hover h3 {
    color: var(--primary);
}

/* Анализы в карте: колонка единиц шире — «органолептически» не налезает */
.lab-view-table td.act-num:nth-child(2),
.lab-view-table th.act-num:nth-child(2) {
    width: 12rem;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.lab-view-table td.act-num:nth-child(3),
.lab-view-table th.act-num:nth-child(3) {
    width: 10rem;
    white-space: normal;
}

.history-last-visit {
    padding: .2rem .7rem;
    border-radius: 999px;
    background: rgba(36, 80, 184, .09);
    color: var(--primary);
    font-size: .85rem;
    font-weight: 600;
}

/* Неопубликованный черновик — пунктирная плашка над записями */
.medical-entry-draft {
    border-style: dashed;
    border-color: var(--secondary, #22703A);
    background: rgba(34, 112, 58, .07);
}

.medical-entry-draft a[role=button] {
    margin: .4rem 0 0;
    padding: .45rem .9rem;
    font-size: .88rem;
}

.medical-timeline + .medical-timeline {
    margin-top: 1rem;
}

/* История посещений */
.visits-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .7rem 1rem;
    margin: 0 0 1rem;
    padding: .8rem 1rem;
    border: 1px solid var(--muted-border-color);
    border-radius: 14px;
    background: #fff;
}

.visits-periods {
    display: flex;
    border: 1px solid var(--muted-border-color);
    border-radius: 999px;
    overflow: hidden;
}

.visits-periods a {
    padding: .4rem 1rem;
    color: var(--text-muted);
    font-size: .9rem;
    text-decoration: none;
}

.visits-periods a.active {
    background: var(--primary);
    color: #fff;
}

.visits-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.visits-nav [role=button] {
    margin: 0;
    padding: .3rem .75rem;
    font-size: 1.1rem;
    line-height: 1.2;
}

.visits-nav .is-disabled {
    opacity: .35;
    pointer-events: none;
}

.visits-period-label {
    min-width: 9rem;
    text-align: center;
    font-size: 1.05rem;
}

.visits-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    min-width: 0;
    margin: 0;
}

.visits-picker input,
.visits-picker select {
    width: auto;
    margin: 0;
    padding-top: .4rem;
    padding-bottom: .4rem;
    font-size: .9rem;
}

.visits-today-link {
    margin-left: auto;
    font-size: .9rem;
}

.visits-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.2rem;
    margin: 0 0 1.4rem;
    color: var(--text-muted);
}

.visits-summary strong {
    color: var(--primary);
    font-size: 1.15rem;
}

.visit-day {
    margin: 0 0 1.4rem;
}

.visit-day-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: .5rem .2rem;
    border-bottom: 2px solid var(--primary);
    background: var(--background-color, #F7F8F5);
}

.visit-day-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.visit-day-head h2 span {
    color: var(--text-muted);
    font-weight: 500;
}

.visit-day-count {
    flex: none;
    white-space: nowrap;
    padding: .1rem .6rem;
    border-radius: 999px;
    background: rgba(36, 80, 184, .1);
    color: var(--primary);
    font-size: .85rem;
    font-weight: 700;
}

.visit-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.visit-row {
    position: relative;
    display: grid;
    grid-template-columns: 4rem minmax(0, 1.4fr) minmax(0, 1fr) 15rem;
    gap: .3rem 1rem;
    align-items: center;
    margin: 0;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--muted-border-color);
    list-style: none;
    background: #fff;
}

.visit-row.is-link:hover {
    background: rgba(36, 80, 184, .06);
}

.visit-time {
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.visit-who small,
.visit-what small {
    display: block;
    color: var(--text-muted);
    font-size: .82rem;
}

.visit-link {
    color: inherit;
    text-decoration: none;
}

/* Вся строка ведёт в карточку клиента */
.visit-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.visit-status {
    position: relative;
    z-index: 1;
    text-align: right;
}

@media (max-width: 700px) {
    .visit-row {
        grid-template-columns: 3.2rem minmax(0, 1fr);
    }

    .visit-what,
    .visit-status {
        grid-column: 2;
        text-align: left;
    }

    .visits-today-link {
        margin-left: 0;
    }

    .visits-picker {
        width: 100%;
    }

    .visits-picker input,
    .visits-picker select {
        flex: 1 1 9rem;
        width: 100%;
        min-width: 0;
    }
}

/* Детали питомца в формах клиники: вид, порода, пол, возраст, кастрация, канал */
.pet-detail-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.pet-detail-fields fieldset {
    margin: 0 0 var(--spacing, 1rem);
}

.pet-detail-fields legend {
    margin-bottom: .35rem;
}

.pet-age-field,
.pet-sterilization-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem 1rem;
}

.pet-age-field legend,
.pet-sterilization-field legend {
    width: 100%;
}

.pet-age-field label {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
}

.pet-age-field input {
    width: 5rem;
    margin: 0;
}

.pet-sterilization-field label {
    margin: 0;
}

.pet-detail-error {
    display: block;
    margin: -.5rem 0 .6rem;
    color: #b3261e;
}

@media (max-width: 560px) {
    .pet-detail-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

.clients-table {
    min-width: 860px;
}

.clients-table td:nth-child(3) {
    min-width: 15rem;
}

.clients-pet-meta {
    display: block;
    color: var(--text-muted);
    font-size: .78rem;
    white-space: normal;
}

.client-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .35rem 1.2rem;
    margin: 0 0 1.5rem;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    background: rgba(36, 80, 184, .06);
}

.client-facts dt {
    color: var(--text-muted);
    font-weight: 600;
}

.client-facts dd {
    margin: 0;
}

/* Фамилия, имя, отчество под полем «Имя клиента» */
.fio-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 .8rem;
}

.fio-fields label {
    font-size: .9rem;
}

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

/* Документы клиники */
.documents-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .7rem;
    margin: 0 0 1rem;
}

.documents-toolbar [role=button] {
    margin: 0;
}

.documents-table {
    margin: 0;
    min-width: 720px;
}

.doc-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    margin-right: .5rem;
    border-radius: 8px;
    background: #E6EEF9;
    color: #2B5797;
    font-size: .72rem;
    font-weight: 800;
    vertical-align: middle;
}

.doc-template-name {
    display: block;
    color: var(--text-muted);
    font-size: .8rem;
}

.doc-number {
    padding: .1rem .4rem;
    border-radius: 5px;
    background: rgba(36, 80, 184, .08);
    color: var(--primary);
    font-size: .82rem;
}

.doc-warning {
    color: #b3261e;
}

.doc-form-title {
    margin-bottom: .6rem;
    font-size: 1.7rem;
}

.doc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin: 0 0 1.2rem;
    border-bottom: 1px solid var(--muted-border-color);
}

.doc-tabs span {
    padding: .5rem .9rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.doc-tabs .is-active {
    margin-bottom: -1px;
    border-color: var(--muted-border-color);
    background: #fff;
    color: var(--color);
    font-weight: 600;
}

.doc-tabs .is-later {
    opacity: .45;
}

.doc-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 1.5rem;
}

.doc-check {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    margin: .35rem 0 .7rem;
}

.doc-check input {
    flex: none;
    margin-top: .2rem;
}

.doc-check small {
    display: block;
    color: var(--text-muted);
    font-size: .8rem;
}

.doc-gap {
    margin-top: .8rem;
}

.doc-dropzone {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    padding: 1rem;
    border: 2px dashed var(--secondary, #22703A);
    border-radius: 12px;
    background: rgba(34, 112, 58, .06);
}

.doc-dropzone span {
    color: var(--text-muted);
    font-size: .88rem;
}

.doc-dropzone input[type=file] {
    margin: 0;
}

.doc-file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .2rem .4rem;
    padding: .55rem .7rem;
    border: 1px solid var(--muted-border-color);
    border-radius: 10px;
    background: #fff;
}

.doc-file small {
    width: 100%;
    color: var(--text-muted);
}

.doc-sample-link {
    font-size: .88rem;
}

.doc-report {
    margin: .8rem 0 0;
    padding: .6rem .8rem;
    border-radius: 10px;
    background: #E8F3E8;
    color: #3E7A43;
    font-size: .9rem;
}

.doc-report.is-bad {
    background: #FDECEA;
    color: #b3261e;
}

.doc-labels-title {
    margin: 1.2rem 0 .4rem;
    font-size: 1rem;
}

.doc-labels {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .25rem .8rem;
    margin: 0;
    font-size: .86rem;
}

.doc-labels dd {
    margin: 0;
    color: var(--text-muted);
}

.doc-labels code {
    padding: 0;
    background: none;
    color: var(--primary);
    font-size: .82rem;
}

/* Документы в карте питомца */
.doc-menu {
    position: relative;
    margin: 0;
}

.doc-menu > summary {
    margin: 0;
    list-style: none;
}

.doc-menu > summary::-webkit-details-marker {
    display: none;
}

.doc-menu-list {
    position: absolute;
    right: 0;
    z-index: 5;
    width: 300px;
    margin-top: .4rem;
    padding: .35rem;
    border: 1px solid var(--muted-border-color);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(20, 26, 33, .18);
}

.doc-menu-list form {
    margin: 0;
}

.doc-menu-list button {
    display: block;
    width: 100%;
    margin: 0;
    padding: .55rem .7rem;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--color);
    text-align: left;
    font-size: .92rem;
}

.doc-menu-list button:hover {
    background: rgba(36, 80, 184, .08);
}

.doc-menu-list small {
    display: block;
    color: var(--text-muted);
    font-size: .78rem;
}

.doc-menu-empty {
    margin: 0;
    padding: .5rem .7rem;
    color: var(--text-muted);
    font-size: .88rem;
}

.doc-issued-list {
    display: grid;
    gap: .5rem;
}

.doc-issued-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .65rem .8rem;
    border: 1px solid var(--muted-border-color);
    border-radius: 10px;
    background: #fff;
}

.doc-issued-body {
    flex: 1 1 16rem;
    min-width: 0;
}

.doc-issued-body small {
    display: block;
    color: var(--text-muted);
    font-size: .8rem;
}

.doc-issued-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.doc-scan-form {
    margin: 0;
}

.doc-pill {
    display: inline-block;
    margin: 0;
    padding: .25rem .7rem;
    border: 1px solid var(--primary);
    border-radius: 999px;
    color: var(--primary);
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.doc-pill:hover {
    background: var(--primary);
    color: #fff;
}

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

.doc-menu > summary {
    white-space: nowrap;
}

.doc-type-form .form-actions > * {
    margin: 0;
}

.clients-table-wrap + .landing-section {
    margin-top: 2rem;
}

.doc-menu > summary::after {
    display: none;
}

.pet-history-header .form-actions {
    align-items: flex-start;
}

.pet-history-header .form-actions [role=button] {
    margin: 0;
}

.doc-tabs button {
    width: auto;
    margin: 0;
    padding: .5rem .9rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: none;
    color: var(--text-muted);
    font-size: .9rem;
    box-shadow: none;
}

.doc-tabs button.is-active {
    margin-bottom: -1px;
    border-color: var(--muted-border-color);
    background: #fff;
    color: var(--color);
    font-weight: 600;
}

.doc-hint {
    color: var(--text-muted);
    font-size: .88rem;
}

.doc-logo-preview {
    display: block;
    max-width: 180px;
    max-height: 90px;
    margin: 0 0 .4rem;
    object-fit: contain;
}

.doc-delete-button {
    margin-left: auto !important;
    border-color: #b3261e !important;
    color: #b3261e !important;
}

button.doc-pill {
    width: auto;
    background: none;
    line-height: inherit;
}

.doc-pill-danger {
    border-color: #b3261e;
    color: #b3261e;
}

.doc-pill-danger:hover {
    background: #b3261e;
    color: #fff;
}

/* Подсказка по меткам — раскрывается по клику */
.doc-labels-help {
    margin: 1rem 0 0;
    padding: .6rem .9rem;
    border: 1px solid var(--muted-border-color);
    border-radius: 10px;
    background: #fff;
}

.doc-labels-help summary {
    color: var(--primary);
    font-weight: 600;
}

.doc-labels-help[open] summary {
    margin-bottom: .5rem;
}

/* Предварительный просмотр документа */
.doc-preview-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .6rem 1rem;
    align-items: center;
    margin-bottom: .8rem;
}

.doc-preview-bar .doc-hint {
    flex: 1 1 22rem;
    margin: 0;
}

.doc-preview-actions {
    display: flex;
    gap: .5rem;
}

.doc-preview-actions > * {
    width: auto;
    margin: 0;
}

.docp-paper {
    max-width: 794px;
    margin: 0 auto 1rem;
    padding: 56px 48px 56px 76px;
    border: 1px solid var(--muted-border-color);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(20, 26, 33, .12);
    color: #111;
    font-family: "Times New Roman", Times, serif;
    font-size: 10.5pt;
    line-height: 1.25;
    overflow-x: auto;
}

.docp-paper p {
    margin: 0 0 3pt;
}

.docp-paper img {
    max-width: 100%;
    height: auto;
}

.docp-table {
    width: 100%;
    margin: 0 0 6pt;
    border-collapse: collapse;
}

.docp-table td {
    padding: 2pt 4pt;
    border: 0;
    background: none;
    font-size: inherit;
}

.docp-tab {
    display: inline-block;
    width: 2.5em;
}

/* Онлайн-запись: новый питомец прямо из формы записи */
.booking-pet-note {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.booking-pet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.booking-pet-actions button {
    width: auto;
    margin-bottom: 0;
}

/* «Записи клиентов»: полоса-разделитель дня — Сегодня, Завтра, дальше дата */
.appointments-day-row td {
  padding: .55rem 1rem;
  background: #EEF2F7;
  border-top: 2px solid var(--border);
  color: var(--text);
  font-size: .95rem;
}

.appointments-day-row strong {
  margin-right: .5rem;
  font-size: 1.05rem;
}

.appointments-day-row.is-today td {
  background: var(--primary);
  border-top-color: var(--primary);
  color: #FFFFFF;
}

.appointments-day-row.is-tomorrow td {
  background: #E2F2E4;
  border-top-color: var(--secondary);
}

.appointments-day-count {
  float: right;
  font-size: .85rem;
  opacity: .85;
}

/* --- Профиль врача: рамка фото и предпросмотр, как на сайте --- */
.photo-framer {
  margin: -0.25rem 0 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #F4F6F8;
}

.photo-framer-title {
  margin: 0 0 .35rem;
  font-size: 1.1rem;
}

.photo-framer-hint {
  margin-bottom: 1rem;
  font-size: .9rem;
}

.photo-framer-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

.photo-framer-editor {
  display: flex;
  flex: 0 1 260px;
  flex-direction: column;
  gap: .75rem;
}

.photo-framer-frame {
  position: relative;
  width: 240px;
  height: 240px;
  overflow: hidden;
  border-radius: 50%;
  background: #E9EEF4;
  box-shadow: 0 0 0 4px #FFFFFF, 0 0 0 6px var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.photo-framer[data-empty="true"] .photo-framer-frame {
  cursor: default;
}

.photo-framer-frame.is-dragging {
  cursor: grabbing;
}

.photo-framer-frame:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 6px;
}

.photo-framer-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.photo-framer-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 4rem;
}

.photo-framer-controls label {
  margin-bottom: .35rem;
  font-size: .85rem;
}

.photo-framer-controls input[type="range"] {
  margin: .2rem 0 .4rem;
}

.photo-framer-controls button {
  width: auto;
  margin: 0;
  padding: .45rem 1rem;
  font-size: .9rem;
}

.photo-framer-previews {
  display: flex;
  flex: 1 1 360px;
  min-width: 0;
  flex-direction: column;
  gap: .5rem;
}

.photo-framer-caption {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.doctor-card.is-preview {
  min-height: 0;
  margin-bottom: .75rem;
  pointer-events: none;
}

.doctor-profile-header.is-preview {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.photo-framer-name {
  display: block;
  margin-bottom: .3rem;
  font-size: 1.4rem;
}

.medical-entry-dispensed {
  margin: .5rem 0;
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  background: #F4F6F8;
  font-size: .9rem;
}

/* «Записи клиентов»: комментарий к статусу и отменённые записи */
.appointment-status {
  display: block;
  white-space: nowrap;
}

.appointment-status.is-cancelled {
  color: #A33A2E;
  font-weight: 650;
}

.appointment-status-note {
  display: block;
  max-width: 16rem;
  margin-top: .2rem;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.35;
  white-space: normal;
}

.appointment-status-note.appointment-status-by {
  color: var(--text);
  font-weight: 500;
}

.appointment-cancelled td {
  background: #FDEEEC;
}

/* Подтверждённые — нежно-зелёные (и при наведении остаются зелёными) */
.appointment-confirmed td {
  background: #EAF6EC;
}

.appointment-confirmed.clients-row:hover td {
  background: #DDF0E1;
}

.appointment-cancelled td,
.appointment-cancelled td a {
  color: #7A4A43;
}

.appointment-actions {
  margin: 0;
  min-width: 13rem;
}

.appointment-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.appointment-actions button {
  width: auto;
  margin: 0;
  padding: .4rem .8rem;
  font-size: .9rem;
}

.appointment-btn-confirm {
  border-color: var(--success);
  color: var(--success);
}

.appointment-btn-cancel {
  border-color: #C2685C;
  color: #A33A2E;
}

.appointment-actions .appointment-btn-confirm.is-filled {
  border-color: var(--success);
  background: var(--success);
  color: #FFFFFF;
}

.appointment-actions .appointment-btn-cancel.is-filled {
  border-color: #B9473A;
  background: #B9473A;
  color: #FFFFFF;
}

.appointment-note input {
  margin: 0 0 .4rem;
  padding: .45rem .6rem;
  font-size: .9rem;
}

.appointment-note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

/* Уведомления в MAX */
.max-connect h2 {
  margin-bottom: .5rem;
  font-size: 1.2rem;
}

.max-code {
  font-size: 1.05rem;
  user-select: all;
}

.max-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
}

.max-actions button {
  width: auto;
  margin: 0;
  padding: .35rem .8rem;
  font-size: .85rem;
}
