/* ============================================================
   PAX LIVE — common.css (восстановлен по референсу index.html)
   Цвета и базовые компоненты, которые ожидает шаблон главной.
   ============================================================ */

:root {
  /* Палитра */
  --bg:           #F4F2EE;
  --bg-2:         #FFFFFF;
  --surface:      #FFFFFF;
  --surface-soft: #F0EEEA;
  --ink:          #18181B;
  --ink-dim:      #52525B;
  --ink-mute:     #A1A1AA;
  --hair:         #E7E5E0;
  --hair-2:       #D6D3CD;
  --accent:       #FF5B2E;
  --accent-soft:  #FFE8E0;
  --blue:         #2563EB;
  --success:      #10B981;
  --danger:       #DC2626;

  /* Радиусы */
  --radius:    14px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* === Layout shell === */
.shell {
  display: grid;
  grid-template-columns: minmax(360px, 480px) 1fr;
  gap: 20px;
  width: 100%;
  height: calc(100vh - 56px);
  max-width: 100%;
  margin: 0;
  padding: 16px 20px 16px 16px;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 56px);
    overflow: visible;
    padding: 16px 12px;
    gap: 18px;
  }
}

/* === Tabs / chips / switch / seg / btn === */
.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: 0;
  padding: 12px 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-mute);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s ease;
  font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.on {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab .count {
  font-size: 11px;
  color: var(--ink-mute);
  background: var(--surface-soft);
  padding: 1px 7px;
  border-radius: 8px;
}
.tab.on .count { color: var(--accent); background: var(--accent-soft); }

.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface-soft);
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-dim);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease;
}
.chip:hover { background: var(--hair); }
.chip.active {
  background: var(--ink);
  color: #fff;
}

.seg {
  display: inline-flex;
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-dim);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
}
.seg button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.switch {
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--hair);
  border: 0;
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
  transition: transform .2s ease;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s ease, transform .15s ease;
}
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink-dim); border: 1px solid var(--hair); }
.btn.ghost:hover { background: var(--surface-soft); color: var(--ink); }

/* === Section title === */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-mute);
  margin-bottom: 10px;
  font-weight: 500;
}
.section-title .caret { font-size: 9px; transition: transform .2s ease; }

/* === Modal === */
.modal {
  position: fixed; inset: 0;
  background: rgba(24,24,27,.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn .25s cubic-bezier(.2,.7,.2,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 22px 24px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--hair);
}
.m-title {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
}
.m-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
}
.modal-close {
  width: 32px; height: 32px;
  background: var(--surface-soft);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 14px;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--hair); color: var(--ink); }
.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--hair);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* === Toast === */
.pax-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  opacity: 0;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), opacity .25s;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.pax-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.pax-toast.success { background: var(--success); }
.pax-toast.error { background: var(--danger); }

/* === FAB (mobile) === */
.fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(255,91,46,.35);
  z-index: 100;
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
.fab.visible { transform: translateX(-50%) translateY(0); }
.fab:hover { transform: translateX(-50%) translateY(-2px); }

/* === Загрузка-лейбл (для мини-скелетонов в карточках) === */
.skeleton {
  background: linear-gradient(90deg, var(--hair) 0%, #fff 50%, var(--hair) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}


/* ============ ВЕРХНЯЯ НАВИГАЦИЯ (topnav) ============ */
body { padding-top: 56px; }

.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--hair);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 18px;
  z-index: 100;
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
.topnav-logo {
  width: 32px; height: 32px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  font-weight: 600;
}
.topnav-name {
  font-family: 'Instrument Serif', serif;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: -.01em;
}

.topnav-burger {
  display: none;
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  width: 40px; height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}
.topnav-burger:hover { color: var(--ink); }

.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  overflow-x: visible;
  overflow-y: visible;
}
.topnav-links::-webkit-scrollbar { display: none; }

