:root {
  --accent: #16a34a;
  --accent-dark: #15803d;
  --accent-tint: #ecfdf3;
  --ink: #0f172a;
  --hint: #64748b;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --radius: 14px;
}
* { box-sizing: border-box; }
body, html { margin: 0; padding: 0; }
body.page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.sr-only { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; fill: currentColor; flex: none; }
a { color: inherit; }

/* -------------------------------------------------- экраны входа */
.loading {
  height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--hint); font-size: 14px;
}
.loading-mark { font-size: 40px; }
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, var(--accent-tint), #fff 60%);
}
.auth-card { max-width: 380px; width: 100%; background: #fff; border-radius: 20px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(15,23,42,.08); }
.auth-over { font-size: 13px; color: var(--accent-dark); font-weight: 600; margin: 0 0 4px; }
.auth-title { font-size: 24px; font-weight: 700; margin: 0 0 12px; }
.auth-text { font-size: 14px; color: var(--hint); margin: 0 0 20px; line-height: 1.5; }
.auth-text-tight { margin-bottom: 12px; }
.auth-text-last { margin-bottom: 0; }
.auth-hint { font-size: 12px; color: var(--hint); margin: 12px 0 0; text-align: center; }
.auth-error { color: #dc2626; font-size: 13px; margin: 12px 0 0; min-height: 1em; }
.auth-dev { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
.auth-dev summary { font-size: 12px; color: var(--hint); cursor: pointer; }
.login-code { font-size: 32px; font-weight: 700; letter-spacing: .3em; text-align: center; background: var(--accent-tint); border-radius: 12px; padding: 14px 0; margin-bottom: 14px; color: var(--accent-dark); }

/* -------------------------------------------------- кнопки/поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: filter .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-soft { background: #f1f5f9; color: var(--ink); }
.btn-soft:hover { background: #e2e8f0; }
.btn-quiet { background: transparent; color: var(--hint); }
.btn-quiet:hover { color: var(--ink); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 10px; }
.btn-add { padding: 10px 14px; }
.w-full { width: 100%; }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.input-sm { padding: 6px 10px; font-size: 13px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hint); }

/* -------------------------------------------------- топбар */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-grid { display: flex; align-items: center; gap: 16px; padding: 12px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark { font-size: 26px; }
.brand-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--hint); }
.topbar-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.search { position: relative; flex: 1; display: flex; align-items: center; }
.search .ico { position: absolute; left: 10px; color: var(--hint); }
.search .input { padding-left: 34px; }
.search-sm .input { padding: 6px 10px 6px 30px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-left: 4px; }

/* -------------------------------------------------- раскладка/фильтры */
.layout { display: flex; gap: 24px; padding: 20px 16px 60px; align-items: flex-start; }
.drawer { width: 240px; flex: none; position: sticky; top: 76px; }
.filter-group { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.filter-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); margin: 0 0 10px; font-weight: 600; }
.filter-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.filter-list button, .chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; cursor: pointer; text-align: left; color: var(--ink); transition: all .12s;
}
.filter-list button { border: none; border-radius: 8px; padding: 6px 8px; }
.filter-list button:hover, .chip:hover { background: var(--accent-tint); }
.filter-list button.active, .chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .gap-2 { gap: 8px; }
.min-w-0 { min-width: 0; } .flex-1 { flex: 1; }

/* -------------------------------------------------- переключатели статуса/раздела */
.switch { display: inline-flex; background: #f1f5f9; border-radius: 999px; padding: 3px; gap: 2px; }
.switch button { border: none; background: transparent; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--hint); cursor: pointer; }
.switch button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.switch-sm button { padding: 5px 11px; font-size: 12px; }

/* -------------------------------------------------- полоса дней рождения */
.bday-strip {
  width: 100%; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; cursor: pointer; text-align: left;
}
.bday-strip:hover { border-color: var(--accent); }
.bday-strip-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-tint); display: flex; align-items: center; justify-content: center; color: var(--accent-dark); flex: none; }
.bday-strip-text { flex: 1; min-width: 0; }
.bday-strip-title { font-weight: 600; font-size: 13.5px; display: block; }
.bday-strip-next { font-size: 12.5px; color: var(--hint); }
.bday-strip-arrow { color: var(--hint); }

