/* ==========================================================================
   Postellium — design tokens
   ========================================================================== */

:root {
  /* Color: deep indigo canvas, electric-violet signal, cyan spark accent */
  --ink-950: #0b0a24;
  --ink-900: #100e33;
  --ink-800: #181454;
  --violet-600: #6c2bd9;
  --violet-500: #7c3aed;
  --indigo-500: #4c3cf0;
  --indigo-400: #6a5bff;
  --spark-400: #4fd8e8;
  --paper-50: #f6f5fe;
  --paper-100: #eeecfc;
  --paper-200: #e1ddf7;
  --text-ink: #17163a;
  --text-muted: #5f5c86;
  --text-faint: #8e8bb8;
  --line: rgba(108, 43, 217, 0.14);
  --line-strong: rgba(108, 43, 217, 0.28);

  --grad-signal: linear-gradient(135deg, var(--indigo-500) 0%, var(--violet-600) 70%);
  --grad-hero: radial-gradient(60% 60% at 20% 20%, rgba(124, 58, 237, 0.55), transparent 60%),
               radial-gradient(50% 50% at 85% 15%, rgba(79, 216, 232, 0.25), transparent 60%),
               radial-gradient(70% 70% at 50% 100%, rgba(76, 60, 240, 0.5), transparent 60%),
               var(--ink-950);

  --shadow-soft: 0 20px 50px -20px rgba(23, 12, 74, 0.35);
  --shadow-pop: 0 10px 30px -10px rgba(76, 60, 240, 0.45);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper-50);
  color: var(--text-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

p { margin: 0; color: var(--text-muted); line-height: 1.6; }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet-600);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--spark-400);
  box-shadow: 0 0 0 4px rgba(79, 216, 232, 0.18);
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  border: none;
  border-radius: 999px;
  padding: 13px 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--grad-signal);
  color: #fff;
  box-shadow: var(--shadow-pop);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px rgba(76, 60, 240, 0.6); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: rgba(108, 43, 217, 0.06); }

.btn-ghost-invert {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(6px);
}
.btn-ghost-invert:hover { background: rgba(255, 255, 255, 0.16); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 13px; }
.btn-danger { background: #fee2e6; color: #b3182f; }
.btn-danger:hover { background: #fdd2d9; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------------------- */
/* Nav                                                                     */
/* ---------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 10, 36, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: #fff;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--grad-signal);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 4px;
  background: var(--spark-400);
  opacity: 0.9;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.72);
}
.nav-links a:hover { color: #fff; }
.nav-cta { display: flex; align-items: center; gap: 12px; }

@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ==========================================================================
   Landing page
   ========================================================================== */

.hero {
  background: var(--grad-hero);
  color: #fff;
  padding: 96px 0 120px;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 60px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(36px, 5vw, 58px);
  margin: 18px 0 20px;
  color: #fff;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--spark-400), #b8a4ff 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 17.5px;
  color: rgba(232, 230, 255, 0.82);
  max-width: 480px;
}
.hero-actions { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }
.hero-meta {
  margin-top: 44px;
  display: flex;
  gap: 34px;
  flex-wrap: wrap;
}
.hero-meta div strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: #fff;
}
.hero-meta div span {
  font-size: 12.5px;
  color: rgba(232, 230, 255, 0.6);
}

/* Signature visual: orbiting channel nodes around an AI core, feeding a
   scheduling timeline — stands in for "message becomes a scheduled post". */
.orbit-card {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: 34px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}
.orbit-stage {
  position: relative;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orbit-core {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--grad-signal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 0 0 10px rgba(124, 58, 237, 0.12), 0 0 60px rgba(124, 58, 237, 0.55);
  z-index: 2;
  text-align: center;
  line-height: 1.15;
}
.orbit-ring {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  animation: spin 22s linear infinite;
}
.orbit-ring.r1 { width: 190px; height: 190px; }
.orbit-ring.r2 { width: 250px; height: 250px; animation-duration: 32s; animation-direction: reverse; }
.orbit-node {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
@keyframes spin { to { transform: rotate(360deg); } }
.orbit-node { animation: counter-spin 22s linear infinite; }
.r2 .orbit-node { animation-duration: 32s; animation-direction: reverse; }
@keyframes counter-spin { to { transform: rotate(-360deg); } }

.orbit-timeline {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  gap: 10px;
}
.orbit-slot {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}
.orbit-slot.filled { background: rgba(124, 58, 237, 0.35); }
.orbit-slot.filled::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(79, 216, 232, 0.55), transparent);
  animation: sheen 3.4s ease-in-out infinite;
}
@keyframes sheen { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

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

@media (prefers-reduced-motion: reduce) {
  .orbit-ring, .orbit-node, .orbit-slot.filled::after { animation: none; }
}

/* Sections on paper background */
.section { padding: 92px 0; }
.section-head { max-width: 640px; margin-bottom: 52px; }
.section-head h2 { font-size: clamp(28px, 3.4vw, 38px); margin: 14px 0 14px; color: var(--text-ink); }
.section-head p { font-size: 16px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.feature-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); border-color: var(--line-strong); }
.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--grad-signal);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 19px;
}
.feature-card h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-ink); }
.feature-card p { font-size: 14.5px; }

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