.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
}
.topnav-link:hover { color: var(--ink); }
.topnav-link.active { color: var(--accent); }
.topnav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.topnav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.topnav-link-with-submenu { position: relative; }
.topnav-link-with-submenu .topnav-chevron {
  width: 12px; height: 12px;
  transition: transform .2s ease;
  margin-left: -2px;
}
.topnav-link-with-submenu:hover .topnav-chevron { transform: rotate(180deg); }
.topnav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 12px 40px -8px rgba(24, 24, 27, .15), 0 4px 12px rgba(24, 24, 27, .06);
  opacity: 0;
  visibility: hidden;
  transition: all .2s cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
  z-index: 110;
}
.topnav-submenu::before {
  content: '';
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
}
.topnav-link-with-submenu:hover .topnav-submenu,
.topnav-link-with-submenu:focus-within .topnav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.topnav-submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .12s ease;
  white-space: nowrap;
}
.topnav-submenu-item:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.topnav-submenu-item svg {
  width: 16px; height: 16px;
  color: var(--ink-mute);
  flex-shrink: 0;
}
.topnav-submenu-item:hover svg { color: var(--accent); }

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.topnav-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  text-decoration: none;
  position: relative;
  transition: all .15s ease;
}
.topnav-icon:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.topnav-icon svg { width: 18px; height: 18px; }
.topnav-icon-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.topnav-icon-dot.hidden { display: none; }

/* Уведомления — кнопка-триггер */
.topnav-notif-wrap {
  position: relative;
  display: inline-flex;
}
.topnav-notif-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.topnav-notif-btn:hover { background: var(--surface-soft); color: var(--ink); }
.topnav-notif-btn.open { background: var(--accent-soft); color: var(--accent); }

/* Dropdown */
.topnav-notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: -8px;
  width: 380px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 16px;
  box-shadow: 0 16px 48px -12px rgba(24,24,27,.18), 0 4px 12px rgba(24,24,27,.06);
  z-index: 110;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(560px, calc(100vh - 80px));
  animation: notifDropIn .18s cubic-bezier(.2,.7,.2,1);
}
.topnav-notif-dropdown[hidden] { display: none; }
@keyframes notifDropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.topnav-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--hair);
}
.topnav-notif-title {
  font-family: 'Instrument Serif', serif;
  font-size: 19px;
  color: var(--ink);
  font-weight: 400;
}
.topnav-notif-mark {
  background: transparent;
  border: 0;
  font-family: 'Geist', sans-serif;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s ease;
}
.topnav-notif-mark:hover { background: var(--accent-soft); }
.topnav-notif-mark[hidden] { display: none; }

.topnav-notif-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.topnav-notif-loading,
.topnav-notif-empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13.5px;
}
.topnav-notif-empty svg {
  width: 36px; height: 36px;
  opacity: .25;
  margin-bottom: 8px;
  display: inline-block;
}
.topnav-notif-empty-title {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 4px;
}

