/* ============================================================
   ЦУП СУПЕРО ГРУП — дизайн-система v2
   Inspired by Linear × Apple. Restrained palette, warm neutrals.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* --- Surfaces --- */
  --bg:        #f6f5f2;       /* тёплый off-white фон */
  --surface:   #ffffff;
  --surface2:  #f0eeea;       /* слегка тёплый серый */
  --surface3:  #e8e4de;

  /* --- Borders --- */
  --border:    #e4e1db;
  --border2:   #d8d4cc;

  /* --- Text --- */
  --text:      #1c1a18;       /* тёплый near-black */
  --text2:     #706c65;       /* secondary */
  --text3:     #a39e96;       /* tertiary / placeholder */

  /* --- Accent (СУПЕРО red — фирменный цвет бренда) --- */
  --accent:    #CC1B1B;
  --accent2:   #a81515;
  --accent-bg: #fff0f0;       /* tint для hover/focus */

  /* --- Семантические цвета --- */
  --green:     #059669;
  --green-bg:  #ecfdf5;
  --red:       #dc2626;
  --red-bg:    #fef2f2;
  --yellow:    #d97706;
  --yellow-bg: #fffbeb;
  --blue:      #2563eb;
  --blue-bg:   #eff6ff;
  --purple:    #7c3aed;
  --purple-bg: #f5f3ff;

  /* --- Sidebar --- */
  --sidebar-bg:      #17161c;    /* near-black, лёгкий пурпурный оттенок как у Linear */
  --sidebar-surface: #1e1d25;
  --sidebar-text:    #8c8898;
  --sidebar-text2:   #c4bfd8;
  --sidebar-border:  rgba(255,255,255,.07);
  --sidebar-accent:  #CC1B1B;    /* amber — логотип О */

  /* --- Геометрия --- */
  --radius:    10px;
  --radius-sm: 7px;
  --radius-xs: 5px;
  --sidebar-w: 240px;

  /* --- Тени --- */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08);

  /* --- Типографика --- */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', ui-monospace, monospace;

  /* --- Переходы --- */
  --t: 140ms cubic-bezier(.4,0,.2,1);
  --t-fast: 80ms cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13.5px; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.content { padding: 28px 36px; flex: 1; max-width: 1400px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--sidebar-border);
}

/* --- Логотип --- */
.sidebar .logo {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 6px;
  text-decoration: none;
}
.sidebar .logo-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.sidebar .logo-wordmark {
  display: flex;
  align-items: baseline;
  gap: 0;
}
.sidebar .logo-super {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #ffffff;
  line-height: 1;
}
.sidebar .logo-o {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--sidebar-accent);
  line-height: 1;
}

/* --- Навигация --- */
.sidebar .nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; scrollbar-width: thin; scrollbar-color: var(--sidebar-border) transparent; }
.sidebar .nav-group { margin-bottom: 6px; }
.sidebar .nav-group-title {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #4a4758;
  padding: 8px 10px 4px;
  user-select: none;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar .nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity var(--t-fast);
}
.sidebar .nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--sidebar-text2);
}
.sidebar .nav-item:hover .nav-icon { opacity: 1; }
.sidebar .nav-item.active {
  background: rgba(255,255,255,.1);
  color: #ffffff;
}
.sidebar .nav-item.active .nav-icon { opacity: 1; }

/* --- Userbox --- */
.sidebar .user-box {
  border-top: 1px solid var(--sidebar-border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar .user-box .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sidebar .user-box .uname { color: #d8d4e8; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.sidebar .user-box .urole { font-size: 11px; color: #605c70; line-height: 1.2; }
.sidebar .logout {
  margin-left: auto;
  color: #4a4758;
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-xs);
  font-size: 16px;
  transition: color var(--t-fast), background var(--t-fast);
  line-height: 1;
}
.sidebar .logout:hover { color: var(--red); background: rgba(220,38,38,.12); }

/* Collapsed на средних экранах — только иконки */
@media (max-width: 1100px) and (min-width: 769px) {
  :root { --sidebar-w: 56px; }
  .sidebar .logo-wordmark,
  .sidebar .nav-item .label,
  .sidebar .nav-group-title,
  .sidebar .user-box .uname,
  .sidebar .user-box .urole { display: none; }
  .sidebar .logo { justify-content: center; padding: 16px 0; }
  .sidebar .nav-item { justify-content: center; padding: 10px 0; }
  .sidebar .nav-item .nav-icon { width: auto; }
  .sidebar .user-box { justify-content: center; }
  .sidebar .logout { display: none; }
}

/* Мобильный сайдбар — overlay по кнопке гамбургера */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 500;
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.35);
  }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 499;
    background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  }
  .sidebar.mobile-open ~ .sidebar-overlay,
  .sidebar-overlay.visible { display: block; }

  /* Гамбургер в топбаре */
  .topbar-burger {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; background: none;
    cursor: pointer; color: var(--text2); font-size: 20px;
    border-radius: var(--radius-sm); margin-right: 4px;
  }
  .topbar-burger:hover { background: var(--surface2); }

  .main { width: 100%; }
  .topbar { padding: 0 12px; }
  .content { padding: 14px; }
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 36px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.9);
}
.topbar h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.topbar .spacer { flex: 1; }
.topbar .topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 500;
}

