/* =========================================================
   BASE VARIABLES
   ========================================================= */
   :root {
    --bg: #0b1020;
    --card: #111633;
    --card-2: #0f1530;
    --text: #e9ecff;
    --muted: #b5c0ff;
    --brand: #6ea8fe;
    --brand-2: #8a5bff;
    --ok: #28c76f;
    --warn: #ff9f43;
    --bad: #ea5455;
    --border: #24306d;
    --chip: #1b2452;
    --chip-on: #21306a;
    --radius: 20px;
    --shadow: 0 16px 40px rgba(0,0,0,0.45), 0 8px 20px rgba(0,0,0,0.30);
  }
  
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  
  body {
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background:
      radial-gradient(1200px 1200px at 10% -10%, #21306a55 0%, transparent 60%),
      radial-gradient(1000px 800px at 100% 0%, #6a3aff33 0%, transparent 60%),
      linear-gradient(180deg, #0b0f22, #0b1020);
    background-attachment: fixed;
  }
  
  .wrap {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 16px;
  }
  
  /* =========================================================
     HEADER + TITLE
     ========================================================= */
  .head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
  }
  
  .title {
    font-weight: 800;
    font-size: clamp(22px, 3vw, 34px);
    background: linear-gradient(90deg, #fff, #bcd0ff 60%, #e2d4ff);
    -webkit-background-clip: text;
    color: transparent;
  }
  
  /* =========================================================
     LANGUAGE SWITCH (unified)
     ========================================================= */
  .lang-switch {
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
  }
  
  .lang-switch button,
  #themeToggle,
  #adminLoginBtn {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.25s ease;
  }
  
  .lang-switch button.active {
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    color: #fff;
  }
  
  /* =========================================================
     STEP INDICATOR + PROGRESS
     ========================================================= */
  .step-indicator {
    text-align: center;
    font-weight: 600;
    color: var(--muted);
    margin: 16px 0 10px;
  }
  
  .progress-bar {
    width: 100%;
    height: 6px;
    background: #1a2144;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 30px;
  }
  
  .progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transition: width 0.4s ease;
  }
  
  /* =========================================================
     CARDS + SECTIONS
     ========================================================= */
  .card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: visible;
    transition: 0.3s ease;
  }
  
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  }
  
  .card-h {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #121a3a, #111633);
  }
  
  .card-h h3 { margin: 0; font-size: 18px; }
  
  .card-b { padding: 22px 24px; }
  
  /* =========================================================
     INPUTS & LABELS
     ========================================================= */
  label.block {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--muted);
  }
  
  input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0c122c;
    color: var(--text);
    font-size: 15px;
    transition: 0.25s ease;
  }
  
  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(138,91,255,0.3);
    background: #121a3c;
  }
  
  input::placeholder { color: #8c93c9; }
  
  /* =========================================================
     LAYOUT GRIDS
     ========================================================= */
  .grid { display: grid; gap: 14px; }
  
  .g2 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(3, 1fr); }
  
  @media (max-width: 900px) {
    .g2, .g3 { grid-template-columns: 1fr; }
  }
  
  /* =========================================================
     STEP SECTION ANIMATION
     ========================================================= */
  .step-section { display: none; animation: fadeIn 0.5s ease; }
  .step-section.active { display: block; }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  
  /* =========================================================
     NAV BUTTONS
     ========================================================= */
  .nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  
  .btn {
    border: 0;
    padding: 12px 16px;
    font-weight: 800;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.3s ease;
  }
  
  .btn.brand {
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 0 12px rgba(110,168,254,0.4);
  }
  
  .btn.brand:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(138,91,255,0.5);
  }
  
  .btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
  }
  
  .btn.ghost:hover {
    background: #141a3c;
  }
  
  #prevBtn { display: none; }
  
  /* =========================================================
   CHIPS
   ========================================================= */
.chips {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
  transition: 0.25s ease;
}

.chip:hover {
  background: var(--chip-on);
  transform: translateY(-1px);
}

.chip input {
  accent-color: var(--brand);
  width: 18px;
  height: 18px;
}

/* =========================================================
   DROPDOWN 
   ========================================================= */
.dropdown {
  position: relative;
  width: 100%;
  user-select: none;
  font-size: 15px;
}

.dropdown-selected {
  padding: 14px 16px;
  background: linear-gradient(180deg, #111a3b, #0f1430);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: 0.25s ease;
}

.dropdown-selected::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: 0.25s;
}

.dropdown.open .dropdown-selected::after {
  transform: rotate(-135deg);
  border-color: var(--brand);
}

