:root {
  --primary-color: #5e6ad2;
  --primary-color-rgb: 94, 106, 210;
  --secondary-color: #fafbfc;
  --text-color: #172b4d;
  --bg-color: #ffffff;
  --card-bg: #f4f5f7;
  --border-color: #dfe1e6;
  --hint-color: #5e6c84;
  --button-color: #5e6ad2;
}

[data-theme="dark"] {
  --primary-color: #8b5cf6;
  --primary-color-rgb: 139, 92, 246;
  --secondary-color: #1f2937;
  --text-color: #f9fafb;
  --bg-color: #111827;
  --card-bg: #1f2937;
  --border-color: #374151;
  --hint-color: #9ca3af;
  --button-color: #8b5cf6;
}

/* ========== ГЛОБАЛЬНОЕ УБИРАЕМ СКРОЛЛБАРЫ ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

html, body {
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.screen {
  display: none;
}
.screen.active {
  display: block;
}

.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 20px;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
}
.theme-toggle:hover {
  transform: scale(1.1);
}

.theme-tab {
    margin-left: auto;
    margin-right: 8px;
    background: var(--secondary-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    min-width: 40px;
    padding: 8px 12px;
}
.theme-tab:hover {
    background: rgba(var(--primary-color-rgb), 0.1) !important;
    color: var(--primary-color) !important;
}

/* ========== LAZY LOADING АНИМАЦИИ ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -468px 0;
  }
  100% {
    background-position: 468px 0;
  }
}

/* ========== ЗАГРУЗОЧНЫЕ PLACEHOLDER'Ы ========== */
.loading-placeholder {
  background: linear-gradient(90deg, 
    var(--card-bg) 25%, 
    rgba(var(--primary-color-rgb), 0.1) 50%, 
    var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: 8px;
}

.folder-loading {
  width: 100%;
  height: 200px;
  margin-bottom: 18px;
  border-radius: 16px;
  animation: pulse 1.5s ease-in-out infinite;
}

.card-loading {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
  border-radius: 8px;
  animation: pulse 1.2s ease-in-out infinite;
}

.list-loading {
  width: 280px;
  height: 300px;
  margin-right: 16px;
  border-radius: 12px;
  animation: pulse 1.3s ease-in-out infinite;
}

/* ========== ЛЕНИВАЯ ЗАГРУЗКА ЭЛЕМЕНТОВ ========== */
.lazy-load {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.lazy-load.loaded {
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 0.6s ease-out;
}

/* Задержки для красивого каскадного появления */
.lazy-load:nth-child(1) { transition-delay: 0.1s; }
.lazy-load:nth-child(2) { transition-delay: 0.2s; }
.lazy-load:nth-child(3) { transition-delay: 0.3s; }
.lazy-load:nth-child(4) { transition-delay: 0.4s; }
.lazy-load:nth-child(5) { transition-delay: 0.5s; }
.lazy-load:nth-child(6) { transition-delay: 0.6s; }

/* ========== ЭКРАН БЛОКИРОВКИ ДОСТУПА ========== */
.access-denied-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.access-denied-content {
  text-align: center;
  max-width: 400px;
  background: var(--card-bg);
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.access-denied-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.access-denied-content h1 {
  font-size: 24px;
  color: var(--text-color);
  margin-bottom: 16px;
}

.access-denied-content p {
  color: var(--hint-color);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ========== КОМПАКТНАЯ ПАНЕЛЬ ТАБОВ ========== */
.folders-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px 0 12px;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  min-height: 38px;
}

.tab-btn {
  background: transparent;
  color: var(--hint-color);
  border: none;
  padding: 6px 12px;
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tab-btn:hover:not(.active) {
  background: rgba(var(--primary-color-rgb), 0.1);
  color: var(--primary-color);
}

.tab-btn.active {
  background: var(--card-bg);
  color: var(--text-color);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-color);
}

.admin-only {
  margin-left: 0;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%) !important;
  color: white !important;
  border-radius: 8px !important;
}

.admin-only:hover {
  opacity: 0.9;
}

/* ========== ТИПЫ ДОСТУПА В МОДАЛЬНОМ ОКНЕ ========== */
.access-type-selection {
  margin: 16px 0;
  padding: 16px;
  background: var(--secondary-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.access-type-selection > label:first-child {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 12px;
  display: block;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
  font-size: 14px;
  color: var(--text-color);
  flex-wrap: wrap;
  word-break: keep-all;
}

.radio-group label:hover {
  background: rgba(var(--primary-color-rgb), 0.1);
}

/* ========== ИСПРАВЛЕНИЯ ДЛЯ ЧЕКБОКСОВ И РАДИО ========== */
.checkbox-group {
  margin: 16px 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-color);
  flex-wrap: wrap;
  word-break: keep-all;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.checkbox-group label:hover {
  background: rgba(var(--primary-color-rgb), 0.1);
}

.radio-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.radio-group label span,
.checkbox-group label span {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

/* ========== АДМИН-ПАНЕЛЬ ========== */
.whitelist-container {
  padding: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.user-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.user-info {
  flex-grow: 1;
}

.user-name {
  font-weight: 600;
  color: var(--text-color);
  font-size: 16px;
}

.user-id {
  font-size: 12px;
  color: var(--hint-color);
  margin-top: 4px;
}

.user-role {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  margin-top: 8px;
  display: inline-block;
  font-weight: 500;
}

.user-role.admin {
  background: #ff6b6b;
  color: white;
}

.user-role.user {
  background: var(--border-color);
  color: var(--hint-color);
}

.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.protected-user {
  font-size: 12px;
  color: var(--hint-color);
  font-style: italic;
}

/* ========== СТРУКТУРА ЭКРАНОВ ========== */
#folders-screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

#folders-screen.active {
  display: flex;
}

#boards-screen {
  display: none;
  height: 100vh;
  padding: 8px;
  overflow: hidden;
  flex-direction: column;
}

#boards-screen.active {
  display: flex;
}

#admin-screen {
  display: none;
  padding: 0;
  min-height: 100vh;
}

#admin-screen.active {
  display: block;
}

.folders-main-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 0 16px;
  padding-bottom: 110px;
  pointer-events: auto;
}

