/* static/style.css */
:root{
  --bg:#0e0b14;
  --panel:#151320;
  --muted:#9ca3af;
  --text:#e5e7eb;
  --violet:#a855f7;
  --pink:#ec4899;
  --grad: linear-gradient(135deg, var(--violet), var(--pink));
  --shadow: 0 12px 30px rgba(236,72,153,.15), 0 4px 12px rgba(168,85,247,.2);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial}

.topbar{height:56px;display:flex;align-items:center;gap:12px;padding:0 12px;background:rgba(21,19,32,.7);backdrop-filter:blur(8px);position:sticky;top:0;z-index:50;border-bottom:1px solid rgba(255,255,255,.06)}
.hamburger{width:40px;height:40px;display:flex;flex-direction:column;justify-content:center;gap:5px;background:transparent;border:none;cursor:pointer}
.hamburger span{height:2px;background:linear-gradient(90deg,var(--violet),var(--pink));border-radius:2px;display:block;transition:all .2s ease}
.stats{min-width:180px;font-weight:600}
.spacer{flex:1}
.btn{
  background-image:var(--grad);
  color:white;
  border:none;
  border-radius:16px;     /* было 12px */
  padding:10px 16px;
  box-shadow:var(--shadow);
  cursor:pointer;
  transition:transform .15s, box-shadow .15s
}
.btn.small{
  padding:6px 12px;
  border-radius:14px;     /* было 10px */
  font-size:.9rem
}
.btn.ghost{background-image:none;background:rgba(255,255,255,.08)}
.btn:hover{transform:translateY(-1px);box-shadow:0 16px 36px rgba(236,72,153,.24),0 8px 18px rgba(168,85,247,.28)}
.btn.red{background-image:linear-gradient(135deg,#ef4444,#f97316)}

.sidemenu{position:fixed;left:0;top:56px;bottom:0;width:280px;background:var(--panel);transform:translateX(-100%);transition:transform .25s ease;z-index:40;border-right:1px solid rgba(255,255,255,.06)}
.sidemenu.open{transform:translateX(0)}
.side-header{display:flex;gap:12px;align-items:center;padding:16px;border-bottom:1px solid rgba(255,255,255,.06)}
.avatar{width:40px;height:40px;border-radius:50%;background:var(--grad);display:flex;align-items:center;justify-content:center;font-weight:800}
.userdata{display:flex;flex-direction:column}
.muted{color:var(--muted);font-size:.9rem}
.side-nav{display:flex;flex-direction:column;padding:8px}
.side-item{display:block;text-decoration:none;color:var(--text);padding:10px 12px;border-radius:10px;transition:background .15s ease}
.side-item:hover{background:rgba(255,255,255,.06)}
.sep{height:1px;background:rgba(255,255,255,.06);margin:8px 0}

.content{padding:16px;max-width:1100px;margin:16px auto}
.card{background:var(--panel);border-radius:16px;padding:16px;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.hidden{display:none}

.grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.cat{display:flex;flex-direction:column;align-items:center;gap:6px;padding:16px;border-radius:14px;background:rgba(255,255,255,.03);cursor:pointer;transition:transform .12s ease, background .12s ease}
.cat:hover{transform:translateY(-2px);background:rgba(255,255,255,.06)}
.icon{width:56px;height:56px;border-radius:14px;display:flex;align-items:center;justify-content:center;font-size:28px}
.grad{background:var(--grad);color:transparent;-webkit-background-clip:text;background-clip:text}
.label{font-weight:600}

.form{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.form input{background:#0f0d18;color:var(--text);border:1px solid rgba(255,255,255,.08);border-radius:10px;padding:10px}
.tabs{display:flex;gap:8px;margin-top:8px}
.tab{background:transparent;border:none;color:var(--text);padding:8px 12px;border-radius:10px;cursor:pointer}
.tab.active{background:rgba(255,255,255,.06)}
.pane.hidden{display:none}

.list{margin-top:16px;display:flex;flex-direction:column;gap:8px}
.item{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border-radius:10px;background:rgba(255,255,255,.03)}
.item .name{display:flex;align-items:center;gap:8px}
.item .act{display:flex;gap:8px}

/* Checkbox/select in site style */
input[type="checkbox"]{accent-color: var(--violet); width: 18px; height: 18px; border-radius:6px}
select{background:#0f0d18;color:var(--text);border:1px solid rgba(255,255,255,.1);border-radius:10px;padding:6px 8px}

/* Modal picker */
.modal{position:fixed;inset:0;background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center;z-index:60}
.modal.open{display:flex}
.modal .box{background:var(--panel);border-radius:14px;padding:12px;min-width:280px;max-width:420px;box-shadow:var(--shadow)}
.modal .box h3{margin:6px 6px 10px 6px}
.picker-list{max-height:48vh;overflow:auto;display:flex;flex-direction:column;gap:8px}
.picker-item{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:rgba(255,255,255,.04);border-radius:10px;cursor:pointer}
.picker-item:hover{background:rgba(255,255,255,.08)}
.picker-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}

/* DM mobile helpers */
@media (max-width:700px){
  .dm-wrap{display:flex;flex-direction:column;gap:8px}
  .dm-sidebar{order:1;width:100%}
  .dm-chat{order:2;height:60vh;overflow:auto}
  .dm-input{position:sticky;bottom:0;background:var(--panel)}
}

@media (max-width:900px){
  .grid{grid-template-columns:repeat(2,1fr)}
  .topbar .stats{display:none}
  .content{padding:12px}
}
@media (max-width:600px){
  .grid{grid-template-columns:repeat(1,1fr)}
  .item{flex-direction:column; align-items:flex-start; gap:6px}
  .item .act{width:100%; display:flex; flex-wrap:wrap; justify-content:flex-start}
  .sidemenu{width:86%}
  .form{width:100%}
  .topbar{gap:6px}
}

/* === Track carousel (music) === */
#clm-track-carousel.clm-track-carousel{
  display:none;
  position:relative;
  height:100%;              /* было: 190px */
  overflow:hidden;
  border-radius:14px;
  background: radial-gradient(1200px 420px at 50% 120%, rgba(236,72,153,.08), rgba(148,163,184,.06));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 8px 22px rgba(0,0,0,.25);
  margin-bottom:10px;
}

/* style.css — усилить плавность карточек карусели */
#clm-track-carousel .clm-card{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);
  padding:14px 16px;
  border-radius:16px;
  background: linear-gradient(135deg, rgba(236,72,153,.24), rgba(148,163,184,.18));
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 26px rgba(236,72,153,.18), 0 0 0 1px rgba(255,255,255,.06) inset;
  cursor:pointer;
  user-select:none;
  width:86%;
  max-width:800px;
  text-align:center;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  transition: transform .35s cubic-bezier(.22,.61,.36,1), opacity .35s ease, box-shadow .35s ease, background .25s ease;
}
#clm-track-carousel .clm-card.current{
  background: linear-gradient(135deg, rgba(236,72,153,.35), rgba(168,85,247,.28));
  box-shadow: 0 16px 34px rgba(236,72,153,.28), 0 0 0 1px rgba(255,255,255,.08) inset;
}

/* Fullscreen overlay controls */
#clm-fs-overlay{
  display:none;
}
#clm-fs-overlay .btn{
  background-image:var(--grad);
  border-radius:16px;
}

