/* ─────────────────────────────────────────
   КОМАНДА (team.css)
───────────────────────────────────────── */
.team-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  flex: 1;
  overflow-y: auto;
}

.page.active#page-team {
  display: flex !important;
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
  background: transparent !important; /* Remove rectangular background */
  border-radius: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
}

.team-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.team-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface2);
  padding: 4px;
  border-radius: 18px;
}

.team-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.team-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.team-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff !important;
  box-shadow: 0 4px 15px var(--accent-glow);
  transform: scale(1.05);
}

/* Сетка карточек */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.team-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
  position: relative;
  backdrop-filter: blur(15px);
}

.team-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.tc-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.tc-info {
  flex: 1;
}

.tc-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0px;
}

.tc-role {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase !important;
}

.tc-position {
  font-size: 11px;
  color: var(--text3);
}

.tc-online {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  position: absolute;
  top: 42px;
  left: 42px;
}

.tc-online.on { background: var(--success); box-shadow: 0 0 10px var(--success); }
.tc-online.off { background: var(--text3); }

/* Метрики */
.tc-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--surface2);
  border-radius: 12px;
}

.tc-metric {
  text-align: center;
}

.tc-mv {
  font-size: 13px;
  font-weight: 800;
}

.tc-ml {
  font-size: 8px;
  color: var(--text3);
  text-transform: uppercase;
  font-weight: 700;
}

.tc-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text2);
}

.tc-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.tc-actions-main {
  display: flex;
  gap: 4px;
}

.tc-actions-main button {
  flex: 1;
}

.tc-actions-ctrl {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.tc-actions button {
  padding: 6px 4px;
  font-size: 11px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.tc-btn-detail, .tc-btn-rights {
  flex: 1;
}

.tc-btn-edit, .tc-btn-archive {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  padding: 0 !important;
}

/* Матрица прав в модалке */
.rights-matrix {
  margin-top: 16px;
}

.rm-table {
  width: 100%;
  border-collapse: collapse;
}

.rm-row td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.rm-module {
  font-size: 13px;
  font-weight: 700;
}

.rm-cell {
  text-align: center;
}

.rm-toggle {
  cursor: pointer;
}

.rm-cb {
  display: none;
}

.rm-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 8px;
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.rm-dot.on {
  background: var(--accent);
  border-color: var(--accent);
}

/* ─── ДЕТАЛЬНОЕ ОКНО СОТРУДНИКА ──────────────── */
.member-detail-modal {
  width: 95%;
  max-width: 740px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 32px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
}

/* Dark theme (default): semi-glassy */
.member-detail-modal {
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
}

/* Light / pastel themes: fully solid, no blur */
.light .member-detail-modal,
.theme-beige .member-detail-modal,
.theme-pink .member-detail-modal,
.theme-green .member-detail-modal,
.theme-slate .member-detail-modal {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.08) !important;
}

/* Glass theme */
.theme-glass .member-detail-modal {
  background: rgba(12, 18, 35, 0.97) !important;
  border-color: rgba(255,255,255,0.12) !important;
}

/* --- Header --- */
.lm-header {
  padding: 24px 24px 16px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

/* --- Tabs bar --- */
.md-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.04);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.light .md-tabs,
.theme-beige .md-tabs,
.theme-pink .md-tabs {
  background: #f4f6f9 !important;
}

.md-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text3);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.md-tab:hover {
  background: var(--surface2);
  color: var(--text);
}

.md-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* --- Body --- */
.md-body {
  padding: 20px 24px;
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
}

/* --- Footer --- */
.md-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.03);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.light .md-footer,
.theme-beige .md-footer,
.theme-pink .md-footer {
  background: #f4f6f9 !important;
}

/* Сетка статистики */
.md-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.md-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.md-stat-card {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.3s;
}

