:root {
  --bg: #0f0f12;
  --surface: #1a1a1f;
  --border: #2d2d35;
  --text: #e8e8ed;
  --text-muted: #8888a0;
  --accent: #6c5ce7;
  --accent-hover: #7d6ef7;
  --green: #00c853;
  --orange: #ff9800;
  --red: #f44336;
  --row-green: #224430;
  --row-orange: #453619;
  --row-red: #452222;
  --row-pause: #36364a;
  --cell-border: rgba(255, 255, 255, 0.14);
  --header-h: 56px;
  --cell-pad: 10px 12px;
  --min-col-w: 60px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
}

.profile-wrap {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  padding: 4px 0;
  z-index: 100;
}

.profile-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.profile-dropdown-item:hover {
  background: var(--border);
}

.auth-prompt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 320px;
}

.auth-form h2 {
  margin: 0 0 20px;
  font-size: 1.25rem;
}

.auth-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  box-sizing: border-box;
}

.auth-form .btn-login {
  width: 100%;
  margin-top: 8px;
}

.auth-hint {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.auth-hint code {
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.auth-error {
  margin: 8px 0 0;
  color: var(--red);
  font-size: 0.85rem;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #3d3d48;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--border);
  color: var(--text);
}

.login-prompt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.btn-login {
  padding: 14px 28px;
  font-size: 1.1rem;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.data-table th,
.data-table td {
  padding: var(--cell-pad);
  border: 1px solid var(--cell-border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  min-height: 44px;
}
.data-table td {
  min-height: 44px;
}
.data-table th {
  border-left: 1px solid var(--cell-border);
}
.data-table td {
  border-left: 1px solid var(--cell-border);
}
.data-table .cell-num {
  display: block;
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.data-table th {
  background: #25252d;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
  position: relative;
}

.data-table th.draggable {
  cursor: grab;
}

.data-table th.draggable:active {
  cursor: grabbing;
}

.data-table th .resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

.data-table th .resizer:hover,
.data-table th .resizer.active {
  background: var(--accent);
  opacity: 0.5;
}

/* --- Filter row --- */
.data-table .filter-cell {
  background: #1a1a22;
  padding: 4px 6px;
  position: relative;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-btn:hover {
  background: rgba(108,92,231,0.1);
  border-color: rgba(108,92,231,0.3);
  color: var(--text);
}
.filter-btn.active {
  background: rgba(108,92,231,0.15);
  border-color: rgba(108,92,231,0.5);
  color: #a78bfa;
}
.filter-btn .filter-icon,
.filter-date-btn .filter-icon {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  opacity: 0.5;
}
.filter-btn.active .filter-icon,
.filter-date-btn.active .filter-icon { opacity: 1; }
.filter-btn .filter-label,
.filter-date-btn .filter-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  width: max-content;
  max-width: min(320px, 90vw);
  padding: 8px 0;
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #1e1e28;
  border: 1px solid #3d3d4a;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 100;
  box-sizing: border-box;
}
.filter-panel.open { display: block; }

.filter-panel-search {
  padding: 6px 10px 8px;
  border-bottom: 1px solid #2d2d35;
}
.filter-panel-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #2d2d35;
  border-radius: 6px;
  background: #0f0f12;
  color: var(--text);
  font-size: 12px;
  box-sizing: border-box;
}
.filter-panel-search input::placeholder { color: #666; }

.filter-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}
.filter-check-label:hover {
  background: rgba(108,92,231,0.08);
}
.filter-check-label input {
  flex-shrink: 0;
  margin: 0;
  width: 15px;
  height: 15px;
  accent-color: #6c5ce7;
}
.filter-check-label .filter-check-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-check-label.all-option {
  border-bottom: 1px solid #2d2d35;
  padding-bottom: 8px;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Date range filter */
.filter-date-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.filter-date-btn:hover {
  background: rgba(108,92,231,0.1);
  border-color: rgba(108,92,231,0.3);
  color: var(--text);
}
.filter-date-btn.active {
  background: rgba(108,92,231,0.15);
  border-color: rgba(108,92,231,0.5);
  color: #a78bfa;
}

.filter-date-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 280px;
  padding: 10px;
  background: #1e1e28;
  border: 1px solid #3d3d4a;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 100;
  box-sizing: border-box;
}
.filter-date-panel.open { display: block; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cal-header button {
  background: none;
  border: 1px solid #3d3d4a;
  border-radius: 6px;
  color: var(--text);
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-header button:hover { border-color: #6c5ce7; }
.cal-header .cal-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-grid .cal-dow {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
}
.cal-grid .cal-day {
  font-size: 12px;
  padding: 5px 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  border: none;
  background: none;
  transition: all 0.1s;
}
.cal-grid .cal-day:hover { background: rgba(108,92,231,0.15); }
.cal-grid .cal-day.other-month { color: #444; }
.cal-grid .cal-day.today { box-shadow: inset 0 0 0 1px #6c5ce7; }
.cal-grid .cal-day.selected { background: #6c5ce7; color: #fff; }
.cal-grid .cal-day.in-range { background: rgba(108,92,231,0.2); }
.cal-range-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.cal-range-info span { font-weight: 600; color: var(--text); }
.cal-range-info .filter-date-clear {
  padding: 4px 10px;
  border: 1px solid #3d3d4a;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}
.cal-range-info .filter-date-clear:hover {
  border-color: #6c5ce7;
  color: var(--text);
}

.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.btn-pagination:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.data-table tbody tr:hover {
  background: rgba(108, 92, 231, 0.06);
}

.data-table td input,
.data-table td select,
.data-table td textarea.cell-textarea {
  box-sizing: border-box;
  width: calc(100% + 24px);
  min-width: 0;
  min-height: 32px;
  margin-left: -12px;
  margin-right: -12px;
  padding: 6px 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
}

.data-table td textarea.cell-textarea {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  vertical-align: middle;
}

.data-table td input:focus,
.data-table td select:focus,
.data-table td textarea:focus {
  outline: none;
  background: var(--bg);
}

.data-table td select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.data-table td .cell-link {
  color: #7d9eff;
  text-decoration: none;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

.data-table td .cell-link:hover {
  text-decoration: underline;
}

/* Переключатель в стиле Apple */
.toggle-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.toggle-wrap {
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-wrap.checked {
  background: #34c759;
}
.toggle-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
  pointer-events: none;
}
.toggle-wrap.checked .toggle-thumb {
  transform: translateX(20px);
}
.cell-num {
  user-select: none;
}

.btn-copy-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.35;
  transition: all 0.15s;
  vertical-align: middle;
  margin-right: 2px;
  flex-shrink: 0;
}
.btn-copy-row svg {
  width: 14px;
  height: 14px;
}
.btn-copy-row:hover {
  opacity: 1;
  color: #a78bfa;
  background: rgba(108,92,231,0.12);
}
.btn-copy-row.copied {
  opacity: 1;
  color: #22c55e;
}
.data-table .cell-num {
  display: inline;
}

/* Цвет текста: Прошли — зелёный, Диззапрув — оранжевый (читаемо на фоне статуса) */
.cell-proshli,
.cell-proshli .cell-textarea {
  color: #4ade80;
}
tr[data-row-status="green"] .cell-proshli { color: #86efac; }
tr[data-row-status="orange"] .cell-proshli { color: #4ade80; }

.cell-dizapruv,
.cell-dizapruv .cell-textarea {
  color: #fb923c;
}

/* Крео: вид как у колонки Статус (Прошли / Диззапрув) */
.cell-creo-wrap {
  position: relative;
  width: 100%;
}
.cell-creo-btn {
  box-sizing: border-box;
  width: calc(100% + 24px);
  min-width: 0;
  min-height: 32px;
  margin-left: -12px;
  margin-right: -12px;
  padding: 6px 24px 6px 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.cell-creo-btn:hover {
  outline: none;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.cell-creo-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 2px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.cell-creo-panel-fixed {
  position: fixed;
  z-index: 1100;
  max-height: 360px;
  overflow-y: auto;
}
.cell-creo-panel .filter-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 0;
  font-size: 1rem;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.cell-creo-panel .filter-check-label:last-child {
  border-bottom: none;
}
.cell-creo-panel .filter-check-label:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cell-creo-panel .filter-check-label input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
}
.cell-creo-panel .filter-check-text {
  flex: 1;
  min-width: 0;
}

/* Пункты выпадающего списка статуса (как у крео) */
.cell-status-option {
  padding: 12px 14px;
  font-size: 1rem;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
}
.cell-status-option:last-child {
  border-bottom: none;
}
.cell-status-option:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cell-creo-panel .cell-creo-loading,
.cell-creo-panel .cell-creo-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 10px 14px;
  margin: 0;
  line-height: 1.3;
}
.cell-creo-panel:has(.cell-creo-loading),
.cell-creo-panel:has(.cell-creo-hint) {
  min-height: 0;
  max-height: none;
}
.cell-creo-panel-loading {
  width: max-content;
  min-width: 0;
}
tr[data-row-status="orange"] .cell-dizapruv { color: #fdba74; }
tr[data-row-status="red"] .cell-dizapruv { color: #fdba74; }

/* Заголовки столбцов по центру */
.data-table th .th-content {
  justify-content: center;
  width: 100%;
}

/* Иконка перетаскивания заголовка */
.th-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.th-content.drag-handle {
  cursor: grab;
}

.th-content.drag-handle:active {
  cursor: grabbing;
}

.th-sort-icon {
  margin-left: 4px;
  opacity: 0.7;
  cursor: pointer;
  user-select: none;
}
.th-sort-icon:hover {
  opacity: 1;
}

.data-table th.dragging {
  opacity: 0.6;
}

.data-table th.drag-ghost {
  opacity: 0.9;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.btn-delete-cell {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.btn-delete-cell:hover {
  color: var(--red);
  background: var(--row-red);
}

/* Кнопки в ячейке: папка — только иконки */
.cell-folder {
  min-width: 0;
}
.folder-loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: folder-spin 0.7s linear infinite;
}
@keyframes folder-spin {
  to { transform: rotate(360deg); }
}
.btn-cell-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  color: var(--text-muted);
  background: transparent;
}
.btn-cell-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.btn-cell-icon svg {
  display: block;
  width: 24px;
  height: 24px;
  pointer-events: none;
}
a.btn-cell-icon {
  color: #7d9eff;
}
a.btn-cell-icon:hover {
  color: #9ab5ff;
}

/* Модальное окно выбора папки */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal.modal-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.modal-content.modal-folder {
  max-width: 720px;
  min-width: 320px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover {
  color: var(--text);
}
.modal-body {
  padding: 14px 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}
.folder-list-wrap {
  min-height: 200px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}
.folder-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
.folder-tree {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* Пункт дерева: кнопки в одну строку, вложенный список — с новой строки на всю ширину */
.folder-tree-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 6px 8px;
  min-height: 36px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* Вложенный список переносится на следующую строку и занимает всю ширину — отступ только 1ch */
.folder-tree-children {
  flex-basis: 100%;
  width: 100%;
  padding-left: 1ch;
  margin: 0;
  margin-top: 2px;
  list-style: none;
  box-sizing: border-box;
}
/* Первый уровень: на 1 символ правее контента корня */
.folder-tree > .folder-tree-item > .folder-tree-children {
  padding-left: calc(8px + 1ch);
}
.folder-tree-children .folder-tree-item {
  padding-left: 0;
  padding-right: 8px;
}
.folder-tree-expand {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.folder-tree-expand:hover {
  background: var(--border);
  color: var(--text);
}
.folder-tree-name {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 6px 10px;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-tree-name:hover {
  background: var(--border);
}
.folder-tree-select {
  flex-shrink: 0;
  display: none;
}
.folder-tree-item--selected .folder-tree-select {
  display: inline-flex;
}
.folder-error {
  padding: 16px;
  color: var(--red);
  font-size: 0.9rem;
}

/* Админ-панель */
.modal-content.modal-admin {
  max-width: 560px;
}

.admin-tabs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-tab-list {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.admin-tab {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.admin-tab:hover {
  background: var(--border);
  color: var(--text);
}

.admin-tab.active {
  background: var(--accent);
  color: #fff;
}

.admin-tab-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.admin-form input,
.admin-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.admin-form input[type="number"] {
  width: 80px;
}

.admin-form label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: var(--bg);
}

.admin-list li span {
  font-size: 0.9rem;
}

.admin-list .btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.admin-columns-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.admin-hint {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 10px 12px;
  }
  .header-left {
    flex-wrap: wrap;
    gap: 8px;
  }
  .header h1 {
    font-size: 1.1rem;
    width: 100%;
    margin-bottom: 4px;
  }
  .table-wrap {
    padding: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    font-size: 0.85rem;
  }
  .data-table th,
  .data-table td {
    padding: 8px 10px;
    min-height: 40px;
  }
  .btn {
    padding: 10px 14px;
    min-height: 44px;
  }
  .filter-panel {
    max-height: 180px;
  }
  .pagination-wrap {
    flex-direction: column;
    gap: 8px;
  }
  .modal-content {
    max-width: 96%;
    max-height: 90vh;
  }
  .folder-tree-item {
    padding: 8px;
  }
  .cell-folder {
    flex-wrap: nowrap;
    display: flex;
    gap: 10px;
    align-items: center;
  }
  .cell-folder .btn-cell-icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }
  .cell-folder .btn-cell-icon svg {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 480px) {
  .header-left {
    flex-direction: column;
  }
  .header-left .btn {
    width: 100%;
  }
}