/* Compact on small screens */
@media (max-width:600px){
  #clm-track-carousel.clm-track-carousel{ height:140px; }
  #clm-track-carousel .clm-card{ font-size:.95rem; }
}

/* === Chat voice / inline players === */
.dm-voice {
  display:flex; align-items:center; gap:10px; min-width:220px;
}
.dm-voice .btn {
  border-radius:999px; width:42px; height:42px; min-width:42px;
}
.dm-voice .time {
  color:var(--muted); font-size:12px; min-width:96px;
}
.dm-voice .bar {
  flex:1; height:6px; border-radius:999px; background:rgba(255,255,255,.16);
  -webkit-appearance: none; appearance: none; outline: none;
}
.dm-voice .bar::-webkit-slider-runnable-track {
  height:6px; border-radius:999px; background: transparent;
}
.dm-voice .bar::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none; width:0; height:0; background:transparent; border:none;
}
.dm-voice .bar::-moz-range-track {
  height:6px; border-radius:999px; background: transparent;
}
.dm-voice .bar::-moz-range-thumb { width:0; height:0; border:none; background:transparent; }

/* Общий мини-ряд для превью файлов в чате */
.dm-file-title { font-weight:600; }
.dm-docthumb {
  width:64px; height:64px; border-radius:8px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; background:rgba(59,130,246,.18);
  border:1px solid rgba(59,130,246,.35); cursor:pointer;
}
.dm-docthumb .ext { font-weight:700; font-size:12px; }
.dm-docthumb .dot { opacity:.6; }