.md-stat-card:hover {
  border-color: var(--sc);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.md-stat-icon {
  font-size: 18px;
  opacity: 0.6;
  margin-bottom: 2px;
}

.md-stat-val {
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.md-stat-label {
  font-size: 10px;
  color: var(--text2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* План */
.md-plan-block {
  background: var(--surface2);
  padding: 14px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.md-plan-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
}

.md-join-date {
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  opacity: 0.6;
}

/* Журнал */
.md-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-log-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid transparent;
}

.md-log-row:hover {
  border-color: var(--border);
  background: var(--surface);
}

.md-log-time {
  width: 120px;
  font-weight: 700;
  color: var(--text3);
}

.md-log-action {
  flex: 1;
  color: var(--text2);
}

.md-log-ip {
  font-size: 11px;
  color: var(--text3);
  opacity: 0.5;
}

/* Аттестация */
.md-attestation {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.att-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.att-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.att-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.att-scores {
  display: flex;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.att-score-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text3);
  font-weight: 800;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.att-score-btn:hover {
  background: rgba(255,255,255,0.05);
}

.att-score-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px var(--accent-glow);
}

.att-total-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
  border: 1px dashed var(--accent);
  padding: 16px;
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.att-total-box span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text2);
}

.att-total-box b {
  font-size: 24px;
  font-weight: 900;
  color: var(--accent);
}

.att-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.att-history-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  font-size: 13px;
}

.att-history-row b {
  color: var(--success);
}

/* ─────────────────────────────────────────
   ADMIN PANEL / SYSTEM SETTINGS
───────────────────────────────────────── */
.team-system-panel {
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.ts-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.ts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 20px;
}

.ts-row:last-child {
  border-bottom: none;
}

.ts-info b {
  display: block;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 6px;
}

.ts-info p {
  font-size: 13px;
  color: var(--text3);
  margin: 0;
  opacity: 0.8;
}

.ts-ctrl {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ts-ctrl input, .ts-ctrl select {
  width: 240px !important;
}

.st-grid-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.fn-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin: 40px 0 20px 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.9;
}

/* PREMIUM LIMIT MODAL */
.limit-modal-premium {
    padding: 30px;
    text-align: center;
    max-width: 450px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08);
}

.lp-icon-wrap {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.lp-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 12px;
}

.lp-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 24px;
}

.lp-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lp-btn {
    border: none;
    padding: 12px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.lp-btn-primary {
    background: linear-gradient(90deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.lp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.lp-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.lp-btn-secondary:hover {
    background: #e2e8f0;
}

.lp-hint {
    margin-top: 20px;
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dark-mode .limit-modal-premium {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .lp-title { color: #f8fafc; }
.dark-mode .lp-desc { color: #94a3b8; }
.dark-mode .lp-btn-secondary { background: #334155; color: #cbd5e1; }

/* ─── TEAM MINI-DASHBOARD (js/team_stats.js) ─── */
.ts-mini-dash {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 4px;
}

.ts-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: rgba(0,0,0,0.03);
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.02);
}

.ts-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.ts-kpi-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.ts-kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--kpi-color);
}

.ts-kpi-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(var(--accent-rgb), 0.2);
}

.ts-kc-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kpi-color);
  font-size: 18px;
}

.ts-kc-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.ts-kc-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.ts-details-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

.ts-funnel-card, .ts-extra-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 20px;
}

.ts-card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ts-funnel-row {
  margin-bottom: 16px;
}

.ts-fr-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.ts-fr-name {
  font-weight: 700;
  color: var(--text2);
}

.ts-fr-count {
  color: var(--text3);
  font-weight: 600;
}

.ts-fr-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.ts-fr-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ts-fr-pct {
  font-size: 10px;
  font-weight: 800;
  color: var(--text);
  text-align: right;
}

.ts-eff-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.ts-eff-label {
  font-size: 12px;
  color: var(--text3);
}

.ts-eff-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

@media (max-width: 768px) {
    .ts-details-grid {
        grid-template-columns: 1fr;
    }
    .ts-topbar {
        flex-direction: column;
        align-items: stretch;
    }
}
