/* Пульс — editorial PWA. No frameworks, no external assets. */

:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --bg-glow: rgba(232, 67, 46, 0.09);
  --surface: #fffdf8;
  --surface-2: #f1ece2;
  --surface-3: #e8e1d4;
  --field: #fbf8f1;
  --ink: #171512;
  --ink-soft: #3f3a33;
  --muted: #726b60;
  --line: #e4dccf;
  --line-strong: #cec4b3;
  --accent: #d63a27;
  --accent-hover: #bd2f1e;
  --accent-soft: #fbe7e2;
  --accent-ink: #fffaf6;
  --ok: #2c7a4b;
  --ok-soft: #e3f0e7;
  --warn: #93610f;
  --warn-soft: #f8ecd6;
  --danger: #b3261e;
  --danger-soft: #fbe5e2;
  --shadow-sm: 0 1px 2px rgba(23, 21, 18, 0.06);
  --shadow-md: 0 24px 48px -28px rgba(23, 21, 18, 0.4), 0 2px 6px rgba(23, 21, 18, 0.05);
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f11;
    --bg-glow: rgba(255, 92, 71, 0.08);
    --surface: #16181b;
    --surface-2: #1d2024;
    --surface-3: #262a2f;
    --field: #101215;
    --ink: #f3efe8;
    --ink-soft: #d3cec4;
    --muted: #9a9388;
    --line: #2a2d31;
    --line-strong: #3b3f45;
    --accent: #ff5c47;
    --accent-hover: #ff7361;
    --accent-soft: #2e1a16;
    --accent-ink: #1a0f0c;
    --ok: #6cc58f;
    --ok-soft: #16281d;
    --warn: #e0ac55;
    --warn-soft: #2a2214;
    --danger: #ff8074;
    --danger-soft: #2d1815;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 24px 48px -24px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f11;
  --bg-glow: rgba(255, 92, 71, 0.08);
  --surface: #16181b;
  --surface-2: #1d2024;
  --surface-3: #262a2f;
  --field: #101215;
  --ink: #f3efe8;
  --ink-soft: #d3cec4;
  --muted: #9a9388;
  --line: #2a2d31;
  --line-strong: #3b3f45;
  --accent: #ff5c47;
  --accent-hover: #ff7361;
  --accent-soft: #2e1a16;
  --accent-ink: #1a0f0c;
  --ok: #6cc58f;
  --ok-soft: #16281d;
  --warn: #e0ac55;
  --warn-soft: #2a2214;
  --danger: #ff8074;
  --danger-soft: #2d1815;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 24px 48px -24px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(900px 520px at 88% -12%, var(--bg-glow), transparent 65%);
  pointer-events: none;
}

