:root {
  --bg: #101923;
  --panel: #f6f8fc;
  --card: #ffffff;
  --text: #0d1726;
  --muted: #6b7280;
  --blue: #0b63ce;
  --red: #d8242f;
  --green: #16a34a;
  --line: rgba(120, 130, 150, .22);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: #0f1a26;
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--panel);
  display: grid;
  grid-template: 1fr 42px / minmax(0, 1fr);
  margin: 0;
}

.floating-menu {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  top: max(14px, env(safe-area-inset-top));
  z-index: 30;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  color: #4b5563;
  font-size: 24px;
  box-shadow: 0 8px 28px rgba(0,0,0,.16);
  cursor: pointer;
}
.floating-menu:hover { background: #eef3fb; }

.sidebar {
  position: fixed;
  inset: 0 auto 42px 0;
  width: min(310px, 86vw);
  z-index: 20;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: grid;
  align-content: start;
  gap: 8px;
  transform: translateX(-105%);
  transition: transform .2s ease;
  box-shadow: 20px 0 40px rgba(0,0,0,.22);
}
.sidebar.open { transform: translateX(0); }
.sidebar button {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 750;
  color: #172235;
  cursor: pointer;
}
.sidebar button.active,
.sidebar button:hover { background: #eef3fb; color: var(--blue); }

main { overflow: auto; }
footer {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: #28394d;
  background: rgba(255,255,255,.82);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.section { padding: 26px; min-height: 100%; }
.page-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); letter-spacing: 1.6px; text-transform: uppercase; font-size: 11px; font-weight: 800; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.14; }
h1 { font-size: 30px; }
h2 { font-size: 23px; }
h3 { font-size: 18px; }
p { color: var(--muted); margin: 0 0 14px; }

.gos-head {
  background: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: -26px -26px 24px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}
.gos-logo { color: #0b57ad; font-size: 24px; font-weight: 900; }
.gos-logo span { color: var(--red); }

.hero {
  color: #fff;
  background: linear-gradient(135deg, #0b63ce, #162337);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 12px;
}
.hero p { color: rgba(255,255,255,.76); }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 18px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 4px 18px rgba(0,0,0,.04);
}
.character-photo {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3fb;
  margin-bottom: 14px;
}
.photo-preview {
  width: min(100%, 260px);
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef3fb;
}
.photo-preview:not([src]),
.photo-preview[src=""] { display: none; }
.list { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.meta { color: var(--muted); font-size: 13px; }

.btn {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 13px 16px;
  font-weight: 850;
  font-size: 15px;
  cursor: pointer;
}
.btn.full { width: 100%; }
.btn.secondary { background: #eef3fb; color: #0d2a4c; }
.btn.dark { background: #101010; }
.btn.danger { background: #fee2e2; color: #991b1b; }
.btn.small { padding: 9px 13px; font-size: 13px; }

.field { display: grid; gap: 7px; margin: 0 0 14px; }
label { color: #5d6675; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eaf1fb;
  padding: 13px;
  color: #172235;
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11,99,206,.24); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #172235;
  font-size: 13px;
}
.status-ok { color: var(--green); font-weight: 900; }
.status-bad { color: #dc2626; font-weight: 900; }
.status-wait { color: #b45309; font-weight: 900; }

.empty {
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}
.emoji { font-size: 34px; display: block; margin-bottom: 8px; }

.dark-page {
  color: #f5f5f5;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    #070707;
  background-size: 20px 20px;
}
.dark-page .card {
  background: rgba(20,20,20,.9);
  border-color: #2d2d2d;
  color: #f4f4f4;
  box-shadow: none;
}
.dark-page input, .dark-page textarea, .dark-page select {
  background: #111;
  color: #f4f4f4;
  border-color: #303030;
}
.dark-page p, .dark-page .meta, .dark-page label { color: #9ca3af; }

.vk-head { background: #2f8df5; color: #fff; padding: 24px 22px 0; margin: -26px -26px 20px; }
.vk-title { font-size: 25px; font-weight: 950; margin-bottom: 18px; }
.tabs { display: flex; gap: 20px; overflow: auto; }
.tab { border: 0; background: transparent; color: rgba(255,255,255,.84); padding: 0 0 13px; font-weight: 800; }
.tab.active { color: #fff; border-bottom: 3px solid #fff; }

.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.search { margin: 10px 0 18px; }

.site-preview {
  min-height: 260px;
  border-radius: 8px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.site-preview.fade { animation: fadeIn .35s ease both; }
.site-preview.slide { animation: slideIn .35s ease both; }
.site-preview.zoom { animation: zoomIn .3s ease both; }
.site-preview img { max-width: 100%; border-radius: 8px; margin: 10px 0; }
.site-html-frame {
  width: 100%;
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.maintenance {
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  background: #f7f8fc;
}

.blocked-page {
  background: #f2f4f7;
}

.block-screen {
  min-height: calc(100vh - 94px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 32px 18px;
}

.block-screen.rkn {
  background: #fff;
  color: #063b70;
}

.block-screen.dark-law {
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    #050505;
  background-size: 24px 24px;
  color: #f5f5f5;
}

.block-emblem {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  background: #0b63ce;
  color: #fff;
  font-size: 42px;
  font-weight: 950;
}

.dark-law .block-emblem {
  background: #151515;
  border: 1px solid #555;
}

.block-screen h1 {
  font-size: clamp(34px, 8vw, 58px);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.block-screen p {
  width: min(820px, 100%);
  color: inherit;
  font-size: 17px;
}

.block-url {
  margin-bottom: 16px;
  color: #6b7280;
  word-break: break-all;
}

.coffee {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff4df;
  font-size: 38px;
}

#toastHost {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}
.toast {
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 14px 40px 14px 14px;
  box-shadow: 0 14px 42px rgba(0,0,0,.26);
  position: relative;
}
.toast button {
  position: absolute;
  right: 8px;
  top: 8px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 899px) {
  body { background: var(--panel); }
  .app-shell {
    width: 100%;
    max-width: none;
  }
  .section { padding: 22px 18px; }
  .gos-head, .vk-head { margin: -22px -18px 20px; padding-left: 18px; padding-right: 18px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .page-head { display: grid; }
  h1 { font-size: 26px; }
}

@media (min-width: 900px) {
  body {
    display: grid;
    place-items: center;
  }
  .app-shell {
    max-width: 1180px;
    grid-template: 1fr 42px / 240px minmax(0, 1fr);
    box-shadow: 0 22px 90px rgba(0,0,0,.35);
  }
  .sidebar {
    position: static;
    transform: none;
    box-shadow: none;
    width: auto;
  }
  .floating-menu { display: none; }
}
