:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 220px);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

h1 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  line-height: 1.25;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.lead {
  margin: 0 0 20px;
  color: var(--muted);
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.question {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}

.question:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.question-number {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.question-text {
  margin: 0 0 12px;
  font-weight: 600;
}

.scale-hints {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.scale-hints span {
  max-width: 48%;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 640px) {
  .score-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}

.score-option {
  position: relative;
}

.score-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.score-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.score-option input:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.score-option label:hover {
  border-color: var(--primary);
}

textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  resize: vertical;
}

.optional-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.submit-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 24px;
}

.submit-btn:hover,
.btn:hover {
  background: var(--primary-dark);
}

.submit-btn:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.status-success {
  background: #d1fae5;
  color: var(--success);
}

.status-warning {
  background: #fef3c7;
  color: var(--warning);
}

.status-danger {
  background: #fee2e2;
  color: var(--danger);
}

.dashboard-layout {
  max-width: 1100px;
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-bottom: 20px;
}

.page-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.page-nav a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
}

.page-nav a:hover {
  color: var(--text);
}

.page-nav a[aria-current="page"] {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.page-nav-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
}

.page-nav-btn:hover {
  color: var(--text);
}

.page-nav-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-header-actions .btn {
  width: auto;
  min-width: 0;
}

.filters-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.filters .btn,
.filters-actions .btn {
  width: auto;
  min-width: 140px;
  margin-top: 0;
  flex: 0 0 auto;
}

@media (min-width: 720px) {
  .filters {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
}

.btn-sync {
  background: #0f766e;
}

.btn-sync:hover {
  background: #0d9488;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 20px;
}

.metric {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.metric-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 4px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.auth-box {
  max-width: 420px;
  margin: 80px auto;
}

.small {
  font-size: 0.85rem;
  color: var(--muted);
}

.response-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}

.response-card .table-wrap {
  margin-top: 12px;
}

.response-comment {
  margin: 12px 0 0;
}

.response-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.score-list {
  margin: 0;
  padding-left: 18px;
}

.score-list li {
  margin-bottom: 8px;
}

.question-label {
  display: inline-block;
  max-width: 100%;
}

.survey-scores-table {
  table-layout: fixed;
  width: 100%;
}

.survey-scores-table .survey-col-score {
  width: 120px;
}

.survey-scores-table th.score-col,
.survey-scores-table td.score-col {
  text-align: center;
  font-weight: 700;
}

.deal-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.deal-link:hover {
  text-decoration: underline;
}

.overview-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 720px) {
  .overview-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.overview-subtitle {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.deals-table {
  font-size: 0.86rem;
}

.deals-table th,
.deals-table td {
  white-space: nowrap;
}

.deals-table .contacts-cell {
  white-space: normal;
  min-width: 140px;
  font-size: 0.8rem;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.status-pending {
  background: #e0e7ff;
  color: #3730a3;
}

.status-sent {
  background: #dbeafe;
  color: #1e40af;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-skipped {
  background: #f3f4f6;
  color: #4b5563;
}

.auth-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-mode-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}

.auth-mode-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.dashboard-header-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.user-form {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.user-form-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}

.user-form-actions .btn {
  width: auto;
  min-width: 120px;
  margin-top: 0;
  flex: 0 0 auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.users-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-small {
  width: auto;
  min-width: 0;
  margin-top: 0;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
}

@media (min-width: 720px) {
  .user-form {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
}

