/* =============================================
   PARTNER THEME — MAIN CSS
   ============================================= */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: rgba(37,99,235,0.08);
  --text: #111827;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F3F4F6;
  --white: #ffffff;
  --error: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary); }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* =============================================
   AUTH PAGES (login / register)
   ============================================= */

.auth-page {
  min-height: 100vh;
  display: flex;
}

.auth-left {
  flex: 1;
  background: linear-gradient(145deg, #1e3a8a 0%, #1D4ED8 55%, #2563EB 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  top: -120px; right: -120px;
}

.auth-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -80px; left: -80px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 64px;
  position: relative; z-index: 1;
}

.auth-brand-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.auth-brand-name {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-left-content { position: relative; z-index: 1; }

.auth-left-content h1 {
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 18px;
}

.auth-left-content h1 span { color: rgba(255,255,255,0.55); }

.auth-left-content p {
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 40px;
  max-width: 380px;
}

.auth-features { display: flex; flex-direction: column; gap: 14px; }

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
}

.auth-feature-dot {
  width: 7px; height: 7px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  flex-shrink: 0;
}

.auth-right {
  width: 460px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  box-shadow: -20px 0 60px rgba(0,0,0,0.06);
}

/* TABS */
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 32px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.auth-form-header { margin-bottom: 24px; }

.auth-form-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.auth-form-header p { font-size: 14px; color: var(--text-muted); }

/* FORMS */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.form-control::placeholder { color: #9CA3AF; }

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-control.error { border-color: var(--error); }

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  display: none;
}

.form-error.show { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  font-family: inherit;
  letter-spacing: -0.1px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  margin-top: 6px;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.auth-footer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.auth-footer a { color: var(--primary); }

.form-panel { display: none; }
.form-panel.active { display: block; }

/* ALERTS */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert.show { display: block; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }

/* =============================================
   WELCOME PAGE (onboarding)
   ============================================= */

.welcome-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.welcome-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-md);
}

.welcome-greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.welcome-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

.welcome-step-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* =============================================
   CABINET LAYOUT
   ============================================= */

.cabinet-page { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sidebar-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-upload-hint {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.18s;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
}

.sidebar-avatar:hover .avatar-upload-hint { opacity: 1; }

.sidebar-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  max-width: 180px;
  word-break: break-word;
}

.sidebar-user-id {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* NAV */
.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

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

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* MANAGER BLOCK */
.sidebar-manager {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.sidebar-manager-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.sidebar-manager-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  font-size: 13px;
}

.sidebar-manager-phone {
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sidebar-manager-link a {
  color: var(--primary);
  font-size: 12px;
}

/* PROMO */
.sidebar-promo {
  margin: 0 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-promo img { width: 100%; border-radius: 6px; }

/* MAIN CONTENT */
.cabinet-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  max-width: 100%;
}

/* CARDS */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

/* USER HEADER */
.cabinet-user-header {
  margin-bottom: 4px;
}

.cabinet-greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

.cabinet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.cabinet-meta strong { color: var(--text); }

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

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table tbody tr:nth-child(even) td { background: #FAFAFA; }

/* STATUS BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-new { background: #EFF6FF; color: #1D4ED8; }
.badge-progress { background: #FFFBEB; color: #B45309; }
.badge-success { background: #ECFDF5; color: #065F46; }
.badge-fail { background: #FEF2F2; color: #991B1B; }

/* ACTION BUTTONS */
.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* PAGINATION */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 16px 0 0;
}

.page-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: all 0.15s;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ALL CLIENTS TOGGLE */
.expand-table { display: none; }
.expand-table.show { display: block; }

.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  margin-top: 12px;
  font-family: inherit;
  transition: all 0.15s;
}

.expand-btn:hover { background: var(--primary-light); border-color: var(--primary); }

/* NEWS PAGE */
.news-item {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 16px;
}

.news-item-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.news-item-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 14px;
}

.news-item-preview { /* collapsed */ }

.news-item-full {
  display: none;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 14px;
  margin-top: 8px;
}

.news-item-full.show { display: block; }

.news-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.news-reactions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: inherit;
}

