:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #12202f;
  --muted: #5e7187;
  --line: #d8e2ee;
  --brand: #0f6f5c;
  --brand-dark: #0a4f43;
  --accent: #d97706;
  --danger: #b42318;
  --focus: #1d4ed8;
  --shadow: 0 12px 30px rgba(18, 32, 47, 0.12);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.shell { width: min(1120px, 100%); margin: 0 auto; padding: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 8px; background: #fff; color: #fff; font-weight: 800; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand h1 { margin: 0; font-size: 22px; line-height: 1.05; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.hero { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.hero-card, .panel, .notice, .ad-card, .empty, .admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.hero-card { padding: 22px; background: linear-gradient(135deg, #0d5e51, #17415f); color: #fff; }
.eyebrow { margin: 0 0 8px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; opacity: 0.8; }
.hero-card h2 { margin: 0 0 10px; font-size: 32px; line-height: 1.08; }
.hero-card p { margin: 0 0 18px; max-width: 620px; font-size: 18px; color: rgba(255, 255, 255, 0.86); }
.hero-help { padding: 18px; display: grid; gap: 12px; }
.help-row { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.help-row strong { display: block; margin-bottom: 2px; }
.help-row span { color: var(--muted); font-size: 14px; }
.icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #e7f5f1; color: var(--brand); font-weight: 800; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 16px; border-radius: 8px; font-weight: 800; text-decoration: none; transition: transform 0.12s ease, background 0.12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #111827; }
.btn-primary:hover { background: #f59e0b; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #25364a; }
.btn-soft { background: #e8eef6; color: var(--ink); }
.btn-soft:hover { background: #dbe6f2; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1d15; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-block { width: 100%; }

.toolbar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin: 14px 0; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 800; font-size: 14px; }
input, select, textarea { width: 100%; border: 1px solid #bccbda; border-radius: 8px; background: #fff; color: var(--ink); padding: 12px; min-height: 46px; }
textarea { resize: vertical; min-height: 98px; }
.counter { color: var(--muted); font-size: 13px; text-align: right; }

.notice { display: none; padding: 16px; margin: 14px 0; border-color: #f0b429; background: #fff8e6; }
.notice.is-visible { display: block; }
.notice h3 { margin: 0 0 6px; font-size: 19px; }
.notice p { margin: 0; color: #4a3a16; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.notice-actions .btn { min-height: 40px; padding: 9px 12px; }
.donors { display: none; padding: 12px 14px; margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; background: #f7fbff; color: var(--muted); font-size: 14px; }
.donors.is-visible { display: block; }
.donors strong { color: var(--ink); }

.ads-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.ads-head h2 { margin: 0; font-size: 22px; }
.count { color: var(--muted); font-weight: 700; }
.fair-note { margin: -4px 0 12px; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ad-card { display: flex; flex-direction: column; min-height: 235px; padding: 16px; box-shadow: none; }
.ad-card.pinned { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.ad-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: #e7f5f1; color: var(--brand-dark); font-weight: 800; font-size: 13px; }
.badge.premium { background: #fff0cf; color: #7a4a00; }
.ad-card h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.18; overflow-wrap: anywhere; }
.ad-card p { margin: 0 0 12px; color: var(--muted); overflow-wrap: anywhere; }
.ad-meta { display: grid; gap: 6px; margin-top: auto; color: var(--muted); font-size: 14px; font-weight: 700; }
.contact-row { display: flex; gap: 8px; margin-top: 12px; }
.contact-row .btn { flex: 1; }
.btn-phone span[aria-hidden="true"] { font-size: 20px; line-height: 1; }
.empty { display: none; padding: 26px 18px; text-align: center; color: var(--muted); box-shadow: none; }
.empty.is-visible { display: block; }
.empty strong { display: block; color: var(--ink); font-size: 20px; margin-bottom: 6px; }

.form-panel { padding: 18px; margin: 14px 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.btn-icon { width: 42px; min-width: 42px; min-height: 42px; padding: 0; display: inline-grid; place-items: center; font-size: 28px; line-height: 1; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bot-check { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.wide { grid-column: 1 / -1; }
.small-note { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.warning { border: 1px solid #f0b429; background: #fff8e6; color: #4a3a16; border-radius: 8px; padding: 12px; font-weight: 700; }
.footer { color: var(--muted); text-align: center; padding: 24px 10px 18px; font-size: 14px; display: grid; justify-items: center; gap: 10px; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 800; text-decoration: none; }
.footer-brand img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.footer-brand:hover { text-decoration: underline; }

.modal { position: fixed; inset: 0; display: none; place-items: center; padding: 14px; background: rgba(7, 17, 29, 0.62); z-index: 50; }
.modal.is-open { display: grid; }
.dialog { width: min(620px, 100%); max-height: 92vh; overflow: auto; border-radius: 8px; background: #fff; box-shadow: var(--shadow); padding: 18px; }
.dialog h2 { margin: 0 0 10px; font-size: 24px; }
.review-list { display: grid; gap: 8px; margin: 14px 0; }
.review-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-wrap: anywhere; }
.review-item span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.confirm-box, .check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-weight: 700; }
.confirm-box input, .check input { width: 22px; height: 22px; min-height: 22px; margin-top: 2px; flex: 0 0 auto; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }

.admin-panel { display: none; margin: 16px 0; padding: 18px; border-color: #9fb4ca; }
.admin-panel.is-visible { display: block; }
.admin-panel h2 { margin: 0 0 6px; }
.admin-panel h3 { margin: 18px 0 8px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-list { display: grid; gap: 10px; margin-top: 10px; }
.admin-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #f8fbff; }
.admin-row strong { display: block; overflow-wrap: anywhere; }
.admin-row small { color: var(--muted); display: block; margin-top: 3px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.toast { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); display: none; max-width: min(520px, calc(100% - 24px)); padding: 12px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 800; z-index: 100; box-shadow: var(--shadow); }
.toast.is-visible { display: block; }
.toast.error { background: var(--danger); }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .hero, .toolbar, .form-grid, .admin-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .shell { padding: 10px; }
  .topbar { align-items: flex-start; }
  .brand h1 { font-size: 19px; }
  .brand p { font-size: 13px; }
  .top-actions { flex-direction: column; align-items: stretch; }
  .top-actions .btn { min-height: 40px; padding: 9px 11px; }
  .hero-card { padding: 18px; }
  .hero-card h2 { font-size: 26px; }
  .hero-card p { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .ads-head { align-items: flex-start; flex-direction: column; }
  .contact-row, .dialog-actions, .admin-row, .row-actions { display: grid; grid-template-columns: 1fr; }
  .modal { align-items: end; padding: 0; }
  .dialog { width: 100%; max-height: 94vh; border-radius: 8px 8px 0 0; }
}