/* Колокольчик уведомлений */
.topbar-bell {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
  color: var(--text2);
}
.topbar-bell:hover { background: var(--surface2); }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  pointer-events: none;
}

/* Дропдаун уведомлений */
.notif-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 320px;
  max-height: 480px;
  overflow-y: auto;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-title { font-size: 13px; font-weight: 700; }
.notif-read-all {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.notif-read-all:hover { text-decoration: underline; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { border-left: 3px solid var(--accent); padding-left: 13px; }
.notif-item-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-item-body { font-size: 12px; color: var(--text2); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--text3); margin-top: 4px; }
.notif-empty, .notif-loading { padding: 24px; text-align: center; color: var(--text2); font-size: 13px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  transition: background var(--t), border-color var(--t), transform var(--t-fast), box-shadow var(--t);
  white-space: nowrap;
  letter-spacing: -.01em;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--surface2); }

.btn.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(29,78,216,.3), 0 1px 2px rgba(29,78,216,.2);
}
.btn.btn-primary:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  box-shadow: 0 2px 6px rgba(29,78,216,.35);
}

.btn.btn-secondary {
  background: var(--surface);
  border-color: var(--border2);
  color: var(--text2);
}
.btn.btn-secondary:hover { background: var(--surface2); color: var(--text); }

.btn.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text2);
}
.btn.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn.btn-xs { padding: 3px 8px; font-size: 11.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 20px;
}
.card .card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: 14px;
}
.card .card-subtitle {
  font-size: 12px;
  color: var(--text2);
  margin-top: -10px;
  margin-bottom: 14px;
}

/* ============================================================
   KPI КАРТОЧКИ (не hero-metric — горизонтальный layout)
   ============================================================ */