body.no-scroll {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ————— Buttons & controls ————— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  padding: 0.68em 1.15em;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px -10px var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-small {
  padding: 0.48em 0.85em;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

/* ————— Top bar ————— */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.08rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px -8px var(--accent);
}

.brand-mark .icon {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-actions .btn {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.55em 0.9em;
}

.topbar-actions .btn:hover {
  color: var(--ink);
}

.push-btn.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.push-btn.is-active .icon {
  fill: currentColor;
  fill-opacity: 0.18;
}

/* ————— Layout ————— */

main {
  flex: 1;
}

.view {
  animation: view-in 0.3s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 0.76rem;
  line-height: 1.45;
}

.link-quiet {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.link-quiet:hover {
  color: var(--ink);
  border-bottom-color: var(--line-strong);
}

/* ————— Feed ————— */

.feed-wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 52px 24px 88px;
}

.feed-head {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
  gap: 40px;
  align-items: end;
  margin-bottom: 36px;
}

.feed-heading h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 10px 0 16px;
}

.lede {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.62;
}

.subscribe-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.subscribe-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.subscribe-icon .icon {
  width: 21px;
  height: 21px;
}

.subscribe-copy h2 {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 2px 0 6px;
}

.subscribe-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.subscribe-copy .btn {
  margin-top: 12px;
}

.subscribe-copy .tiny {
  margin-top: 8px;
}

.subscribe-card.is-subscribed .subscribe-icon {
  background: var(--ok-soft);
  color: var(--ok);
}

.subscribe-card.is-subscribed .subscribe-copy .btn {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  box-shadow: none;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.notice .icon {
  color: var(--warn);
  margin-top: 2px;
}

.notice[hidden] {
  display: none;
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 30px 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.feed-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.news-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.news-card:first-child {
  grid-column: 1 / -1;
}

.news-card:first-child.has-media .news-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  min-height: 340px;
}

.news-card:first-child.has-media .news-media {
  height: 100%;
  order: 2;
}

.news-card:first-child.has-media .news-media img {
  height: 100%;
  aspect-ratio: auto;
}

.news-card:first-child:not(.has-media) .news-content {
  max-width: 860px;
}

.news-card:first-child .news-content {
  padding: 34px 36px;
  justify-content: center;
}

.news-card:first-child .news-title {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
}

.news-card:first-child .news-excerpt {
  font-size: 1rem;
  -webkit-line-clamp: 4;
}

.news-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.news-media {
  background: var(--surface-2);
  overflow: hidden;
}

.news-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.news-card:hover .news-media img {
  transform: scale(1.02);
}

.news-content {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 20px 22px 22px;
  flex: 1;
}

.news-date {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.news-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.2vw, 1.6rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.news-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.news-more .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.18s ease;
}

.news-card:hover .news-more .icon {
  transform: translateX(3px);
}

.empty {
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-mark .icon {
  width: 25px;
  height: 25px;
}

.empty h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.empty p {
  color: var(--muted);
  margin: 0 auto 18px;
  max-width: 42ch;
}

.empty-small {
  padding: 30px 20px;
  background: transparent;
  border-color: var(--line);
}

.empty-small p {
  margin: 0;
}

/* ————— Footer ————— */

.footer {
  border-top: 1px solid var(--line);
  padding: 26px 24px;
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.84rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.footer-brand .icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

/* ————— Auth ————— */

.auth-wrap {
  min-height: calc(100vh - 64px - 92px);
  display: grid;
  place-items: center;
  padding: 48px 20px 64px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -12px var(--accent);
}

.auth-mark .icon {
  width: 23px;
  height: 23px;
}

.auth-card h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 6px 0 8px;
}

.auth-subtitle {
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 22px;
}

.auth-card .field {
  margin-bottom: 14px;
}

.auth-card .btn-block {
  margin-top: 6px;
}

.auth-card .link-quiet {
  align-self: center;
  margin-top: 18px;
}

/* ————— Forms ————— */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.62;
}

.field-title input {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  padding: 13px 16px;
  letter-spacing: -0.01em;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 16px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.check-box {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--field);
  color: var(--accent-ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.check-box .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.check input:checked + .check-box {
  background: var(--accent);
  border-color: var(--accent);
}

.check input:checked + .check-box .icon {
  opacity: 1;
  transform: scale(1);
}

.check input:focus-visible + .check-box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.check input:disabled ~ span {
  opacity: 0.6;
}

.form-error {
  min-height: 1.1em;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.83rem;
  line-height: 1.4;
}

.form-error:empty {
  display: none;
}

/* ————— Admin layout ————— */

.admin-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 24px 88px;
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.admin-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 8px 0 0;
}

.admin-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

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

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.card-head h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pill-muted {
  background: var(--surface-2);
  color: var(--muted);
}

.composer-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.composer-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}

.preview-card {
  position: sticky;
  top: 84px;
}

.phone {
  width: 100%;
  max-width: 292px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 34px;
  background: #0c0d0f;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.phone-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 440px;
  border-radius: 27px;
  overflow: hidden;
  background: #f7f4ee;
  color: #171512;
}

.phone-status {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #171512;
}

.phone-dots {
  letter-spacing: 0.12em;
  font-size: 0.55rem;
}

.phone-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 10px;
  border-bottom: 1px solid rgba(23, 21, 18, 0.08);
  color: #e8432e;
}

.phone-appbar .icon {
  width: 15px;
  height: 15px;
}

.phone-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #171512;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
}

.phone-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e8432e;
}

.preview-feed {
  flex: 1;
  padding: 12px 12px 8px;
  overflow: hidden;
}

.preview-news {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(23, 21, 18, 0.07);
  background: #fffdf8;
  box-shadow: 0 3px 10px rgba(23, 21, 18, 0.05);
}

.preview-image {
  display: block;
  width: 100%;
  height: 104px;
  margin-bottom: 9px;
  border-radius: 8px;
  object-fit: cover;
}

.preview-date {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8378;
}