/* -------------------------------------------------- сетка карточек */
.page-head { margin-bottom: 12px; }
.page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.result-count { font-size: 13px; color: var(--hint); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  cursor: pointer; transition: all .12s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.card-name { font-weight: 600; font-size: 14.5px; }
.card-sub { font-size: 12.5px; color: var(--hint); margin-bottom: 8px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; background: #f1f5f9; border-radius: 6px; padding: 2px 7px; color: var(--hint); }
.status-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.status-active { background: #dcfce7; color: #166534; }
.status-new { background: #dbeafe; color: #1e40af; }
.status-inactive { background: #f1f5f9; color: #64748b; }
.status-potential { background: #fef9c3; color: #854d0e; }
.status-left { background: #fee2e2; color: #991b1b; }
.empty-state { text-align: center; color: var(--hint); font-size: 14px; padding: 60px 0; }
.empty-state b { display: block; color: var(--ink); margin-bottom: 4px; }

/* -------------------------------------------------- type-бейджи (волонтёр/партнёр/спонсор) */
.type-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.type-volunteer { background: #dcfce7; color: #166534; }
.type-partner { background: #dbeafe; color: #1e40af; }
.type-sponsor { background: #fef3c7; color: #92400e; }
.type-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.type-volunteer .type-dot, .dot-volunteer { background: #16a34a; }
.type-partner .type-dot, .dot-partner { background: #2563eb; }
.type-sponsor .type-dot, .dot-sponsor { background: #d97706; }

/* -------------------------------------------------- меню/бэкдроп/шторка */
.backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 30; }
.menu {
  position: fixed; top: 66px; right: 16px; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.15);
  z-index: 40; min-width: 220px; padding: 8px; border: 1px solid var(--line);
}
.menu-me { padding: 10px 12px; font-size: 13px; color: var(--hint); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; text-align: left;
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; color: var(--ink);
}
.menu-item:hover { background: #f1f5f9; }

.sheet {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
}
.sheet::before { content:""; position: absolute; inset: 0; background: rgba(15,23,42,.5); }
#sheet-body {
  position: relative; background: #fff; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 20px; margin: 0 auto;
}
@media (min-width: 640px) {
  .sheet { align-items: center; }
  #sheet-body { border-radius: 20px; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.sheet-title { font-size: 18px; font-weight: 700; margin: 0; }
.sheet-end { height: 4px; }
.eyebrow { font-size: 12px; color: var(--accent-dark); font-weight: 600; }
.panel { background: var(--bg); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.panel-text { font-size: 12.5px; color: var(--hint); margin: 4px 0 10px; }
.section { margin-bottom: 18px; }
.section-title { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.summary-toggle { cursor: pointer; }
.note { font-size: 12px; color: var(--hint); background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.form-field { margin-bottom: 12px; }
.form-label { font-size: 12px; color: var(--hint); display: block; margin-bottom: 4px; }
.grid { display: grid; } .gap-3 { gap: 12px; } .grid-cols-2 { grid-template-columns: 1fr 1fr; }
.mt-1 {margin-top:4px;} .mt-2{margin-top:8px;} .mt-3{margin-top:12px;} .mt-4{margin-top:16px;} .mb-4{margin-bottom:16px;}

/* -------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast.error { background: #dc2626; }

/* -------------------------------------------------- строки списков (сотрудники/приглашения) */
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: none; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-meta { font-size: 12px; color: var(--hint); }
.opacity-60 { opacity: .55; }
.history-row { font-size: 12px; color: var(--hint); padding: 4px 0; border-bottom: 1px solid var(--line); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------- дни рождения: календарь */
.bday-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bday-row:last-child { border-bottom: none; }
.bday-date { display: flex; flex-direction: column; align-items: center; width: 40px; flex: none; font-size: 11px; color: var(--hint); text-transform: uppercase; }
.bday-date b { font-size: 18px; color: var(--ink); font-weight: 700; }
.bday-name { font-size: 13.5px; font-weight: 600; }
.bday-meta { font-size: 12px; color: var(--hint); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 600; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 14px; }
.cal-wd { font-size: 11px; color: var(--hint); text-align: center; padding: 4px 0; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 12.5px; border-radius: 8px; }
.cal-empty {}
.cal-day.has-bday { background: var(--accent-tint); color: var(--accent-dark); font-weight: 700; cursor: default; }
.cal-day.is-today { outline: 2px solid var(--accent); }
.text-hint { color: var(--hint); } .text-sm { font-size: 13px; }

/* -------------------------------------------------- выбор даты (day/month/year picker) */
.date-wrap { position: relative; }
.date-row { display: flex; gap: 8px; align-items: center; }
.date-field { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.date-empty { color: var(--hint); }
.date-pop { position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); width: 280px; }
.date-selects { display: flex; gap: 6px; margin-bottom: 10px; }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.date-day { border: none; background: none; padding: 6px 0; border-radius: 6px; font-size: 12.5px; cursor: pointer; }
.date-day:hover { background: var(--accent-tint); }
.date-day.is-picked { background: var(--accent); color: #fff; }
.date-hint { font-size: 11px; color: var(--hint); margin: 8px 0 0; }

@media (min-width: 768px) {
  .md-hidden { display: none !important; }
  .drawer { display: block !important; }
}
@media (max-width: 767px) {
  .drawer {
    position: fixed; inset: 0; z-index: 45; background: #fff; padding: 16px; overflow-y: auto;
    transform: translateX(-100%); transition: transform .2s;
  }
  .drawer.open { transform: translateX(0); }
  .sm-inline { display: none; }
}
@media (min-width: 640px) {
  .sm-inline { display: inline; }
}

/* -------------------------------------------------- доп. отметки (Бадди / Помогает финансово / Нет анкеты) */
.sp-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.sp-buddy { background: #ede9fe; color: #5b21b6; }
.sp-money { background: #fef3c7; color: #92400e; }
.sp-noprofile { background: #fff; color: #64748b; border: 1px dashed #94a3b8; }
.tag-chat { background: #e0f2fe; color: #075985; }

/* -------------------------------------------------- ссылки на карточки, чекбокс-«чипы» */
.link-card { color: var(--accent-dark); font-weight: 600; text-decoration: none; border-bottom: 1px dashed var(--accent); }
.link-card:hover { color: var(--ink); }
.check-chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; background: #fff; }
.check-chip:has(input:checked) { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-dark); }

/* -------------------------------------------------- вкладка «Бадди» */
.buddy-list { display: flex; flex-direction: column; gap: 10px; }
.buddy-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
}
.buddy-people { flex: 1; min-width: 220px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.buddy-field { width: 150px; }

/* -------------------------------------------------- клик по человеку в календаре ДР */
.bday-click { cursor: pointer; border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.bday-click:hover, .bday-click:focus { background: var(--accent-tint); outline: none; }
.bday-open { color: var(--hint); margin-left: auto; }