.section-dark {
  background: var(--ink-950);
  color: #fff;
  border-radius: 32px;
  margin: 0 auto;
  max-width: 1180px;
  padding: 70px 56px;
}
.section-dark .section-head h2 { color: #fff; }
.section-dark .section-head p { color: rgba(232, 230, 255, 0.7); }

.flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  counter-reset: flow;
}
.flow-step {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 26px;
  position: relative;
}
.flow-step .flow-index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--spark-400);
  letter-spacing: 0.1em;
}
.flow-step h3 { color: #fff; font-size: 17px; margin: 12px 0 8px; }
.flow-step p { color: rgba(232, 230, 255, 0.68); font-size: 14px; }

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

.channels-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px 9px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-ink);
}
.channel-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
}
.channel-dot.tg { background: #4c3cf0; }
.channel-dot.vk { background: #6c2bd9; }
.channel-dot.ig { background: linear-gradient(135deg, #7c3aed, #4fd8e8); }
.channel-dot.dz { background: #2f2668; }

.cta-band {
  text-align: center;
  padding: 90px 0 110px;
}
.cta-card {
  background: var(--grad-signal);
  border-radius: 28px;
  padding: 62px 40px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.cta-card h2 { font-size: clamp(26px, 3.6vw, 36px); color: #fff; margin-bottom: 14px; }
.cta-card p { color: rgba(255, 255, 255, 0.85); max-width: 480px; margin: 0 auto 28px; }

.footer {
  border-top: 1px solid var(--line);
  padding: 34px 0;
}
.fn-ref {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
  color: inherit;
  opacity: 0.75;
}
.footer-note {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.footer-note p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 760px;
}
.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-faint);
}

/* ==========================================================================
   Auth page
   ========================================================================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper-50);
}
.auth-side {
  background: var(--grad-hero);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-side .brand { margin-bottom: 0; }
.auth-quote {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.3;
  max-width: 420px;
}
.auth-quote span { color: var(--spark-400); }
.auth-side-foot { font-size: 13px; color: rgba(232, 230, 255, 0.6); }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-tabs {
  display: flex;
  background: var(--paper-100);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 30px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font-body);
}
.auth-tab.active { background: #fff; color: var(--text-ink); box-shadow: var(--shadow-soft); }

.auth-box h1 { font-size: 25px; margin-bottom: 6px; }
.auth-box > p.sub { margin-bottom: 26px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-ink);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-family: var(--font-body);
  font-size: 14.5px;
  background: #fff;
  color: var(--text-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(76, 60, 240, 0.15);
  outline: none;
}
.field-hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.form-msg {
  font-size: 13.5px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
}
.form-msg.error { background: #fee2e6; color: #b3182f; display: block; }
.form-msg.success { background: #e3f9ee; color: #16794a; display: block; }

.auth-foot-link { margin-top: 22px; text-align: center; font-size: 13.5px; color: var(--text-muted); }
.auth-foot-link a { color: var(--indigo-500); font-weight: 600; }

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ==========================================================================
   Dashboard (личный кабинет)
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper-50);
}

.sidebar {
  background: var(--ink-950);
  color: #fff;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-height: 0;
  overflow-y: auto;
}
.sidebar .brand { padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.66);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.active { background: rgba(124, 58, 237, 0.28); color: #fff; }
.side-link .ic { width: 18px; text-align: center; font-size: 15px; }

.side-user {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.side-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--grad-signal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.side-user-info { min-width: 0; flex: 1; }
.side-user-info div:first-child { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info div:last-child { font-size: 11.5px; color: rgba(255, 255, 255, 0.5); }
.side-logout { background: none; border: none; color: rgba(255, 255, 255, 0.5); cursor: pointer; font-size: 16px; }
.side-logout:hover { color: #fff; }

.main-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  flex-shrink: 0;
}
.topbar h1 { font-size: 21px; }
.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--paper-100);
  color: var(--violet-600);
}

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }

/* --- Chat view --- */
.chat-view { padding: 26px 32px; gap: 18px; min-height: 0; overflow: hidden; }
.chat-composer { flex-shrink: 0; }
.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chat-attachments:empty { margin-bottom: 0; }
.chat-attach-thumb {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-100);
  flex-shrink: 0;
}
.chat-attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.chat-attach-thumb button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(11, 10, 36, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-attach-thumb button:hover { background: #b3182f; }
.chat-attach-btn {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chat-attach-btn:hover { background: var(--paper-100); border-color: var(--indigo-500); }
.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-width: 100%;
}
.msg-images img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  cursor: zoom-in;
  border: 1px solid var(--line);
}
.chat-window {
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  scroll-behavior: smooth;
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.msg { max-width: 68%; display: flex; flex-direction: column; gap: 4px; }
.msg.human { align-self: flex-end; align-items: flex-end; }
.msg.ai { align-self: flex-start; align-items: flex-start; }
.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* --- markdown в ответах ассистента --- */
/* переносы расставляет уже разметка, pre-wrap здесь дал бы двойные отступы */
.msg-markdown { white-space: normal; overflow-wrap: anywhere; }
.msg-markdown > *:first-child { margin-top: 0; }
.msg-markdown > *:last-child { margin-bottom: 0; }
.msg-markdown p { margin: 0 0 10px; color: inherit; line-height: 1.55; }
.msg-markdown h3,
.msg-markdown h4,
.msg-markdown h5,
.msg-markdown h6 {
  font-family: var(--font-display);
  color: var(--text-ink);
  margin: 16px 0 8px;
  line-height: 1.25;
}
.msg-markdown h3 { font-size: 16.5px; }
.msg-markdown h4 { font-size: 15px; }
.msg-markdown h5,
.msg-markdown h6 { font-size: 14px; }
.msg-markdown ul,
.msg-markdown ol { margin: 0 0 10px; padding-left: 22px; }
.msg-markdown li { margin-bottom: 4px; }
.msg-markdown li::marker { color: var(--violet-600); }
.msg-markdown strong { font-weight: 600; color: var(--text-ink); }
.msg-markdown a { color: var(--indigo-500); text-decoration: underline; }
.msg-markdown a:hover { color: var(--violet-600); }
.msg-markdown code {
  font-family: var(--font-mono);
  font-size: 12.8px;
  background: rgba(108, 43, 217, 0.1);
  color: var(--violet-600);
  padding: 1px 5px;
  border-radius: 5px;
}
.msg-markdown pre {
  background: var(--ink-950);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 10px;
}
.msg-markdown pre code {
  background: none;
  color: #e6e3ff;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.5;
}
.msg-markdown blockquote {
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--text-muted);
}
.msg-markdown hr {
  border: none;
  border-top: 1px solid var(--line-strong);
  margin: 14px 0;
}
.msg-markdown table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 10px;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}
.msg-markdown th,
.msg-markdown td {
  border: 1px solid var(--line-strong);
  padding: 6px 10px;
  text-align: left;
}
.msg-markdown th { background: rgba(108, 43, 217, 0.08); font-weight: 600; color: var(--text-ink); }
.msg.human .msg-bubble { background: var(--grad-signal); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai .msg-bubble { background: var(--paper-100); color: var(--text-ink); border-bottom-left-radius: 4px; }
.msg-label { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  max-width: 340px;
}
.chat-empty .feature-icon { margin: 0 auto 16px; }

.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  padding: 13px 16px;
  font-family: var(--font-body);
  font-size: 14.5px;
  min-height: 50px;
  max-height: 160px;
  background: #fff;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--indigo-500); box-shadow: 0 0 0 3px rgba(76, 60, 240, 0.15); }
.chat-hint { font-size: 12px; color: var(--text-faint); margin-top: 8px; }
.typing-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint);
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* --- Calendar view --- */
.calendar-view { padding: 26px 32px; gap: 18px; min-height: 0; overflow-y: auto; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; }
.calendar-nav { display: flex; align-items: center; gap: 14px; }
.calendar-nav button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; cursor: pointer; font-size: 14px; color: var(--text-ink);
}
.calendar-nav button:hover { background: var(--paper-100); }
.calendar-month-label { font-family: var(--font-display); font-size: 18px; min-width: 170px; text-align: center; }

.calendar-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(108px, 1fr);
  gap: 8px;
}
.calendar-weekday {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 4px 6px;
}
.calendar-cell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}
.calendar-cell:hover { border-color: var(--line-strong); box-shadow: var(--shadow-soft); }
.calendar-cell.outside { opacity: 0.38; }
.calendar-cell.today { border-color: var(--indigo-500); box-shadow: 0 0 0 2px rgba(76, 60, 240, 0.15); }
.calendar-date { font-size: 12.5px; font-weight: 600; color: var(--text-ink); }
.calendar-posts { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.calendar-post-chip {
  font-size: 10.8px;
  padding: 3px 6px;
  border-radius: 6px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* --- Profile view --- */
.profile-view { padding: 32px; min-height: 0; overflow-y: auto; }
.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 480px;
}
.profile-row { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.profile-row:last-child { border-bottom: none; }
.profile-row span:first-child { color: var(--text-muted); }
.profile-row span:last-child { font-weight: 600; color: var(--text-ink); }

.profile-card-about { margin-top: 20px; }
.profile-card-about h3 { font-size: 17px; margin-bottom: 6px; }
.profile-card-about .sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.55; }
.profile-card-about textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 140px;
  resize: vertical;
  background: #fff;
  color: var(--text-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.profile-card-about textarea:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(76, 60, 240, 0.15);
}
.profile-card-about .field-hint { text-align: right; }

/* --- Публикация в соцсети --- */
.profile-card-social { margin-top: 20px; max-width: 560px; }
.profile-card-social h3 { font-size: 17px; margin-bottom: 6px; }
.profile-card-social .sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.55; }
.social-loading { font-size: 13.5px; color: var(--text-faint); }
.social-list { display: flex; flex-direction: column; gap: 12px; }

.social-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.social-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: #fff;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  transition: background 0.15s ease;
}
.social-head:hover { background: var(--paper-50); }
.social-head .channel-dot { width: 30px; height: 30px; font-size: 11px; }
.social-head .social-name { flex: 1; font-size: 14.5px; font-weight: 600; color: var(--text-ink); }
.social-head .chevron { color: var(--text-faint); font-size: 13px; transition: transform 0.18s ease; }
.social-item.open .chevron { transform: rotate(90deg); }

