/* ==========================================================================
   Shiftyn Gang — Team Site
   Премиальный минимализм в духе Apple
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { margin: 0; padding: 0; min-height: 100%; width: 100%; }

/* --------------------------------------------------------------------------
   Токены тем
   -------------------------------------------------------------------------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
          'Helvetica Neue', system-ui, sans-serif;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --ring: 0 0 0 4px rgba(10, 132, 255, 0.18);

  /* Светлая тема (по умолчанию, как apple.com) */
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --primary-soft: rgba(0, 113, 227, 0.1);

  --bg: #f5f5f7;
  --bg-gradient: radial-gradient(1200px 600px at 15% -10%, rgba(0,113,227,0.08), transparent 60%),
                 radial-gradient(1000px 500px at 100% 0%, rgba(94,92,230,0.07), transparent 55%);
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-elevated: #f2f2f4;
  --glass: rgba(255, 255, 255, 0.72);
  --column-bg: rgba(255, 255, 255, 0.38);
  --cell-bg: #ecedf0;
  --cell-bg-marked: #ffffff;

  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-faint: #86868b;

  --border: rgba(0, 0, 0, 0.13);
  --border-strong: rgba(0, 0, 0, 0.22);

  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.1);
  --success: #34c759;
  --success-soft: rgba(52, 199, 89, 0.12);
  --warning: #ff9500;
  --warning-soft: rgba(255, 149, 0, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 12px 24px rgba(0, 0, 0, 0.08), 0 32px 80px rgba(0, 0, 0, 0.16);

  --nav-height: 60px;
  color-scheme: light;
}

/* Тёмная тема */
html[data-theme="dark"] {
  --primary: #0a84ff;
  --primary-hover: #409cff;
  --primary-soft: rgba(10, 132, 255, 0.14);

  --bg: #000000;
  --bg-gradient: radial-gradient(1200px 600px at 15% -10%, rgba(10,132,255,0.14), transparent 60%),
                 radial-gradient(1000px 500px at 100% 0%, rgba(94,92,230,0.12), transparent 55%);
  --surface: #1c1c1e;
  --surface-2: #171719;
  --surface-elevated: #2c2c2e;
  --glass: rgba(22, 22, 24, 0.66);
  --column-bg: rgba(28, 28, 30, 0.30);
  --cell-bg: #131316;
  --cell-bg-marked: #29292e;

  --text: #f5f5f7;
  --text-muted: #98989d;
  --text-faint: #6e6e73;

  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.14);
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.14);
  --warning: #ffd60a;
  --warning-soft: rgba(255, 214, 10, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 12px 24px rgba(0, 0, 0, 0.5), 0 32px 80px rgba(0, 0, 0, 0.7);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   База
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.47059;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

::selection { background: var(--primary-soft); color: var(--text); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 8px 0 28px;
  line-height: 1.1;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 36px 0 16px;
}

/* --------------------------------------------------------------------------
   Шапка (навигация)
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}

.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-brand a {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s var(--ease);
}
.nav-brand a:hover { opacity: 0.75; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6 60%, #bf5af2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.35);
  flex-shrink: 0;
}

.version {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-elevated);
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.nav-links { display: flex; gap: 6px; align-items: center; }

.nav-links a,
.nav-links button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 980px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-links a:hover,
.nav-links button:hover {
  background: var(--surface-elevated);
}

/* Кнопка выхода — приглушённая */
.nav-links a.logout-link { color: var(--text-muted); }

/* Переключатель темы */
.theme-toggle {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 980px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.3s var(--ease);
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s var(--spring);
  color: #f59e0b;
}
html[data-theme="dark"] .theme-toggle .thumb {
  transform: translateX(18px);
  color: #b0b0ff;
}

/* Режим просмотра от лица пользователя */
.view-as-user-btn, .exit-view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary-soft);
  color: var(--primary);
  border: none;
  border-radius: 980px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s var(--ease);
}
.view-as-user-btn:hover { background: var(--primary); color: #fff; }
.exit-view-mode-btn {
  background: var(--danger-soft);
  color: var(--danger);
}
.exit-view-mode-btn:hover { background: var(--danger); color: #fff; }
.view-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--warning-soft);
  color: var(--warning);
  border-radius: 980px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Кнопка уведомлений */
.notification-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: background 0.2s var(--ease);
}
.notification-btn:hover { background: var(--surface-elevated); }
.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: #fff;
  border-radius: 980px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--glass);
}

