/* Минимальный медицинский стиль — белое + красный акцент */
:root {
  --red: #c82333;
  --red-dark: #962432;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  font: inherit; cursor: pointer; padding: 8px 14px;
  background: var(--red); color: #fff; border: 0; border-radius: 6px;
}
button:hover { background: var(--red-dark); }
button[type="button"] { background: #6b7280; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -2px; }
input[type="radio"],
input[type="checkbox"] {
  width: auto;
  min-width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  accent-color: var(--red);
}
input[type="radio"]:focus,
input[type="checkbox"]:focus {
  outline-offset: 3px;
}

.topbar {
  background: #fff; border-bottom: 1px solid var(--border); padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .logo { font-size: 32px; }
.topbar h1 { margin: 0; font-size: 18px; color: var(--red); }
.topbar small { color: var(--muted); }
.site-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.nav-links,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.nav-actions { justify-content: flex-end; margin-left: auto; }
.account-link { font-weight: 600; }
.who {
  color: var(--muted);
  font-size: 14px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-toggle { display: none; }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.tab { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.tab h2 { margin-top: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 14px; }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge-blood { background: #fee2e2; color: var(--red); font-weight: 600; }
.badge-rank { background: #fef3c7; color: var(--warn); }
.badge-status-open { background: #dcfce7; color: var(--ok); }
.badge-status-closed { background: #e5e7eb; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }

.form { display: flex; flex-direction: column; gap: 10px; min-width: 320px; }
.form .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form textarea { min-height: 80px; resize: vertical; }
.err { color: var(--err); font-size: 14px; min-height: 1em; margin: 0; }

.role-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.role-option {
  position: relative;
  min-width: 0;
}
.role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.role-option input:focus {
  outline: 0;
}
.role-option span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: center;
}
.role-option input:checked + span {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 600;
}
.role-option input:focus-visible + span {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.password-field {
  position: relative;
  display: flex;
  width: 100%;
}
.password-field input { width: 100%; padding-right: 52px; }
.password-toggle[type="button"] {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: var(--red);
  line-height: 1;
}
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-toggle[type="button"]:hover,
.password-toggle[type="button"]:focus-visible {
  background: #fff5f5;
  border-color: var(--red);
  color: var(--red);
}
.password-toggle[type="button"][aria-pressed="true"] {
  background: #fff5f5;
  border-color: var(--red);
  color: var(--red);
}

.ann-create-summary {
  width: fit-content;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  list-style-position: inside;
}
.ann-create-summary:hover {
  border-color: var(--red);
  background: #fff5f5;
  color: var(--red);
}
.ann-create-summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,0.4); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table th { background: #fafbfc; font-weight: 600; }
table .actions button { padding: 4px 10px; font-size: 13px; margin-right: 4px; }

.site-footer {
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 0 16px 24px;
}
.footer-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.footer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.footer-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--red);
}
.footer-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.partner-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.partner-logo {
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(90, 169, 176, 0.18);
}
.memo-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}
.memo-list li {
  padding-left: 4px;
}
.memo-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}
.footer-form textarea {
  min-height: 120px;
}
.footer-contact {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.admin-body { background: #f0f2f5; }
.admin-body .topbar h1 { color: #1f2328; }
.admin-body table { background: #fff; border-radius: 10px; overflow: hidden; }
.admin-banners-table {
  table-layout: fixed;
}
.admin-banners-table th:nth-child(1),
.admin-banners-table td:nth-child(1) {
  width: 56px;
}
.admin-banners-table th:nth-child(2),
.admin-banners-table td:nth-child(2) {
  width: 220px;
}
.admin-banners-table th:nth-child(3),
.admin-banners-table td:nth-child(3) {
  width: 96px;
}
.admin-banners-table th:nth-child(5),
.admin-banners-table td:nth-child(5) {
  width: 88px;
}
.admin-banners-table th:nth-child(6),
.admin-banners-table td:nth-child(6) {
  width: 88px;
}
.admin-banners-table th:nth-child(7),
.admin-banners-table td:nth-child(7) {
  width: 148px;
}
.banner-id-cell,
.banner-position-cell,
.banner-active-cell,
.banner-impressions-cell {
  white-space: nowrap;
}
.banner-url-cell {
  min-width: 0;
}
.admin-banner-url {
  display: -webkit-box;
  overflow: hidden;
  color: var(--red);
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.admin-banner-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  max-width: 100%;
  height: 64px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.admin-banner-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.admin-tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}
.admin-tool-panel {
  min-width: 0;
}
.admin-tool-panel h3 {
  margin-top: 0;
}
.admin-tool-panel input:not([type="radio"]):not([type="checkbox"]),
.admin-tool-panel select,
.admin-tool-panel textarea {
  width: 100%;
}
.admin-search-results {
  margin-top: 10px;
}
.admin-search-result {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.admin-search-result:hover,
.admin-search-result:focus-visible {
  border-color: var(--red);
  background: #fff5f5;
}

.contact-locked { color: var(--muted); font-style: italic; font-size: 13px; }

.banners { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.banner { display: block; flex: 1 1 280px; max-width: 100%; border-radius: 8px; overflow: hidden; }
.banner img { width: 100%; height: auto; display: block; }

.lang { padding: 6px; border-radius: 6px; border: 1px solid var(--border); background: #fff; }

/* Hero — большой счётчик «вы спасли N жизней» */
.hero-saved {
  background: linear-gradient(135deg, #c82333 0%, #8b1d2a 100%);
  color: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin: 16px 0;
  box-shadow: 0 8px 24px rgba(200,35,51,0.25);
}
.hero-saved-num {
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
.hero-saved-label { font-size: 18px; opacity: 0.95; }
.hero-saved-unread {
  margin-top: 12px;
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}

/* Лента благодарностей */
.thanks-feed h3 { color: var(--red); }
.thanks-item {
  border-left: 3px solid var(--border);
  padding: 12px 14px;
  margin: 10px 0;
  background: #fafbfc;
  border-radius: 6px;
  position: relative;
}
.thanks-item.unread {
  border-left-color: var(--red);
  background: #fff5f5;
}
.thanks-item.unread::before {
  content: "•";
  position: absolute;
  top: 14px;
  right: 12px;
  color: var(--red);
  font-size: 24px;
  line-height: 0;
}
.thanks-meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.thanks-msg { font-size: 15px; line-height: 1.5; color: #1f2328; }
.thanks-seen {
  margin-top: 8px;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 4px 10px;
  font-size: 13px;
}

/* Бейдж «спас N жизней» */
.badge-saved {
  background: #fee2e2;
  color: var(--red);
  font-weight: 700;
  border: 1px solid var(--red);
}

@media (max-width: 760px) {
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar .brand { flex: 1 1 calc(100% - 54px); }
  .topbar .logo { font-size: 26px; }
  .topbar h1 {
    font-size: 16px;
    line-height: 1.2;
  }
  .topbar small { display: none; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--red);
    font-size: 24px;
    line-height: 1;
  }
  .menu-toggle:hover { background: #fff5f5; }
  .site-nav {
    display: none;
    order: 3;
    width: 100%;
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .topbar.nav-open .site-nav { display: flex; }
  .nav-links,
  .nav-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }
  .nav-actions {
    margin-left: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .nav-links a,
  .nav-actions a {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
  }
  .nav-links a:hover,
  .nav-actions a:hover {
    background: #fff5f5;
    text-decoration: none;
  }
  .who {
    max-width: none;
    padding: 6px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .lang { width: 100%; }
  main {
    margin: 16px auto;
    padding: 0 12px;
  }
  .tab {
    padding: 16px;
    border-radius: 8px;
  }
  .filters,
  .form .row {
    align-items: stretch;
    flex-direction: column;
  }
  .filters > *,
  .form .row > *,
  .form button,
  .form input,
  .form select,
  .form textarea {
    width: 100%;
  }
  .form input[type="radio"],
  .form input[type="checkbox"] {
    width: auto;
  }
  .admin-tool-grid {
    grid-template-columns: 1fr;
  }
  .form { min-width: 0; }
  dialog {
    width: calc(100% - 24px);
    max-width: 420px;
    padding: 16px;
  }
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .admin-banners-table {
    table-layout: auto;
    min-width: 860px;
  }
  .admin-banner-preview {
    width: 150px;
    height: 56px;
  }
  .site-footer {
    padding: 0 12px 16px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .partner-badge {
    align-items: flex-start;
  }
  .partner-logo {
    width: 74px;
    height: 74px;
  }
}