.folders-bottom-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 2px solid var(--border-color);
  backdrop-filter: blur(10px);
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  border-radius: 16px 16px 0 0;
  animation: slideUpPanel 0.3s ease-out;
}

.panel-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.panel-content h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.folders-bottom-panel .btn-primary {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: 25px;
  box-shadow: 0 4px 12px rgba(94, 106, 210, 0.3);
}

.folders-bottom-panel .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(94, 106, 210, 0.4);
}

@keyframes slideUpPanel {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========== ЗАГОЛОВКИ ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 12px 16px;
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color);
}

/* ========== КНОПКИ ========== */
.btn-primary {
  background-color: var(--button-color);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--button-color);
  border: 2px solid var(--button-color);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back {
  background-color: transparent;
  color: var(--button-color);
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.2s;
}
.btn-back:hover {
  background-color: rgba(94, 106, 210, 0.1);
}

/* ========== ПАПКИ ========== */
.folders-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  width: 100%;
}

.folder-item {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
  width: 100%;
  pointer-events: auto;
  z-index: 1;
}
.folder-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
.folder-item::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
}

.folder-item.light-folder {
  color: #2d3748 !important;
  text-shadow: none;
}

.folder-item.light-folder .folder-top-actions button,
.folder-item.light-folder .folder-actions button {
  background-color: rgba(45, 55, 72, 0.15);
  color: #2d3748;
  border: 1px solid rgba(45, 55, 72, 0.3);
}

.folder-item.light-folder .delete-btn {
  background-color: #eb5a46;
  color: white;
}

.folder-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
  margin-right: 75px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2.6em;
}

.folder-stats {
  font-size: 11px;
  opacity: 0.9;
  position: relative;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 8px;
}

.folder-date {
  font-size: 9px;
  opacity: 0.75;
  margin-top: 2px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-creator {
  font-size: 10px;
  opacity: 0.8;
  margin-top: 4px;
  font-style: italic;
}

.folder-top-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.folder-edit-btn, .folder-color-btn {
  background-color: rgba(255, 255, 255, 0.25);
  color: white;
  border: none;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

.folder-edit-btn:hover, .folder-color-btn:hover {
  background-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.folder-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.folder-actions .delete-btn {
  background-color: #eb5a46;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 500;
}

.folder-actions .delete-btn:hover {
  background-color: #c53518;
  transform: scale(1.05);
}

.folder-item.light-folder .folder-edit-btn,
.folder-item.light-folder .folder-color-btn {
  background-color: rgba(45, 55, 72, 0.2);
  color: #2d3748;
  border: 1px solid rgba(45, 55, 72, 0.3);
}

.folder-item.light-folder .delete-btn {
  background-color: #eb5a46;
  color: white;
}

/* === ЗАГРУЗОЧНЫЙ СПИННЕР === */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner.active {
  display: flex;
}

.spinner-container {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === УВЕДОМЛЕНИЯ === */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transition: all 0.3s ease;
  transform: translateX(0);
  opacity: 1;
}

.notification.notification-hide {
  transform: translateX(100%);
  opacity: 0;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.notification-text {
  color: var(--text-color);
  font-size: 14px;
}

.notification-error {
  border-left: 4px solid #e74c3c;
}

.notification-success {
  border-left: 4px solid #2ecc71;
}

.notification-info {
  border-left: 4px solid var(--primary-color);
}

/* === LAZY LOADING ИЗОБРАЖЕНИЙ === */
.lazy-image {
  filter: blur(2px);
  transition: filter 0.3s ease;
}

.lazy-loaded {
  filter: none;
}

/* ========== ДОСКИ (LISTS) ========== */
.board-container {
  display: flex;
  gap: 16px;
  overflow-y: hidden;
  overflow-x: auto;
  padding: 8px 0;
  flex: 1;
  max-height: calc(100vh - 80px);
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
}

.board-container::-webkit-scrollbar {
  display: block;
  height: 8px;
}

.board-container::-webkit-scrollbar-track {
  background: var(--secondary-color);
  border-radius: 4px;
}

.board-container::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
  opacity: 0.7;
}

.board-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
  opacity: 1;
}

.board-list {
  background: var(--secondary-color);
  border-radius: 12px;
  min-width: 280px;
  max-width: 280px;
  padding: 12px;
  height: fit-content;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  box-sizing: border-box;
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
  margin-bottom: 20px;
}

.board-list .card:last-child {
  margin-bottom: 8px;
}

.board-list::-webkit-scrollbar {
  display: block;
  width: 6px;
}

.board-list::-webkit-scrollbar-track {
  background: transparent;
}

.board-list::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
  opacity: 0.7;
}

.board-list::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
  opacity: 1;
}