.reaction-btn:hover { background: var(--bg); }
.reaction-btn.liked { color: #2563EB; }
.reaction-btn.disliked { color: #EF4444; }

.news-read-more {
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  padding: 0;
}

.load-more-wrap { text-align: center; padding: 8px 0; }

.btn-load-more {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 12px 40px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}

.btn-load-more:hover { border-color: var(--primary); color: var(--primary); }
.btn-load-more:disabled { opacity: 0.5; cursor: not-allowed; }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: none;
  background: var(--bg);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.modal-close:hover { background: var(--border); }

/* SPINNER */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn:disabled .spinner { display: inline-block; }

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

/* RESPONSIVE */
@media (max-width: 900px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 40px 24px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .cabinet-main { margin-left: 0; padding: 20px 16px; }
}

/* ---- Мобильный гамбургер ---- */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 42px;
  height: 42px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  padding: 0;
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--bg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 900px),
       (orientation: landscape) and (pointer: coarse) and (max-width: 1200px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .cabinet-main { margin-left: 0; padding-top: 68px; }
}

@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }
  .cabinet-main { padding-top: 68px; }

  /* Кнопка Изменить уходит под текст на мобиле */
  .profile-top-card .profile-field-row {
    flex-wrap: wrap;
    gap: 2px 12px;
  }
  .profile-top-card .profile-field-value {
    flex: 1 1 auto;
  }
  .profile-top-card .profile-izm-wrap {
    width: 100%;
    padding-left: 142px; /* отступ = ширина лейбла + gap */
    box-sizing: border-box;
  }
  .profile-top-card .profile-izm-wrap .profile-tooltip {
    left: 0;
    right: auto;
  }
}

/* =============================================
   OFFERS — список предложений
   ============================================= */

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 20px;
}

.offer-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: box-shadow 0.18s;
}

.offer-card:hover { box-shadow: var(--shadow-md); }

.offer-card--pinned {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.offer-pinned-badge {
  font-size: 12px;
  font-weight: 600;
  color: #92400E;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.offer-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.offer-card-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.offer-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: stretch;
  margin-top: 16px;
}
.offer-card-actions .btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  margin-top: 0 !important;
  width: auto !important;
  padding: 10px 14px;
}

#pinned-offer { position: sticky; top: 0; z-index: 10; }

.loader-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 20px auto;
}

#offers-loader { display: flex; justify-content: center; padding: 16px 0; }

.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--primary); text-decoration: none; }

/* =============================================
   OFFER SINGLE — страница предложения
   ============================================= */

.offer-single {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.offer-single-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 16px;
}

.offer-single-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

