:root {
  /* Юность — брендбук 19.12.2025 */
  --yunost-white: #ffffff;
  --yunost-black: #000000;
  --yunost-gray: #ece6dd;
  --yunost-green: #00a870;
  --yunost-magenta: #e60064;
  --yunost-orange: #f59b32;

  --bg: var(--yunost-gray);
  --card: var(--yunost-white);
  --text: var(--yunost-black);
  --muted: #5c5c5c;
  --accent: var(--yunost-green);
  --accent-soft: #d4f3e8;
  --accent-2: var(--yunost-magenta);
  --accent-2-soft: #fde6ef;
  --warn: var(--yunost-orange);
  --warn-soft: #fff1dc;
  --border: #d9d2c8;
  --error: #c41e3a;
  --topbar: var(--yunost-black);
  --topbar-text: var(--yunost-white);
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Golos Text", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--topbar);
  color: var(--topbar-text);
  border-bottom: 3px solid var(--yunost-green);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand span {
  color: var(--yunost-green);
}

.topbar nav a {
  margin-left: 1rem;
  color: var(--yunost-white);
  text-decoration: none;
  opacity: 0.9;
}

.topbar nav a:hover {
  color: var(--yunost-green);
  opacity: 1;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card.narrow {
  max-width: 420px;
  margin: 3rem auto;
}

h1, h2 {
  margin-top: 0;
  font-weight: 700;
}

h1::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 0.5rem;
  background: linear-gradient(90deg, var(--yunost-green), var(--yunost-magenta));
  border-radius: 999px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.stat-card.accent {
  background: var(--accent-soft);
  border-color: #9edfc4;
}

.stat-card.warn {
  background: var(--warn-soft);
  border-color: #ffd08a;
}

.stat-card.magenta {
  background: var(--accent-2-soft);
  border-color: #f5b3cc;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

input, select, textarea, button {
  font: inherit;
}

.form-control,
input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c5c5c' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(0, 168, 112, 0.25);
  border-color: var(--yunost-green);
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(0.95);
}

button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.error { color: var(--error); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.status { min-height: 1.5rem; margin-top: 0.75rem; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem;
  text-align: left;
}

.table th {
  color: var(--muted);
  font-size: 0.9rem;
}

.broadcast-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .broadcast-layout { grid-template-columns: 1fr; }
}

.fields-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.fields-row .field {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 640px) {
  .fields-row {
    flex-direction: column;
  }
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.row > label {
  min-width: 0;
  margin-bottom: 0;
}

.row input,
.row select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .row {
    grid-template-columns: 1fr;
  }
}

/* Визуальный редактор */
.editor-block label {
  margin-bottom: 0.5rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: #faf8f5;
}

.editor-toolbar button {
  min-width: 2.25rem;
  padding: 0.45rem 0.65rem;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 700;
}

.editor-toolbar button.is-active {
  background: var(--accent-soft);
  border-color: var(--yunost-green);
  color: var(--yunost-green);
}

.editor-toolbar button:hover {
  border-color: var(--yunost-green);
}

.editor-surface {
  min-height: 220px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: #fff;
  overflow-y: auto;
}

.editor-surface:empty::before {
  content: attr(data-placeholder);
  color: #9a9a9a;
  pointer-events: none;
}

.editor-surface:focus {
  outline: 2px solid rgba(0, 168, 112, 0.2);
}

.editor-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Превью в стиле Telegram */
.tg-preview-wrap {
  background: linear-gradient(180deg, #dfe9f2 0%, #d4e3ef 100%);
  border-radius: 12px;
  padding: 1rem;
  min-height: 280px;
}

.tg-bubble {
  max-width: 92%;
  background: #fff;
  border-radius: 0 14px 14px 14px;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  white-space: pre-wrap;
  word-break: break-word;
}

.tg-bubble a {
  color: var(--yunost-green);
}

.tg-bubble-empty {
  color: #7a8794;
  font-style: italic;
}

.login-card h1::after {
  margin-left: auto;
  margin-right: auto;
}