.list-created {
  font-size: 11px;
  color: var(--hint-color);
  opacity: 0.7;
  margin-top: 4px;
}
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 6px 8px;
  background: var(--card-bg);
  border-radius: 6px;
}

.list-title { 
  font-size: 14px;
  font-weight: 600; 
  color: var(--text-color); 
  margin-bottom: 0; 
}
.list-title-section { display: flex; flex-direction: column; flex-grow: 1; }

.add-card-btn {
  background: transparent;
  color: var(--hint-color);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}
.add-card-btn:hover { background-color: rgba(9, 30, 66, 0.08); color: var(--text-color); }

.add-list-btn {
  background: var(--secondary-color);
  color: var(--primary-color);
  border: 2px solid var(--border-color);
  padding: 8px;
  border-radius: 8px;
  min-width: 280px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  height: fit-content;
}

.add-list-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ========== КАРТОЧКИ ========== */
.card {
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  border-left: 4px solid transparent;
  overflow: hidden;
  word-break: break-word;
}
.card:hover { 
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); 
  transform: translateY(-1px);
  border-color: var(--primary-color);
}

.card-date-info {
  font-size: 12px;
  color: var(--hint-color);
  background: var(--secondary-color);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.card.completed { opacity: 0.6; border-left-color: #61bd4f; }
.card.completed .card-title { text-decoration: line-through; }
.card-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; color: var(--text-color); }

.card-actions { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-top: 8px;
  gap: 8px;
}

.card-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--button-color);
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.card-checkbox.checked { background-color: var(--button-color); color: white; }
.card-checkbox.checked::after { content: "✓"; font-size: 12px; font-weight: bold; }

.card-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.card-edit-btn {
  background: var(--button-color);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.card-edit-btn:hover {
  background: #4c5aa8;
}

.delete-btn {
  background-color: #eb5a46;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.delete-btn:hover { background-color: #c53518; transform: scale(1.05); }

/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}
.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-content h2 {
  margin-bottom: 20px;
  font-size: 24px;
  color: var(--text-color);
}
.modal-content textarea {
  word-break: break-all;
  overflow-wrap: break-word;
  resize: vertical;
  min-height: 80px;
}
.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.modal-content input:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: var(--button-color);
}
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}