.preview-news h3 {
  margin: 0 0 5px;
  font-family: var(--font-serif);
  font-size: 1.04rem;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: #171512;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-news > p:last-child {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.42;
  color: #625c52;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.phone-push {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  padding: 9px;
  border-radius: 13px;
  border: 1px solid rgba(23, 21, 18, 0.06);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 8px 24px -8px rgba(23, 21, 18, 0.45);
  backdrop-filter: blur(8px);
}

.phone-push.is-hidden {
  opacity: 0.35;
}

.phone-push-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: #e8432e;
  color: #fffaf6;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: var(--font-sans);
}

.phone-push-copy {
  min-width: 0;
}

.phone-push-copy strong {
  display: block;
  margin-bottom: 1px;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  color: #171512;
}

.phone-push-copy p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  line-height: 1.32;
  color: #4c463d;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-caption {
  margin: 14px auto 0;
  max-width: 30ch;
  text-align: center;
}

/* ————— Materials ————— */

.materials-card,
.subscribers-card {
  margin-bottom: 22px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.materials-list {
  display: flex;
  flex-direction: column;
}

.material {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.material:first-child {
  padding-top: 0;
  border-top: none;
}

.material-main {
  min-width: 0;
}

.material-title {
  margin: 0 0 5px;
  font-family: var(--font-serif);
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.material-meta {
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.material-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.material-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.material-status.is-published {
  color: var(--ok);
}

.material-status.is-draft {
  color: var(--warn);
}

.material-status.is-sending {
  color: var(--accent);
}

.material-push {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.material-push .icon {
  width: 13px;
  height: 13px;
}

.material-push.is-error {
  color: var(--danger);
}

.material-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.material-actions .icon-btn {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.material-actions .icon-btn:hover {
  color: var(--ink);
}

.material-actions .icon-btn.is-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ————— Subscribers ————— */

.subs-intro {
  margin: -8px 0 12px;
  font-size: 0.86rem;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 750;
  vertical-align: 2px;
}

.subs-list {
  display: flex;
  flex-direction: column;
}

.sub {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sub:first-child {
  border-top: none;
  padding-top: 4px;
}

.sub-main {
  min-width: 0;
}

.sub-device {
  margin: 0 0 2px;
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sub-meta {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.sub-error {
  margin: 4px 0 0;
  font-size: 0.74rem;
  color: var(--danger);
}

.sub-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.sub-ok {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ok);
  font-size: 0.73rem;
  font-weight: 600;
}

.sub-ok .icon {
  width: 14px;
  height: 14px;
}

/* ————— Overlay / article ————— */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 11, 9, 0.55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade-in 0.2s ease both;
}

.article {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 80px);
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6);
  animation: article-in 0.24s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes article-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
}

.article-scroll {
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  padding: 48px clamp(22px, 5vw, 56px) 52px;
}

.article-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}

.article-scroll h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.03em;
  margin: 10px 0 22px;
  overflow-wrap: anywhere;
}

.article-image {
  display: block;
  width: 100%;
  margin: 0 0 26px;
  border-radius: 12px;
  object-fit: cover;
  max-height: 460px;
}

.article-body {
  color: var(--ink-soft);
  font-size: 1.04rem;
  line-height: 1.72;
}

.article-body p {
  margin: 0 0 1.1em;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.article-scroll > .btn {
  margin-top: 28px;
}

/* ————— Toast ————— */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.86rem;
  font-weight: 550;
  text-align: center;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease both;
}

.toast[data-tone="error"] {
  background: var(--danger);
  color: #fff;
}

.toast[data-tone="success"] {
  background: var(--ok);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ————— Responsive ————— */

@media (max-width: 1020px) {
  .feed-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .subscribe-card {
    max-width: 560px;
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview-card {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    padding: 0 16px;
    height: 60px;
  }

  .topbar-actions .admin-link span,
  .topbar-actions .btn-install span {
    display: none;
  }

  .topbar-actions .admin-link,
  .topbar-actions .btn-install {
    padding: 0.55em;
  }

  .brand-name {
    font-size: 1rem;
  }

  .feed-wrap {
    padding: 34px 16px 64px;
  }

  .feed-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .news-card:first-child.has-media .news-inner {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .news-card:first-child.has-media .news-media {
    order: 0;
    height: auto;
  }

  .news-card:first-child.has-media .news-media img {
    aspect-ratio: 16 / 9;
  }

  .news-card:first-child .news-content {
    padding: 22px;
  }

  .news-card:first-child .news-title {
    font-size: 1.6rem;
  }

  .admin-wrap {
    padding: 28px 16px 64px;
  }

  .card {
    padding: 18px;
  }

  .composer-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .materials-head {
    align-items: flex-start;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding: 6px 6px;
  }

  .material {
    gap: 8px;
  }

  .material-actions {
    align-self: flex-start;
  }

  .stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 10px 12px;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .footer-inner {
    justify-content: center;
    text-align: center;
  }

  .overlay {
    padding: 0;
  }

  .article {
    max-height: 100dvh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .article-scroll {
    max-height: 100dvh;
    padding: 46px 20px 48px;
  }
}

@media (max-width: 440px) {
  .topbar-actions {
    gap: 0;
  }

  .push-btn span {
    display: none;
  }

  .push-btn {
    padding: 0.55em !important;
  }

  .feed-heading h1 {
    font-size: 2.5rem;
  }

  .subscribe-card {
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Small state helpers */
body[data-view="admin"] .admin-link {
  display: none;
}

.material-title-link {
  color: inherit;
  text-decoration: none;
}

.material-title-link:hover {
  color: var(--accent);
}

.icon-btn:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.material-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ————— Personal account (Remnawave) ————— */

body[data-view="account"] .account-link {
  display: none;
}

.account-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 48px 24px 88px;
}

.account-auth {
  min-height: calc(100vh - 64px - 92px);
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.account-auth-card {
  width: 100%;
  max-width: 470px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.account-auth-card h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 6px 0 10px;
}

.account-intro {
  font-size: 0.93rem;
  line-height: 1.55;
  margin: 0 0 20px;
}

.account-auth-card .field {
  margin-bottom: 14px;
}

.account-auth-card .btn-block {
  margin-top: 4px;
}

.account-auth-card .link-quiet {
  display: block;
  margin-top: 18px;
}

.account-privacy {
  margin: 12px 0 0;
}

.account-error-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.account-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.account-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.account-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.account-subline {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.account-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.is-active {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.is-warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.account-grid .card {
  height: 100%;
}

.traffic-value {
  margin: 6px 0 0;
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.traffic-limit {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
}

.traffic-bar {
  height: 10px;
  margin: 16px 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.traffic-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.4s ease;
}

.traffic-fill.is-over {
  background: linear-gradient(90deg, var(--warn), var(--danger));
}

.traffic-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--muted);
}

.traffic-lifetime {
  margin: 15px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.expiry-date {
  margin: 8px 0 4px;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.expiry-card > p.muted {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

.expiry-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.expiry-actions .btn {
  margin-top: 0;
}

.device-list {
  display: flex;
  flex-direction: column;
}

.device-item {
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.device-item:first-child {
  padding-top: 2px;
  border-top: none;
}

.device-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.device-meta {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.devices-card #devices-note {
  margin: 12px 0 0;
}

.subscription-card,
.connections-card {
  margin-top: 18px;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.copy-value {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-list {
  display: flex;
  flex-direction: column;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.connection-item:first-child {
  padding-top: 0;
  border-top: none;
}

.protocol-pill {
  flex: none;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.connection-label {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-item .btn {
  padding: 0.35em 0.7em;
  font-size: 0.75rem;
}

.account-updated {
  margin: 20px 0 0;
  text-align: center;
}

.remnawave-card {
  margin-bottom: 22px;
}

.remnawave-card .subs-intro {
  max-width: 70ch;
}

#rw-status.is-on {
  background: var(--ok-soft);
  color: var(--ok);
}

#rw-token-note,
#rw-test-result {
  min-height: 1.1em;
  margin: 0 0 14px;
}

#rw-test-result.is-ok {
  color: var(--ok);
}

#rw-test-result.is-error {
  color: var(--danger);
}

.btn.is-danger {
  color: var(--danger);
  border-color: var(--line);
}

.btn.is-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
  color: var(--danger);
}

@media (max-width: 1020px) {
  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .traffic-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .account-wrap {
    padding: 30px 16px 64px;
  }

  .account-auth {
    min-height: calc(100vh - 60px - 92px);
  }

  .account-auth-card {
    padding: 22px;
  }

  .account-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .traffic-card {
    grid-column: auto;
  }

  .account-head-actions {
    width: 100%;
  }

  .copy-row {
    flex-wrap: wrap;
  }

  .copy-value {
    flex-basis: 100%;
  }

  .connection-item {
    gap: 8px;
  }

  .connection-label {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
  }

  .topbar-actions .account-link span {
    display: none;
  }

  .topbar-actions .account-link {
    padding: 0.55em;
  }
}