.social-status {
  font-size: 11.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.social-status.on { background: #e3f9ee; color: #16794a; }
.social-status.off { background: var(--paper-100); color: var(--text-muted); }
.social-status.paused { background: #fff3e0; color: #a35b00; }

.social-body {
  display: none;
  padding: 4px 16px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper-50);
}
.social-item.open .social-body { display: block; }
.social-body .field { margin-top: 14px; margin-bottom: 0; }
.social-body .field input {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-family: var(--font-body);
  font-size: 14px;
  background: #fff;
  color: var(--text-ink);
}
.social-body .field input:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(76, 60, 240, 0.15);
}
.social-help {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(108, 43, 217, 0.06);
  border-radius: var(--radius-sm);
}
.social-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.social-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 14px;
  cursor: pointer;
}
.social-toggle input { width: 16px; height: 16px; cursor: pointer; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; padding: 14px; }
  .sidebar .brand span { display: none; }
  .side-nav { flex-direction: row; }
  .side-user { display: none; }
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 10, 36, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-soft);
}
.modal-box h3 { font-size: 19px; margin-bottom: 4px; }
.modal-box .sub { font-size: 13.5px; margin-bottom: 20px; }
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-family: var(--font-body);
  font-size: 14.5px;
  background: #fff;
  color: var(--text-ink);
}
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-family: var(--font-body);
  font-size: 14.5px;
  min-height: 90px;
  resize: vertical;
}

