/* Dashboard layout & components. Tokens, buttons, inputs and badges come from
   theme.css; nothing in here hard-codes a colour, so dark mode is automatic. */

body { display: flex; min-height: 100vh; }

/* soft cyan discs behind the page, like the design mock */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  background: var(--deco);
  pointer-events: none;
  z-index: 0;
}
body::before { width: 300px; height: 300px; top: -150px; right: 90px; }
body::after { width: 250px; height: 250px; top: -110px; right: -70px; }

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 296px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 26px 16px 18px;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; margin-bottom: 38px; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; }
.brand-name { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; color: var(--ink); }
.brand-accent { color: var(--primary); }

/* profile block under the brand: photo, company name, role */
.sidebar-profile { margin-bottom: 18px; }
.sidebar-profile .me-block { padding: 0 8px; gap: 14px; }
.sidebar-profile .me-name { font-size: 16px; }
.sidebar-profile .me-role { font-size: 13px; margin-top: 2px; }
.avatar.profile { width: 58px; height: 58px; font-size: 20px; }
.avatar.mini { width: 34px; height: 34px; font-size: 12px; }
.me-email-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px 14px; font-size: 13px; color: var(--ink-soft); min-width: 0; }
.me-email-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-item:hover { background: var(--primary-soft); color: var(--primary-ink); }
.nav-item.active { background: var(--primary-tint); color: var(--primary-ink); font-weight: 800; }

.sidebar-footer { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.me-block { display: flex; align-items: center; gap: 11px; padding: 6px 8px 12px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign-out-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; background: none; border: none; box-shadow: none;
}
.sign-out-row svg { width: 20px; height: 20px; flex-shrink: 0; }
.sign-out-row:hover:not(:disabled) { background: var(--red-tint); color: var(--red); border-color: transparent; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: var(--primary-tint); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 120px; height: 120px; font-size: 40px; border: 4px solid var(--primary-tint); }

/* ---------- main ---------- */

.main { flex: 1; min-width: 0; padding: 40px 48px 56px; position: relative; z-index: 1; }
.main > * { position: relative; }

h2 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; font-weight: 800; letter-spacing: -0.4px; }
.page-subtitle { font-size: 14px; color: var(--ink-soft); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.card { padding: 24px; margin-bottom: 20px; }
.card h3 { font-size: 15px; margin: 0 0 14px; font-weight: 700; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.field input, .field select { width: 100%; max-width: 420px; }

/* icon tile + title + subtitle, the header used on every section card */
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.section-icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  background: var(--primary-tint); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center;
}
.section-icon svg { width: 22px; height: 22px; }
.section-title { font-size: 17px; font-weight: 800; margin: 0 0 2px; }
.section-sub { font-size: 12.5px; color: var(--ink-soft); margin: 0; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 18px; }
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.filter-bar select { min-width: 140px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
.pagination .page-info { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.save-bar { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 4px; }
.save-bar button.primary { min-width: 170px; padding: 13px 22px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.save-bar button.primary svg { width: 18px; height: 18px; }

.logo-preview { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.logo-preview img { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); background: var(--primary-tint); }

/* ---------- settings ---------- */

.profile-grid { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }
.photo-col { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-right: 32px; border-right: 1px solid var(--line); }
@media (max-width: 900px) { .photo-col { border-right: none; padding-right: 0; } }
.photo-wrap { position: relative; }
.photo-cam {
  position: absolute; right: 2px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center; background: var(--card); color: var(--ink);
  box-shadow: var(--shadow);
}
.photo-cam svg { width: 16px; height: 16px; }
.photo-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.photo-btn svg { width: 16px; height: 16px; }
.photo-hint { font-size: 11.5px; color: var(--ink-faint); text-align: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .field { margin-bottom: 0; }
.form-grid .field input { max-width: none; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-soft); pointer-events: none; }
.input-wrap input { width: 100%; padding-left: 40px; height: 46px; }
.input-wrap input.readonly { background: var(--card-2); color: var(--ink-soft); }

.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .theme-options { grid-template-columns: 1fr; } }
.theme-option {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card-2); text-align: left; width: 100%; color: var(--ink);
}
.theme-option:hover:not(:disabled) { border-color: var(--primary); color: var(--ink); }
.theme-option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.theme-option .t-icon { width: 34px; height: 34px; flex-shrink: 0; color: var(--primary-ink); }
.theme-option .t-text { flex: 1; min-width: 0; }
.theme-option .t-title { font-size: 15px; font-weight: 700; }
.theme-option .t-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.theme-option .t-radio { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.theme-option.selected .t-radio { border-color: var(--primary); }
.theme-option.selected .t-radio::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; color: var(--ink-soft); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: 0.03em; }
td { padding: 12px 10px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.invite-row { display: flex; gap: 8px; align-items: flex-end; }
.invite-row .field { margin-bottom: 0; flex: 1; }
.person-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person-name { font-weight: 700; }
.person-sub { font-size: 11.5px; color: var(--ink-soft); }

.listings-table-wrap { overflow-x: auto; }
.listings-table-wrap td, .listings-table-wrap th { white-space: nowrap; }
.listings-table-wrap td.listing-cell { white-space: normal; min-width: 280px; }
.listing-title { font-weight: 700; }
.listing-sub { color: var(--ink-soft); font-size: 11.5px; margin-top: 2px; }
.listing-row-main { display: flex; align-items: flex-start; gap: 12px; }
.listing-thumb { width: 50px; height: 50px; border-radius: 10px; background: var(--primary-tint); color: var(--primary-ink); flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-thumb svg { width: 18px; height: 18px; }
.checkbox-cell { width: 36px; }
.listings-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.listings-count { font-size: 13px; color: var(--ink-soft); font-weight: 600; }

.search-input-wrap { position: relative; flex: 1; min-width: 220px; }
.search-input-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-soft); pointer-events: none; }
.search-input-wrap input[type="text"] { padding-left: 36px; width: 100%; max-width: none; }
.filter-select-wrap { position: relative; display: inline-block; }
.filter-select-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--ink-soft); pointer-events: none; }
.filter-select-wrap select { padding-left: 34px; min-width: 150px; }

