/* TWC (The Welder Catherine) — фирменные стили
   Палитра: жёлтый #FFCD00 (Pantone 116C) + чёрный + белый.
   Акценты: красный #CB2C30, синий #000FE8 — для специальных меток.
   Шрифты: Manrope (основной, аналог Cera Pro) + PT Mono (акцентный). */

:root {
  --brand:        #FFCD00;
  --brand-dark:   #1F1F1F;
  --brand-soft:   #FFF6CC;
  --brand-hover:  #E6B800;
  --accent-red:   #CB2C30;
  --accent-blue:  #000FE8;
  --text:         #1F1F1F;
  --muted:        #6c757d;
  --border:       #e6e6e6;
  --bg-soft:      #f6f6f6;
  --sidebar-bg:   #ffffff;
  --sidebar-w:    260px;
}

html, body { background: #fafafa; color: var(--text); }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: #000; }

code, .font-monospace { font-family: 'PT Mono', SFMono-Regular, Menlo, monospace; }

h1, h2, h3, h4, h5, .page-title, .fw-bold, .fw-medium { font-weight: 700; letter-spacing: -0.01em; }
.page-title { font-size: 1.7rem; margin-bottom: .25rem; color: #000; }
.section-sub { color: var(--muted); margin-bottom: 1.25rem; }

.brand-dot {
  display: inline-block; width: 14px; height: 14px;
  background: var(--brand); border-radius: 3px;
  box-shadow: 0 0 0 2px #000 inset;
}

/* Кнопки — жёлтые с чёрным текстом */
.btn-floo, .btn-twc {
  background: var(--brand); color: #000; border: 1px solid #000;
  font-weight: 600;
}
.btn-floo:hover, .btn-twc:hover {
  background: var(--brand-hover); color: #000; border-color: #000;
}
.btn-floo:active, .btn-twc:active { background: #000; color: var(--brand); }

.btn-outline-dark { border-color: #000; color: #000; }
.btn-outline-dark:hover { background: #000; color: var(--brand); }

.text-muted-floo, .text-muted-twc { color: var(--muted) !important; }

.badge-floo, .badge-twc { background: var(--brand); color: #000; font-weight: 700; }
.badge-soft  { background: var(--brand-soft); color: #000; }
.badge-muted { background: #eef1f6; color: var(--muted); }

.card { border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; }

.empty-state { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #000;
  font-weight: 700; overflow: hidden;
  box-shadow: 0 0 0 1px #000 inset;
}
.avatar-lg { width: 80px; height: 80px; font-size: 1.75rem; }

/* App shell — sidebar + main */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  height: 100vh; width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.1rem 1.25rem;
  font-weight: 800; color: #000; text-decoration: none;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em; font-size: 1.05rem;
}
.sidebar-brand:hover { color: #000; }

.sidebar-user {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--brand-soft);
}
.sidebar-user .user-name { font-weight: 600; font-size: .95rem; }
.sidebar-user .user-role { font-size: .75rem; color: var(--muted); }

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem 1.25rem; color: var(--text);
  font-size: .9rem; font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-nav-item:hover { background: var(--brand-soft); color: #000; }
.sidebar-nav-item.active {
  background: var(--brand); color: #000;
  border-left-color: #000; font-weight: 700;
}
.sidebar-nav-item i.bi { font-size: 1rem; opacity: .85; }

.sidebar-group {
  margin-top: .75rem; padding-top: .5rem; border-top: 1px solid var(--border);
}
.sidebar-group-title {
  padding: .25rem 1.25rem .5rem;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: #000; font-weight: 700;
}

/* details/summary как верхне-уровневые сворачиваемые группы */
details.sidebar-group { padding-bottom: .25rem; }
details.sidebar-group > summary.sidebar-group-title {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
details.sidebar-group > summary.sidebar-group-title::-webkit-details-marker { display: none; }
details.sidebar-group > summary.sidebar-group-title:hover { color: #000; background: var(--brand-soft); }
details.sidebar-group > summary.sidebar-group-title .chevron {
  font-size: .65rem; opacity: .5; margin-right: 1rem;
  transition: transform .15s;
}
details.sidebar-group[open] > summary.sidebar-group-title .chevron { transform: rotate(180deg); }

/* Сворачиваемые подкатегории (📊 Аналитика / 💬 Клиенты / 📦 Товар / 💰 Финансы) внутри группы */
details.sidebar-subgroup { margin: 0; }
details.sidebar-subgroup > summary.sidebar-subgroup-title {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 1.25rem .25rem;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 700; color: #6c757d;
}
details.sidebar-subgroup > summary.sidebar-subgroup-title::-webkit-details-marker { display: none; }
details.sidebar-subgroup > summary.sidebar-subgroup-title:hover { color: #000; }
details.sidebar-subgroup > summary.sidebar-subgroup-title .chevron {
  font-size: .58rem; opacity: .55; margin-left: .5rem; transition: transform .15s;
}
details.sidebar-subgroup[open] > summary.sidebar-subgroup-title .chevron { transform: rotate(180deg); }

/* Сворачиваемые подгруппы внутри админки */
.admin-subgroup { margin: 0; }
.admin-subgroup > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem 1.25rem;
  font-size: .8rem; font-weight: 600;
  color: #444;
  user-select: none;
}
.admin-subgroup > summary::-webkit-details-marker { display: none; }
.admin-subgroup > summary:hover { background: var(--brand-soft); color: #000; }
.admin-subgroup > summary i.bi:first-child { font-size: .9rem; opacity: .85; }
.admin-subgroup > summary > span { flex: 1; }
.admin-subgroup > summary .chevron {
  font-size: .7rem; opacity: .5;
  transition: transform .15s;
}
.admin-subgroup[open] > summary .chevron { transform: rotate(180deg); }
.sidebar-nav-item.sub {
  padding-left: 2.25rem; font-size: .85rem; font-weight: 500;
}
.sidebar-footer {
  padding: .5rem 0; border-top: 1px solid var(--border);
  background: #fafafa;
}

.app-main { flex: 1; min-width: 0; }

.mobile-topbar { display: none; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .2s; z-index: 1100;
    box-shadow: 0 0 20px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1099;
  }
  .sidebar-backdrop.open { display: block; }
  .mobile-topbar {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1rem; background: var(--brand); border-bottom: 2px solid #000;
    position: sticky; top: 0; z-index: 1090; font-weight: 700;
  }
  .sidebar-toggle {
    border: 1px solid #000; background: #fff; border-radius: 6px;
    width: 36px; height: 36px;
  }
}

/* Карточка-модуль на главной */
.module-card {
  display: block; padding: 1.1rem 1.25rem; background: #fff;
  border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); height: 100%; text-decoration: none;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.module-card:hover {
  transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.06);
  color: var(--text); border-color: #000;
}
.module-card .icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #000;
  font-size: 1.35rem; margin-bottom: .75rem;
  box-shadow: 0 0 0 1px #000 inset;
}
.module-card h5 { margin-bottom: .25rem; font-size: 1rem; font-weight: 700; color: #000; }
.module-card p  { margin-bottom: 0; color: var(--muted); font-size: .85rem; }

/* Логин — жёлтый бренд-фон */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--brand);
  background-image:
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(0,0,0,.04) 18px 19px);
}
.login-card {
  background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  padding: 2.5rem 2rem; width: 100%; max-width: 400px;
  border: 1px solid #000;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 1.6rem; margin-top: .65rem; font-weight: 800; }
.login-logo .subtitle { color: var(--muted); font-size: .85rem; }

/* Канбан задач и сделок */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 992px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .kanban { grid-template-columns: 1fr; } }
/* Доски со встроенным числом колонок (CRM-сделки) переполняют узкий экран —
   даём горизонтальный скролл вместо схлопывания/разъезда страницы. */
@media (max-width: 768px) {
  .kanban { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
}
.kanban-col {
  background: var(--bg-soft); border-radius: 10px;
  padding: 10px; min-height: 200px;
  border: 1px solid var(--border);
}
.kanban-col h6 {
  margin-bottom: 10px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.task-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03); transition: box-shadow .15s, border-color .15s;
}
.task-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.08); border-color: #000; }
.task-card .title { font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.task-card .title a { color: #000; text-decoration: none; }
.task-card .title a:hover { text-decoration: underline; }
.task-card .meta {
  font-size: .75rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.task-card.focused { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,205,0,.5); }
.tag {
  display: inline-block; font-size: .68rem; padding: 1px 6px;
  background: var(--brand-soft); color: #000; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.08);
}

/* Дерево оргструктуры */
.org-tree, .org-tree ul { list-style: none; }
.org-tree ul { padding-left: 1.25rem; border-left: 1px dashed var(--border); margin-left: .5rem; }
.org-tree li { padding: .15rem 0; }

/* Bootstrap-overrides под бренд */
.alert-success { background: #E8F8E0; color: #1c4d12; border-color: #B7D9A1; }
.alert-danger  { background: #fee9ea; color: #6f1c1f; border-color: var(--accent-red); }
.alert-warning { background: var(--brand-soft); color: #4a3b00; border-color: var(--brand); }

.form-control:focus, .form-select:focus {
  border-color: #000; box-shadow: 0 0 0 .2rem rgba(255,205,0,.45);
}

.table > thead { background: #fafafa; }
.table > thead th { font-weight: 700; color: #000; }

.nav-tabs .nav-link.active {
  color: #000; font-weight: 700;
  border-bottom-color: var(--brand);
  border-bottom-width: 3px;
}
.nav-tabs .nav-link { color: var(--muted); }

.dropdown-item.active, .dropdown-item:active { background: var(--brand); color: #000; }

.list-group-item.active,
.list-group-item-action.active {
  background: var(--brand); color: #000;
  border-color: rgba(0,0,0,.12); font-weight: 600;
}
.list-group-item-action:hover { background: var(--brand-soft); color: #000; }
.list-group-item-action:focus { background: var(--brand-soft); color: #000; }

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
  background: var(--brand); color: #000;
}

.page-link { color: var(--brand-dark); }
.page-link:hover { background: var(--brand-soft); color: #000; }
.page-item.active .page-link { background: var(--brand); border-color: #000; color: #000; }

.form-check-input:checked { background-color: #000; border-color: #000; }
.form-check-input:focus { border-color: #000; box-shadow: 0 0 0 .2rem rgba(255,205,0,.45); }

.page-help-btn {
  color: var(--muted); font-size: 1rem; line-height: 1;
  text-decoration: none; vertical-align: middle;
}
.page-help-btn:hover, .page-help-btn:focus {
  color: #000; text-decoration: none;
  box-shadow: 0 0 0 2px rgba(255,205,0,.5); border-radius: 50%;
}
.page-help-floating {
  position: fixed; right: 16px; bottom: 16px; z-index: 1050;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #000 !important; font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  display: flex; align-items: center; justify-content: center;
}
.popover.page-help-popover { max-width: 380px; }
.popover.page-help-popover .popover-header {
  background: var(--brand-soft); color: #000; font-weight: 700;
}
.popover.page-help-popover .popover-body { font-size: .9rem; line-height: 1.5; max-height: 70vh; overflow-y: auto; }
.popover.page-help-popover .popover-body code {
  background: #f1f1f1; padding: 1px 4px; border-radius: 3px; font-size: .85em;
}
