:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --color-bg: #f8fafc;
  --color-card-bg: #ffffff;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-primary: #0284c7;
  --color-primary-hover: #0369a1;
  --color-primary-light: #e0f2fe;
  --color-accent: #0f766e;
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-warning: #ea580c;
  --color-warning-bg: #ffedd5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: -0.5px;
}

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

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #f1f5f9;
  border-radius: 30px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.user-profile-badge:hover {
  border-color: #cbd5e1;
  background: #e2e8f0;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

/* Main Layout */
.main-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 80px 20px;
}

/* Hero Section */
.hero-block {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-headline {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  max-width: 900px;
  letter-spacing: -0.5px;
}

.hero-subtext {
  font-size: 17px;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 850px;
}

/* Scenario Section */
.scenario-section {
  margin-top: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1e293b;
}

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

.scenario-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 18px;
}

.scenario-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.scenario-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.scenario-card.primary {
  border: 2px solid var(--color-primary);
  background: #ffffff;
}

.card-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
}

.scenario-card.primary .card-badge {
  background: var(--color-primary-light);
  color: #0369a1;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.card-desc {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  flex-grow: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

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

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

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

.btn-outline {
  background: transparent;
  color: #0f172a;
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
  padding: 0;
  font-family: inherit;
}

.btn-back:hover {
  color: var(--color-text-main);
}

/* User Trips Section */
.user-trips-section {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

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

.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

.trip-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.15s ease;
}

.trip-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.trip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.trip-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.trip-status-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.status-analyzed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-draft_survey, .status-draft_route {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.status-route_ready {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.trip-context-badge {
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #f1f5f9;
}

.trip-summary-text {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.4;
  flex-grow: 1;
}

.trip-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.empty-trips-box {
  background: var(--color-card-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-buttons-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-custom-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.input-text {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Intro Screen */
.intro-container {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-sm);
  max-width: 800px;
  margin: 0 auto;
}

.intro-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.intro-lead {
  font-size: 16px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 28px;
}

.intro-steps-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 28px;
}

.intro-steps-header {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 18px;
}

.intro-two-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.intro-step-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step-num-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.step-item-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.step-item-info p {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

.intro-actions {
  display: flex;
  justify-content: flex-end;
}

/* Создание тура: все значения вводит турист; форма не подставляет примерный маршрут. */
.create-trip-form {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
}
.create-trip-form .form-status {
  min-height: 20px;
  margin: 2px 0 14px;
  color: #9a3412;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 860px) {
  .scenario-cards-grid {
    grid-template-columns: 1fr;
  }
  .hero-headline {
    font-size: 24px;
  }
}

/* --- SURVEY & CONTEXT STYLES (Шаг 3) --- */
.survey-wrapper {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stepper Bar */
.stepper-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.stepper-steps {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-badge {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.step-badge.active {
  color: var(--color-primary);
  font-weight: 700;
}

.step-badge.completed {
  color: var(--color-success);
}

.step-divider {
  color: #cbd5e1;
  font-size: 12px;
}

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

/* Блок 3: Известные данные */
.known-data-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: #166534;
  font-size: 13.5px;
}

.known-data-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.known-data-summary {
  color: #15803d;
  font-size: 13px;
  line-height: 1.4;
}

/* Question Container */
.question-container {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.question-topic {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.question-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.question-sub {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item-card {
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  transition: all 0.15s ease;
}

.option-item-card:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.option-item-card.selected {
  border-color: var(--color-primary);
  background: #f0f9ff;
}

.option-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.option-item-card.selected .option-checkbox {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.option-label-text {
  font-size: 15px;
  color: #1e293b;
  font-weight: 500;
}

.custom-answer-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--color-border);
}

/* Блок Б: Микро-реакции КонструкТура */
.agent-micro-reaction {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  animation: fadeInReaction 0.25s ease-out;
}

@keyframes fadeInReaction {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.reaction-avatar {
  font-size: 20px;
  flex-shrink: 0;
}

.reaction-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reaction-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #166534;
  letter-spacing: 0.5px;
}

.reaction-text {
  font-size: 13.5px;
  color: #14532d;
  line-height: 1.4;
  margin: 0;
  font-weight: 500;
}

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

.custom-input {
  width: 100%;
}

.survey-nav-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* Блок 4. Подтверждение контекста */
.confirmation-container {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.confirm-icon {
  font-size: 28px;
}

.confirm-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
}

.confirm-bullets-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bullet-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14.5px;
  color: #334155;
  line-height: 1.4;
}

.bullet-bullet {
  color: var(--color-primary);
  font-weight: bold;
}

.confirm-summary-callout {
  background: #f0f9ff;
  border-left: 4px solid var(--color-primary);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: #0369a1;
  line-height: 1.5;
  font-weight: 500;
}

.confirm-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

/* --- ROUTE BUILDER STYLES (Шаг 4) --- */
.route-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.route-intro-callout {
  background: #f1f5f9;
  border-left: 4px solid #64748b;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #334155;
}

.trip-meta-bar {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.trip-meta-inputs {
  display: flex;
  gap: 24px;
  align-items: center;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.dates-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-summary-badge {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: #0369a1;
}

/* Quick Add Toolbar */
.quick-add-toolbar {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.toolbar-label {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.toolbar-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Days Tabs Nav */
.days-tabs-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-tab-btn {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 90px;
  transition: all 0.15s ease;
}

.day-tab-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.day-tab-btn.active {
  background: #f0f9ff;
  border-color: var(--color-primary);
  border-width: 2px;
}

.tab-day-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.tab-day-date {
  font-size: 11px;
  color: var(--color-text-muted);
}

.tab-day-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 2px;
}

/* Active Day Box */
.active-day-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.day-headline {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* Timeline Elements */
.timeline-elements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.15s ease;
}

.timeline-item-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.elem-left-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.elem-cat-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.elem-cat-icon.transport { background: #e0f2fe; color: #0284c7; }
.elem-cat-icon.lodging { background: #fef3c7; color: #d97706; }
.elem-cat-icon.activity { background: #dcfce7; color: #16a34a; }
.elem-cat-icon.meal { background: #fee2e2; color: #dc2626; }

.elem-details h4 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.elem-sub-tags {
  font-size: 12.5px;
  color: var(--color-text-muted);
  display: flex;
  gap: 8px;
  margin-top: 3px;
}

.elem-tag-pill {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.elem-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Два выбора туриста остаются читаемыми в карточке даже на узком экране.
   Они меняют поля элемента маршрута и не требуют открытия карточки продукта. */
.element-key-flags, .element-key-form {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.element-key-flags label, .element-key-form label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .timeline-item-card { align-items: flex-start; flex-direction: column; }
  .elem-right-actions { flex-wrap: wrap; }
  .elem-sub-tags { flex-wrap: wrap; }
}

.btn-icon {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
  transition: all 0.1s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-icon.delete:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.empty-day-elements {
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

/* Warnings */
.day-warning-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 13.5px;
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Ready for Analysis Bar */
.ready-for-analysis-bar {
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.ready-info h4 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.ready-info p {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Modal Form Specifics */
.modal-lg {
  max-width: 600px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

/* Подсказки 2ГИС прокручиваются внутри формы, чтобы длинный список не перекрывал её кнопки. */
.element-place-suggestions {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  margin-top: 4px;
  position: relative;
  z-index: 5;
}
/* Один вариант выбора: название, адрес и дополнительные сведения из 2ГИС. */
.element-place-option {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.element-place-option:hover, .element-place-option:focus { background: #eff6ff; }
.element-place-option span { display: block; font-weight: 600; }
.element-place-option small, .element-place-status { display: block; color: #475569; }
.element-place-option .element-place-region { color: #2563eb; }
/* Показываем начало длинного описания; полный текст остаётся в title элемента. */
.element-place-option .element-place-description {
  margin-top: 3px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.element-place-status { margin-top: 5px; }

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.time-inputs-row {
  display: flex;
  gap: 8px;
}

.time-input {
  width: 100px;
}

/* --- ANALYSIS SCREEN STYLES (Шаг 5) --- */
.analysis-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.analysis-hero-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.analysis-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.analysis-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 8px;
}

.analysis-title {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.analysis-sub {
  font-size: 14.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.overall-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  min-width: 150px;
  text-align: center;
}

.score-big {
  font-size: 44px;
  font-weight: 800;
  color: #16a34a;
  line-height: 1;
}

.score-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.risk-pill {
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 600;
  background: #dcfce7;
  color: #16a34a;
  padding: 3px 8px;
  border-radius: 12px;
}

.risk-pill.warning {
  background: #ffedd5;
  color: #ea580c;
}

.risk-pill.critical {
  background: #fee2e2;
  color: #dc2626;
}

.verdict-banner {
  background: #f0fdf4;
  border-left: 4px solid #16a34a;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: #166534;
  line-height: 1.5;
  font-weight: 500;
}

/* Triad Cards */
.metrics-triad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.triad-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.triad-icon {
  font-size: 28px;
  background: #f1f5f9;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.triad-label {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.triad-value {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 2px 0;
}

.triad-desc {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.4;
}

/* Recommendations Card */
.recommendations-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rec-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.rec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #334155;
}

.rec-bullet {
  color: var(--color-primary);
  font-weight: bold;
}

.rec-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* Days Analysis Grid */
.days-analysis-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.days-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.day-analysis-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-an-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.day-an-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.day-an-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: #dcfce7;
  color: #16a34a;
}

.day-an-badge.warning {
  background: #ffedd5;
  color: #ea580c;
}

.day-an-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: #475569;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.day-an-highlights {
  font-size: 12.5px;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Agent DB Table Drawer */
.agent-db-drawer {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.drawer-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}

.drawer-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.drawer-header p {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.drawer-content {
  padding: 20px 24px;
  max-height: 480px;
  overflow-y: auto;
}

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

.agent-table th {
  background: #f1f5f9;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: #334155;
  border-bottom: 2px solid var(--color-border);
}

.agent-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  color: #334155;
}

.agent-table tr:hover {
  background: #f8fafc;
}

.agent-code-tag {
  font-family: monospace;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.analysis-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}




/* Unified Auth Modal Styles */
.auth-modal-box {
  max-width: 480px;
  width: 90%;
  border-radius: 16px;
  padding: 24px;
}
.modal-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}
.modal-header-nav h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.close-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #64748b;
}
.auth-desc {
  font-size: 14.5px;
  color: #475569;
  margin-bottom: 18px;
}
.auth-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.btn-auth-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}
.btn-auth-option:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  transform: translateY(-1px);
}
.auth-icon {
  font-size: 24px;
}
.auth-text {
  display: flex;
  flex-direction: column;
}
.auth-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}
.auth-subtitle {
  font-size: 12.5px;
  color: #64748b;
}
.demo-users-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0 12px 0;
  color: #94a3b8;
  font-size: 12px;
}
.demo-users-divider::before, .demo-users-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}
.demo-users-divider span {
  padding: 0 10px;
}
.demo-profiles-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-demo-badge {
  background: white;
  border: 1px dashed #cbd5e1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #475569;
  cursor: pointer;
  text-align: left;
}
.btn-demo-badge:hover {
  background: #f1f5f9;
}
.btn-back-text {
  background: none;
  border: none;
  color: #3b82f6;
  font-size: 13.5px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
}
.auth-sub {
  font-size: 13.5px;
  color: #64748b;
  margin-bottom: 14px;
}
.code-inputs-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}
.code-input {
  font-size: 24px !important;
  letter-spacing: 8px !important;
  text-align: center !important;
  max-width: 200px !important;
}
.alert-notice {
  background: #fef3c7;
  border: 1px solid #fde047;
  color: #92400e;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.btn-block {
  width: 100%;
}
.tg-auth-center {
  text-align: center;
  padding: 10px 0;
}
.tg-logo-large, .max-logo-large {
  font-size: 48px;
  margin-bottom: 8px;
}
.btn-tg-pulse {
  display: inline-block;
  margin: 16px 0;
  font-size: 15px;
  padding: 12px 24px;
}
.polling-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: #475569;
  margin: 14px auto;
  max-width: 320px;
}
.spinner-dot {
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}
.auth-caption {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 10px;
}

/* Logout & User Nav Styles */
.user-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-source-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  margin-left: 4px;
}

.tag-telegram {
  background: #e0f2fe;
  color: #0284c7;
}

.tag-phone {
  background: #dcfce7;
  color: #15803d;
}

.tag-max {
  background: #fef3c7;
  color: #b45309;
}

.tag-demo {
  background: #f1f5f9;
  color: #475569;
}

.tag-guest {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-logout {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.current-user-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.curr-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.curr-user-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #15803d;
  font-weight: 700;
}

#curr-user-title {
  font-size: 15px;
  color: #14532d;
}

.muted-info {
  font-size: 12px;
  color: #4ade80;
}

/* --- WIKILLM 15 BLOCKS STYLES --- */
.wikillm-blocks-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  margin-bottom: 24px;
}

.wikillm-blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.wiki-block-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.wiki-block-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wiki-block-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.wiki-block-id-badge {
  background: #0284c7;
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.wiki-block-score-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.wiki-block-score-badge.success {
  background: #dcfce7;
  color: #166534;
}

.wiki-block-score-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.wiki-block-score-badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.wiki-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.35;
  margin: 0;
}

.wiki-block-summary {
  font-size: 13px;
  color: #334155;
  line-height: 1.45;
  flex-grow: 1;
}

.wiki-block-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border);
}

.wiki-block-state-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-proof-link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.1s;
}

.btn-proof-link:hover {
  background: #e0f2fe;
}

/* Modal Block Proof (Почему так?) */
.proof-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.proof-badge {
  background: var(--color-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.proof-state {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 600;
}

.proof-layers-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.proof-layer {
  display: flex;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--color-primary);
}

.proof-layer strong {
  display: block;
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 4px;
}

.proof-layer p {
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}

.layer-num {
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.proof-vectors-box {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
  background: #f1f5f9;
  padding: 12px;
  border-radius: var(--radius-sm);
}

.vector-chip {
  background: white;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.vector-name {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.vector-state {
  font-size: 12px;
  font-weight: 600;
  color: #0369a1;
  margin-top: 2px;
}

.proof-claims-box h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #1e293b;
}

.claim-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #10b981;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.claim-item-card.warning {
  border-left-color: #f59e0b;
}

.claim-item-card.critical {
  border-left-color: #ef4444;
}

.claim-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.claim-desc {
  font-size: 12.5px;
  color: #475569;
  margin-top: 3px;
}

.claim-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 5px;
}

/* Floating AI Chat Widget */
.ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.chat-toggle-btn {
  background: #0284c7;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.chat-toggle-btn:hover {
  transform: scale(1.04);
  background: #0369a1;
}

.chat-window {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 380px;
  height: 520px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: #0f172a;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

.btn-chat-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
}

.chat-messages {
  flex-grow: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-bubble.bot {
  background: white;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.chat-bubble.user {
  background: #0284c7;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.chat-suggestions {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border-top: 1px solid #e2e8f0;
  overflow-x: auto;
}

.suggestion-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  color: #334155;
}

.suggestion-chip:hover {
  background: #e2e8f0;
}

.chat-input-row {
  display: flex;
  padding: 10px 12px;
  background: white;
  border-top: 1px solid var(--color-border);
  gap: 8px;
}

.chat-input {
  flex-grow: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
}

.chat-input:focus {
  border-color: #0284c7;
}

.btn-send {
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
}

/* Стили для рассчитанных показателей анализатора под кнопкой */
.calc-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 12px;
}
.calc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.calc-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.calc-stat-pill {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
/* Развёрнутый прогноз относится ко всему элементу и остаётся читаемым
   при изменении числа колонок карточки на узком экране. */
.calc-weather-pill {
  grid-column: 1 / -1;
}
.calc-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.calc-stat-val {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
