/* Версия для телефона: верхняя шапка, вкладки внизу, всё в одну колонку. */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .logo { padding-left: 0; gap: 9px; }
  .topbar .logo-name { font-size: 18px; }
  .topbar .logo-sub { font-size: 11.5px; }
  .topbar-call { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 14px; background: var(--blue-soft); color: var(--blue-dark); }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px; border: none; background: transparent; padding: 7px 4px; border-radius: 14px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
  .tab.is-active { color: var(--blue); background: var(--blue-soft); }

  .main { padding: 20px 16px calc(100px + env(safe-area-inset-bottom)); }
  .container, .stack { gap: 18px; }
  .h1 { font-size: 26px; }
  .page-head { gap: 6px; }

  .card { padding: 20px; border-radius: 22px; gap: 14px; }
  .card-hero { padding: 22px 20px; border-radius: 24px; }
  .card-list { padding-bottom: 8px; }
  .grid-2, .columns, .col-main, .col-side { gap: 18px; }

  .hero { flex-direction: column; gap: 20px; }
  .hero-main, .hero-side { flex: 1 1 auto; }
  .hero-side { padding: 20px; border-radius: 20px; }
  .hero-date, .hero-time { font-size: 28px; }
  .info-label { flex-basis: 96px; font-size: 13.5px; }
  .info-list-wide .info-row { flex-direction: column; gap: 2px; }
  .info-list-wide .info-label { flex-basis: auto; font-size: 13px; }

  .tax-shortcut { padding: 20px; }
  .tax-shortcut .btn { width: 100%; }

  .doc-row { gap: 12px; }
  .doc-date { display: none; }
  .kind { flex-basis: 42px; }

  .visit-row { padding: 16px 18px; gap: 6px 14px; border-radius: 20px; align-items: flex-start; }
  .visit-day { flex: 0 0 52px; }
  .visit-day-num { font-size: 22px; }
  .visit-info { flex: 1 1 0; }
  .visit-title { font-size: 15.5px; }
  .visit-meta { font-size: 13px; }
  .visit-docs { margin-left: 66px; }
  .visit-more { display: none; }

  .proc-price { flex-basis: auto; }
  .next-card .btn, .empty-card .btn { width: 100%; }
  .empty-card { padding: 22px 20px; }

  .slot-days { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .slot-day { flex: 0 0 auto; min-width: 88px; scroll-snap-align: start; }
  .slot-time { flex: 1 1 calc(33% - 9px); text-align: center; padding: 13px 8px; }
  .slot-footer .btn { width: 100%; }
  .form-block { padding: 18px 0; }
  .btn-self { align-self: stretch; }

  /* Окна выезжают снизу */
  .backdrop { align-items: flex-end; padding: 0; }
  .dialog { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); gap: 16px; animation: sheet-in 0.24s ease-out; }
  .dialog-wide { width: 100%; }
  .dialog-title { font-size: 20px; }
  .sheet-frame { padding: 10px; max-height: 52vh; margin: 0 -6px; }
  .sheet { padding: 18px 16px; font-size: 12.5px; }
  .sheet-watermark { font-size: 48px; }
  .sheet-line { flex-direction: column; gap: 0; }
  .sheet-line > span:last-child { text-align: left; }
  .btn-wrap .btn { flex: 1 1 100%; }
  .phone { width: 100%; }

  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); border-radius: 18px; font-size: 14px; }
  body.has-overlay .toast { bottom: 24px; }

  .login { align-items: flex-start; padding: 40px 16px 32px; }
  .login-card { padding: 24px 20px; }
}

@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 380px) {
  .h1 { font-size: 24px; }
  .hero-date, .hero-time { font-size: 25px; }
  .info-label { flex-basis: 86px; }
  .tab { font-size: 11px; }
}
