/* «Волонтёрский движ»: светлая тема, один акцент (небесно-голубой), цвета фондов только на их кнопках. */
:root {
  --bg: #F4F8FC;
  --surface: #FFFFFF;
  --surface-2: #EEF4FB;
  --ink: #1C2633;
  --muted: #5B6878;
  --line: #E1E9F2;
  --accent: #0A84FF;
  --accent-ink: #0563C1;
  --accent-soft: #E3F0FF;
  --vera: #0071E3;
  --vera-accent: #FF5A00;
  --angel: #E0225C;
  --angel-soft: #FFE6EE;
  --mint: #1F9D5C;
  --mint-soft: #E2F6EB;
  --warn: #B45309;
  --warn-soft: #FFF3D6;
  --danger: #C2410C;
  --danger-soft: #FFE9DF;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28, 54, 92, .06), 0 10px 28px rgba(28, 54, 92, .08);
  --shadow-lift: 0 2px 4px rgba(28, 54, 92, .07), 0 18px 40px rgba(28, 54, 92, .14);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: 'Onest', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 10px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; white-space: nowrap; cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, border-color .18s;
}
.btn img { width: 26px; height: 26px; object-fit: contain; margin-left: -6px; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-primary { background: linear-gradient(180deg, #2B95FF, var(--accent)); color: #fff; box-shadow: 0 6px 16px rgba(10, 132, 255, .28), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-primary:hover { box-shadow: 0 10px 22px rgba(10, 132, 255, .34), inset 0 1px 0 rgba(255,255,255,.35); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #C9D7E6; background: #FBFDFF; }
.btn-xl { min-height: 54px; font-size: 17px; padding: 0 26px; }
.btn-xl img { width: 34px; height: 34px; }
.btn-block { width: 100%; }
.btn-mint { background: var(--mint-soft); color: #11663C; border-color: #BFE8D1; }
.btn-warn { background: var(--warn-soft); color: #8A4A0A; border-color: #F6DE9F; }
.btn-danger { background: var(--danger-soft); color: #9A3412; border-color: #FBCDB8; }
.btn-vera { background: var(--vera); color: #fff; box-shadow: 0 6px 16px rgba(0, 113, 227, .28); }
.btn-angel { background: var(--angel); color: #fff; box-shadow: 0 6px 16px rgba(224, 34, 92, .26); }
.btn-vera:hover, .btn-angel:hover { transform: translateY(-1px); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn img { width: 22px; height: 22px; opacity: .75; }

/* ---------- Формы ---------- */
label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
input:not([type=checkbox]):not([type=range]), textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #8391A2; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 8px 0; }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; margin: 14px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------- Вход ---------- */
.login {
  min-height: 100dvh; display: grid; grid-template-columns: 1.1fr minmax(360px, 440px); gap: 56px;
  align-items: center; padding: 48px clamp(24px, 7vw, 120px);
  background: url(img/bg-login.jpg) center / cover no-repeat, var(--bg);
}
.login-copy { max-width: 560px; display: grid; justify-items: start; }
.login-hero { width: auto; height: min(66dvh, 660px); max-width: 100%; object-fit: contain; margin: -12px 0 8px -18px;
  filter: drop-shadow(0 24px 40px rgba(28,54,92,.16)); animation: float-in .9s var(--ease) both; }
@keyframes float-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.login-copy h1 { font-size: clamp(36px, 4.4vw, 54px); letter-spacing: -.025em; }
.login-copy p { font-size: 18px; color: #3E4B5C; margin-top: 14px; max-width: 40ch; }
.login-funds { display: flex; align-items: center; gap: 28px; margin-top: 34px; }
.login-card {
  background: rgba(255,255,255,.86); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255,255,255,.9); border-radius: 26px; padding: 32px; box-shadow: var(--shadow-lift);
}
.login-card h2 { font-size: 26px; margin-bottom: 6px; }
.login-card .btn { width: 100%; margin-top: 6px; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; gap: 22px;
  padding: 0 24px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 18px; white-space: nowrap; }
.tabs { display: flex; gap: 6px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 8px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab img { width: 28px; height: 28px; object-fit: contain; }
.tab:hover { background: rgba(255,255,255,.75); color: var(--ink); }
.tab.is-on { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.tab b { min-width: 24px; padding: 0 7px; height: 22px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; line-height: 22px; text-align: center; }
.tab b:empty { display: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-actions .btn { min-height: 40px; padding: 0 14px; font-size: 14px; background: rgba(255,255,255,.9); }
.top-actions .btn img { width: 24px; height: 24px; }
.me { font-weight: 600; color: var(--muted); padding-left: 6px; white-space: nowrap; }

/* ---------- Лента ---------- */
.layout { display: grid; grid-template-columns: 290px 1fr; gap: 28px; padding: 24px; max-width: 1600px; margin: 0 auto; }
.filters {
  position: sticky; top: 96px; align-self: start; max-height: calc(100dvh - 120px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.filters fieldset { border: 0; padding: 0; margin: 18px 0 0; }
.filters legend { font-weight: 700; font-size: 15px; margin-bottom: 8px; padding: 0; }
.filters legend output { color: var(--accent-ink); }
.filters .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters .row2 label { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.filters .hint { font-size: 13px; margin-top: 6px; }
.search { position: relative; }
.search img { position: absolute; left: 14px; top: 13px; width: 20px; opacity: .55; }
.search input { padding-left: 42px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip.is-on { background: var(--accent-soft); border-color: #B8D8FF; color: var(--accent-ink); }
.funds-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 12px; justify-items: start; }
.funds-foot p { font-size: 13px; color: var(--muted); font-weight: 600; }

.feed-head {
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 20px; padding: 30px 28px; min-height: 120px; align-content: center; flex-wrap: wrap;
  border-radius: 22px; border: 1px solid var(--line); background: url(img/bg-header.jpg) right center / cover no-repeat, #F3F8FF;
}
.feed-head h1 { font-size: 30px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card-top { display: flex; gap: 14px; padding: 16px 16px 0; }
.avatar { width: 72px; height: 72px; flex: none; border-radius: 16px; object-fit: cover; background: var(--surface-2); }
.avatar.ph { display: grid; place-items: center; }
.avatar.ph img { width: 44px; height: 44px; }
.card h3 { font-size: 18px; line-height: 1.25; }
.card .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: #42536A; }
.badge.cat { background: var(--accent-soft); color: var(--accent-ink); }
.badge.urgent { background: #FFE8E2; color: #B42318; }
.badge.fund { background: var(--warn-soft); color: #8A4A0A; }
.badge.vera { background: #E3F0FF; color: var(--vera); }
.badge.angel { background: var(--angel-soft); color: #B0124A; }
.badge.status { background: var(--mint-soft); color: #11663C; }
.card .need { padding: 12px 16px 0; color: #3E4B5C; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 16px; }
.goal { font-weight: 800; font-size: 17px; }
.goal small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); }
.card-foot .btn { min-height: 46px; }

.skeleton { height: 230px; border-radius: var(--radius); background: linear-gradient(100deg, #EAF1F8 30%, #F6FAFD 50%, #EAF1F8 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 20px 60px; }
.empty img { width: 260px; height: 260px; object-fit: contain; }
.empty p { color: var(--muted); max-width: 46ch; }

/* ---------- Карточка семьи (боковая панель) ---------- */
.drawer-wrap, .modal-wrap { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(28, 38, 51, .28); animation: fade .2s ease; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg);
  box-shadow: -20px 0 50px rgba(28,54,92,.18); overflow: auto; padding: 24px 26px 40px;
  animation: slide .32s var(--ease);
}
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-close { position: absolute; top: 14px; right: 14px; }
.d-head { display: flex; gap: 16px; align-items: center; padding-right: 40px; }
.d-head .avatar { width: 96px; height: 96px; border-radius: 22px; }
.d-head h2 { font-size: 24px; }
.d-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 14px; }
.d-sec h3 { margin-bottom: 8px; }
.d-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.d-facts div span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.d-facts div b { font-size: 16px; }
.d-text { white-space: pre-line; color: #3E4B5C; font-size: 15px; max-height: 240px; overflow: auto; }
.contact { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.contact + .contact { border-top: 1px solid var(--line); }
.contact a { color: var(--accent-ink); font-weight: 700; text-decoration: none; word-break: break-all; }
.contact small { display: block; color: var(--muted); font-size: 13px; }
.script { background: var(--accent-soft); border: 1px solid #C7E0FF; }
.script p { font-size: 15px; color: #1D3A5C; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1 1 200px; }
.actions .btn-fund { min-height: 58px; font-size: 16px; }
.actions .btn-fund img { width: 30px; height: 30px; }
.quiet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quiet-actions .btn { min-height: 40px; font-size: 14px; }
.note-form { display: flex; gap: 8px; margin-top: 8px; }
.note-form input { flex: 1; }
.events { list-style: none; padding: 0; margin: 0; }
.events li { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 8px 0; font-size: 14px; }
.events li + li { border-top: 1px dashed var(--line); }
.events time { color: var(--muted); }

/* ---------- Модальное окно ---------- */
.modal { position: relative; width: min(520px, calc(100% - 32px)); margin: 12vh auto 0; background: var(--surface); border-radius: 24px; padding: 28px; box-shadow: var(--shadow-lift); animation: slide .3s var(--ease); }
.modal p.hint { margin-top: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ---------- Страницы: статистика, настройки ---------- */
.page { padding: 28px 24px 60px; max-width: 1200px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg-btn { height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg-btn.is-on { background: var(--accent); color: #fff; }
.tiles { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-auto-rows: minmax(130px, auto); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between; }
.tile .num { font-size: 44px; font-weight: 800; letter-spacing: -.02em; }
.tile .lbl { color: var(--muted); font-weight: 600; }
.tile img.ic { width: 52px; height: 52px; object-fit: contain; }
.tile.big { grid-row: span 2; background: linear-gradient(160deg, #FFFFFF 30%, #E6F2FF); }
.tile.big .num { font-size: 72px; }
.tile.funds { background: linear-gradient(135deg, #F2F8FF 0%, #fff 50%, #FFF0F5 100%); }
.fund-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.fund-row .logo { height: 30px; width: auto; max-width: 100%; object-fit: contain; object-position: left; }
.fund-row .num { font-size: 40px; }
#stat-users { margin-top: 24px; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
table.list th, table.list td { text-align: left; padding: 12px 16px; }
table.list th { font-size: 13px; color: var(--muted); background: var(--surface-2); }
table.list tr + tr td { border-top: 1px solid var(--line); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h3 { margin-top: 18px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.user-row + .user-row { border-top: 1px solid var(--line); }
.user-row .who { flex: 1; }
.user-row .who small { display: block; color: var(--muted); }
.user-row .btn { min-height: 36px; font-size: 13px; padding: 0 12px; }
.inline-form { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.inline-form .btn { margin-top: 6px; }
.kv { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: #1C2633; color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lift);
  animation: rise .3s var(--ease); max-width: min(520px, calc(100% - 32px));
}
.toast.err { background: #9A3412; }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }

.admin-only { }
body:not(.is-admin) .admin-only { display: none !important; }

/* ---------- Узкие окна ---------- */
@media (max-width: 1180px) {
  .top-actions .btn span, .brand span { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile.big { grid-column: span 2; grid-row: auto; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; gap: 28px; padding: 32px 16px; }
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .filters { position: static; max-height: none; }
  .topbar { overflow-x: auto; padding: 0 12px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
table.list td:first-child { white-space: nowrap; }
