/* ========================
   LOGIN SCREEN
======================== */
.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0f1117;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.login-overlay.show { display: flex; }

.login-box {
  background: #1a1d27;
  border: 1px solid #2a2f45;
  border-radius: 12px;
  padding: 40px 36px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.login-logo-icon { font-size: 24px; }
.login-logo-text { font-size: 18px; font-weight: 700; color: #e8eaf0; }

.login-error {
  color: #ff4d6d;
  font-size: 13px;
  min-height: 18px;
}

.login-input {
  background: #22263a;
  border: 1px solid #2a2f45;
  color: #e8eaf0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: #5b6af0; }

.login-btn {
  background: #5b6af0;
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}
.login-btn:hover    { opacity: 0.88; }
.login-btn:disabled { opacity: 0.55; pointer-events: none; }

/* ========================
   AUTH USER (sidebar)
======================== */
.auth-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-top: 1px solid #2a2f45;
  margin-bottom: 8px;
}
.auth-user-name    { font-size: 13px; font-weight: 500; color: #e8eaf0; }
.auth-logout-btn   {
  background: none; border: none; color: #7a7f9a;
  font-size: 12px; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; font-family: inherit;
  transition: color 0.1s, background 0.1s;
}
.auth-logout-btn:hover { color: #ff4d6d; background: rgba(255,77,109,0.1); }

/* ========================
   BTN USERS
======================== */
.btn-users {
  display: flex; align-items: center; gap: 6px;
  background: transparent; color: #7a7f9a;
  border: 1px solid #2a2f45; padding: 8px 14px;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-users:hover { background: #22263a; color: #e8eaf0; border-color: #5b6af0; }

/* ========================
   USERS MODAL
======================== */
.modal-wide { max-width: 580px; }

.user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-bottom: 1px solid #2a2f45;
}
.user-row:last-child { border-bottom: none; }

.user-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-name  { font-size: 14px; font-weight: 600; color: #e8eaf0; }
.user-login { font-size: 12px; color: #7a7f9a; }
.user-depts { font-size: 11px; color: #7a7f9a; }

.badge-role {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px;
}
.role-superadmin { background: rgba(255,200,0,0.15); color: #f0b800; border: 1px solid rgba(255,200,0,0.3); }
.role-admin      { background: rgba(91,106,240,0.15); color: #5b6af0; }
.role-watcher    { background: rgba(46,204,113,0.12); color: #2ecc71; }
.role-manager    { background: rgba(122,127,154,0.15); color: #7a7f9a; }

.user-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

.user-del-btn {
  background: none; border: none; color: #7a7f9a;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
  font-size: 13px; transition: color 0.1s, background 0.1s;
}
.user-del-btn:hover { color: #ff4d6d; background: rgba(255,77,109,0.1); }

.user-unlock-btn {
  background: none; border: 1px solid rgba(46,204,113,0.3); color: #2ecc71;
  cursor: pointer; padding: 4px 10px; border-radius: 4px;
  font-size: 12px; font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
}
.user-unlock-btn:hover { background: rgba(46,204,113,0.1); border-color: #2ecc71; }

.user-row-locked { background: rgba(255,77,109,0.04); }

.user-edit-btn {
  background: none; border: none; color: #7a7f9a;
  cursor: pointer; padding: 4px 7px; border-radius: 4px;
  font-size: 13px; opacity: 0.7; transition: opacity 0.1s, background 0.1s;
}
.user-edit-btn:hover { opacity: 1; background: rgba(255,255,255,0.06); }

.user-edit-form {
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 12px;
}
.user-edit-inner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.user-edit-role { min-width: 140px; }
.user-edit-depts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-edit-btns  { display: flex; gap: 8px; margin-left: auto; }

.btn-save-user {
  padding: 5px 16px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: opacity 0.1s;
}
.btn-save-user:hover { opacity: 0.85; }

.btn-cancel-user {
  padding: 5px 14px; background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; transition: color 0.1s, border-color 0.1s;
}
.btn-cancel-user:hover { color: var(--text); border-color: var(--text-muted); }
.user-lock-icon  { font-size: 13px; }

.user-locked-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: rgba(255,77,109,0.12); color: #ff4d6d;
}

.add-user-form {
  padding: 16px 20px;
  border-top: 1px solid #2a2f45;
  display: flex; flex-direction: column; gap: 12px;
}
.add-user-title { font-size: 12px; font-weight: 600; color: #7a7f9a; text-transform: uppercase; letter-spacing: 0.5px; }
.add-user-row   { display: flex; gap: 8px; flex-wrap: wrap; }

.add-user-input, .add-user-select {
  background: #22263a; border: 1px solid #2a2f45;
  color: #e8eaf0; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; font-family: inherit; outline: none;
  flex: 1; min-width: 100px;
  transition: border-color 0.15s;
}
.add-user-input:focus,
.add-user-select:focus { border-color: #5b6af0; }
.add-user-select option { background: #22263a; }

.add-user-depts { display: flex; gap: 16px; flex-wrap: wrap; }
.dept-cb-label  { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #e8eaf0; cursor: pointer; }
.dept-cb-label input { accent-color: #5b6af0; }

.btn-add-user {
  background: #5b6af0; color: #fff; border: none;
  padding: 9px 20px; border-radius: 6px; font-size: 13px;
  font-weight: 600; font-family: inherit; cursor: pointer;
  align-self: flex-start; transition: opacity 0.15s;
}
.btn-add-user:hover { opacity: 0.88; }

/* ========================
   RESET & BASE
======================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2a2f45;
  --text:      #e8eaf0;
  --text-muted:#7a7f9a;
  --accent:    #5b6af0;

  --drop:      #ff4d6d;
  --drop-bg:   rgba(255, 77, 109, 0.10);
  --flat:      #f5a623;
  --flat-bg:   rgba(245, 166, 35, 0.10);
  --growth:    #2ecc71;
  --growth-bg: rgba(46, 204, 113, 0.10);
  --overtime:  #e67e22;
  --overtime-bg: rgba(230, 126, 34, 0.10);

  --radius:    10px;
  --radius-sm: 6px;
  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ========================
   SIDEBAR
======================== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 32px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(91, 106, 240, 0.15);
  color: var(--accent);
}

.nav-icon {
  font-size: 16px;
}

.sidebar-actions {
  margin-top: auto;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.1s, color 0.1s;
}

.sidebar-btn:hover { background: var(--surface2); color: var(--text); }

.sidebar-footer {
  border-top: 1px solid var(--border);
}

.last-update {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px;
}

.update-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--growth);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ========================
   MAIN CONTENT
======================== */
.main {
  margin-left: 220px;
  flex: 1;
  min-width: 0;        /* prevent flex item from growing beyond viewport */
  overflow-x: hidden;  /* contain horizontal overflow so table never shifts header/stats */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 32px;
  gap: 24px;
}

/* ========================
   HEADER
======================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.project-count {
  font-size: 14px;
  color: var(--text-muted);
}

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

.filters {
  display: flex;
  gap: 8px;
}

.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--accent);
}

.filter-select option {
  background: var(--surface2);
}

.range-btns {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.range-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.range-btn:hover  { color: var(--text); background: var(--surface2); }
.range-btn.active { background: var(--accent); color: #fff; }

.btn-applog {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-applog:hover  { background: #22263a; }
.btn-applog:active { opacity: 0.8; }

.btn-pushlog {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-pushlog:hover  { background: var(--surface2); color: var(--text); }
.btn-pushlog:active { opacity: 0.8; }

.btn-reports {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-reports:hover  { background: rgba(91,106,240,0.12); }
.btn-reports:active { opacity: 0.8; }

.btn-mgmt-report {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #a78bfa;
  border: 1px solid #a78bfa;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-mgmt-report:hover  { background: rgba(167,139,250,0.1); }
.btn-mgmt-report:active { opacity: 0.8; }

.mgmt-report-preview {
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0;
}
.mgmt-report-text {
  font-family: var(--font);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}

.btn-push {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--overtime);
  border: 1px solid var(--overtime);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-push:hover  { background: var(--overtime-bg); }
.btn-push:active { opacity: 0.8; }

/* ========================
   PUSH MODAL
======================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 340px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}

.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-list {
  list-style: none;
  padding: 10px 0;
  max-height: 360px;
  overflow-y: auto;
}

.push-row {
  padding: 10px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.push-row:last-child { border-bottom: none; }
.push-ok   { color: var(--growth); }
.push-skip { color: var(--text-muted); }
.push-err  { color: var(--drop); }

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-refresh:hover   { opacity: 0.88; }
.btn-refresh:active  { transform: scale(0.97); }
.btn-refresh.loading { opacity: 0.6; pointer-events: none; }

/* ========================
   STATS ROW
======================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s;
}

.stat-card {
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card-active {
  border-color: #f5c518 !important;
  box-shadow: 0 0 0 1px #f5c518, 0 0 16px rgba(245, 197, 24, 0.35);
  transform: translateY(-2px);
}

.stat-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.stat-drop    .stat-num { color: var(--drop); }
.stat-flat    .stat-num { color: var(--flat); }
.stat-growth  .stat-num { color: var(--growth); }
.stat-overtime .stat-num { color: var(--overtime); }

.stat-drop    { border-left: 3px solid var(--drop); }
.stat-flat    { border-left: 3px solid var(--flat); }
.stat-growth  { border-left: 3px solid var(--growth); }
.stat-overtime { border-left: 3px solid var(--overtime); }

/* ========================
   TABLE
======================== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  flex: 1;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead tr {
  border-bottom: 1px solid var(--border);
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--surface2);
}

.table td {
  padding: 13px 16px;
  vertical-align: middle;
}

/* Статус-бейдж */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-drop     { background: var(--drop-bg);     color: var(--drop); }
.badge-flat     { background: var(--flat-bg);     color: var(--flat); }
.badge-growth   { background: var(--growth-bg);   color: var(--growth); }
.badge-overtime { background: var(--overtime-bg); color: var(--overtime); }

/* Тултип на бейдже */
.badge-has-tip {
  position: relative;
  cursor: default;
}
.badge-has-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e2030;
  color: #c5cae9;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.badge-has-tip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(255,255,255,0.1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
}
.badge-has-tip:hover::after,
.badge-has-tip:hover::before {
  opacity: 1;
}

/* Сайт */
.site-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.site-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Дельта */
.delta {
  font-weight: 600;
  font-size: 13px;
}

.delta-pos { color: var(--growth); }
.delta-neg { color: var(--drop); }
.delta-zero { color: var(--text-muted); }

/* Топвизор */
.topvisor-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid rgba(91, 106, 240, 0.3);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.topvisor-link:hover {
  background: rgba(91, 106, 240, 0.12);
}

/* ========================
   SYNC MODAL
======================== */
.modal-sync {
  max-width: 360px;
  width: 100%;
}

.sync-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}

.sync-option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
  color: var(--text);
}

.sync-option-btn:hover {
  background: rgba(91, 106, 240, 0.07);
  border-color: var(--accent);
}

.sync-option-icon {
  font-size: 20px;
  min-width: 28px;
  text-align: center;
}

.sync-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sync-option-title {
  font-weight: 600;
  font-size: 14px;
}

.sync-option-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Колонка Топвизор — фиксируем ширину, чтобы кнопка не съезжала при смене срезов */
.col-topvisor {
  white-space: nowrap;
  min-width: 90px;
}
.th-topvisor {
  min-width: 90px;
}

/* ========================
   TICKET SYSTEM
======================== */
.th-ticket {
  min-width: 52px;
  text-align: center;
}
.col-ticket {
  text-align: center;
  white-space: nowrap;
}
.ticket-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 3px 7px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.ticket-btn:hover {
  background: rgba(255, 193, 7, 0.1);
  border-color: #ffc107;
}

/* Кнопка заметок в строке проекта */
.note-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 3px 7px;
  margin-left: 4px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.note-btn:hover {
  background: rgba(96, 165, 250, 0.12);
  border-color: #60a5fa;
}
.note-btn.has-notes {
  border-color: #60a5fa;
  color: #60a5fa;
}
.note-count {
  position: absolute;
  top: -7px;
  right: -7px;
  background: #60a5fa;
  color: #0f1117;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Модалка заметок */
.modal-notes { max-width: 560px; width: 92%; }
.notes-modal-body { padding: 16px 20px 20px; }
.notes-add { margin: 10px 0 6px; }
.notes-add-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.notes-history-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.notes-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
}
.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.note-author { font-size: 12px; font-weight: 600; color: #60a5fa; margin-right: auto; }
.note-time   { font-size: 11px; color: var(--text-muted); }
.note-del-btn {
  flex: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.note-del-btn:hover { background: rgba(255,77,109,.15); color: #ff4d6d; }
.note-text   { font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.notes-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 18px 10px;
}

/* Панель фокус-вида: пресеты + поиск */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.preset-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.preset-chip:hover { border-color: #60a5fa; color: var(--text); }
.preset-chip.active {
  background: #60a5fa;
  border-color: #60a5fa;
  color: #0f1117;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  flex: 0 1 320px;
}
.search-icon {
  position: absolute;
  left: 10px;
  font-size: 12px;
  opacity: 0.6;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 30px 7px 30px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: #60a5fa; }
.search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.search-clear:hover { color: var(--drop); }

/* Спарклайн тренда ТОП10 */
.spark-wrap { margin-top: 3px; line-height: 0; }
.spark { display: block; }
.spark-na { font-size: 11px; color: var(--text-muted); }

/* Badge on sidebar Заявки button */
.ticket-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffc107;
  color: #1a1d27;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.4;
}
@keyframes ticket-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
  50%       { box-shadow: 0 0 8px 2px rgba(255, 193, 7, 0.35); }
}
.sidebar-btn.ticket-glow {
  animation: ticket-pulse 2s ease-in-out infinite;
  border-color: rgba(255, 193, 7, 0.5);
  color: #ffc107;
}
@keyframes ticket-bump {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  60%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.ticket-badge.ticket-bump { animation: ticket-bump 0.45s ease-out; }

/* Ticket submit modal */
.modal-ticket {
  max-width: 360px;
  width: 100%;
}
.ticket-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket-project-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.ticket-reason-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.ticket-reason-value {
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 193, 7, 0.07);
  border: 1px solid rgba(255, 193, 7, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
}
.ticket-modal-footer {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
}
.ticket-submit-status {
  font-size: 12px;
}

/* Tickets management modal */
.tickets-content {
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0;
}
.tickets-loading,
.tickets-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.ticket-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row-rejected   { opacity: 0.6; }
.ticket-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.ticket-project {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.ticket-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ticket-status-open     { background: rgba(255,193,7,0.15); color: #ffc107; }
.ticket-status-rejected { background: rgba(255,77,109,0.15); color: #ff4d6d; }
.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.ticket-date { font-style: italic; }
.ticket-by   { color: var(--accent); }
.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.ticket-act-btn {
  font-size: 12px;
  font-family: inherit;
  padding: 4px 11px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.ticket-act-btn:hover      { background: var(--surface2); color: var(--text); }
.ticket-act-done:hover     { border-color: #4caf50; color: #4caf50; background: rgba(76,175,80,0.08); }
.ticket-act-reject:hover   { border-color: #ff9800; color: #ff9800; background: rgba(255,152,0,0.08); }
.ticket-act-close:hover    { border-color: #ff4d6d; color: #ff4d6d; background: rgba(255,77,109,0.08); }

/* ---- Ticket submit modal: type selector + fields ---- */
.ticket-field-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.ticket-type-options {
  display: flex;
  gap: 8px;
}
.ticket-type-btn {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.ticket-type-btn:hover { background: var(--surface2); border-color: var(--accent); }
.ticket-type-btn.active {
  border-color: #ffc107;
  background: rgba(255, 193, 7, 0.12);
  color: #ffc107;
  font-weight: 600;
}
.ticket-field { display: flex; flex-direction: column; gap: 6px; }
.ticket-input,
.ticket-textarea {
  background: #22263a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.ticket-input:focus,
.ticket-textarea:focus { border-color: var(--accent); }
.ticket-textarea { resize: vertical; min-height: 80px; }

/* ---- Tickets management modal: table ---- */
.modal-tickets {
  max-width: 1000px;
  width: 100%;
}
.tk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tk-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tk-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
.tk-row-closed { opacity: 0.55; }
.tk-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.tk-open   { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.tk-closed { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.tk-fail   { background: rgba(255, 77, 109, 0.15); color: #ff4d6d; }
.tk-project { font-weight: 600; word-break: break-all; }
.tk-nowrap { white-space: nowrap; }
.tk-details { max-width: 260px; word-break: break-word; color: var(--text-muted); }
.tk-time { white-space: nowrap; color: var(--text-muted); font-size: 12px; }
.tk-act {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.tk-act-reopen:hover { border-color: #ffc107; color: #ffc107; background: rgba(255,193,7,0.08); }
.tk-act-done:hover   { border-color: #4caf50; color: #4caf50; background: rgba(76,175,80,0.08); }
.tk-act-fail:hover   { border-color: #ff4d6d; color: #ff4d6d; background: rgba(255,77,109,0.08); }
.tk-actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* Менеджер */
.manager-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Клиент */
.client-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Дней */
.days-count {
  font-weight: 600;
}

.days-count.overtime {
  color: var(--overtime);
}

/* Строки с цветной подсветкой по статусу */
tr.row-drop     { background: rgba(255, 77, 109, 0.04); }
tr.row-flat     { background: rgba(245, 166, 35, 0.04); }
tr.row-overtime { background: rgba(230, 126, 34, 0.06); }

/* ========================
   SLICE CELLS (дата-колонки)
======================== */
.slice-cell {
  vertical-align: middle;
  white-space: nowrap;
  min-width: 90px;
}

.slice-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 1px 0;
}

.slice-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 36px;
  flex-shrink: 0;
}

.slice-val {
  font-weight: 600;
  color: var(--text);
  min-width: 32px;
}

.kw-count {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
}

/* Двойные бейджи */
.badges-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ========================
   LOADING STATE
======================== */
.loading-row td {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-row td {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ========================
   COLUMN SORT / FILTER HEADERS
======================== */
.col-th-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
}

.col-th-label {
  flex: 1;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 4px 1px 0;
  transition: color 0.1s;
}

.col-th-label:hover { color: var(--text); }
.col-th-label.on    { color: var(--accent); }

.col-th-sort,
.col-th-flt {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  font-size: 11px;
  border-radius: 3px;
  line-height: 1;
  font-family: var(--font);
  font-weight: 600;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}

.col-th-sort:hover { color: var(--text); background: var(--surface2); }
.col-th-sort.on    { color: var(--accent); }

/* ========================
   COLUMN DROPDOWN PORTAL
======================== */
#col-dd-portal {
  display: none;
  position: fixed;
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 9999;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  padding: 4px 0;
}

.col-dd-sort {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
  white-space: nowrap;
}

.col-dd-sort:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.col-dd-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.col-dd-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.col-dd-item:hover { background: rgba(255,255,255,0.05); }
.col-dd-item.sel   { color: var(--accent); font-weight: 600; }

/* ── Client multi-filter ── */
.client-dd-search-wrap {
  padding: 10px 12px 6px;
  position: sticky;
  top: 0;
  background: var(--surface2);
  z-index: 1;
}
.client-search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12.5px;
  font-family: var(--font);
  padding: 6px 10px;
  outline: none;
}
.client-search-input:focus { border-color: var(--accent); }
.client-search-input::placeholder { color: var(--text-muted); }

.client-dd-actions {
  display: flex;
  gap: 6px;
  padding: 4px 12px 8px;
}
.client-dd-btn {
  font-size: 11px;
  font-family: var(--font);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.client-dd-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.client-dd-btn-reset { border-color: var(--drop); color: var(--drop); }
.client-dd-btn-reset:hover { background: rgba(255,80,80,0.08); }

.client-cb-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 2px 0;
}
.client-cb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.client-cb-item:hover { background: rgba(255,255,255,0.04); }
.client-cb {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}
.client-cb-label {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.3;
}

.client-dd-footer {
  padding: 8px 12px 10px;
  position: sticky;
  bottom: 0;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}
.client-dd-apply {
  width: 100%;
  padding: 7px 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s;
}
.client-dd-apply:hover { opacity: 0.88; }

/* ========================
   SCROLLBAR
======================== */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========================
   OVERTIME PUSH MODAL
======================== */
.ot-push-content {
  padding: 8px 20px 4px;
  max-height: 420px;
  overflow-y: auto;
}
.ot-push-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.ot-push-row:last-child { border-bottom: none; }

.ot-push-top {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 6px;
}
.ot-push-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.ot-push-name  { font-weight: 600; color: var(--text); font-size: 14px; }
.ot-push-count { font-size: 11px; color: var(--text-muted);
  background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 10px; }

.ot-push-sites {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 26px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.ot-push-methods {
  display: flex;
  gap: 20px;
  padding-left: 26px;
}
.ot-push-method {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.ot-push-method input[type="radio"] { accent-color: var(--accent); }
.ot-push-method:has(input:checked) {
  border-color: var(--accent);
  background: rgba(91,106,240,0.08);
}
.ot-push-method:has(input:not(:disabled)):hover {
  border-color: rgba(91,106,240,0.5);
}
.ot-method-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.ot-push-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ========================
   DROPS DIGEST
======================== */
.dd-digest-hint {
  padding: 12px 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.dd-empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--text-muted);
}
.dd-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 20px;
  background: var(--surface);
}
.dd-row-muted { opacity: 0.62; }
.dd-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.dd-count { color: var(--text-muted); font-size: 13px; }
.dd-badge {
  margin-left: auto;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
}
.dd-ok { background: rgba(74,222,128,0.16); color: var(--growth); }
.dd-no { background: rgba(255,77,109,0.14); color: var(--drop); }
.dd-preview {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.dd-only-new {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}

/* ========================
   REPORTS MODAL
======================== */
.reports-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reports-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reports-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.reports-select {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.reports-select:focus { border-color: var(--accent); }

.reports-projects-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.reports-selall-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.1s;
}

.reports-selall-btn:hover { background: rgba(91,106,240,0.12); }

.reports-projects-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 0;
}

.report-proj-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 4px;
}

.report-proj-label:hover { background: rgba(255,255,255,0.04); }

.report-proj-cb {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.report-proj-site {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.report-proj-client {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.reports-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.btn-send-reports {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-send-reports:hover    { opacity: 0.88; }
.btn-send-reports:disabled { opacity: 0.45; pointer-events: none; }

.reports-status {
  font-size: 13px;
  color: var(--text-muted);
}

.reports-status.ok  { color: var(--growth); }
.reports-status.err { color: var(--drop); }

/* ========================
   APP LOG MODAL
======================== */
.modal-applog {
  max-width: 900px;
  width: 96vw;
}

.alog-content {
  display: flex;
  flex-direction: column;
  height: 560px;
}

.alog-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.alog-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
  margin-bottom: -1px;
}

.alog-tab:hover { color: var(--text); }
.alog-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.alog-count {
  padding: 6px 16px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.alog-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.alog-loading {
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.alog-row {
  display: grid;
  grid-template-columns: 120px 24px 1fr 1fr 80px 40px;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
  transition: background 0.1s;
}

.alog-row:hover { background: rgba(255,255,255,0.025); }

.alog-dt     { color: var(--text-muted); white-space: nowrap; font-size: 11px; }
.alog-icon   { text-align: center; }
.alog-action { color: var(--text); font-weight: 500; }
.alog-detail { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alog-by     { color: var(--text-muted); font-size: 11px; text-align: right; }
.alog-src    { font-size: 10px; color: var(--text-muted); opacity: 0.6; }

.alog-refresh-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}

.alog-refresh-btn:hover { color: var(--text); border-color: var(--accent); }

/* ========================
   PUSH LOG MODAL
======================== */
.modal-log { max-width: 640px; }

.pushlog-content {
  max-height: 520px;
  overflow-y: auto;
}

.pushlog-loading,
.pushlog-empty {
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.pushlog-list {
  padding: 6px 0;
}

.pushlog-row {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pushlog-row:last-child { border-bottom: none; }
.pushlog-row:hover { background: rgba(255,255,255,0.02); }

.pushlog-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pushlog-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 110px;
}

.pushlog-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.pushlog-by {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.pushlog-bottom {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pushlog-manager {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.pushlog-projects {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   UI ENHANCEMENTS (devbuild)
   Контекстное меню, тосты, модалка подтверждения, скелетоны,
   умный empty-state, sticky-колонки, индикатор свежести, адаптив
============================================================ */

/* ---- Индикатор заметок рядом с сайтом ---- */
.site-note-ind {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  font-size: 12px;
  vertical-align: middle;
  opacity: 0.85;
}
.site-note-ind .note-count {
  position: static;          /* перекрываем абсолютный бейдж .note-btn */
  top: auto; right: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- Индикатор свежести данных (цвет точки) ---- */
.last-update.fresh .update-dot { background: var(--growth); }
.last-update.stale .update-dot { background: var(--flat);   animation-duration: 1.4s; }
.last-update.old   .update-dot { background: var(--drop);   animation-duration: 0.9s; }

/* ---- Скелетон загрузки ---- */
.skel-row td { padding: 14px 16px; }
.skel {
  display: block;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    var(--surface2) 25%, rgba(255,255,255,0.07) 37%, var(--surface2) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.3s ease-in-out infinite;
}
@keyframes skel-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---- Умный empty-state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 16px;
  text-align: center;
}
.empty-ico   { font-size: 36px; opacity: 0.8; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-sub   { font-size: 13px; color: var(--text-muted); }
.empty-reset {
  margin-top: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.empty-reset:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Заголовки групп навигации (ПФ / GEO) ---- */
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.7;
  padding: 4px 12px 2px;
  margin-top: 6px;
}
.nav-group-label:first-child { margin-top: 0; }

/* ---- Заметки из заявок (системные) ---- */
.note-text { white-space: pre-wrap; }            /* сохраняем переносы строк */
.note-item-sys {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
.note-sys-ok   { border-left-color: var(--growth); }
.note-sys-fail { border-left-color: var(--drop);   }
.note-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text-muted);
}
.note-tag-ok   { background: rgba(46,204,113,0.18); color: var(--growth); }
.note-tag-fail { background: rgba(255,77,109,0.18); color: var(--drop);   }
.note-tag-sys  { background: rgba(91,106,240,0.18); color: var(--accent); }

/* ---- Контекстное меню по строке ---- */
.rcx-menu {
  display: none;
  position: fixed;
  z-index: 1000;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  padding: 6px;
  font-size: 13px;
  animation: rcx-in 0.1s ease-out;
}
@keyframes rcx-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
.rcx-head {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: lowercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rcx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.rcx-item:hover { background: var(--surface2); }
.rcx-ico { width: 18px; text-align: center; flex-shrink: 0; }
.rcx-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ---- Тосты ---- */
#toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100000;   /* выше любых модалок (.modal-overlay = 10000) */
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: var(--growth); }
.toast-error   { border-left-color: var(--drop);   }
.toast-info    { border-left-color: var(--accent); }
.toast-ico { font-size: 15px; flex-shrink: 0; }
.toast-msg { line-height: 1.4; }

/* ---- Модалка подтверждения ---- */
.uic-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100001;   /* поверх модалки Заметки/Заявки (.modal-overlay = 10000) */
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
}
.uic-overlay.open { display: flex; }
.uic-box {
  width: min(420px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: rcx-in 0.12s ease-out;
}
.uic-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.uic-msg   { font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.uic-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.uic-cancel, .uic-ok {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
}
.uic-cancel { background: var(--surface2); color: var(--text); }
.uic-cancel:hover { background: var(--border); }
.uic-ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.uic-ok:hover { filter: brightness(1.1); }
.uic-ok.danger { background: var(--drop); border-color: var(--drop); }

/* ---- Sticky левые колонки (Статус / Менеджер / Сайт) ---- */
#projectsTable tbody tr { background: var(--surface); }   /* нужно для inherit у sticky-ячеек */

#projectsTable th:nth-child(1), #projectsTable td:nth-child(1) { min-width: 132px; left: 0;     }
#projectsTable th:nth-child(2), #projectsTable td:nth-child(2) { min-width: 116px; left: 132px; }
#projectsTable th:nth-child(3), #projectsTable td:nth-child(3) { min-width: 200px; left: 248px; }

#projectsTable td:nth-child(-n+3) {
  position: sticky;
  z-index: 2;
  background: inherit;
}
#projectsTable th:nth-child(-n+3) {
  position: sticky;
  z-index: 3;              /* угол: липнет и сверху, и слева — выше всех */
}
/* Тень-разделитель у 3-й закреплённой колонки */
#projectsTable th:nth-child(3),
#projectsTable td:nth-child(3) {
  box-shadow: 6px 0 8px -6px rgba(0,0,0,0.45);
}
/* На загрузочных/пустых строках sticky не нужен (colspan) */
#projectsTable tbody tr.skel-row td,
#projectsTable tbody tr.empty-row td,
#projectsTable tbody tr.loading-row td { position: static; }

/* ============================================================
   АДАПТИВ
============================================================ */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 20px; }
}

@media (max-width: 768px) {
  /* Сайдбар → верхняя панель */
  .sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
  }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .sidebar-footer { margin-left: auto; }
  .main { margin-left: 0; padding: 16px; }
  body { flex-direction: column; }

  /* Отключаем закреплённые колонки на узких экранах */
  #projectsTable th:nth-child(-n+3),
  #projectsTable td:nth-child(-n+3) {
    position: static;
    box-shadow: none;
    min-width: 0;
  }
  .stats-row { grid-template-columns: 1fr 1fr; }

  #toast-wrap { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}


/* === Окно «Сотрудники»: прокрутка списка, шапка и форма добавления зафиксированы === */
#usersModal .modal {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
#usersModal .modal-header { flex: 0 0 auto; }
#usersModal #usersList { flex: 1 1 auto; overflow-y: auto; min-height: 60px; }
#usersModal .add-user-form { flex: 0 0 auto; }


/* ALT+DRAG блочное выделение ячеек */
#tableBody td.col-sel { background: rgba(91,140,255,0.30) !important; }
body.block-selecting, body.block-selecting * {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: cell !important;
}


/* ===== База знаний ===== */
.kb-btn { width:100%; margin-bottom:10px; padding:8px 12px; background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--text); cursor:pointer; font-size:13px; text-align:left; }
.kb-btn:hover { background:rgba(255,255,255,0.06); }
.modal-kb { max-width:900px; width:96vw; }
.kb-body-wrap { display:flex; height:60vh; min-height:300px; }
.kb-left { width:38%; border-right:1px solid var(--border); display:flex; flex-direction:column; min-width:0; }
.kb-search { margin:12px; padding:8px 10px; background:var(--surface2); border:1px solid var(--border); border-radius:6px; color:var(--text); font-size:13px; }
.kb-list { overflow-y:auto; flex:1; padding:0 8px 8px; }
.kb-item { display:block; width:100%; text-align:left; padding:8px 10px; background:none; border:none; color:var(--text); cursor:pointer; border-radius:6px; font-size:13px; }
.kb-item:hover { background:rgba(255,255,255,0.05); }
.kb-item-active { background:rgba(91,140,255,0.18); font-weight:600; }
.kb-tag { font-size:10px; color:var(--text-muted); border:1px solid var(--border); border-radius:4px; padding:1px 5px; margin-left:4px; white-space:nowrap; }
.kb-right { flex:1; overflow-y:auto; padding:16px 20px; min-width:0; }
.kb-title { margin:0 0 12px; font-size:16px; }
.kb-text { white-space:pre-wrap; line-height:1.6; font-size:13.5px; color:var(--text); }
.kb-text mark { background:#ffd54f; color:#111; border-radius:2px; padding:0 2px; }
.kb-empty { padding:16px; color:var(--text-muted); font-size:13px; }
@media (max-width:700px){ .kb-body-wrap{flex-direction:column;height:auto;max-height:75vh} .kb-left{width:auto;border-right:none;border-bottom:1px solid var(--border);max-height:40vh} }


/* Окно конструктора отчётов: прокрутка при маленьком экране */
#reportsModal .modal { max-height: 92vh; display: flex; flex-direction: column; }
#reportsModal .modal-header { flex: 0 0 auto; }
#reportsModal .reports-content { overflow-y: auto; flex: 1 1 auto; min-height: 0; }


/* ===== Детализация (график) ===== */
.modal-detail { max-width:760px; width:96vw; position:relative; }
.detail-body { padding:14px 18px; }
.detail-legend { display:flex; gap:16px; align-items:center; margin-bottom:6px; font-size:12px; }
.dleg-t3 { color:#f0a020; } .dleg-t10 { color:#5b8cff; }
.dleg-hint { color:var(--text-muted); margin-left:auto; }
.detail-chart { width:100%; }
.detail-svg { width:100%; height:auto; display:block; }
.dchart-grid { stroke:var(--border); stroke-width:1; }
.dchart-ylbl { fill:var(--text-muted); font-size:10px; text-anchor:end; }
.dchart-xlbl { fill:var(--text-muted); font-size:10px; text-anchor:middle; }
.dchart-t3 { stroke:#f0a020; stroke-width:2; fill:none; }
.dchart-t10 { stroke:#5b8cff; stroke-width:2; fill:none; }
.dchart-pt3 { fill:#f0a020; cursor:pointer; }
.dchart-pt10 { fill:#5b8cff; cursor:pointer; }
.dchart-pt3:hover, .dchart-pt10:hover { r:6; }
.detail-tip { position:absolute; z-index:20; background:var(--surface2); border:1px solid var(--border); border-radius:6px; padding:6px 10px; font-size:12px; pointer-events:none; box-shadow:0 6px 20px rgba(0,0,0,.45); white-space:nowrap; }
.dtip-date { font-weight:600; margin-bottom:3px; }