/* ---------- menus & status pills ---------- */

.icon-btn-circle { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.icon-btn-circle svg { width: 16px; height: 16px; }
.row-menu-wrap { position: relative; display: inline-block; }
.row-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; min-width: 170px; z-index: 60; display: none; }
.row-menu.open { display: block; }
.row-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; background: none; border: none; box-shadow: none; }
.row-menu-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.row-menu-item:hover:not(:disabled) { background: var(--primary-soft); color: var(--ink); border-color: transparent; }
.row-menu-item.danger { color: var(--red); }
.row-menu-item.danger:hover:not(:disabled) { background: var(--red-tint); color: var(--red); }
.row-menu-item .status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.status-badge-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; cursor: pointer; border: 1px solid transparent; background: none; box-shadow: none; }
.status-badge-btn .status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-badge-btn:hover:not(:disabled) { border-color: currentColor; }
.status-badge-btn.green { background: var(--green-tint); color: var(--green); }
.status-badge-btn.blue { background: var(--blue-tint); color: var(--blue); }
.status-badge-btn.amber { background: var(--amber-tint); color: var(--amber); }
.status-badge-btn.purple { background: var(--purple-tint); color: var(--purple); }

/* ---------- home ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.stat-icon-wrap { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.stat-icon-wrap svg { width: 20px; height: 20px; }
.stat-icon-wrap.blue { background: var(--blue-tint); color: var(--blue); }
.stat-icon-wrap.green { background: var(--green-tint); color: var(--green); }
.stat-icon-wrap.purple { background: var(--purple-tint); color: var(--purple); }
.stat-icon-wrap.teal { background: var(--teal-tint); color: var(--primary-ink); }
.stat-icon-wrap.indigo { background: var(--indigo-tint); color: var(--indigo); }
.stat-icon-wrap.amber { background: var(--amber-tint); color: var(--amber); }
.stat-icon-wrap.gray { background: var(--card-2); color: var(--ink-soft); }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
.stat-trend { display: flex; align-items: center; gap: 5px; margin-top: 12px; font-size: 11px; color: var(--ink-soft); }
.stat-trend .trend-icon { display: flex; }
.stat-trend .trend-icon svg { width: 12px; height: 12px; }
.stat-trend .trend-value { font-weight: 700; }
.stat-trend.up, .stat-trend.up .trend-value { color: var(--green); }
.stat-trend.down, .stat-trend.down .trend-value { color: var(--red); }
.stat-trend.flat .trend-icon, .stat-trend.flat .trend-value { color: var(--ink-soft); }
.stat-trend-note { color: var(--ink-soft); font-weight: 500; }

.dash-section { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; align-items: start; margin-bottom: 20px; }
@media (max-width: 900px) { .dash-section { grid-template-columns: 1fr; } }
.dash-col { display: flex; flex-direction: column; gap: 18px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-header-row h3 { margin: 0; }
.card-select { padding: 6px 28px 6px 10px; font-size: 11.5px; font-weight: 600; border-radius: 9px; }
.card-link { font-size: 12px; font-weight: 700; color: var(--primary-ink); text-decoration: none; white-space: nowrap; }
.card-link:hover { text-decoration: underline; }

.city-row { padding: 9px 0; }
.city-row-top { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.city-row-top .count { font-weight: 700; }
.progress-track { height: 8px; border-radius: 999px; background: var(--primary-tint); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); }

.connection-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.connection-row:last-child { border-bottom: none; }
.conn-label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.conn-icon { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.conn-icon svg { width: 16px; height: 16px; }
.conn-icon.sheets, .export-icon.sheets { background: var(--green-tint); color: var(--green); }
.conn-icon.telegram, .export-icon.telegram { background: var(--blue-tint); color: var(--blue); }

.recent-list { display: flex; flex-direction: column; }
.recent-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.recent-row:last-child { border-bottom: none; }
.recent-row:hover .recent-row-title { color: var(--primary-ink); }
.recent-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.recent-row-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-tint); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recent-row-icon svg { width: 16px; height: 16px; }
.recent-row-text { min-width: 0; }
.recent-row-title { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-row-sub { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.recent-row-chev { color: var(--ink-faint); flex-shrink: 0; display: flex; }
.recent-row-chev svg { width: 14px; height: 14px; }

.tip-card { background: var(--primary-soft); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; position: relative; display: flex; gap: 14px; align-items: flex-start; }
.tip-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--card); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: var(--shadow); }
.tip-icon svg { width: 18px; height: 18px; }
.tip-title { font-size: 13.5px; font-weight: 700; margin: 0 0 4px; }
.tip-body { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 12px; }
.tip-close { position: absolute; top: 10px; right: 10px; background: none; border: none; box-shadow: none; padding: 4px 8px; color: var(--ink-soft); font-size: 15px; line-height: 1; }
.tip-close:hover:not(:disabled) { color: var(--red); border-color: transparent; }

.help-menu { position: relative; }
.help-pill-btn { display: inline-flex; align-items: center; gap: 12px; background: var(--card); color: var(--ink); border-radius: 12px; padding: 12px 20px; font-size: 13.5px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow); }
.help-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; flex-shrink: 0; }
.help-pill-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.help-popover { position: absolute; top: 46px; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 14px 16px; width: 280px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; z-index: 50; display: none; }
.help-popover.open { display: block; }

/* ---------- modal ---------- */

