/* ============================================================
   БаннерСлот — стили
   ============================================================ */

   :root {
    --bg:       #0e1116;
    --bg2:      #161a22;
    --bg3:      #1d222c;
    --border:   #262c38;
    --text:     #e6e9ef;
    --muted:    #8a93a6;
    --accent:   #4f8cff;
    --accent-h: #6ea0ff;
    --ok:       #3ecf8e;
    --warn:     #f0b429;
    --danger:   #ff5c5c;
    --radius:   10px;
    --gap:      16px;
    --font:     system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono:     ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
  
  html[data-theme="light"] {
    --bg:       #f6f7f9;
    --bg2:      #ffffff;
    --bg3:      #eef1f5;
    --border:   #d9dee7;
    --text:     #1a1f2b;
    --muted:    #6b7488;
    --accent:   #2f6fed;
    --accent-h: #1f5cd9;
    --ok:       #1e9c68;
    --warn:     #c98a10;
    --danger:   #d94343;
  }
  
  * { box-sizing: border-box; }
  
  html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
  }
  
  a { color: var(--accent); text-decoration: none; }
  a:hover { color: var(--accent-h); text-decoration: underline; }
  
  code, pre {
    font-family: var(--mono);
    background: var(--bg3);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: .92em;
  }
  
  h1, h2, h3 { font-weight: 600; margin: 0 0 12px; line-height: 1.25; }
  h1 { font-size: 24px; }
  h2 { font-size: 17px; color: var(--text); }
  p  { margin: 6px 0; }
  
  .muted      { color: var(--muted); }
  .small      { font-size: 13px; }
  .center     { text-align: center; }
  .big        { font-size: 26px; font-weight: 700; }
  
  /* -------- Layout -------- */
  .topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    position: sticky; top: 0; z-index: 10;
  }
  .topbar .logo {
    font-weight: 700; color: var(--text); font-size: 17px; letter-spacing: .3px;
  }
  .topbar .logo:hover { text-decoration: none; color: var(--accent); }
  
  .mainnav {
    display: flex; flex-wrap: wrap; gap: 4px; flex: 1;
  }
  .mainnav a {
    color: var(--muted); padding: 6px 10px; border-radius: 8px;
    font-size: 14px;
  }
  .mainnav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
  .mainnav a.on    { background: var(--bg3); color: var(--text); }
  
  .userbox {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px;
  }
  .userbox .rank {
    background: var(--bg3); padding: 2px 8px; border-radius: 6px;
    font-weight: 600; color: var(--accent);
  }
  .userbox .bal {
    font-family: var(--mono); color: var(--muted);
  }
  
  .wrap { max-width: 1100px; margin: 20px auto; padding: 0 20px; }
  
  .foot {
    max-width: 1100px; margin: 40px auto 20px; padding: 0 20px;
    color: var(--muted); font-size: 13px;
  }
  
  /* -------- Cards & grid -------- */
  .card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: var(--gap);
  }
  .card > h2:first-child { margin-top: 0; }
  
  .grid { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
  .cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  @media (max-width: 800px) {
    .cols-2, .cols-3 { grid-template-columns: 1fr; }
  }
  
  /* -------- Forms -------- */
  .form { display: flex; flex-direction: column; gap: 10px; }
  .form label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 13px; color: var(--muted);
  }
  .form input[type=text],
  .form input[type=password],
  .form input[type=number],
  .form input[type=date],
  .form input[type=url],
  .form input[type=email],
  .form input[type=tel],
  .form input[type=search],
  .form select,
  .form textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    width: 100%;
  }
  .form input:focus, .form select:focus, .form textarea:focus {
    outline: none;
    border-color: var(--accent);
  }
  .form fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    margin: 0;
  }
  .form legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
  .form .chk { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
  
  .inlineform { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
  .inlineform label { flex-direction: column; }
  
  /* -------- Buttons -------- */
  .btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
  }
  .btn:hover { background: var(--accent-h); text-decoration: none; color: #fff; }
  .btn:disabled { opacity: .5; cursor: not-allowed; }
  .btn.small  { padding: 6px 10px; font-size: 13px; }
  .btn.ghost  { background: transparent; color: var(--text); border: 1px solid var(--border); }
  .btn.ghost:hover { background: var(--bg3); color: var(--text); }
  .btn.danger { background: var(--danger); }
  .btn.danger:hover { background: #ff7777; }
  
  /* -------- Badges & flash -------- */
  .badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
  }
  .badge.ok     { background: rgba(62,207,142,.15); color: var(--ok); }
  .badge.warn   { background: rgba(240,180,41,.15); color: var(--warn); }
  .badge.danger { background: rgba(255,92,92,.15);  color: var(--danger); }
  
  .flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid var(--border);
    background: var(--bg2);
  }
  .flash-ok    { border-color: rgba(62,207,142,.4); color: var(--ok); }
  .flash-error { border-color: rgba(255,92,92,.4);  color: var(--danger); }
  .flash-warn  { border-color: rgba(240,180,41,.4); color: var(--warn); }
  .flash-info  { color: var(--muted); }
  
  /* -------- Tabs -------- */
  .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
  .tabs a {
    padding: 6px 12px; border-radius: 8px; background: var(--bg2);
    border: 1px solid var(--border); color: var(--muted); font-size: 13px;
  }
  .tabs a:hover { color: var(--text); text-decoration: none; }
  .tabs a.on    { background: var(--bg3); color: var(--text); border-color: var(--accent); }
  
  /* -------- Tables -------- */
  .tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
  .tbl th, .tbl td {
    text-align: left; padding: 8px 10px;
    border-bottom: 1px solid var(--border);
  }
  .tbl th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
  .tbl tr:hover td { background: var(--bg3); }
  
  /* -------- Lists -------- */
  .list { list-style: none; padding: 0; margin: 0; }
  .list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: baseline; }
  .list li:last-child { border-bottom: none; }
  
  /* -------- Referrals -------- */
  .refcard .refhead {
    display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px;
  }
  .refcard .refstats { display: flex; gap: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
  .refcard .refbody {
    display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px;
  }
  @media (max-width: 900px) {
    .refcard .refbody { grid-template-columns: 1fr; }
  }
  .refcard .col { min-width: 0; }
  
  /* -------- Matrix tree -------- */
  .tree { list-style: none; padding-left: 16px; margin: 4px 0; border-left: 1px dashed var(--border); }
  .tree li { padding: 4px 0; }
  .tree .node { display: inline-block; padding: 3px 8px; border-radius: 6px; background: var(--bg3); }
  .tree li.off .node { opacity: .5; text-decoration: line-through; }
  
  /* -------- Surf -------- */
  .surflist { display: flex; flex-wrap: wrap; gap: 14px; }
  .surfitem {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 8px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg3);
  }
  .surfitem.done { filter: grayscale(1); opacity: .55; }
  .surfimg {
    display: block; object-fit: cover; border-radius: 6px;
    background: var(--bg2);
  }
  .surfimg.w200h200 { width: 200px; height: 200px; }
  .surfimg.w200h300 { width: 200px; height: 300px; }
  .surfimg.placeholder {
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 13px; border: 1px dashed var(--border);
  }
  .surflink { font-size: 15px; }
  .surflink.done { text-decoration: line-through; color: var(--muted); }
  
  /* -------- Proofs / reviews -------- */
  .proofcard { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--bg3); }
  .proofcard img { width: 100%; height: auto; border-radius: 6px; display: block; }
  .proofcard p { font-size: 13px; margin: 6px 0 0; }
  
  .reviews { list-style: none; padding: 0; margin: 0; }
  .reviews > li { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .reviews .revhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .reviews .stars { color: var(--warn); letter-spacing: 2px; }
  .reviews .revbody { margin-top: 4px; }
  
  /* -------- Article -------- */
  .article .body { line-height: 1.65; }
  .article .body img { max-width: 100%; height: auto; border-radius: 8px; }
  
  /* -------- Small screen -------- */
  @media (max-width: 600px) {
    .topbar { padding: 8px 12px; }
    .wrap   { padding: 0 12px; }
    h1      { font-size: 20px; }
    .userbox .bal { display: none; }
  }
  /* таблица в карточке: не вылазит на мобилке */
.tblwrap { overflow-x: auto; }

.tbl td.mono,
.tbl .mono { font-family: var(--mono); font-size: 13px; white-space: nowrap; }

.tbl td.actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}
.tbl td.actions form.inline { display: inline; margin: 0; }