/* --------------------------------------------------------------------------
   Контейнер
   -------------------------------------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 28px 120px;
  position: relative;
  z-index: 1;
  animation: fade-up 0.6s var(--ease);
  transition: transform 0.3s var(--ease);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Карточки и сетки
   -------------------------------------------------------------------------- */
.page-hero {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}
.page-hero h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.hero-sub {
  font-size: 1.2rem;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--ease),
              border-color 0.35s var(--ease), background 0.4s var(--ease);
}
.card h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: 6px; }
.card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; }

.grid { display: grid; gap: 24px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Карточки-навигация на дашборде */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 20px auto 0;
}

.card.clickable {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}
.card.clickable:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-strong);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  transition: transform 0.35s var(--spring);
}
.card.clickable:hover .card-icon { transform: scale(1.08); }
.card.clickable h3 { font-size: 1.35rem; margin-bottom: 8px; }
.card.clickable .card-desc { margin: 0; }

.card-arrow {
  position: absolute;
  top: 28px;
  right: 28px;
  color: var(--text-faint);
  transition: transform 0.3s var(--spring), color 0.3s var(--ease);
}
.card.clickable:hover .card-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Списки
   -------------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.item {
  background: var(--surface);
  padding: 20px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.4s var(--ease);
}
.item:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.item strong { color: var(--text); font-weight: 600; font-size: 1.05rem; }
.item small { color: var(--text-muted); display: block; margin-top: 6px; font-size: 0.875rem; }

/* --------------------------------------------------------------------------
   Формы
   -------------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 18px; max-width: 520px; }
.form-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 0.875rem; font-weight: 500; }

input, select, textarea {
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.4s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 100px; }

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  accent-color: var(--primary);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Кнопки
   -------------------------------------------------------------------------- */
button.btn, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
}
button.btn:hover, .btn:hover { background: var(--primary-hover); }
button.btn:active, .btn:active { transform: scale(0.97); }
.btn-small { padding: 8px 16px; font-size: 0.875rem; }

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 11px 20px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger); filter: brightness(1.1); }

/* --------------------------------------------------------------------------
   Таблицы
   -------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
}
th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* Таблица пользователей в админ-панели */
.admin-users td:last-child { width: 1%; }
.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
/* Фиксированная ширина — списки ролей стоят ровно друг под другом */
.user-actions select {
  width: 170px;
  min-width: 170px;
  flex-shrink: 0;
}
.delete-btn-spacer {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-block;
}

/* --------------------------------------------------------------------------
   Канбан (доска задач)
   -------------------------------------------------------------------------- */
.kanban-container {
  /* Растягиваем доску на всю ширину окна, выходя за limits .container */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 24px 24px;
  overflow-x: auto;
  height: calc(100vh - var(--nav-height) - 180px);
  min-height: 420px;
}
.kanban {
  display: flex;
  gap: 20px;
  /* max-content + auto-отступы: группа центрируется, когда колонок мало,
     и уходит в скролл от левого края, когда они не помещаются (без обрезки) */
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  height: 100%;
  align-items: stretch;
}
.column {
  min-width: 300px;
  /* Ширина колонки = ровно 5 колонок на экран (48px — padding доски,
     5*20px — промежутки, 84px — кнопка «добавить колонку»).
     flex-basis запрещает сжатие: 6-я и далее колонки уходят за край и скроллятся. */
  flex: 1 0 calc((100vw - 232px) / 5);
  max-width: calc((100vw - 232px) / 5);
  background: var(--column-bg);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  height: 100%;
  /* Лёгкая прозрачность, чтобы просвечивало звёздное небо.
     Сильное размытие «съедает» звёзды, поэтому blur небольшой */
  backdrop-filter: blur(6px) saturate(150%);
  -webkit-backdrop-filter: blur(6px) saturate(150%);
}
.column h3 {
  font-size: 1.1rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tasks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
  /* Отступ, чтобы ползунок не прилипал к карточкам */
  padding-right: 12px;
}