.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 1000; overflow-y: auto; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 720px; padding: 24px; box-shadow: var(--shadow-pop); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; gap: 12px; }
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-close { background: none; border: none; box-shadow: none; padding: 4px 8px; font-size: 18px; color: var(--ink-soft); }
.modal-close:hover:not(:disabled) { color: var(--red); border-color: transparent; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin: 16px 0; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-label { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 3px; }
.detail-value { font-size: 13px; word-break: break-word; }
.detail-value.empty-value { color: var(--ink-faint); font-style: italic; }

.modal-card.detail-modal { max-width: 920px; padding: 0; overflow: hidden; }
.detail-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.detail-modal-header-left { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.detail-modal-thumb { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--primary-tint); flex-shrink: 0; }
.detail-modal-title { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.detail-modal-meta { font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-modal-body { padding: 22px 26px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 26px; max-height: 62vh; overflow-y: auto; }
@media (max-width: 760px) { .detail-modal-body { grid-template-columns: 1fr; } }
.detail-modal-footer { padding: 16px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.detail-photo-main { width: 100%; height: 260px; border-radius: 14px; object-fit: cover; background: var(--card-2); margin-bottom: 10px; }
.detail-photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.detail-photo-strip img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; cursor: pointer; border: 2px solid transparent; }
.detail-photo-strip img.active { border-color: var(--primary); }
.detail-section-title { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 10px; }
.detail-side-card { background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.detail-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.detail-kv:last-child { border-bottom: none; }
.detail-kv .k { color: var(--ink-soft); flex-shrink: 0; }
.detail-kv .v { font-weight: 600; text-align: right; word-break: break-word; }
.group-check-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.group-check-row:hover { background: var(--card); }
.group-check-row span { font-size: 13px; font-weight: 600; }

/* ---------- groups ---------- */

/* Groups: new-group card with a round icon and a soft decorative sweep on the right */
.new-group-card { display: flex; align-items: flex-start; gap: 22px; position: relative; overflow: hidden; padding: 24px 28px; }
.new-group-card::after {
  content: ''; position: absolute; right: -90px; top: -60px; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle at 30% 70%, var(--primary-soft), transparent 70%); pointer-events: none;
}
.new-group-icon {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; background: var(--primary-tint); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center;
}
.new-group-icon svg { width: 28px; height: 28px; }
.new-group-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.new-group-body .section-title { margin-top: 6px; }
.new-group-row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 18px; }
.new-group-row input { flex: 1; min-width: 200px; max-width: none; height: 48px; }
.new-group-row button { width: auto; min-width: 180px; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; }
.new-group-row button svg { width: 18px; height: 18px; }

.groups-toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.groups-toolbar .search-input-wrap { flex: 0 1 60%; }
.groups-toolbar input[type='text'] { height: 48px; background: var(--card); }
.groups-sort-wrap select { height: 48px; min-width: 230px; font-weight: 700; background-color: var(--card); }

.avatar.xs { width: 36px; height: 36px; font-size: 14px; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack-item { display: flex; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); }
.avatar-stack-item + .avatar-stack-item, .avatar-stack-more { margin-left: -6px; }
.avatar-stack-item.tint-teal .avatar { background: var(--teal-tint); color: var(--primary-ink); }
.avatar-stack-item.tint-red .avatar { background: var(--red-tint); color: var(--red); }
.avatar-stack-item.tint-green .avatar { background: var(--green-tint); color: var(--green); }
.avatar-stack-item.tint-blue .avatar { background: var(--blue-tint); color: var(--blue); }
.avatar-stack-item.tint-amber .avatar { background: var(--amber-tint); color: var(--amber); }
.avatar-stack-item.tint-purple .avatar { background: var(--purple-tint); color: var(--purple); }
.avatar-stack-item.tint-indigo .avatar { background: var(--indigo-tint); color: var(--indigo); }
.avatar-stack-more {
  width: 36px; height: 36px; border-radius: 50%; background: var(--line); color: var(--ink-soft); box-shadow: 0 0 0 2px var(--card);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700;
}
.group-row-people { flex-shrink: 0; min-width: 150px; display: flex; justify-content: flex-end; }
.icon-btn-plain { width: 40px; height: 40px; padding: 0; border: none; background: transparent; box-shadow: none; color: var(--ink-soft); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.icon-btn-plain:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.icon-btn-plain svg { width: 20px; height: 20px; }
.group-list-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.group-row { display: flex; align-items: center; gap: 28px; padding: 18px 30px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.12s ease; }
.group-row:last-child { border-bottom: none; }
.group-row:hover { background: var(--primary-soft); }
.group-row-main { display: flex; align-items: center; gap: 26px; flex: 1; min-width: 0; }
.stat-icon-wrap.group-icon { width: 60px; height: 60px; border-radius: 14px; margin-bottom: 0; }
.stat-icon-wrap.group-icon svg { width: 26px; height: 26px; }
.stat-icon-wrap.group-icon { flex-shrink: 0; }
.groups-toolbar .search-input-wrap { min-width: 260px; }
@media (max-width: 1100px) {
  .group-row { gap: 16px; padding: 16px 20px; }
  .group-row-main { gap: 16px; }
  .group-row-people { min-width: 0; }
  .group-row-count { min-width: 0; }
  .groups-toolbar .search-input-wrap { flex: 1 1 260px; }
  .new-group-row { gap: 12px; }
  .new-group-row button { min-width: 0; }
}
@media (max-width: 760px) {
  .group-row-people { display: none; }
  .new-group-icon { display: none; }
}
.group-icon svg { width: 20px; height: 20px; }
.group-row-text { min-width: 0; }
.group-row-name { font-size: 15px; font-weight: 700; }
.group-row-desc { font-size: 13px; color: var(--ink-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-row-count { font-size: 14px; color: var(--ink-soft); white-space: nowrap; flex-shrink: 0; min-width: 110px; }
.group-row-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.group-row-edit { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.group-row-edit input { max-width: none; width: 100%; }
.groups-empty-card { text-align: center; padding: 48px 24px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: 16px; }
.groups-empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.groups-empty-icon svg { width: 24px; height: 24px; }
.groups-empty-title { font-size: 14.5px; font-weight: 700; margin: 0 0 6px; }
.groups-empty-sub { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 16px; }

/* ---------- integrations ---------- */

.itg-list { display: flex; flex-direction: column; gap: 20px; }
.itg-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); }
.itg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.itg-head-left { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.itg-head-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-top: 2px; }
.itg-logo { width: 54px; height: 54px; border-radius: 15px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.itg-logo.sheets { background: #ffffff; border: 1px solid var(--line); }
.itg-logo.telegram { background: #29a9eb; border-radius: 50%; }
.itg-title { font-size: 16px; font-weight: 800; margin: 0 0 3px; }
.itg-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin: 0; max-width: 620px; }

.toggle-switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; display: inline-block; }
.toggle-switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; top: 0; left: 0; cursor: pointer; z-index: 1; }
.toggle-switch .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background 0.15s ease; }
.toggle-switch input:checked + .track { background: var(--primary); }
.toggle-switch .thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s ease; }
.toggle-switch input:checked ~ .thumb { transform: translateX(20px); }
.toggle-switch input:disabled { cursor: not-allowed; }
.toggle-switch input:disabled ~ .track { opacity: 0.5; }

.status-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 11px 15px; border-radius: 12px; font-size: 12.5px; font-weight: 700; margin-bottom: 16px; }
.status-banner.connected { background: var(--green-tint); color: var(--green); }
.status-banner.not-connected { background: var(--card-2); color: var(--ink-soft); }
.status-banner svg { width: 15px; height: 15px; flex-shrink: 0; }
.status-banner .status-meta { font-weight: 500; color: var(--ink-soft); margin-left: auto; }

.export-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 3px 10px 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.export-badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.export-badge.connected { background: var(--green-tint); color: var(--green); }
.export-badge.connected .dot { background: var(--green); }
.export-badge.not-connected { background: var(--card-2); color: var(--ink-soft); }
.export-badge.not-connected .dot { background: var(--ink-faint); }

.itg-field-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.itg-field-row .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.itg-field-row .field input, .itg-field-row .field select { max-width: none; width: 100%; }
.itg-hint { display: flex; align-items: flex-start; gap: 6px; font-size: 11.5px; color: var(--ink-soft); margin-bottom: 16px; }
.itg-hint svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 1px; }
.itg-actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.tg-list { display: flex; flex-direction: column; margin: 4px 0 18px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tg-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--card-2); }
.tg-row:last-child { border-bottom: none; }
.tg-row-main { flex: 1; min-width: 0; }
.tg-row-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tg-row-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.tg-row-err { font-size: 11.5px; color: var(--red); margin-top: 2px; }
.tg-add { border-top: 1px solid var(--line); padding-top: 18px; }
.tg-add h4 { margin: 0 0 12px; font-size: 13.5px; }