.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: box-shadow var(--t), transform var(--t);
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kpi-card.is-danger { border-color: #fca5a5; }
.kpi-card.is-danger:hover { border-color: var(--red); }

.kpi-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--surface2);
}
.kpi-card:nth-child(1) .kpi-icon-wrap { background: #eff6ff; }
.kpi-card:nth-child(2) .kpi-icon-wrap { background: #ecfdf5; }
.kpi-card:nth-child(3) .kpi-icon-wrap { background: #fef2f2; }
.kpi-card:nth-child(4) .kpi-icon-wrap { background: #fffbeb; }
.kpi-card:nth-child(5) .kpi-icon-wrap { background: #f5f3ff; }

.kpi-info { flex: 1; min-width: 0; }
.kpi-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--text);
}
.kpi-label {
  font-size: 11.5px;
  color: var(--text2);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .01em;
}
.badge.gray   { background: var(--surface2); color: var(--text2); }
.badge.blue   { background: var(--blue-bg); color: var(--blue); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.green  { background: var(--green-bg); color: var(--green); }
.badge.red    { background: var(--red-bg); color: var(--red); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }

/* Приоритеты задач */
.prio-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.prio-dot.prio-low,     .prio-stripe.prio-low     { background: var(--text3); }
.prio-dot.prio-medium,  .prio-stripe.prio-medium   { background: var(--blue); }
.prio-dot.prio-high,    .prio-stripe.prio-high     { background: var(--yellow); }
.prio-dot.prio-critical,.prio-stripe.prio-critical { background: var(--red); }

.prio-stripe {
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
}

/* ============================================================
   TABLE
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}
.table th {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--surface);
  white-space: nowrap;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface2); }
.table tbody tr:last-child td { border-bottom: none; }
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.row-overdue td { color: var(--red); }
.row-overdue { background: #fff8f8 !important; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
  line-height: 1.5;
  font-size: 13.5px;
}
.input::placeholder { color: var(--text3); }
.input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-error { color: var(--red); font-size: 12px; margin-top: 5px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface2);
  border-radius: 0 0 14px 14px;
}
.modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text2);
  line-height: 1;
  transition: background var(--t), color var(--t);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: transparent; }

/* ============================================================
   TOAST (без border-left полос — используем tinted background)
   ============================================================ */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  min-width: 260px;
  max-width: 360px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: toast-in .18s ease-out;
}
.toast.success {
  background: var(--green-bg);
  border-color: #6ee7b7;
}
.toast.error {
  background: var(--red-bg);
  border-color: #fca5a5;
}
.toast.info {
  background: var(--blue-bg);
  border-color: #bfdbfe;
}
.toast .toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
}
.toast.success .toast-icon { background: var(--green); }
.toast.error   .toast-icon { background: var(--red); }
.toast.info    .toast-icon { background: var(--blue); }
.toast.toast-out { animation: toast-out .2s ease-in forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(12px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(16px); } }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f6f5f2 0%, #ede9e3 100%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.login-card .login-logo {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.login-card .login-logo .super { color: var(--text); }
.login-card .login-logo .o-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  border: 2.5px solid var(--yellow);
  border-radius: 50%;
  color: var(--yellow);
  font-size: .85em;
  line-height: 1;
  margin-left: 1px;
  position: relative;
  top: 0;
}
.login-card .login-sub {
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 28px;
  margin-top: 6px;
}

/* Поле пароля с кнопкой показать/скрыть */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap .input {
  width: 100%;
  padding-right: 40px;
}
.pw-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text2);
  display: flex;
  align-items: center;
  transition: color var(--t-fast);
}
.pw-toggle:hover { color: var(--text); }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  align-items: flex-start;
}
.kanban-col {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 272px;
  width: 272px;
  flex-shrink: 0;
}
.kanban-col-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text2);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}
.kanban-col-title .col-count {
  background: var(--surface3);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text3);
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px 11px 15px;
  margin-bottom: 7px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t), transform var(--t-fast);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; transform: scale(.98); }