.task-card {
  background: var(--surface);
  padding: 16px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  cursor: grab;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              border-color 0.25s var(--ease), background 0.4s var(--ease);
}
.task-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.5; border-color: var(--primary); }

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.task-header strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  word-break: break-word;
  line-height: 1.3;
}
.task-deadline {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.task-deadline svg { flex-shrink: 0; opacity: 0.75; }
.task-assignee {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 500;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 5px;
}
.task-assignee svg { flex-shrink: 0; opacity: 0.85; }
.task-creator {
  font-size: 0.75rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.task-creator svg { flex-shrink: 0; opacity: 0.7; }

.add-task-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.add-task-btn:hover { background: var(--primary-soft); border-color: var(--primary); }

.add-column-btn-wrapper { display: flex; align-items: center; min-width: 84px; }
.add-column-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: transparent;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.3s var(--spring);
}
.add-column-btn:hover { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.06); }

/* --------------------------------------------------------------------------
   Модальные окна
   -------------------------------------------------------------------------- */
.modal {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-in 0.3s var(--ease) both;
}
@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-up 0.35s var(--spring) both;
}
@keyframes modal-up {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 1.4rem; margin: 0; font-weight: 600; }
.modal-close {
  background: var(--surface-elevated);
  border: none;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.modal-close:hover { color: var(--danger); background: var(--danger-soft); }
.modal-close svg { display: block; }

/* Заголовок задачи в шапке модалки */
.edit-title-input {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 0;
  outline: none;
  font-family: inherit;
  letter-spacing: -0.02em;
  height: auto;
  line-height: 1.2;
}
.edit-title-input:not([readonly]) {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 4px;
}

.modal-header .edit-title-input {
  flex: 1;
  width: auto;
  min-width: 0;
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 8px; }
.form-row-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.delete-btn:hover { color: var(--danger); background: var(--danger-soft); }

/* Кнопка удаления колонки — крупнее, выровнена с заголовком */
.delete-column-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.delete-column-btn:hover { color: var(--danger); background: var(--danger-soft); }

/* --------------------------------------------------------------------------
   Карты
   -------------------------------------------------------------------------- */
.maps-wrapper { display: flex; gap: 24px; flex-wrap: wrap; }
.map-card {
  background: var(--surface);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  flex: 1;
  min-width: 320px;
}
.map-card h3 { margin-bottom: 16px; font-size: 1.25rem; font-weight: 600; }
.floor-controls { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.floor-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  font-family: inherit;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.floor-btn:hover { background: var(--surface-2); }
.floor-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
#floor-info { margin-top: 12px; color: var(--text-muted); font-size: 0.9rem; }
.hint { margin-top: 12px; font-size: 0.85rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Страницы авторизации
   -------------------------------------------------------------------------- */
.auth-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: var(--surface);
  padding: 52px 44px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 440px;
  animation: modal-up 0.5s var(--spring) both;
}
.auth-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6 60%, #bf5af2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin: 0 auto 24px;
  box-shadow: 0 12px 32px rgba(10, 132, 255, 0.4);
}
.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}
.auth-card .form { max-width: 100%; }
.auth-card p { margin-top: 22px; font-size: 0.92rem; text-align: center; color: var(--text-muted); }
.auth-card a { color: var(--primary); font-weight: 500; }
.auth-card a:hover { text-decoration: underline; }
.auth-card button[type="submit"] { width: 100%; }

/* --------------------------------------------------------------------------
   Уведомления (модал)
   -------------------------------------------------------------------------- */
.notification-modal-content { max-width: 520px; }
.notification-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.notification-item {
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.notification-item.unread {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.notification-content { flex: 1; }
.notification-message { font-size: 0.93rem; color: var(--text); margin-bottom: 4px; }
.notification-time { font-size: 0.75rem; color: var(--text-muted); }
.notification-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  transition: color 0.2s var(--ease);
}
.notification-close:hover { color: var(--danger); }
.notification-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 0.95rem; }

/* --------------------------------------------------------------------------
   Выбор ответственных
   -------------------------------------------------------------------------- */
.assignee-select-container {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.assignee-select-container.disabled { opacity: 0.6; pointer-events: none; }
.assignee-selected {
  padding: 12px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 42px;
  flex-wrap: wrap;
  gap: 6px;
  border-radius: var(--radius-sm);
  user-select: none;
  transition: background 0.2s var(--ease);
}
.assignee-selected:hover { background: var(--surface-2); }
.assignee-placeholder { color: var(--text-faint); }

.assignee-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
}
.assignee-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
  user-select: none;
  transition: background 0.15s var(--ease);
}
.assignee-option:hover { background: var(--primary-soft); }
.assignee-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  align-self: center;
}
.assignee-option label { cursor: pointer; flex: 1; margin: 0; padding: 0; }

