:root {
  --navy: #0b1d3a;
  --navy-light: #14305c;
  --red: #c62828;
  --gold: #e8c36a;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e3e7ed;
  --bg: #f4f6f9;
  --white: #fff;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(4, 16, 38, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}

.button:hover {
  filter: brightness(1.08);
}

.button--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.button--danger {
  background: transparent;
  border-color: #f0c7c7;
  color: var(--red);
}

.button--small {
  padding: 7px 11px;
  font-size: 13px;
  border-radius: 8px;
}

/* Публичная открытка */

.greeting-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 15% 12%, rgba(200, 40, 40, 0.55), transparent 42%),
    radial-gradient(circle at 85% 82%, rgba(232, 195, 106, 0.35), transparent 45%),
    linear-gradient(160deg, var(--navy-light), var(--navy) 70%);
}

.card {
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #fffdf8;
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 195, 106, 0.6);
  animation: rise 0.4s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.card__image-wrap {
  background: var(--navy);
}

.card__image {
  display: block;
  width: 100%;
  max-height: 52dvh;
  object-fit: contain;
}

.card__body {
  padding: clamp(20px, 5vw, 34px);
  text-align: center;
}

.card__title {
  margin: 0 0 12px;
  color: var(--red);
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.15;
}

.card__message {
  margin: 0 0 22px;
  font-size: clamp(16px, 4.2vw, 19px);
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.card__body--empty {
  padding: 56px 24px;
}

.card__snow {
  font-size: 46px;
  color: var(--gold);
}

/* Админка */

.service-page {
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 32px);
  background: var(--navy);
  color: #fff;
}

.topbar__brand {
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
}

.topbar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.topbar__nav a {
  color: #dbe4f2;
  text-decoration: none;
  font-size: 14px;
}

.topbar__nav a:hover {
  color: #fff;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 32px) clamp(14px, 4vw, 32px) 64px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(22px, 5vw, 30px);
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.panel {
  margin-bottom: 20px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.panel--flush {
  padding: 0;
  overflow: hidden;
}

.panel--narrow {
  max-width: 680px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

code {
  background: #eef1f5;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 0.92em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.stat__value {
  display: block;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 700;
  color: var(--navy);
}

.stat__label {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.inline-form input[type="text"] {
  flex: 1 1 260px;
}

input[type="text"],
textarea,
select,
input[type="file"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd6e0;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(11, 29, 58, 0.25);
  outline-offset: 1px;
}

input[type="file"] {
  padding: 9px;
  font-size: 13px;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field__label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  font-size: 14px;
}

.field__note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.current-image {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.current-image img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.flashes {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
}

.flash--success {
  background: #e7f6ec;
  color: #1b6e37;
  border: 1px solid #c4e7d0;
}

.flash--error {
  background: #fdecec;
  color: #a32424;
  border: 1px solid #f3caca;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.table th {
  background: #f7f9fc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: none;
}

.table__message {
  max-width: 320px;
  color: #3d4553;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.table__num {
  text-align: center;
  white-space: nowrap;
}

.table__actions {
  text-align: right;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.preview-trigger {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.preview-trigger:hover .thumb {
  border-color: var(--gold);
}

.preview-trigger--tile {
  width: 100%;
}

.preview-trigger--tile img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--navy);
}

.preview {
  position: relative;
  width: min(92vw, 520px);
  max-height: 90dvh;
  overflow: auto;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.preview::backdrop {
  background: rgba(4, 16, 38, 0.72);
  backdrop-filter: blur(3px);
}

.preview__image {
  display: block;
  width: 100%;
  max-height: 58dvh;
  object-fit: contain;
  background: var(--navy);
}

.preview__body {
  padding: 20px;
  text-align: center;
}

.preview__title {
  margin: 0 0 10px;
  color: var(--red);
  font-size: clamp(20px, 5vw, 26px);
}

.preview__message {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.preview__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(11, 29, 58, 0.75);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.image-tile {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.image-tile__info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
}

.image-tile__name {
  font-size: 12px;
  overflow-wrap: anywhere;
  flex: 1 1 100px;
}

.badge {
  padding: 5px 8px;
  border-radius: 20px;
  background: #eef3fa;
  color: var(--navy);
  font-size: 11px;
}

.notice {
  max-width: 420px;
  margin: 14dvh auto;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.notice h1 {
  margin: 0 0 8px;
  font-size: 48px;
  color: var(--red);
}

@media (max-width: 600px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat {
    padding: 12px 6px;
  }

  .stat__label {
    font-size: 11px;
  }

  .topbar {
    gap: 8px;
  }

  .topbar__nav {
    gap: 14px;
    width: 100%;
  }

  .table th,
  .table td {
    padding: 10px;
  }
}