.offer-ratings {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.offer-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.offer-rating-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.offer-rating-dots {
  font-size: 16px;
  letter-spacing: 3px;
  color: var(--text);
}

.offer-meta-row {
  display: flex;
  gap: 32px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.offer-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.offer-meta-key {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.offer-meta-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.offer-materials {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.offer-material-item a {
  font-size: 13px;
  color: var(--primary);
  word-break: break-all;
}

.offer-material-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.offer-single-actions { margin-top: 24px; }

/* =============================================
   OFFER PUBLIC PAGE — без авторизации
   ============================================= */

.offer-public-page {
  min-height: 100vh;
  background: var(--bg);
  padding: 32px 20px;
}

.offer-public-header {
  max-width: 680px;
  margin: 0 auto 24px;
}

.offer-public-content {
  max-width: 680px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.offer-public-cta {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

/* =============================================
   PROFILE PAGE
   ============================================= */

/* Заголовок страницы */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px 0;
}

/* Верхний блок: фото + поля */
.profile-top-card .profile-top {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

/* ---- Фото ---- */
.profile-photo-wrap {
  flex-shrink: 0;
}

.profile-photo {
  width: 140px;
  height: 140px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}

.profile-photo:hover { border-color: var(--primary); }

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-placeholder {
  font-size: 14px;
  color: var(--text-muted);
}

.profile-photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.profile-photo:hover .profile-photo-overlay { opacity: 1; }

.profile-photo-status {
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
  min-height: 18px;
}

/* ---- Поля справа от фото ---- */
.profile-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.profile-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  min-height: 36px;
}

.profile-field-label {
  font-size: 14px;
  color: var(--text-muted);
  min-width: 130px;
  flex-shrink: 0;
}

.profile-field-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 0 0 220px;
  min-width: 0;
}

.profile-field-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 14px;
}

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

/* Кнопка Изменить (маленькая) */
.profile-izmBtn {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1.5px solid var(--primary);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: all 0.15s;
  white-space: nowrap;
}
.profile-izmBtn:hover {
  background: var(--primary);
  color: #fff;
}
.profile-izmBtn--disabled {
  color: var(--text-muted);
  border-color: var(--border);
  cursor: default;
}

/* Обёртка для тултипа при наведении на кнопку Изменить */
.profile-izm-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.profile-izm-wrap .profile-tooltip {
  left: 0;
  white-space: normal;
  width: 180px;
  line-height: 1.4;
}
.profile-izm-wrap .profile-tooltip::before {
  left: 14px;
}
.profile-izm-wrap:hover .profile-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* xs кнопки */
.btn-xs {
  padding: 4px 12px;
  font-size: 12px;
}

/* ---- Тултип ---- */
.profile-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: 130px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.profile-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 20px;
  border: 5px solid transparent;
  border-bottom-color: #1f2937;
  border-top: none;
}

.profile-tooltip.show,
.profile-tooltip--dark.show {
  opacity: 1;
  transform: translateY(0);
}

/* Тултип для кнопки Изменить (снизу) */
.req-locked-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.profile-tooltip--dark {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.profile-tooltip--dark::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 16px;
  border: 5px solid transparent;
  border-bottom-color: #1f2937;
  border-top: none;
}
.req-locked-wrap:hover .profile-tooltip--dark {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Таблица контактов/финансов/реквизитов ---- */
.profile-table {
  width: 100%;
  border-collapse: collapse;
}

.profile-table tr {
  border-bottom: 1px solid var(--border);
}
.profile-table tr:last-child { border-bottom: none; }

.profile-table-key {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-muted);
  width: 45%;
  vertical-align: middle;
}

.profile-table-val {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  vertical-align: middle;
}

.profile-table-val .req-input {
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
}

/* Секция реквизиты */
.profile-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px 0;
}

.req-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.req-edit-btn--locked {
  opacity: 0.5;
  cursor: not-allowed !important;
}

/* Плейсхолдер в реквизитах */
.profile-placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

/* Sidebar avatar — ссылка на профиль */
.sidebar-avatar-link {
  display: block;
  text-decoration: none;
}

/* Greeting name link → profile */
.greeting-name-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px dashed var(--primary);
  transition: opacity 0.15s;
}
.greeting-name-link:hover { opacity: 0.75; }

/* =============================================
   DEALS PAGE (/deals/)
   ============================================= */

.deals-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.deals-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}
.deals-breadcrumb a:hover { text-decoration: underline; }

.deals-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Sortable table headers */
.sort-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sort-th:hover { color: var(--primary); }

.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.sort-th.sort-asc .sort-icon,
.sort-th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
}

.deals-td-title {
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 100px;
}

/* Resizable columns */
#dealsTable {
  table-layout: fixed;
  width: 100%;
}
#dealsTable thead th {
  position: relative;
  overflow: visible;
}
.col-resizer {
  position: absolute;
  right: -3px;
  top: 0;
  height: 100%;
  width: 7px;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Видимая линия-разделитель */
.col-resizer::after {
  content: '';
  display: block;
  width: 2px;
  height: 60%;
  background: #d1d5db;
  border-radius: 2px;
  transition: background 0.15s, height 0.15s;
}
.col-resizer:hover::after,
.col-resizer.resizing::after {
  background: var(--primary);
  height: 80%;
  width: 3px;
}
.deals-td-money { font-variant-numeric: tabular-nums; }

.deals-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}

/* Google-style pagination */
.deals-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.deals-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.deals-page-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.deals-page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
  pointer-events: none;
}
.deals-page-ellipsis {
  display: flex;
  align-items: center;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Mobile deals table — все тач-устройства (portrait + landscape) */
@media (max-width: 900px),
       (orientation: landscape) and (pointer: coarse) and (max-width: 1200px) {
  .deals-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #dealsTable {
    table-layout: auto;
    min-width: 600px; /* горизонтальный скролл если не влезает */
  }
}