/* --------------------------------------------------------------------------
   Кнопка «на главную»
   -------------------------------------------------------------------------- */
.back-to-home-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-elevated);
  transition: transform 0.3s var(--spring), background 0.2s var(--ease), color 0.2s var(--ease);
  z-index: 1000;
}
.back-to-home-btn:hover { transform: translateY(-4px); background: var(--primary); color: #fff; }
.back-to-home-btn svg { stroke: currentColor; }

/* --------------------------------------------------------------------------
   Детальная карточка задачи
   -------------------------------------------------------------------------- */
.btn-back { margin-bottom: 20px; }
.detail-card { background: var(--surface); border-radius: var(--radius-lg); padding: 32px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin-bottom: 28px; }
.detail-field { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.detail-value { font-size: 1rem; color: var(--text); }
.priority-badge { display: inline-flex; padding: 4px 12px; border-radius: 980px; font-size: 0.85rem; font-weight: 500; width: fit-content; }
.priority-high { background: var(--danger-soft); color: var(--danger); }
.priority-medium { background: var(--warning-soft); color: var(--warning); }
.priority-low { background: var(--success-soft); color: var(--success); }
.detail-description h3, .detail-attachments h3, .detail-add-attachment h3 { font-size: 1.1rem; margin-bottom: 12px; }
.description-content { color: var(--text-muted); line-height: 1.6; }
.attachments-list { display: flex; flex-direction: column; gap: 10px; }
.attachment-item { display: flex; align-items: center; gap: 12px; }
.attachment-link { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 500; }
.attachment-delete { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 1.1rem; padding: 2px 6px; border-radius: 6px; }
.attachment-delete:hover { color: var(--danger); background: var(--danger-soft); }
.attach-empty { color: var(--text-faint); font-size: 0.9rem; }
.attach-add-row { display: flex; gap: 8px; align-items: center; }
.attach-add-row input[type="file"] { flex: 1; }
.detail-add-attachment { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.attach-form { display: flex; gap: 12px; align-items: center; }

/* --------------------------------------------------------------------------
   Алерты
   -------------------------------------------------------------------------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.92rem;
  border: 1px solid var(--border);
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }

/* --------------------------------------------------------------------------
   Скроллбары
   -------------------------------------------------------------------------- */
.tasks, .kanban-container, .notification-list, .assignee-dropdown {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.tasks::-webkit-scrollbar,
.kanban-container::-webkit-scrollbar,
.notification-list::-webkit-scrollbar,
.assignee-dropdown::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.tasks::-webkit-scrollbar-thumb,
.kanban-container::-webkit-scrollbar-thumb,
.notification-list::-webkit-scrollbar-thumb,
.assignee-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Страница задач: без вертикальной прокрутки, только горизонтальный скролл доски
   -------------------------------------------------------------------------- */
body.page-tasks {
  height: 100vh;
  overflow: hidden;
}
body.page-tasks .container {
  height: calc(100vh - var(--nav-height));
  padding: 24px 28px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: none;
}
body.page-tasks .page-hero {
  flex-shrink: 0;
  margin-bottom: 18px;
}
body.page-tasks .kanban-container {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

/* Шапка колонки: заголовок + иконка-фильтр */
.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.column-head h3 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  flex: 1;
}

/* Фильтр по ответственным (воронка) */
.filter-wrap { position: relative; flex-shrink: 0; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.filter-btn:hover { color: var(--primary); background: var(--primary-soft); }
.filter-btn.active { color: var(--primary); background: var(--primary-soft); }

.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  z-index: 1000;
  min-width: 180px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.filter-option {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  transition: background 0.15s var(--ease);
}
.filter-option:hover { background: var(--primary-soft); }
.filter-option.selected { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

/* Модал подтверждения удаления */
.delete-confirm-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 16px;
}
.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}
.remember-label input { width: 16px; height: 16px; }

/* Toast отмены удаления */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-elevated);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1200;
  max-width: 90vw;
  animation: toast-up 0.35s var(--spring) both;
}
.undo-toast span {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes toast-up {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* --------------------------------------------------------------------------
   Фоновые декоративные слои (тёмная тема): звёздное небо + свечение за курсором
   -------------------------------------------------------------------------- */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
html[data-theme="dark"] #starfield { opacity: 1; }

#cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  will-change: transform;
  background: radial-gradient(circle at center,
      rgba(10, 132, 255, 0.14),
      rgba(94, 92, 230, 0.06) 45%,
      transparent 72%);
  mix-blend-mode: screen;
  transition: opacity 0.4s var(--ease);
}
html[data-theme="dark"] #cursor-glow { opacity: 1; }

/* --------------------------------------------------------------------------
   Недельное расписание смен (Planner-стиль)
   -------------------------------------------------------------------------- */
body.page-handover { height: 100vh; overflow: hidden; }
body.page-handover .container {
  max-width: none;
  padding: 24px 24px 24px;
  height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
}
body.page-handover .page-hero { flex-shrink: 0; margin-bottom: 12px; }

.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-shrink: 0;
  margin-bottom: 12px;
}
.week-nav-btn { padding: 8px 18px; }
.week-range {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  min-width: 160px;
  text-align: center;
}

.schedule-wrap { flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
.schedule {
  display: grid;
  grid-template-columns: 200px repeat(7, minmax(120px, 1fr));
  gap: 8px;
  min-width: 1040px;
  height: 100%;
  grid-template-rows: auto;
  grid-auto-rows: minmax(72px, 1fr);
}
.schedule-corner,
.schedule-employee {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.schedule-corner {
  display: flex;
  align-items: flex-end;
  padding: 0 10px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.schedule-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.schedule-day-header .dow {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.schedule-day-header .dnum { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.schedule-day-header.is-today { border-color: var(--primary); }
.schedule-day-header.is-today .dow { color: var(--primary); }

.schedule-employee {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--text);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.employee-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
}
.employee-name[onclick] { cursor: pointer; }
.employee-name[onclick]:hover { color: var(--primary); }
.employee-rename-input {
  width: 88%;
  font-size: 1.05rem;
  text-align: center;
  padding: 6px 8px;
}

.shift-cell {
  position: relative;
  min-height: 76px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--cell-bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px;
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.shift-cell:hover { border-color: var(--text-faint); }
.schedule.view-only .shift-cell { cursor: default; }
.schedule.view-only .shift-cell:hover { border-color: var(--border-strong); background: var(--cell-bg); }

/* Отмеченная смена — нейтрально светлее (без синего) */
.shift-cell.marked { background: var(--cell-bg-marked); }
.schedule.shift-mark-mode .shift-cell {
  cursor: pointer;
  border-style: dashed;
}

.cell-comment {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  flex: 1;
}
.cell-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
}
.cell-task-count {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
}
.cell-task-done {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
}

/* Панель и кнопка режима проставления смен */
.shift-mode-bar {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-bottom: 10px;
}
.shift-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.shift-mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Задачи-чекбоксы передачи смены */
.note-tasks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; max-height: 220px; overflow-y: auto; }
.note-empty { color: var(--text-faint); font-size: 0.9rem; padding: 6px 0; }
.note-task-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.note-task-row { display: flex; align-items: center; gap: 8px; }
.note-task-label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; font-size: 0.92rem; color: var(--text); }
.note-task-label input { width: 16px; height: 16px; }
.note-task-item.done .note-task-label span { text-decoration: line-through; color: var(--text-faint); }
.note-attach-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.note-attach-btn:hover { color: var(--primary); background: var(--primary-soft); }
.note-attachments { display: flex; flex-direction: column; gap: 4px; }
.note-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 10px;
  border-radius: 980px;
  background: var(--surface-elevated);
  font-size: 0.75rem;
}
.note-attach-chip a { color: var(--primary); font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-attach-chip button {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 4px;
  border-radius: 50%;
}
.note-attach-chip button:hover { color: var(--danger); }
.note-task-del {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.note-task-del:hover { color: var(--danger); background: var(--danger-soft); }
.note-add-row { display: flex; gap: 8px; }
.note-add-row input { flex: 1; }

/* Поповер выбора смены */
.shift-picker {
  position: fixed;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
}
.shift-option {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s var(--ease);
}
.shift-option:hover { background: var(--primary-soft); }
.shift-option.shift-clear { color: var(--danger); }
.shift-option.shift-clear:hover { background: var(--danger-soft); }

/* --------------------------------------------------------------------------
   Панель просмотра фотографии (справа)
   -------------------------------------------------------------------------- */
:root { --preview-w: min(46vw, 560px); }

.photo-preview {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--preview-w);
  z-index: 2000;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-elevated);
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
  display: flex;
  flex-direction: column;
}
.photo-preview.open { transform: translateX(0); }

.photo-preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.photo-preview-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-preview-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.photo-preview-download:hover { color: var(--primary); background: var(--primary-soft); }

.photo-preview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}
.photo-preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* Сдвиг основного окна влево при открытой фотографии */
body.photo-open .navbar,
body.photo-open .container {
  transform: translateX(calc(var(--preview-w) * -0.5));
}

/* Элементы вложений */
.attachment-item { display: flex; align-items: center; gap: 10px; }
.attachment-type { color: var(--text-faint); display: inline-flex; flex-shrink: 0; }
.attachment-name {
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.attachment-name.is-photo {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
}
.attachment-name.is-photo:hover { text-decoration: underline; }
.attachment-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.attachment-download:hover { color: var(--primary); background: var(--primary-soft); }
.attachment-link { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 500; }

/* --------------------------------------------------------------------------
   Гайды
   -------------------------------------------------------------------------- */
.guides-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.guide-search { flex: 1; min-width: 220px; }

.guide-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.guide-cat {
  padding: 7px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: inherit;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.guide-cat:hover { border-color: var(--border-strong); color: var(--text); }
.guide-cat.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.guide-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.guide-card-head { display: flex; align-items: center; gap: 8px; }
.guide-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.guide-cat-badge {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 980px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.guide-title { font-size: 1.1rem; font-weight: 600; margin: 0; line-height: 1.3; word-break: break-word; }
.guide-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.guide-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.guide-meta { font-size: 0.78rem; color: var(--text-faint); flex: 1; }
.guide-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.guides-empty { padding: 60px 0; text-align: center; color: var(--text-muted); font-size: 1rem; }
.guide-title a { color: var(--text); }
.guide-title a:hover { color: var(--primary); }

/* Детальная страница гайда */
.guide-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head-spacer { flex: 1; }
.guide-title-input {
  width: 100%;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  margin: 0 0 16px;
  outline: none;
  font-family: inherit;
}
.guide-title-input:not([readonly]):focus { border-bottom: 2px solid var(--primary); padding-bottom: 4px; }

.guide-editor {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.guide-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.tb-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.tb-btn:hover { background: var(--primary-soft); color: var(--primary); }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; align-self: center; }

.guide-content {
  min-height: 60vh;
  padding: 20px 22px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  outline: none;
}
.guide-content:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.guide-content img { max-width: 100%; border-radius: 10px; margin: 8px 0; }
.guide-content h2 { margin: 18px 0 8px; }
.guide-content ul, .guide-content ol { padding-left: 24px; margin: 8px 0; }
.guide-content a { color: var(--primary); }
.guide-detail-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Ручки изменения размера картинок в редакторе */
.img-resize-handle {
  position: fixed;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 50%;
  z-index: 3000;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.img-resize-handle.nw { cursor: nwse-resize; }
.img-resize-handle.ne { cursor: nesw-resize; }
.img-resize-handle.sw { cursor: nesw-resize; }
.img-resize-handle.se { cursor: nwse-resize; }

/* Ручка перемещения картинки */
.img-move-handle {
  position: fixed;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  z-index: 3000;
  cursor: move;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.img-move-handle svg { width: 10px; height: 10px; }

/* Подпись на главной странице */
.home-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
  font-size: 0.78rem;
  color: var(--text-faint);
}
.home-footer span { opacity: 0.75; }

/* --------------------------------------------------------------------------
   Адаптивность
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .navbar { padding: 0 16px; }
  .container { padding: 24px 16px 100px; }
  h1 { font-size: 2rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .column { min-width: 260px; }
  .auth-card { padding: 36px 24px; }
  .form-row-two { grid-template-columns: 1fr; }
  .detail-meta { grid-template-columns: 1fr 1fr; }
}

/* Уважение к настройке уменьшенного движения */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