.image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.image-gallery:empty { margin-bottom: 0; }
.image-thumb {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-100);
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.image-thumb .image-thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(11, 10, 36, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-thumb .image-thumb-remove:hover { background: #b3182f; }
.image-thumb.uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
}
.image-thumb.uploading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid var(--indigo-500);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
  z-index: 1;
}
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }
.modal-close { position: absolute; }

.day-posts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin: 4px 0 4px;
}
.day-post-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.day-post-item:hover { border-color: var(--line-strong); background: var(--paper-50); }
.day-post-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.day-post-item .info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.day-post-item .time-net {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-ink);
  font-family: var(--font-mono);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-post-item .snippet {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-post-item .arrow { color: var(--text-faint); flex-shrink: 0; }

/* --- Рилсы --- */
.calendar-post-chip.is-reel {
  /* тонкая светлая рамка, чтобы видео отличалось от обычного поста */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.reel-video-wrap {
  margin: 4px 0 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--ink-950);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 420px;
}
.reel-video-wrap video {
  width: 100%;
  max-height: 420px;
  display: block;
  background: #000;
}
.reel-video-empty {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13.5px;
  padding: 40px 16px;
  text-align: center;
}
.reel-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-ink);
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
  padding: 12px 14px;
  background: var(--paper-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink-950);
  color: #fff;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: var(--shadow-soft);
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b3182f; }

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-50);
  color: var(--text-muted);
  font-size: 14px;
}

/* ==========================================================================
   Lightbox (fullscreen image viewer)
   ========================================================================== */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 10, 36, 0.92);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox-overlay.open {
  display: flex;
  animation: lightbox-fade 0.16s ease;
}
@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.18); }

@media (max-width: 620px) {
  .lightbox-overlay { padding: 16px; }
  .lightbox-close { top: 12px; right: 12px; }
}