.dropdown-selected:hover {
  border-color: var(--brand);
  background: #141b3e;
  box-shadow: 0 0 10px rgba(110,168,254,0.3);
}

.dropdown-list {
  list-style: none;
  position: absolute;
  width: 100%;
  margin: 6px 0 0;
  padding: 6px 0;
  background: #101530;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 20;
}

.dropdown.open .dropdown-list {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-list li {
  padding: 12px 18px;
  color: var(--text);
  cursor: pointer;
  transition: 0.25s;
}

.dropdown-list li:hover {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
}

.dropdown-list li.selected {
  background: var(--chip-on);
  color: var(--brand);
  font-weight: 600;
}

/* =========================================================
   MATRIX (Q4, Q9, Q11)
   ========================================================= */
.matrix {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

.matrix th,
.matrix td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
}

.matrix th {
  text-align: center;
  color: var(--muted);
  background: #151a3d;
  font-weight: 600;
}

.matrix td {
  text-align: center;
}

.matrix-label {
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.matrix-choice input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

.matrix tr:hover td {
  background: #111a3b;
}

/* =========================================================
   Q11 MATRIX (уникальный стиль)
   ========================================================= */
#q11_matrix {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* header */
#q11_matrix th {
  background: #151a3d;
}

/* rows */
#q11_matrix td {
  border-bottom: 1px solid #1a224f;
}

#q11_matrix tr:hover td {
  background: #111a3b;
}

/* =========================================================
   DROPDOWN — MAIN ACTIVITY (использует общие стили)
   ========================================================= */
#activityFields {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

/* чекбоксы “secondary activities” */
#secondaryActivities .chip {
  padding: 10px 12px;
  font-size: 14px;
}

#secondaryActivities input:disabled + span {
  opacity: 0.5;
}

/* поле “Other” */
.input-other {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  width: 100%;
  display: none;
  transition: 0.25s ease;
}