/* Ползунки (универсально, с заливкой прогресса) */
input[type="range"]{
  -webkit-appearance:none; appearance:none;
  height:8px; border-radius:999px; cursor:pointer; outline:none;
  background: linear-gradient(90deg, rgba(168,85,247,.6) 0%, rgba(255,255,255,.16) 0%);
}
input[type="range"]::-webkit-slider-runnable-track{ height:8px; border-radius:999px; background: transparent; }
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:14px; height:14px; border-radius:50%;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  border:none; box-shadow:0 2px 8px rgba(0,0,0,.35);
}
input[type="range"]::-moz-range-track{ height:8px; border-radius:999px; background: transparent; }
input[type="range"]::-moz-range-thumb{
  width:14px; height:14px; border-radius:50%;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  border:none; box-shadow:0 2px 8px rgba(0,0,0,.35);
}

/* Скроллбары в стиле сайта (везде) */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-track{ background: rgba(255,255,255,.06); border-radius:10px; }
*::-webkit-scrollbar-thumb{
  background: linear-gradient(135deg, rgba(168,85,247,.45), rgba(236,72,153,.45));
  border-radius:10px; border:1px solid rgba(255,255,255,.12);
}
*{ scrollbar-width: thin; scrollbar-color: rgba(168,85,247,.55) rgba(255,255,255,.08); }

