/* ===== Design tokens ===== */
:root{
  /* Shape */
  --radius: 18px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  /* Shadows */
  --shadow: 0 10px 30px rgba(0,0,0,.08);

  /* Accent (customizable). Use HSL so we can create pastel presets easily. */
  --accent-h: 258;
  --accent-s: 92%;
  --accent-l: 66%;
  --accent: hsl(var(--accent-h) var(--accent-s) var(--accent-l));
  /* softer accent for backgrounds */
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 30%, transparent);

  /* Light theme */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #0b0c10;
  --muted: rgba(11,12,16,.7);
  --border: rgba(11,12,16,.12);

  /* Controls */
  --input-bg: color-mix(in srgb, var(--surface) 86%, var(--bg));
  --chip-bg: color-mix(in srgb, var(--surface) 78%, var(--bg));
}
html[data-theme="dark"]{
  --bg: #0b0d12;
  --surface: #101522;
  --card: #101522;
  --text: #f3f4f6;
  --muted: rgba(243,244,246,.72);
  --border: rgba(243,244,246,.14);

  --input-bg: color-mix(in srgb, var(--surface) 88%, #000);
  --chip-bg: color-mix(in srgb, var(--surface) 82%, #000);

  --shadow: 0 14px 40px rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

/* Links */
a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: underline; text-underline-offset: 3px; }

/* Layout */
.container{ width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0; }
.stack{ display:flex; flex-direction:column; gap:12px; }
.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.spread{ display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap; }

/* Cards */
.card{
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.card.home{ margin-top: 18px; }

/* Typography */
h1,h2,h3{ margin: 0; letter-spacing: .2px; }
h1{ font-size: 24px; }
h2{ font-size: 18px; }
.small{ font-size: 13px; color: var(--muted); }

/* Inputs */
input, textarea, select{
  font: inherit;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-sm));
  padding: 10px 12px;
  outline: none;
}
textarea{ min-height: 100px; resize: vertical; }
input:focus, textarea:focus, select:focus{
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Buttons */
.btn, button.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  cursor: pointer;
  user-select:none;
  transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:hover{ box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.btn:active{ transform: scale(.98); }
.btn.primary{
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.btn.danger{
  background: color-mix(in srgb, #ef4444 18%, var(--surface));
  border-color: color-mix(in srgb, #ef4444 42%, transparent);
}
hr{ border:0; border-top:1px solid var(--border); margin: 10px 0; }

/* Pills / tags */
.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

/* Helpers */
.hidden{ display:none !important; }


/* Compatibility vars used by existing JS/HTML */
:root{
  --bg-color: var(--bg);
  --ui-color: var(--text);
  --accent-color: var(--accent);
}
html[data-theme="dark"]{
  --bg-color: var(--bg);
  --ui-color: var(--text);
  --accent-color: var(--accent);
}

/* ===== Page-specific (moved from inline <style>) ===== */
/* Небольшие стили под соцчасть, при этом общий стиль берётся из styles.css */
    .topbar { display:flex; gap:10px; justify-content:space-between; align-items:center; flex-wrap:wrap; }
    .topbar h1 { margin: 8px 0; font-size: 22px; }
    .meBox { display:flex; gap:10px; align-items:center; }
    .meAva {
      width: 40px; height: 40px; border-radius: 12px;
      display:grid; place-items:center;
      background: color-mix(in srgb, var(--bg-color) 70%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 25%, transparent);
      overflow:hidden;
    }
    .meAva img { width:100%; height:100%; object-fit:cover; display:block; }
    .muted { opacity:.75; font-size: 13px; }

    .composer textarea, .composer input {
      width: 100%;
      background: color-mix(in srgb, var(--bg-color) 75%, transparent);
      color: var(--ui-color);
      border: 1px solid color-mix(in srgb, var(--ui-color) 25%, transparent);
      border-radius: 14px;
      padding: 12px;
      outline: none;
    }
    .composer textarea { min-height: 90px; resize: vertical; }

    .grid2 { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
    @media (max-width: 740px){ .grid2 { grid-template-columns: 1fr; } }

    .post {
      margin-top: 12px;
      padding: 14px;
      border-radius: 18px;
      border: 1px solid color-mix(in srgb, var(--ui-color) 22%, transparent);
      background: color-mix(in srgb, var(--bg-color) 72%, transparent);
      box-shadow: 0 0 18px color-mix(in srgb, var(--accent-color) 10%, transparent);
    }
    .postHead { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
    .postLeft { display:flex; gap:10px; align-items:center; }
    .ava {
      width: 34px; height: 34px; border-radius: 12px;
      display:grid; place-items:center;
      background: color-mix(in srgb, var(--bg-color) 70%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 22%, transparent);
      overflow:hidden;
    }
    .ava img { width:100%; height:100%; object-fit:cover; display:block; }
    .mediaBox {
      margin-top: 10px;
      border-radius: 16px;
      overflow: hidden;
      border: 1px solid color-mix(in srgb, var(--ui-color) 18%, transparent);
    }
    .mediaBox img, .mediaBox video { width:100%; display:block; }

    .actions { display:flex; gap:10px; margin-top: 12px; flex-wrap:wrap; }
    .abtn {
      display:inline-flex; align-items:center; gap:8px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid color-mix(in srgb, var(--ui-color) 22%, transparent);
      background: transparent;
      color: var(--ui-color);
      cursor: pointer;
      transition: transform .08s ease, box-shadow .15s ease;
    }
    .abtn:active { transform: scale(.98); }
    .abtn.on {
      box-shadow: 0 0 20px color-mix(in srgb, var(--accent-color) 18%, transparent);
      border-color: color-mix(in srgb, var(--accent-color) 35%, transparent);
    }

    .comments {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed color-mix(in srgb, var(--ui-color) 18%, transparent);
      display:none;
    }
    .comments.on { display:block; }
    .citem { padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--ui-color) 10%, transparent); }
    .citem:last-child { border-bottom: 0; }
    .cform { display:flex; gap:10px; margin-top: 10px; }
    .cform input { flex: 1; }

    /* модалка профиля */
    .modalBack {
      position: fixed; inset: 0;
      background: rgba(0,0,0,.55);
      display:none;
      align-items: center; justify-content: center;
      padding: 18px;
      z-index: 20;
    }
    .modalBack.on { display:flex; }
    .modal {
      width: min(720px, 100%);
      border-radius: 22px;
      padding: 16px;
      border: 1px solid color-mix(in srgb, var(--ui-color) 25%, transparent);
      background: color-mix(in srgb, var(--bg-color) 85%, transparent);
      box-shadow: 0 0 30px color-mix(in srgb, var(--accent-color) 18%, transparent);
    }

.hdr{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding: 10px 14px;
      border-radius: 18px;
      background: color-mix(in srgb, var(--bg-color) 78%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 20%, transparent);
      position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px);
    }
    .card{
      background: color-mix(in srgb, var(--bg-color) 72%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 18%, transparent);
      border-radius: 20px;
      padding: 14px;
      margin-top: 12px;
    }
    .row{ display:grid; grid-template-columns: 88px 1fr; gap:12px; align-items:center; }
    .ava{
      width: 88px; height: 88px; border-radius: 28px;
      background: color-mix(in srgb, var(--ui-color) 14%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 18%, transparent);
      overflow:hidden;
      display:grid; place-items:center;
      font-size: 28px; font-weight: 800;
    }
    .ava img{ width:100%; height:100%; object-fit:cover; display:block; }
    input{
      width: 100%;
      background: color-mix(in srgb, var(--bg-color) 75%, transparent);
      color: var(--ui-color);
      border: 1px solid color-mix(in srgb, var(--ui-color) 18%, transparent);
      border-radius: 16px;
      padding: 12px;
      outline: none;
    }
    .muted{ color: var(--muted); font-size:13px; }
    .grid2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-top:10px; }
    @media (max-width: 720px){ .grid2{ grid-template-columns: 1fr; } }

.hdr{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding: 10px 14px;
      border-radius: 18px;
      background: color-mix(in srgb, var(--bg-color) 78%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 20%, transparent);
      position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px);
    }
    .card{
      background: color-mix(in srgb, var(--bg-color) 72%, transparent);
      border: 1px solid color-mix(in srgb, var(--ui-color) 18%, transparent);
      border-radius: 20px;
      padding: 14px;
      margin-top: 12px;
    }
    textarea, input{
      width: 100%;
      background: color-mix(in srgb, var(--bg-color) 75%, transparent);
      color: var(--ui-color);
      border: 1px solid color-mix(in srgb, var(--ui-color) 18%, transparent);
      border-radius: 16px;
      padding: 12px;
      outline: none;
    }
    textarea{ min-height: 140px; resize: vertical; }
    .row{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; margin-top:10px; }
    @media (max-width: 720px){ .row{ grid-template-columns: 1fr; } }
    .muted{ color: var(--muted); font-size:13px; }


/* ===== App layout (VK/Telegram-ish) ===== */
.appShell{
  width: min(1240px, calc(100% - 32px));
  margin: 16px auto;
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 16px;
}
.appHeader{
  width: min(1240px, calc(100% - 32px));
  margin: 16px auto 0;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight: 800;
  letter-spacing: .2px;
}
.brandDot{
  width: 12px; height: 12px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.search{
  flex: 1;
  display:flex;
  max-width: 520px;
}
.search input{
  width:100%;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
}
.headerActions{ display:flex; align-items:center; gap:10px; }
.iconBtn{
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  display:grid; place-items:center;
  cursor:pointer;
}
.iconBtn:hover{ filter: brightness(1.02); }
.pill{
  display:flex; align-items:center; gap:10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
}
.pill .ava{
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display:grid; place-items:center;
  font-weight:700;
}

/* Sidebars */
.sideCard{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.nav{
  display:flex; flex-direction:column; gap:6px;
}
.nav a{
  text-decoration:none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  display:flex; align-items:center; gap:10px;
}
.nav a:hover{ background: var(--accent-soft-2); }
.nav a.active{ background: var(--accent-soft); border: 1px solid var(--accent-border); }

.sectionTitle{
  margin: 6px 0 10px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .4px;
  text-transform: uppercase;
}

.chatList{ display:flex; flex-direction:column; gap:8px; }
.chatItem{
  display:flex; align-items:center; gap:10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
}
.chatItem .dot{
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.chatItem b{ font-size: 14px; }
.chatItem span{ display:block; font-size: 12px; color: var(--muted); }

/* Center column */
.centerCol{ display:flex; flex-direction:column; gap: 14px; }
.composer{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.composer textarea{
  width:100%;
  min-height: 92px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 12px;
}
.composerRow{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.fileBtn{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  cursor:pointer;
}
.fileBtn strong{ color: var(--accent); }
.primaryBtn{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 800;
  cursor:pointer;
}
.primaryBtn:hover{ filter: brightness(1.02); }
.preview{
  margin-top: 10px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.preview img, .preview video{ max-width:100%; border-radius: 14px; display:block; }

/* Mobile */
.mobileNav{
  position: fixed;
  left: 0; right:0; bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-top: 1px solid var(--border);
  display:none;
}
.mobileNav .row{
  display:flex; justify-content: space-around; gap: 10px;
}
.mobileNav a{
  text-decoration:none;
  color: var(--text);
  width: 44px; height: 44px;
  border-radius: 14px;
  display:grid; place-items:center;
}
.mobileNav a.active{
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

/* Responsive breakpoints */
@media (max-width: 1100px){
  .appShell{ grid-template-columns: 240px 1fr; }
  .rightCol{ display:none; }
}
@media (max-width: 820px){
  body{ padding-bottom: 84px; }
  .appHeader{ position: sticky; top: 10px; z-index: 10; }
  .appShell{
    grid-template-columns: 1fr;
    width: calc(100% - 20px);
  }
  .leftCol{ display:none; }
  .search{ display:none; }
  .mobileNav{ display:block; }
}

/* ===== Settings modal ===== */
.modalBackdrop{
  position: fixed; inset:0;
  background: rgba(0,0,0,.35);
  display:none;
  align-items:center; justify-content:center;
  padding: 16px;
  z-index: 50;
}
.modalBackdrop.open{ display:flex; }
.modal{
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.modalHead{
  display:flex; align-items:center; justify-content:space-between;
  gap: 10px;
}
.modalHead b{ font-size: 16px; }
.closeBtn{ border:none; background: transparent; color: var(--muted); cursor:pointer; font-size: 22px; }
.optRow{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 10px; }
.swatch{
  border: 1px solid var(--border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 8px 10px;
  cursor:pointer;
  display:flex; align-items:center; gap:10px;
}
.swatch i{
  width: 16px; height: 16px; border-radius: 999px; display:inline-block;
  background: var(--accent);
}
.swatch.active{ outline: 2px solid var(--accent-border); background: var(--accent-soft-2); }



/* ===== Auth pages ===== */
.authPage{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 500px at 30% 0%, var(--accent-soft), transparent 55%),
              radial-gradient(900px 500px at 80% 20%, rgba(0,0,0,.05), transparent 60%),
              var(--bg);
}
.authCard{
  width: min(520px, 92vw);
  padding: 18px;
}
.authBrand{
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom: 10px;
}
.authTitle{ margin: 6px 0 10px; }

/* ===== Badges ===== */
.nameBadges{
  display:inline-flex;
  gap:6px;
  margin-left: 8px;
  vertical-align: middle;
}
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0,0,0,.06);
}
html[data-theme="dark"] .badge{ border-color: rgba(255,255,255,.10); }
.badge.verified{
  background: rgba(0, 120, 255, .12);
  color: rgb(0, 120, 255);
}
.badge.admin{
  background: rgba(255, 180, 0, .14);
  color: rgb(200, 130, 0);
}

/* ===== Settings page ===== */
.settingsWrap{
  max-width: 820px;
  margin: 0 auto;
  padding: 18px;
}
.settingsGrid{
  display:grid;
  gap: 14px;
}
.settingRow{
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid rgba(0,0,0,.06);
}
html[data-theme="dark"] .settingRow{ border-color: rgba(255,255,255,.10); }
.presetRow{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
}
.presetBtn{
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: var(--card);
  cursor:pointer;
}
html[data-theme="dark"] .presetBtn{ border-color: rgba(255,255,255,.12); }
.presetSwatch{
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--accent);
}

/* ===== Toggle switch ===== */
.switch{ position: relative; display:inline-block; width: 44px; height: 26px; }
.switch input{ opacity:0; width:0; height:0; }
.slider{
  position:absolute; cursor:pointer; inset:0;
  background: rgba(0,0,0,.10);
  border-radius: 999px;
  transition: .18s;
}
html[data-theme="dark"] .slider{ background: rgba(255,255,255,.14); }
.slider:before{
  content:"";
  position:absolute; height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: var(--card);
  border-radius: 999px;
  transition: .18s;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
.switch input:checked + .slider{
  background: var(--accent-soft);
}
.switch input:checked + .slider:before{
  transform: translateX(18px);
}

.authBrandText{ display:flex; flex-direction:column; line-height:1.1; }
.authBrandName{ font-size:18px; }
.authBrandSub{ font-size:13px; }
.spacer{ height:10px; }


/* ===== Base theme application ===== */
html,body{ background: var(--bg); color: var(--text); }

/* Links */
a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: none; }

/* Clickable profile pill */
.pillLink{ cursor:pointer; }

/* Post media sizing */
.postMedia{ margin-top:12px; border-radius: var(--radius-sm); overflow:hidden; background: color-mix(in srgb, var(--surface) 86%, var(--bg)); border:1px solid var(--border); }
.postMedia img, .postMedia video{ display:block; width:100%; max-height:520px; object-fit:cover; }

/* Post actions */
.postActions{ display:flex; gap:10px; align-items:center; padding:10px 0 0; }
.actionBtn{ border:1px solid var(--border); background: var(--surface); border-radius: 999px; padding:8px 12px; font: inherit; cursor:pointer; display:inline-flex; gap:8px; align-items:center; }
.actionBtn:hover{ background: color-mix(in srgb, var(--surface) 86%, var(--bg)); }
.actionBtn.active{ border-color: var(--accent-border); background: var(--accent-soft); }

/* button that behaves like text link (for usernames) */
.linkBtn{ border:0; padding:0; margin:0; background:transparent; font:inherit; color:inherit; cursor:pointer; }
.linkBtn:hover{ text-decoration: underline; }
.actionCount{ color: var(--muted); font-size:13px; }

/* Comments */
.comments{ margin-top:10px; padding-top:10px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:10px; }
.comment{ display:flex; gap:10px; }
.comment .cAva{ width:32px; height:32px; border-radius:999px; background: var(--input-bg); display:flex; align-items:center; justify-content:center; font-weight:700; }
.comment .cBody{ flex:1; }
.commentInputRow{ display:flex; gap:10px; }
.commentInputRow input{ flex:1; }
.commentMeta{ color: var(--muted); font-size:12px; margin-top:2px; }

/* Switch (settings) */
.switch{ position:relative; display:inline-block; width:44px; height:26px; }
.switch input{ opacity:0; width:0; height:0; }
.switch .slider{ position:absolute; cursor:pointer; inset:0; background: color-mix(in srgb, var(--surface) 80%, var(--bg)); border:1px solid var(--border); transition:.2s; border-radius:999px; }
.switch .slider:before{ position:absolute; content:""; height:20px; width:20px; left:3px; top:2px; background: var(--surface); border-radius:999px; transition:.2s; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.switch input:checked + .slider{ background: var(--accent-soft); border-color: var(--accent-border); }
.switch input:checked + .slider:before{ transform: translateX(18px); }

/* Settings typography fixes */
.settingsWrap .muted{ color: var(--muted); }

/* Admin table */
.adminTable{ width:100%; border-collapse:separate; border-spacing:0 10px; }
.adminTable td{ background: var(--surface); border:1px solid var(--border); padding:10px; }
.adminTable td:first-child{ border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.adminTable td:last-child{ border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }


/* ===== Feed + Post cards ===== */
.feed{ display:flex; flex-direction:column; gap:12px; margin-top:12px; }
.postCard{
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.postHead{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.postAuthor{ display:flex; align-items:center; gap:10px; }
.postAva{
  width: 40px; height: 40px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  background: var(--input-bg);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}
.postAva img{ width:100%; height:100%; object-fit:cover; display:block; }
.postBody{ margin-top: 10px; white-space: pre-wrap; }

/* Make generic avatars behave (fix letter centering) */
.ava{
  width: 34px; height: 34px;
  border-radius: 12px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  background: var(--input-bg);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}
.ava.big{ width: 52px; height: 52px; border-radius: 16px; font-size: 22px; }
.ava img{ width:100%; height:100%; object-fit:cover; display:block; }

/* ===== Toast notifications ===== */
.toastHost{
  position: fixed;
  right: 14px;
  bottom: 76px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index: 9999;
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  width: min(360px, calc(100vw - 28px));
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateY(10px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}
.toast.show{ transform: translateY(0); opacity: 1; }
.toast.hide{ transform: translateY(10px); opacity: 0; }
.toastIcon{ width: 34px; height: 34px; border-radius: 12px; display:flex; align-items:center; justify-content:center; background: var(--accent-soft); border: 1px solid var(--accent-border); }
.toastTitle{ font-weight: 700; }
.toastText{ color: var(--muted); font-size: 13px; margin-top: 2px; }
.toastClose{
  margin-left:auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor:pointer;
  padding: 2px 6px;
  font-size: 14px;
}
.toastClose:hover{ color: var(--text); }

/* ===== Fixes: missing vars + button text color on dark ===== */
:root{ --card: color-mix(in srgb, var(--surface) 92%, transparent); }
html[data-theme="dark"]{ --card: color-mix(in srgb, var(--surface) 94%, transparent); }
button{ color: var(--text); }
.presetBtn, .settingRow{ color: var(--text); }

/* ===== Feed + post cards (used on index + profile) ===== */
.feed{ display:flex; flex-direction:column; gap:12px; }
.postCard{
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--card);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 10%, transparent);
}
.postHead{ display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.postAuthor{ display:flex; gap:10px; align-items:center; }
.postAva, .ava, .meAva{
  width: 36px; height: 36px;
  border-radius: 12px;
  display:flex; align-items:center; justify-content:center;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  overflow:hidden;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}
.meAva{ width:40px; height:40px; }
.ava.big{ width: 54px; height: 54px; border-radius: 18px; font-size: 22px; }
.postAva img, .ava img, .meAva img{ width:100%; height:100%; object-fit:cover; display:block; }
.postBody{ margin-top: 10px; white-space: pre-wrap; }

/* ===== Toast notifications ===== */
.toastStack{
  position: fixed;
  right: 14px;
  top: 74px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index: 9999;
  max-width: min(380px, calc(100% - 28px));
}
.toast{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 12px;
}
.toastTitle{ font-weight: 800; }
.toastText{ margin-top:4px; color: var(--muted); }
.toastMeta{ margin-top:6px; font-size: 12px; color: var(--muted); }



/* ===== Comments: avatar ===== */
.commentList{ display:flex; flex-direction:column; gap:10px; margin-top: 10px; }
.commentRow{ display:flex; gap:10px; align-items:flex-start; }
.commentLeft{ display:flex; flex-direction:column; gap:2px; min-width: 120px; }
.postComments{ margin-top: 10px; }
.commentInputRow{ display:flex; gap:10px; margin-top: 10px; }
.commentInputRow input{ flex:1; min-width: 0; }

/* ===== Chats: adaptive layout ===== */
.chatLayout{ display:grid; grid-template-columns: 320px 1fr; min-height: 520px; }
@media (max-width: 820px){
  .chatLayout{ display:flex; flex-direction:column; min-height: auto; }
  .chatLayout aside{ border-right: 0 !important; border-bottom: 1px solid var(--border); }
  #chatMsgs{ max-height: 55vh; }
}