.input-other:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(138,91,255,0.3);
}
/* =========================================================
   LIGHT THEME
   ========================================================= */
   :root[data-theme="light"] {
    --bg: #f8f9fc;
    --card: #ffffff;
    --card-2: #f4f6fb;
    --text: #1a1a1a;
    --muted: #555;
    --brand: #0066ff;
    --brand-2: #7b4dff;
    --border: #dce2f2;
    --chip: #eef2ff;
    --chip-on: #dde3ff;
    --shadow: 0 6px 16px rgba(0,0,0,0.08);
  }
  
  html, body, .card, input, select, textarea,
  .dropdown-selected, .chip {
    transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
  }
  
  :root[data-theme="light"] body {
    background: linear-gradient(180deg, #eef2f8, #ffffff);
  }
  
  :root[data-theme="light"] .card {
    background: #ffffff;
    border: 1px solid #e0e4f0;
    color: #1a1a1a;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  }
  
  :root[data-theme="light"] .card-h {
    background: #f0f3fa;
    border-bottom: 1px solid #d5d8e5;
    color: #1a1a1a;
  }
  
  :root[data-theme="light"] .lang-switch,
  :root[data-theme="light"] .dropdown-selected,
  :root[data-theme="light"] .dropdown-list,
  :root[data-theme="light"] input,
  :root[data-theme="light"] select,
  :root[data-theme="light"] textarea {
    background: #fff;
    border: 1px solid #ccd3ea;
    color: #1a1a1a;
  }
  
  :root[data-theme="light"] .dropdown-list li:hover {
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    color: #fff;
  }
  
  :root[data-theme="light"] .chip {
    background: #f7f9ff;
    border: 1px solid #d8def2;
    color: #1a1a1a;
  }
  
  :root[data-theme="light"] .chip:hover {
    background: #e9edff;
  }
  
  :root[data-theme="light"] .title {
    background: linear-gradient(90deg, #1a1a1a, #444 60%, #777);
    -webkit-background-clip: text;
    color: transparent;
  }
  
  :root[data-theme="light"] input::placeholder { color: #777; }
  
  :root[data-theme="light"] label.block,
  :root[data-theme="light"] .step-indicator {
    color: #444;
  }
  
  /* tables in light mode */
  :root[data-theme="light"] .modern-table,
  :root[data-theme="light"] #q11_matrix {
    background: #ffffff;
    border: 1px solid #e0e4f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
  
  :root[data-theme="light"] .matrix-label,
  :root[data-theme="light"] .modern-table th {
    color: #1a1a1a;
  }
  
  :root[data-theme="light"] .modern-table tr:hover td,
  :root[data-theme="light"] #q11_matrix tr:hover td {
    background: #f2f4ff;
  }
  
  /* =========================================================
     MOBILE RESPONSIVE (< 600px)
     ========================================================= */
  @media (max-width: 600px) {
    .wrap { margin: 20px auto; padding: 0 12px; }
  
    .head {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
    }
  
    .title { font-size: 22px; line-height: 1.2; }
  
    .lang-switch {
      align-self: stretch;
      justify-content: space-between;
      padding: 4px;
    }
  
    .card { border-radius: 14px; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
    .card-h { padding: 14px 16px; }
    .card-b { padding: 16px 18px; }
  
    .modern-table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
      font-size: 13px;
    }
  
    .g2, .g3 { grid-template-columns: 1fr !important; }
  
    .chips { gap: 10px; }
    .chip { font-size: 15px; padding: 12px 14px; }
  
    .nav { flex-direction: column; gap: 10px; }
    .btn { width: 100%; }
  
    canvas {
      max-width: 100% !important;
      height: auto !important;
    }
  
    p, .small.hint {
      font-size: 14px;
      line-height: 1.5;
    }
  
    input[type="radio"], input[type="checkbox"] {
      width: 20px;
      height: 20px;
    }
  
    #themeToggle {
      position: fixed;
      top: 10px;
      right: 12px;
      padding: 10px;
      background: rgba(0,0,0,0.25);
      backdrop-filter: blur(4px);
      border-radius: 50%;
      z-index: 1000;
    }
  
    body { overflow-x: hidden; }
  }
  
  /* =========================================================
     Q1 — Mobile fix (< 700px)
     ========================================================= */
  @media (max-width: 700px) {
    .step-section[data-step="2"] .modern-table {
      display: flex;
      flex-direction: column;
      gap: 20px;
      border: none;
    }
  
    .step-section[data-step="2"] .modern-table thead { display: none; }
    .step-section[data-step="2"] .modern-table tbody {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }
  
    .step-section[data-step="2"] .modern-table td {
      padding: 0;
      border: none;
      width: 100%;
      display: block;
    }
  
    #q1_already::before,
    #q1_plan::before {
      content: attr(data-label) " —";
      display: block;
      font-weight: 700;
      color: var(--brand);
      margin-bottom: 10px;
    }
  
    #q1_already .chip,
    #q1_plan .chip {
      width: 100%;
      justify-content: flex-start;
    }
  }
  
  /* =========================================================
     LIGHT THEME FIX — Q11
     ========================================================= */
  :root[data-theme="light"] #q11_matrix th {
    background: #f0f3fa;
    border-bottom: 1px solid #d5d8e5;
  }
  
  :root[data-theme="light"] #q11_matrix td { border-bottom: 1px solid #d4daf0; }
  
  :root[data-theme="light"] #activityFields .chip {
    background: #f7f9ff;
    border: 1px solid #d8def2;
    color: #1a1a1a;
  }
  
  :root[data-theme="light"] #activityFields .chip:hover {
    background: #e9edff;
  }
  
  :root[data-theme="light"] .input-other {
    background: #fff;
    border: 1px solid #ccd3ea;
    color: #1a1a1a;
  }
  #errorBox, #globalErrorBox {
    display: none;
    padding: 14px 18px;
    margin-bottom: 18px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    animation: fadeIn 0.25s ease-out;
  }
  
  .light #globalErrorBox {
    background: #ffe2e2;
    color: #b10000;
    border: 1px solid #ffb5b5;
  }
  
  .dark #globalErrorBox {
    background: #4a1f1f;
    color: #ffbcbc;
    border: 1px solid #b44;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  :root[data-theme="light"] .matrix th {
    background: #f0f3fa !important;
    color: #1a1a1a !important;
    border-bottom: 1px solid #d5d8e5 !important;
  }

  :root[data-theme="light"] .matrix td {
    border-bottom: 1px solid #e0e4f0 !important;
  }

  :root[data-theme="light"] .matrix tr:hover td {
    background: #f2f4ff !important;
  }
  @media (max-width: 600px) {
    .matrix {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
    }
  
    .matrix td, .matrix th {
      padding: 8px 6px;
    }
  }
  @media (max-width: 600px) {
    #q1_already::before,
    #q1_plan::before {
      display: none !important;
    }
  }
  @media (max-width: 600px) {
    #q11_matrix {
      display: block !important;
      overflow-x: auto !important;
      white-space: nowrap !important;
    }
  
    #q11_matrix th,
    #q11_matrix td {
      padding: 10px 8px !important;
    }
  }
  @media (max-width: 600px) {
    .card-b {
      overflow-x: auto !important;
    }
  
    #q11_matrix {
      min-width: 520px !important;
    }
  }
  
  