.color-picker {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1001;
}
.color-picker.active { display: block; }
.color-picker h3 { color: var(--text-color); margin-bottom: 15px; }
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 15px; }
.color-option {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.color-option:hover { border-color: var(--primary-color); transform: scale(1.1); }

/* ========== ИЗОБРАЖЕНИЯ ========== */
.image-preview-container {
  text-align: center;
  margin-top: 12px;
}

.image-actions {
  margin-top: 8px;
}

.image-upload-section {
  margin: 16px 0;
  padding: 16px;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  background: var(--secondary-color);
}

.image-upload-label {
  display: inline-block;
  background: var(--button-color);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.image-upload-label:hover {
  opacity: 0.8;
}

.image-preview {
  margin-top: 12px;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
  margin: 0 auto;
}

.image-remove-btn {
  background: #eb5a46;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.image-remove-btn:hover {
  background: #c53518;
}

.paste-hint {
  font-size: 12px;
  color: var(--hint-color);
  margin-top: 8px;
  font-style: italic;
}

.card-image {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin: 8px 0;
  cursor: pointer;
  display: block;
  box-sizing: border-box;
}

.card-image:hover {
  opacity: 0.9;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

.card * {
  max-width: 100%;
  box-sizing: border-box;
}

.image-modal-content {
  max-width: 90vw;
  max-height: 90vh;
  padding: 20px;
}

.image-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

#modal-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ========== АНИМАЦИИ ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.card, .board-list { animation: fadeIn 0.3s ease-out; }
.card, .card-title, .card-description {
  word-break: break-word !important;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ ========== */
@media (max-width: 768px) {
  /* Фикс переноса папок на мобильных (<768px) */
  .folders-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    grid-auto-rows: 1fr;
    grid-auto-flow: row dense;
    gap: 10px;
    padding: 0 4px;
  }

  .folder-item {
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px;
    min-height: 90px;
    max-height: 120px;
    aspect-ratio: 4/3;
  }

  .folders-main-area {
    padding: 12px 8px 0 8px;
    padding-bottom: 90px;
  }
  
  .folders-tabs {
    padding: 4px 8px 0 8px;
    gap: 2px;
    min-height: 35px;
  }
  
  .tab-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .theme-toggle {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
    z-index: auto;
  }

  .theme-tab {
    margin-right: 2px;
    min-width: 30px;
    padding: 5px 6px;
    font-size: 12px;
  }
  
  .folder-name { 
    font-size: 12px;
    margin-right: 50px;
    margin-bottom: 4px;
    -webkit-line-clamp: 2;
    max-height: 2.4em;
    line-height: 1.2;
  }
  
  .folder-stats { 
    font-size: 9px;
    margin-bottom: 2px;
  }
  
  .folder-date {
    font-size: 8px;
    margin-top: 1px;
  }
  
  .folder-creator {
    font-size: 7px;
  }
  
  .folder-top-actions { 
    top: 6px; 
    right: 6px; 
    gap: 4px; 
  }
  
  .folder-edit-btn, .folder-color-btn { 
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
  
  .folder-actions .delete-btn {
    font-size: 9px;
    padding: 4px 8px;
    height: 24px;
    min-width: 40px;
  }
  
  .card-actions {
    gap: 6px;
    flex-wrap: nowrap;
  }
  
  .card-checkbox {
    width: 16px;
    height: 16px;
    min-width: 16px;
  }
  
  .card-buttons {
    gap: 4px;
  }
  
  .card-edit-btn {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 3px;
  }
  
  .delete-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
  
  .panel-content {
    padding: 8px 12px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .panel-content h1 {
    font-size: 16px;
  }
  
  .folders-bottom-panel .btn-primary {
    padding: 8px 16px;
    font-size: 12px;
    width: 100%;
    max-width: 180px;
  }

  #boards-screen {
    padding: 6px;
  }

  .board-container {
    display: flex;
    gap: 16px;
    overflow-y: hidden;
    overflow-x: auto;
    padding: 8px 0 30px 0;
    flex: 1;
    max-height: calc(100vh - 80px);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
  }
  
  .board-container::-webkit-scrollbar {
    height: 6px;
  }
  
  .board-list { 
    max-height: calc(100vh - 160px);
    margin-bottom: 15px;
  }

  .add-list-btn {
    min-width: 260px;
    padding: 6px;
    font-size: 13px;
  }

  .header { 
    flex-direction: column; 
    gap: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
  }

  .header h1 {
    font-size: 18px;
  }
  
  .whitelist-container {
    padding: 12px;
  }
  
  .user-item {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
  }
  
  .user-actions {
    align-self: flex-end;
  }
  
  .modal-content {
    padding: 16px;
    margin: 15px;
    max-width: calc(100vw - 30px);
  }
  
  .radio-group label,
  .checkbox-group label {
    font-size: 13px;
    gap: 6px;
    padding: 6px;
  }
  
  .access-type-selection {
    padding: 10px;
  }
  
  .modal-buttons {
    flex-direction: column;
  }
  
  .modal-buttons .btn-primary,
  .modal-buttons .btn-secondary {
    width: 100%;
    margin: 0;
  }

  .color-grid { 
    grid-template-columns: repeat(3, 1fr); 
    gap: 8px; 
  }
  
  .color-option {
    width: 45px;
    height: 45px;
  }
}

@media (max-width: 480px) {
  .folder-name {
    margin-right: 45px;
  }
  
  .folder-edit-btn, .folder-color-btn {
    width: 20px;
    height: 20px;
    font-size: 8px;
  }
  
  .folder-top-actions {
    top: 5px;
    right: 5px;
    gap: 1px;
  }
  
  .folder-actions .delete-btn {
    font-size: 8px;
    padding: 3px 6px;
    height: 20px;
    min-width: 35px;
  }
  
  .card-buttons {
    gap: 2px;
  }
  
  .card-edit-btn, .delete-btn {
    padding: 3px 6px;
    font-size: 9px;
  }
  
  .card-checkbox {
    width: 14px;
    height: 14px;
    min-width: 14px;
  }
}