/* Mobile portrait: только Сделка / Клиент / Телефон */
@media (max-width: 900px) and (orientation: portrait) {
  #dealsTable {
    min-width: unset;
    width: 100%;
    table-layout: fixed;
  }

  /* Скрываем ненужные колонки по номеру */
  /* E-mail (4), Статус (5), Сумма (6), Комиссия (7), Статус оплаты (8) */
  #dealsTable thead th:nth-child(4),
  #dealsTable thead th:nth-child(5),
  #dealsTable thead th:nth-child(6),
  #dealsTable thead th:nth-child(7),
  #dealsTable thead th:nth-child(8),
  #dealsTable tbody td:nth-child(4),
  #dealsTable tbody td:nth-child(5),
  #dealsTable tbody td:nth-child(6),
  #dealsTable tbody td:nth-child(7),
  #dealsTable tbody td:nth-child(8) {
    display: none;
  }

  /* Пропорции трёх видимых столбцов */
  #dealsTable thead th:nth-child(1),
  #dealsTable tbody td:nth-child(1) { width: 42%; }
  #dealsTable thead th:nth-child(2),
  #dealsTable tbody td:nth-child(2) { width: 33%; }
  #dealsTable thead th:nth-child(3),
  #dealsTable tbody td:nth-child(3) { width: 25%; }

  /* Ресайзер скрываем на мобиле */
  .col-resizer { display: none; }

  /* Текст в портрете — мельче, но читабельно */
  #dealsTable th,
  #dealsTable td {
    font-size: 12px;
    padding: 8px 6px;
    white-space: normal;
    word-break: break-word;
  }
}

/* =============================================
   CLIENT MODE TOGGLE — переключатель в модалке
   ============================================= */
.client-mode-toggle {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.client-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    user-select: none;
}

.client-mode-option input[type="radio"] {
    display: none;
}

.client-mode-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.client-mode-option--active {
    border-color: var(--primary);
    background: #EFF6FF;
    color: var(--primary);
}

.form-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* =============================================
   BTN-TRANSFER-CLIENT — кнопка "Передать" в таблице сделок
   ============================================= */
.btn-transfer-client {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    background: #EFF6FF;
    border: 1px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    vertical-align: middle;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.btn-transfer-client:hover {
    background: var(--primary);
    color: #fff;
}

.btn-transfer-client:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* =============================================
   REF LINK TOAST — тултип «ссылка скопирована» над кнопкой
   ============================================= */
.ref-btn-wrap {
    position: relative;
    display: inline-block;
}

.ref-link-toast {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 280px;
    background: #1f2937;
    color: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s, transform .18s;
    pointer-events: none;
}

.ref-link-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Стрелка вниз */
.ref-link-toast::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 18px;
    border: 6px solid transparent;
    border-top-color: #1f2937;
}

.ref-link-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.ref-link-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #9CA3AF;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color .15s;
}

.ref-link-toast-close:hover { color: #fff; }

.ref-link-toast-desc {
    font-size: 12px;
    color: #D1D5DB;
    line-height: 1.5;
    margin: 0;
}

.ref-link-toast-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: #fff;
    color: #1f2937;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    align-self: flex-start;
    transition: background .15s;
}

.ref-link-toast-open:hover { background: #F3F4F6; color: #1f2937; }

/* =============================================
   FINANCE METRICS — блок финансов на главной
   ============================================= */
.fin-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 4px;
}

.fin-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 12px 16px;
    border-radius: 12px;
    background: #F9FAFB;
    border: 1px solid var(--border);
    gap: 4px;
    transition: box-shadow .15s;
}

.fin-metric:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

.fin-metric--accent {
    background: #EFF6FF;
    border-color: #BFDBFE;
}

.fin-metric--green {
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.fin-metric--muted {
    background: #FFF7ED;
    border-color: #FED7AA;
}

.fin-metric-icon {
    font-size: 22px;
    margin-bottom: 4px;
    line-height: 1;
}

.fin-metric-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.35;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fin-metric-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-top: 4px;
}

.fin-metric--accent .fin-metric-value { color: var(--primary); }
.fin-metric--green  .fin-metric-value { color: #16A34A; }
.fin-metric--muted  .fin-metric-value { color: #EA580C; }

.fin-metric-unit {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    min-height: 14px;
}

@media (max-width: 900px) {
    .fin-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .fin-metrics .fin-metric:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .fin-metrics {
        grid-template-columns: 1fr;
    }
    .fin-metrics .fin-metric:last-child {
        grid-column: auto;
    }
    .fin-metric-value { font-size: 20px; }
}
