:root {
  --accent: #6b5ce7;
  --accent-dark: #5343d9;
  --accent-soft: #efecfd;
  --accent-soft-2: #e2ddfb;
  --ink: #1a1a2e;
  --muted: #9aa0b4;
  --muted-2: #6f7488;
  --line: #eef0f4;
  --line-2: #e8eaf1;
  --bg: #ffffff;
  --bg-soft: #f5f6fa;
  --ok: #1f9d55;
  --radius: 16px;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать любые display:flex/grid из правил ниже */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

.btn, .btn--icon, .link-btn, .dropzone, .file-dl, .user-avatar {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Бренд ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand--big { justify-content: center; margin-bottom: 20px; }
.brand-logo { height: 43px; width: auto; display: block; }
.brand--big .brand-logo { height: 62px; }

/* ---------- Кнопки ---------- */
.btn {
  border: none; border-radius: 12px; font-weight: 700; font-size: 14px;
  padding: 12px 20px; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; transition: background 0.15s, color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost { background: var(--accent-soft); color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft-2); }
.btn--icon {
  background: transparent; color: var(--muted); padding: 8px; border-radius: 10px;
}
.btn--icon:hover { background: var(--bg-soft); color: var(--ink); }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px; }
.link-btn:hover { color: var(--accent-dark); }

:focus-visible { outline: 3px solid rgba(107, 92, 231, 0.45); outline-offset: 2px; border-radius: 8px; }

/* ---------- Экран входа ---------- */
.login {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 40px 20px; text-align: center;
}
.login-card {
  max-width: 460px; width: 100%;
  border: 1px solid var(--line-2); border-radius: 24px;
  padding: 44px 36px; box-shadow: 0 20px 60px rgba(107, 92, 231, 0.08);
}
.login-title { font-size: 26px; font-weight: 800; margin: 8px 0 12px; line-height: 1.25; }
.login-sub { color: var(--muted-2); font-size: 15px; line-height: 1.6; margin: 0 0 28px; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.qr-img {
  width: 240px; height: 240px; border-radius: 16px;
  border: 1px solid var(--line-2); padding: 10px; background: #fff;
}
.login-status { color: var(--muted-2); font-size: 14px; min-height: 20px; }
.login-status--ok { color: var(--ok); font-weight: 700; }
.login-status--err { color: #c74854; font-weight: 600; }
.login-footer { color: var(--muted); font-size: 13px; }

/* ---------- Шапка ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 68px; border-bottom: 1px solid var(--line);
}
.user { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
}
.user-avatar--initials {
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.user-name { font-weight: 700; font-size: 15px; }

/* ---------- Раскладка ---------- */
.layout {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  gap: 0; min-height: 0;
}
.center {
  padding: 40px 56px; display: flex; flex-direction: column; align-items: center; gap: 32px;
}
.side {
  border-left: 1px solid var(--line); padding: 28px 24px;
  display: flex; flex-direction: column; gap: 6px; overflow: auto;
}

/* ---------- Баннер подключения бота ---------- */
.banner {
  width: 100%; max-width: 640px;
  background: linear-gradient(135deg, #f6f4ff, #efecfd);
  border: 1px solid var(--accent-soft-2); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.banner-text { display: flex; flex-direction: column; gap: 3px; }
.banner-text strong { font-size: 15px; }
.banner-text span { font-size: 13px; color: var(--muted-2); }

/* ---------- Дропзона ---------- */
.dropzone {
  width: 100%; max-width: 640px; min-height: 340px;
  border: 2px dashed #c9c3f2; border-radius: 28px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: #fff; transition: background 0.2s, border-color 0.2s;
}
.dropzone:hover { border-color: var(--accent); background: #fbfbff; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: 0.7; pointer-events: none; }
.dropzone-icon {
  width: 100px; height: 100px; border-radius: 50%; background: #fff;
  box-shadow: 0 8px 30px rgba(107, 92, 231, 0.18);
  display: flex; align-items: center; justify-content: center;
  animation: pulse 3s ease-in-out infinite;
}
.dropzone-title { font-size: 26px; font-weight: 800; }
.dropzone-sub { font-size: 15px; color: var(--muted); }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) {
  .dropzone-icon { animation: none; }
  .btn:active { transform: none; }
}

/* ---------- Тумблер мессенджера ---------- */
.messenger-toggle {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 14px;
}
.mt-opt {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent; color: var(--muted-2);
  font-weight: 700; font-size: 14px; padding: 9px 18px; border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.mt-opt:hover:not(:disabled):not(.is-active) { color: var(--ink); }
.mt-opt.is-active { background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(107, 92, 231, 0.15); }
.mt-opt:disabled { color: var(--muted); cursor: not-allowed; }
.mt-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.mt-arrow { font-weight: 800; margin-right: -3px; }
.mt-soon {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--muted);
  border-radius: 6px; padding: 1px 6px;
}

/* ---------- Фичи ---------- */
.features { display: flex; gap: 40px; flex-wrap: wrap; justify-content: center; max-width: 700px; }
.feature { display: flex; gap: 12px; align-items: flex-start; max-width: 200px; }
.feature-ico {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.feature-title { font-weight: 800; font-size: 15px; }
.feature-sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* ---------- Список файлов ---------- */
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-title { font-size: 19px; font-weight: 800; }
.files { display: flex; flex-direction: column; }
.file {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 6px; border-bottom: 1px solid #f2f3f7;
}
.file-ext {
  width: 40px; height: 40px; border-radius: 10px; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800;
}
.file-main { flex: 1; min-width: 0; }
.file-name {
  font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.dir { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.dir--out { color: var(--accent); }
.dir--in { color: var(--ok); }
.file-dl {
  color: var(--muted); background: none; border: none; padding: 6px; border-radius: 8px; flex-shrink: 0;
  display: flex;
}
.file-dl:hover { color: var(--accent); background: var(--accent-soft); }
.files-empty { color: var(--muted); font-size: 14px; padding: 24px 6px; text-align: center; }

/* ---------- Тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 50; max-width: 90vw;
}
.toast--err { background: #c74854; }
.toast--ok { background: var(--ok); }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-left: none; border-top: 1px solid var(--line); }
  .center { padding: 28px 20px; }
  .header { padding: 0 20px; }
}