.topnav-notif-item {
  display: block;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hair);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background .15s ease;
  cursor: pointer;
}
.topnav-notif-item:last-child { border-bottom: 0; }
.topnav-notif-item:hover { background: var(--surface-soft); }
.topnav-notif-item.unread { background: var(--accent-soft); }
.topnav-notif-item.unread:hover { background: #FFD9CB; }
.topnav-notif-item.unread::before {
  content: '';
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.topnav-notif-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.topnav-notif-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  color: var(--ink-dim);
}
.topnav-notif-icon svg { width: 14px; height: 14px; }
.topnav-notif-item.unread .topnav-notif-icon {
  background: var(--accent);
  color: #fff;
}

.topnav-notif-content { flex: 1; min-width: 0; }
.topnav-notif-item-title {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topnav-notif-item-text {
  font-size: 12.5px;
  color: var(--ink-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.topnav-notif-item-time {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 4px;
  text-transform: lowercase;
}

.topnav-notif-foot {
  display: block;
  text-align: center;
  padding: 12px 18px;
  border-top: 1px solid var(--hair);
  font-size: 13px;
  color: var(--ink-dim);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s ease;
}
.topnav-notif-foot:hover { color: var(--accent); }

@media (max-width: 480px) {
  .topnav-notif-dropdown {
    right: -54px;
    width: calc(100vw - 24px);
  }
}
.topnav-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: opacity .15s ease;
}
.topnav-profile:hover { opacity: .9; }
.topnav-profile svg { width: 14px; height: 14px; }

.topnav-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #FF8C5A);
  color: #fff;
  text-decoration: none;
  font-family: 'Geist', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 4px 12px -4px rgba(255,91,46,.4);
}
.topnav-ai-btn:hover {
  opacity: .9;
  color: #fff;
  transform: translateY(-1px);
}
.topnav-ai-btn svg { width: 14px; height: 14px; }
@media (max-width: 600px) {
  .topnav-ai-btn span { display: none; }
  .topnav-ai-btn { padding: 7px 9px; }
}

.topnav-auth-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
  white-space: nowrap;
}
.topnav-auth-ghost {
  color: var(--ink-dim);
  border: 1px solid transparent;
}
.topnav-auth-ghost:hover {
  color: var(--ink);
  background: var(--surface-soft);
}
.topnav-auth-primary {
  background: var(--accent);
  color: #fff;
}
.topnav-auth-primary:hover { opacity: .9; color: #fff; }
@media (max-width: 480px) {
  .topnav-auth-ghost { display: none; }
  .topnav-auth-btn { padding: 7px 12px; font-size: 12.5px; }
}

.topnav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24,24,27,.5);
  z-index: 99;
}
.topnav-overlay.active { display: block; }

@media (max-width: 1100px) {
  .topnav-link span { display: none; }
  .topnav-link { padding: 8px 10px; }
  .topnav-link svg { width: 18px; height: 18px; }
  .topnav-link-with-submenu .topnav-chevron { display: none; }
}
@media (max-width: 760px) {
  .topnav { padding: 0 14px; gap: 10px; }
  .topnav-burger { display: inline-flex; }
  .topnav-links {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 86%; max-width: 360px;
    height: 100vh;
    height: 100dvh;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 18px 16px 24px;
    box-shadow: -10px 0 30px rgba(0,0,0,.25);
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.2,.7,.2,1);
    overflow-y: auto;
    overflow-x: hidden;
    flex: none;
    justify-content: flex-start;
    z-index: 101;
    box-sizing: border-box;
  }
  .topnav-links.open { transform: translateX(0); }
  .topnav-links .topnav-link {
    padding: 12px 14px;
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
  }
  .topnav-links .topnav-link span { display: inline; }
  .topnav-link.active::after { display: none; }

  .topnav-link-with-submenu { width: 100%; }
  .topnav-link-with-submenu .topnav-chevron { display: inline-block; margin-left: auto; }
  .topnav-submenu {
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 4px 0 4px 28px !important;
    min-width: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
  }
  .topnav-submenu::before { display: none !important; }
  .topnav-link-with-submenu.open .topnav-submenu { display: block !important; }
  .topnav-link-with-submenu.open .topnav-chevron { transform: rotate(180deg); }
  /* Гасим hover-стейт на мобиле — открываем только по клику */
  .topnav-link-with-submenu:hover .topnav-submenu,
  .topnav-link-with-submenu:focus-within .topnav-submenu {
    transform: none !important;
    display: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .topnav-link-with-submenu.open:hover .topnav-submenu,
  .topnav-link-with-submenu.open .topnav-submenu {
    display: block !important;
  }
  .topnav-submenu-item {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 9px 12px !important;
    border-radius: 8px !important;
  }

  .topnav-actions .topnav-profile span { display: none; }
  .topnav-actions { gap: 2px; }

  /* На мобиле когда меню открыто — шапка должна быть ПОД меню */
  body.topnav-open { overflow: hidden; }
}