/* === DM header (экран чата) === */
.dm-header{
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* лево | центр | право */
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 6px 0 10px 0;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.dm-header .btn.ghost{ background:rgba(255,255,255,.06); }

/* центр больше не позиционируем, просто выравниваем */
.dm-head-center{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  /* СБРОС старых трюков: */
  position: static;
  left: auto;
  transform: none;
}

#dm-ava{ width:30px; height:30px; border-radius:50%; object-fit:cover; }
.dm-head-name{ font-weight:700; }
.dm-head-sub{ font-size:12px; }

/* явное выравнивание крайних кнопок (не обязательно, но наглядно) */
#dm-back{ justify-self: start; }
#btn-call-dm{ justify-self: end; }

/* Голосовые — чуть крупнее, аккуратный прогресс */
.dm-voice{ display:flex; align-items:center; gap:10px; min-width:260px; }
.dm-voice .btn{ border-radius:999px; width:48px; height:48px; min-width:48px; }
.dm-voice .time{ color:var(--muted); font-size:12px; min-width:100px; }
.dm-voice .bar{ flex:1; height:6px; border-radius:999px; background:rgba(255,255,255,.16);
  -webkit-appearance:none; appearance:none; outline:none; }
.dm-voice .bar::-webkit-slider-runnable-track{ height:6px; border-radius:999px; background:transparent; }
.dm-voice .bar::-webkit-slider-thumb{ -webkit-appearance:none; width:0; height:0; background:transparent; border:none; }
.dm-voice .bar::-moz-range-track{ height:6px; border-radius:999px; background:transparent; }
.dm-voice .bar::-moz-range-thumb{ width:0; height:0; border:none; background:transparent; }

/* Значок документа для общих файлов */
.dm-file-title{ font-weight:600; }
.dm-docthumb{
  width:64px; height:64px; border-radius:8px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; background:rgba(59,130,246,.18);
  border:1px solid rgba(59,130,246,.35); cursor:pointer;
}
.dm-docthumb .ext{ font-weight:700; font-size:12px; }
.dm-docthumb .dot{ opacity:.6; }

/* На узких экранах — показываем только экран чата */
@media (max-width:700px){
  .dm-header{ margin-top:0; }
}

/* Borderless fullscreen для модалки/медиа */
.clm-fs-borderless{
  padding:0 !important;
  border:none !important;
  border-radius:0 !important;
  width:100vw !important;
  max-width:100vw !important;
  max-height:100vh !important;
  background:#000 !important;
}

/* Volume popup (стабильные размеры) */
.clm-vol-popup{
  width:44px;
  height:160px;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
  background: rgba(17,17,26,.72);
  border:1px solid rgba(255,255,255,.18);
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Вертикальный регулятор (горизонтальный с поворотом) */
.clm-vol-vert{
  -webkit-appearance:none; appearance:none; outline:none;
  width:140px; height:14px;               /* «горизонтальный» размер до поворота */
  border-radius:999px;
  background: linear-gradient(90deg, rgba(168,85,247,.7) 0% 0%, rgba(255,255,255,.14) 0% 100%);
  transform: rotate(-90deg);
  transform-origin: center;
  cursor:pointer;
}
.clm-vol-vert::-webkit-slider-runnable-track{ background:transparent; height:14px; border-radius:999px; }
.clm-vol-vert::-webkit-slider-thumb{
  -webkit-appearance:none; width:14px; height:14px; border-radius:50%;
  background:linear-gradient(135deg, var(--violet), var(--pink));
  border:none; box-shadow:0 2px 8px rgba(0,0,0,.35);
}
.clm-vol-vert::-moz-range-track{ background:transparent; height:14px; border-radius:999px; }
.clm-vol-vert::-moz-range-thumb{
  width:14px; height:14px; border-radius:50%;
  background:linear-gradient(135deg, var(--violet), var(--pink));
  border:none; box-shadow:0 2px 8px rgba(0,0,0,.35);
}

/* === Group (corp) header + tabs carousel === */
.corp-head{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:8px;
  padding:8px;
  margin:4px 0 8px 0;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
}
.corp-head .center{
  display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center;
}
.corp-sub{ font-size:12px; color:var(--muted); }

.corp-tabs{
  display:flex; gap:8px; overflow-x:auto; padding:6px 2px 8px 2px; -webkit-overflow-scrolling:touch;
}
.corp-tab{
  flex:0 0 auto; border:none; cursor:pointer; color:var(--text);
  padding:8px 12px; border-radius:999px;
  background:rgba(255,255,255,.06); transition:background .12s ease, transform .12s ease;
}
.corp-tab:hover{ transform:translateY(-1px); }
.corp-tab.active{ background:linear-gradient(135deg, rgba(168,85,247,.22), rgba(236,72,153,.22)); }

.corp-pane.hidden{ display:none !important; }

/* Голосовые в “сфере”: круглая кнопка с кольцевым прогрессом */
.voice-circle{
  position:relative; width:48px; height:48px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; color:#fff;
  background: radial-gradient(circle at 30% 30%, rgba(168,85,247,.35), rgba(236,72,153,.35));
  box-shadow: 0 8px 20px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.12);
}
.voice-circle::after{
  /* кольцо прогресса — управляется инлайновым style через conic-gradient */
  content:''; position:absolute; inset:-2px; border-radius:50%;
  background: conic-gradient(var(--pink) 0deg, rgba(255,255,255,.12) 0deg);
  -webkit-mask:
    radial-gradient(circle 22px at center, transparent 98%, #000 101%);
  mask:
    radial-gradient(circle 22px at center, transparent 98%, #000 101%);
  pointer-events:none;
}
.voice-time{ color:var(--muted); font-size:12px; min-width:100px; text-align:center; }
.voice-wave{
  height:8px; border-radius:999px; background:rgba(255,255,255,.16); position:relative; overflow:hidden; flex:1;
}
.voice-wave .fill{
  position:absolute; left:0; top:0; bottom:0; width:0%;
  background:linear-gradient(90deg, rgba(255,255,255,.45), rgba(255,255,255,.25));
}
.voice-wave .stripes{
  position:absolute; inset:0; opacity:.5;
  background:repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 3px, transparent 3px 7px);
}

/* Мини-рядок превью для DM файлов — как в группах */
.dm-file-row{
  display:flex; align-items:center; gap:8px; cursor:pointer; flex-wrap:nowrap;
}
.dm-thumb{
  width:64px; height:64px; border-radius:8px; overflow:hidden;
  background:rgba(255,255,255,.06); display:flex; align-items:center; justify-content:center;
}
.dm-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.dm-file-name{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:60vw; }

/* для очень узких экранов — компактнее */
@media (max-width:600px){
  .voice-time{ min-width:86px; }
  .dm-file-name{ max-width:52vw; }
}

/* === MyFiles: mobile overflow + folder inner scroll === */
.myfiles .fname{
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}


/* чтобы flex-дочерние не раздували ширину на мобайле */
.myfiles .item,
.myfiles .item .name,
.myfiles .item .act{
min-width: 0;
}


/* прогресс-бары загрузки/удаления — на всю ширину строки на малых экранах /
@media (max-width: 900px){
html, body{ overflow-x: hidden; }              / анти-«уплывание» */
.myfiles .upload #upbar,
.myfiles .upload #delbar{
flex: 1 1 100%;
min-width: 0;
}
.myfiles #toolbar,
.myfiles .upload{
overflow-x: hidden;
}


/* файлы в раскрытой папке со своим вертикальным скроллом (десктоп) */
@media (min-width: 901px){
#folders-panel .pf-content{
max-height: 48vh;
overflow: auto;
margin-top: 8px;
background: rgba(255,255,255,.03);
border-radius: 10px;
padding: 8px;
-webkit-overflow-scrolling: touch;
}
}