.btn.ghost.small { padding: 5px 9px; font-size: 12px; }
.btn.small        { padding: 5px 9px; font-size: 12px; }

.form .row { display: flex; gap: 8px; flex-wrap: wrap; }
/* прогресс-бар */
.progress {
  display: block;
  width: 100%;
  height: 6px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* визуализация матрицы */
.matrixviz {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.vizlevel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.vizlabel {
  min-width: 160px;
  font-size: 13px;
  color: var(--muted);
}
.vizslots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.slot {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
}
.slot.on  { background: var(--accent); border-color: var(--accent); }
.slot.off { background: transparent; }
.slotmore {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 16px;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg3);
  border-radius: 4px;
}

.tbl tfoot th {
  border-top: 2px solid var(--border);
  border-bottom: none;
  padding-top: 12px;
}

@media (max-width: 600px) {
  .vizlabel { min-width: 120px; font-size: 12px; }
  .slot { width: 14px; height: 14px; }
}
/* полотно объявлений */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.feedcard {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedhead { display: flex; gap: 8px; align-items: center; }
.feedhead .rank { color: var(--accent); font-weight: 600; font-size: 12px; }
.feedtitle { font-weight: 600; }
.feedbody { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.feedbody > div { display: flex; gap: 6px; align-items: baseline; }
.feedfoot { display: flex; justify-content: flex-end; margin-top: auto; }

/* форма в 2 колонки */
.gridform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.gridform .span2 { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .gridform { grid-template-columns: 1fr; }
  .gridform .span2 { grid-column: auto; }
}

/* чат */
.chat {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.chat .msg {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  max-width: 80%;
}
.chat .msg.me   { align-self: flex-end; border-color: var(--accent); }
.chat .msg.them { align-self: flex-start; }
.chat .msghead { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chat .msgbody { font-size: 14px; line-height: 1.45; }
/* биржа */
.tgcard { border-left: 3px solid var(--accent); }
.tgcard .btn { font-size: 15px; padding: 10px 18px; }

.adbox {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.adbox pre {
  width: 100%;
  margin: 0;
  padding: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  max-height: 320px;
  overflow-y: auto;
}
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.modal-head h2 { margin: 0; }
.modal-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.reviews .revimage { margin-top: 8px; }
.reviews .revimage img {
  max-width: 320px;
  max-height: 320px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
}
.reviews .revimage a { display: inline-block; }
.surfimg { cursor: pointer; }
.surfimg.placeholder { cursor: pointer; }
.surflink { cursor: pointer; }

.form input[type=file] {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
}
.article {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.article .body {
  line-height: 1.65;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.article pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0;
  max-width: 100%;
  box-sizing: border-box;
}

.article code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  word-break: break-word;
}

.article img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
/* ---- База знаний ---- */
.kb { display: flex; flex-direction: column; gap: 20px; }

.kb-cat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.kb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.kb-head h2 { margin: 0; font-size: 17px; }
.kb-head .small { margin: 0; }
.kb-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg3);
  padding: 2px 8px;
  border-radius: 6px;
}

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.kb-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.kb-card:hover {
  text-decoration: none;
  color: var(--text);
  border-color: var(--accent);
  background: var(--bg2);
}
.kb-card-title { font-size: 14px; font-weight: 500; }
.kb-card-arrow { color: var(--muted); font-size: 16px; }
.kb-card:hover .kb-card-arrow { color: var(--accent); }

@media (max-width: 600px) {
  .kb-grid { grid-template-columns: 1fr; }
  .kb-cat { padding: 12px; }
}
/* ---- Мобильное меню ---- */
.burger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 42px;
  height: 38px;
  padding: 9px 10px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  margin-left: auto;
  z-index: 70;
}
.burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

html, body { overflow-x: hidden; }

@media (max-width: 900px) {
  .burger { display: flex; }

  .mainnav {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 260px !important;
    max-width: 82vw !important;
    height: 100vh;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    padding: 70px 14px 20px;
    margin: 0;
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    transform: translateX(110%) !important;
    transition: transform .22s ease;
    z-index: 60;
    overflow-y: auto;
    box-sizing: border-box;
    flex: none !important;
  }
  .mainnav.open { transform: translateX(0) !important; }

  .mainnav a {
    display: block;
    padding: 11px 12px;
    font-size: 15px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar { flex-wrap: nowrap; }
  .userbox .bal { display: none; }
}

@media (min-width: 901px) {
  .nav-backdrop { display: none; }
}
/* ============================================================
   Мобильная адаптация серфинга и модалок
   ============================================================ */

/* Сетки — на мобилке всегда 1 колонка */
@media (max-width: 700px) {
  .grid.cols-2,
  .grid.cols-3 { grid-template-columns: 1fr; }
}

/* Список баннеров: карточки по центру, не вылезают */
@media (max-width: 700px) {
  .surflist {
    justify-content: center;
    gap: 10px;
  }
  .surfitem {
    max-width: 100%;
    padding: 6px;
  }
  .surfimg.w200h200 { width: 100%; max-width: 200px; height: auto; aspect-ratio: 1/1; }
  .surfimg.w200h300 { width: 100%; max-width: 200px; height: auto; aspect-ratio: 2/3; }
}

/* Модалка */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: flex-start;   /* прижимаем к верху, чтобы не центрировало за экран */
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal[hidden] { display: none; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
  max-height: none;           /* убираем 90vh, пусть растёт и скроллит родитель */
  overflow: visible;
  margin: 20px auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 4px 8px;
}

/* Форма внутри модалки — крупные тапы */
.modal .form input,
.modal .form select,
.modal .form textarea,
.modal .form button {
  font-size: 15px;
}
.modal .form .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.modal .form .row .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

/* Файловый инпут */
.form input[type=file] {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

/* Табы на мобилке — переносим, кнопка «Добавить» отдельной строкой */
@media (max-width: 700px) {
  .tabs {
    flex-wrap: wrap;
    gap: 6px;
  }
  .tabs a {
    flex: 1 1 auto;
    text-align: center;
  }
  .tabs .btn {
    flex: 1 1 100%;
    margin-top: 4px;
  }
}
/* ---- Карточки моих баннеров ---- */
.bannerlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.bannercard {
  display: flex;
  gap: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  align-items: flex-start;
}

.bannercard-preview {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bannercard-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bannercard-link {
  font-size: 28px;
  color: var(--muted);
}
.bannercard-placeholder {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 4px;
}

.bannercard-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bannercard-title {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bannercard-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bannercard-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.bannercard-stats b { color: var(--text); }

.bannercard-actions { margin-top: 4px; }

@media (max-width: 500px) {
  .bannerlist { grid-template-columns: 1fr; }
  .bannercard-preview { flex: 0 0 64px; width: 64px; height: 64px; }
}
.reviews .revimage { margin-top: 8px; }
.reviews .revimage img {
  max-width: 320px;
  max-height: 320px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  cursor: zoom-in;
}
.reviews .revimage a { display: inline-block; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form input[type=file] {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.flash-info { color: var(--muted); }
/* ---- Карточки рефералов ---- */
.refgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.refcard {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.refcard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.refcard-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.refcard-name b {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refcard-slot .badge {
  background: var(--bg3);
  color: var(--muted);
}

.refcard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 13px;
}
.refcard-stats > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
  justify-content: space-between;
}
.refcard-stats b { color: var(--text); font-weight: 600; }

.refcard-norm {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}

.refcard-actions {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 500px) {
  .refgrid { grid-template-columns: 1fr; }
}
.kb-card-emoji {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
}

.kb-card-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.kb-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-title-emoji {
  font-size: 28px;
  vertical-align: middle;
  margin-right: 4px;
}

.article h1 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.invitetext {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  min-height: 180px;
}