.kanban-card-overdue { background: #fff8f8; border-color: #fca5a5; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}
.empty-state .empty-icon {
  font-size: 40px;
  opacity: .3;
  margin-bottom: 12px;
  display: block;
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}
.empty-state p { font-size: 13px; color: var(--text2); max-width: 340px; margin: 0 auto; }

/* ============================================================
   MODULE HEAD (шапка раздела)
   ============================================================ */
.module-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.module-head h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.spacer { flex: 1; }

/* ============================================================
   TOOLBAR
   ============================================================ */
.module-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.module-toolbar .input,
.module-toolbar select {
  width: auto;
  flex: 0 0 auto;
  min-width: 130px;
}
.view-switch {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.view-switch button {
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  transition: background var(--t-fast), color var(--t-fast);
}
.view-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ============================================================
   SKELETON (загрузка)
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
.skeleton-line { height: 14px; }
@keyframes skeleton-wave { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   УТИЛИТЫ
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-4  { gap: 4px; }  .gap-6  { gap: 6px; }  .gap-8  { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; }
.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }  .mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.text-muted  { color: var(--text2); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-xs  { font-size: 11.5px; }
.text-sm  { font-size: 12.5px; }
.text-lg  { font-size: 16px; }
.text-xl  { font-size: 20px; }
.text-bold { font-weight: 700; }
.text-semibold { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.rounded { border-radius: var(--radius-sm); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Тип-табы на странице проектов ───────────────────────── */
.type-tabs {
  display: flex;
  gap: 6px;
  padding: 0 0 16px 0;
  flex-wrap: wrap;
}
.type-tab {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.type-tab:hover { border-color: var(--accent); color: var(--accent); }
.type-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Дополнительные badge-цвета ──────────────────────────── */
.badge-purple { background: #f3e8ff; color: #7c3aed; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-teal   { background: #d1fae5; color: #065f46; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ── Архивный баннер (задачи) ─────────────────────────────── */
.archive-banner {
  background: var(--bg-secondary, #f8f9fa);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.archive-banner a { color: var(--accent); text-decoration: none; font-weight: 500; }
.archive-banner a:hover { text-decoration: underline; }

/* ── Направления в сайдбаре ─────────────────────────────── */
.nav-group-dir { border-left: 3px solid var(--dir-color, transparent); padding-left: 4px; margin-left: -4px; border-radius: 0 6px 6px 0; }
.nav-group-dir .nav-group-title { font-weight: 700; letter-spacing: 0.02em; }
.nav-group-dir .nav-item.active { background: var(--dir-bg) !important; color: var(--dir-color) !important; border-left: 3px solid var(--dir-color) !important; }
.nav-group-dir .nav-item:hover { background: var(--dir-bg); opacity: 0.9; }

.logo { padding: 20px 16px 16px; }
.logo-text { color: #fff; font-size: 18px; font-weight: 800; letter-spacing: 0.1em; }

/* ---- Preset tags (task modal) ---- */
.preset-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.preset-tag-chip {
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer;
  background: var(--bg-secondary); color: var(--text-muted);
  border: 1.5px solid var(--border); transition: all .15s;
  user-select: none;
}
.preset-tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.preset-tag-chip.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); font-weight: 600; }


/* ---- Documents module ---- */
.doc-group { padding: 0; overflow: hidden; }
.doc-group-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.doc-group-title { font-weight: 700; font-size: 15px; color: var(--text); }
.doc-subgroup-label {
  padding: 6px 16px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.doc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--bg-secondary); }
.doc-icon { font-size: 22px; flex-shrink: 0; }
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.doc-version { font-size: 11px; font-weight: 500; color: var(--text-muted); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.doc-meta { display: flex; gap: 12px; margin-top: 3px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.doc-badges { display: flex; gap: 6px; flex-shrink: 0; }
.alert-warn {
  background: #fff8e1; border: 1px solid #fbbf24; border-radius: 8px;
  padding: 10px 16px; color: #92400e; font-size: 14px; font-weight: 500;
}

/* ---- Notification bell ---- */
.notif-bell {
  position: relative; background: none; border: none; cursor: pointer;
  font-size: 20px; padding: 4px 8px; border-radius: 8px;
  transition: background .15s; color: var(--text);
}
.notif-bell:hover { background: var(--bg-secondary); }
.notif-badge {
  position: absolute; top: 0; right: 0;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.notif-panel {
  position: fixed; z-index: 9999;
  width: 360px; max-height: 520px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
}
.notif-refresh {
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: var(--text-muted); padding: 2px 6px; border-radius: 6px;
}
.notif-refresh:hover { background: var(--bg-secondary); }
.notif-section-title {
  padding: 10px 16px 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.notif-group { border-bottom: 1px solid var(--border); }
.notif-group-label {
  padding: 6px 16px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.notif-group-label.urgent { color: var(--accent); background: var(--accent-bg); }
.notif-group-label.warn { color: #d97706; background: #fffbeb; }
.notif-group-label.muted { color: var(--text-muted); }
.notif-download {
  margin-left: auto; font-size: 11px; color: var(--accent);
  text-decoration: none; padding: 2px 8px; border: 1px solid var(--accent);
  border-radius: 6px; font-weight: 600;
}
.notif-download:hover { background: var(--accent); color: #fff; }
.notif-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.task-row { cursor: pointer; transition: background .12s; }
.notif-item.task-row:hover { background: var(--bg-secondary); }
.notif-item.muted-row { color: var(--text-muted); font-size: 12px; }
.notif-exp-name { flex: 1; }
.notif-exp-amount { font-weight: 600; font-size: 13px; white-space: nowrap; }
.notif-task-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-task-date { font-size: 12px; color: var(--accent); white-space: nowrap; margin-left: 8px; }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); }

/* ============================================================
   PostMyPost / Контент-план styles
   ============================================================ */

.pmp-calendar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.pmp-day {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.pmp-day-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.pmp-day-past {
  opacity: 0.75;
}

.pmp-day-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.pmp-day-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-transform: capitalize;
  flex: 1;
}

.pmp-day-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border);
  border-radius: 10px;
  padding: 1px 7px;
}

.pmp-day-posts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
}

.pmp-post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 220px;
  max-width: 320px;
  flex: 1;
  cursor: default;
  transition: box-shadow .15s;
}

.pmp-post-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.pmp-post-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pmp-post-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.pmp-post-channels {
  font-size: 14px;
  letter-spacing: 2px;
}

.pmp-post-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.pmp-no-text {
  color: var(--text-muted);
  font-style: italic;
}

.pmp-post-media {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Status badges */
.pmp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.pmp-draft     { background: #f1f3f5; color: #495057; }
.pmp-pending   { background: #fff3cd; color: #856404; }
.pmp-scheduled { background: #e0f0ff; color: #0055aa; }
.pmp-published { background: #d1f5d3; color: #1a7a2e; }
.pmp-error     { background: #ffe5e5; color: #cc1b1b; }
.pmp-canceled  { background: #f1f3f5; color: #868e96; text-decoration: line-through; }

.view-tabs .btn-sm {
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
}


/* ============================================================
   Gantt Chart — интерактивный
   ============================================================ */
.gantt-wrap { padding: 16px; }
.gantt-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.gantt-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.gantt-range { font-size: 13px; color: var(--text-muted); min-width: 160px; text-align: center; }
.gantt-loading, .gantt-empty { padding: 40px; text-align: center; color: var(--text-muted); }

.gantt-body { display: flex; gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; }

.gantt-labels-col { min-width: 160px; max-width: 160px; border-right: 1px solid var(--border); background: var(--card-bg); flex-shrink: 0; }
.gh-spacer { height: 32px; border-bottom: 1px solid var(--border); }
.gr-label-side { height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 12px; color: var(--text); border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.gantt-chart-col { flex: 1; overflow-x: auto; position: relative; }
.gh-header { display: grid; height: 32px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.gh-cell { font-size: 10px; color: var(--text-muted); display: flex; align-items: center; padding-left: 2px; border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.gh-today { background: var(--accent-bg); }

.gantt-tracks { position: relative; }
.g-track-row { height: 40px; border-bottom: 1px solid var(--border); position: relative; background: var(--bg); }
.g-track-row:hover { background: var(--hover); }

.g-bar {
  position: absolute;
  top: 6px;
  height: 28px;
  border-radius: 6px;
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0 8px;
  min-width: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: box-shadow .1s;
  user-select: none;
  z-index: 1;
}
.g-bar:hover { box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.g-bar:active, .g-bar-dragging { cursor: grabbing; opacity: .9; }
.g-bar-text { font-size: 11px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

.g-resize {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 8px;
  cursor: ew-resize;
  background: rgba(255,255,255,.25);
  border-radius: 0 6px 6px 0;
  flex-shrink: 0;
}

.g-today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: .6;
  z-index: 3;
  pointer-events: none;
}
.g-today-line::before {
  content: 'Сегодня';
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 9px;
  color: var(--accent);
  white-space: nowrap;
}

/* Color swatches in modal */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: border-color .15s, transform .1s; }
.color-swatch.active { border-color: var(--text); transform: scale(1.15); }
.color-swatch:hover { transform: scale(1.1); }



/* ===== CRM History Feed ===== */
.history-feed { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.hist-item { display: flex; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg-secondary, #f8f9fa); }
.hist-icon { font-size: 18px; flex-shrink: 0; line-height: 1.4; }
.hist-content { flex: 1; min-width: 0; }
.hist-kind { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hist-date { font-weight: 400; margin-left: 6px; }
.hist-title { font-size: 14px; color: var(--text-primary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.hist-meeting { border-left: 3px solid #2563eb; }
.hist-task    { border-left: 3px solid #7c3aed; }
.hist-doc     { border-left: 3px solid #d97706; }
.hist-event   { border-left: 3px solid #0d9e6e; }

/* ===== CRM Kanban Funnel Split ===== */
.crm-funnel-section { }
.crm-funnel-label { padding: 8px 4px 4px; }
.crm-funnel-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 20px; }
.funnel-entry { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.funnel-mgmt  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.crm-funnel-divider { height: 1px; background: var(--border-color, #e5e7eb); margin: 12px 0; }
.crm-kanban-wrap { overflow-x: auto; }


/* ===== CRM Funnel Switcher ===== */
.crm-funnel-switcher {
  display: flex; gap: 8px; padding: 4px 0 16px;
}
.crm-fs-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 2px solid var(--border-color, #e5e7eb);
  background: var(--bg-secondary, #f8f9fa); color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
}
.crm-fs-btn:hover:not(.active) { border-color: #2563eb; color: #2563eb; }
.crm-fs-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.crm-fs-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.25); color: inherit;
}
.crm-fs-btn:not(.active) .crm-fs-count { background: var(--border-color, #e5e7eb); color: var(--text-muted); }

/* account_manager — скрытие финансовых данных в проектах */
body.am-role .bb-row,
body.am-role #add-tx-btn,
body.am-role .kpi-card:has(.kpi-label:contains("Рентабельность")),
body.am-role .kpi-card:has(.kpi-label:contains("Доход")),
body.am-role .budget-bars { display: none !important; }