/* на мобайле для контента папок просто страховка от горизонтального скролла */
@media (max-width: 900px){
#folders-panel .pf-content{ overflow-x: hidden; }
}

/* === Home (главная): плитки и пикер === */
.home-title{ display:flex; align-items:center; gap:8px; }
#home-grid .cat{ position:relative; }

/* кнопки на плитке */
.cat .tile-pin, .cat .tile-x{
  opacity:0; transition:opacity .12s ease;
}
.cat:hover .tile-pin, .cat:hover .tile-x{
  opacity:1;
}

/* Чипбар сверху (afile) — стилизованные сферки */
.chipbar .btn.small.ghost{
  background: rgba(255,255,255,.06);
  border-radius:999px;
}
.chipbar .btn.small.ghost:hover{
  background: linear-gradient(135deg, rgba(168,85,247,.22), rgba(236,72,153,.22));
}

/* Пикер: уже есть базовые .modal/.picker-... — добавим лишь мелочи */
#picker-modal .box{ animation: fadeIn .18s ease; }
@keyframes fadeIn{ from{ transform: translateY(6px); opacity:.0; } to{ transform:none; opacity:1; } }

/* === Afile: mobile toolbar fix === */
.afile-tools{ gap:8px; }
@media (max-width: 700px){
  .afile-tools{ flex-direction:column; align-items:stretch; }
  .afile-tools select{ width:100%; }
  #q{ width:100%; flex:1 1 auto; min-width:0; }
  #up-af{ width:100%; flex-wrap:wrap; }
  #up-af input{ min-width:0; }
  #af-name, #af-tags{ flex:1 1 48%; }
}

/* FAB мягкая тень */
#btn-data{ box-shadow: var(--shadow); }

/* Модальные «внимания» — затемнение кнопки подтверждения без галочки */
#usage-attn .btn.small{ opacity:1; transition: opacity .15s ease; }
#usage-attn .btn.small[disabled]{ opacity:.5; cursor:not-allowed; }

/* MODALS mobile fit + disabled buttons */
.modal .box{
  max-height: 90vh;
  overflow: auto;
}
@media (max-width: 600px){
  .modal .box{ width: 94vw; }
}

/* общий стиль для disabled */
.btn[disabled], .btn.small[disabled]{
  opacity:.5;
  cursor:not-allowed;
  filter: grayscale(10%);
}

/* «сферки ВНИМАНИЕ» внутри карточек — не уезжают вверх на мобайле */
#usage-attn{
  position: relative;
  max-width: 100%;
}

/* Прямоугольный плавный дропдаун (для лент вложений) */
.rect-drop{
  max-height:0;
  overflow:hidden;
  opacity:0;
  transform: translateY(-4px);
  transition: max-height .2s ease, opacity .2s ease, transform .2s ease;
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  padding:8px;
  margin-top:6px;
}
.rect-drop.open{
  max-height: 240px;  /* достаточно для 2-3 рядов миниатюр */
  opacity:1;
  transform: translateY(0);
}

.thumb-grid{ display:flex; gap:8px; flex-wrap:wrap; }
.thumb-ribbon{ display:flex; gap:6px; overflow:auto; padding:4px 2px; }

/* Кнопка-чип (+N) — уже используем .btn.small, стили хватает */