/* admin's view: one card per agent */
.agent-int-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow); }
.agent-int-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.agent-int-head .person-name { font-size: 15px; }
.agent-int-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.agent-int-item .conn-icon { width: 36px; height: 36px; border-radius: 10px; }
.agent-int-item-main { flex: 1; min-width: 0; }
.agent-int-item-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-int-item-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.agent-int-item-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.agent-int-item-err { font-size: 11.5px; color: var(--red); margin-top: 2px; }
.agent-int-item-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.agent-int-empty { font-size: 12.5px; color: var(--ink-soft); padding: 12px 0 2px; border-top: 1px solid var(--line); }

/* Team tab: sub-teams (groups of people) */
.subteams-card .section-head { margin-bottom: 16px; }
.subteam-new-row { margin: 0 0 14px; }
.subteam-list { display: flex; flex-direction: column; }
.subteam-row { display: flex; align-items: center; gap: 18px; padding: 12px 4px; border-top: 1px solid var(--line); }
.subteam-row .section-icon { width: 40px; height: 40px; border-radius: 12px; }
.subteam-row .section-icon svg { width: 19px; height: 19px; }
.subteam-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subteam-row .group-row-people { min-width: 120px; }
.subteam-row .group-row-count { min-width: 80px; }
.subteam-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 10px; border-radius: 999px; background: var(--primary-tint); color: var(--primary-ink); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.modal-card.subteam-modal { max-width: 480px; }
.subteam-modal .field input { max-width: none; }
.subteam-modal-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 14px 0 6px; }
.subteam-member-list { display: flex; flex-direction: column; gap: 2px; max-height: 45vh; overflow-y: auto; margin-bottom: 16px; }
.subteam-member-option { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.subteam-member-option:hover { background: var(--primary-soft); }
.subteam-member-option input { width: 16px; height: 16px; flex-shrink: 0; }
.subteam-member-option .person-name, .subteam-member-option .person-sub { display: block; }
.subteam-modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.subteam-modal-actions button { width: auto; }

/* Integrations: sharing the company sheet with the agents */
.sheet-share-box { margin-top: 18px; padding: 16px 18px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--card-2); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.sheet-share-title { font-size: 13.5px; font-weight: 800; }
.itg-actions-row .primary { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0; }
.itg-actions-row .primary svg { width: 16px; height: 16px; flex-shrink: 0; }
