    /* ── Variables & Reset ────────────────────────────────────────────────── */
    :root {
      --bg:       var(--tg-theme-bg-color,            #ffffff);
      --text:     var(--tg-theme-text-color,          #000000);
      --hint:     var(--tg-theme-hint-color,          #888888);
      --link:     var(--tg-theme-link-color,          #2481cc);
      --btn:      var(--tg-theme-button-color,        #2481cc);
      --btn-text: var(--tg-theme-button-text-color,   #ffffff);
      --sec-bg:   var(--tg-theme-secondary-bg-color,  #f0f0f0);
      --r: 12px;
      --gap: 16px;
    }

    *, *::before, *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    html { height: 100%; }

    body {
      min-height: 100%;
      background: var(--bg);
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
      font-size: 16px;
      line-height: 1.5;
      overflow-x: hidden;
    }

    /* ── Screen system ────────────────────────────────────────────────────── */
    .screen {
      display: none;
      padding: var(--gap);
      padding-bottom: 96px;
      max-width: 520px;
      margin: 0 auto;
    }
    .screen.active { display: block; }

    /* ── Loading overlay ──────────────────────────────────────────────────── */
    #overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.45);
      z-index: 500;
      align-items: center;
      justify-content: center;
    }
    #overlay.on { display: flex; }

    .spinner {
      width: 44px; height: 44px;
      border: 3px solid rgba(255,255,255,0.25);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.75s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── Toast ────────────────────────────────────────────────────────────── */
    #toast {
      position: fixed;
      bottom: 88px;
      left: 50%;
      transform: translateX(-50%) translateY(12px);
      background: rgba(0,0,0,0.82);
      color: #fff;
      padding: 10px 22px;
      border-radius: 22px;
      font-size: 14px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease, transform 0.25s ease;
      z-index: 600;
      max-width: calc(100vw - 48px);
      white-space: normal;
      text-align: center;
    }
    #toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* ── Typography ───────────────────────────────────────────────────────── */
    h1 { font-size: 24px; font-weight: 700; line-height: 1.25; margin-bottom: 10px; }
    h2 { font-size: 20px; font-weight: 600; line-height: 1.3;  margin-bottom: 6px; }
    p.sub { color: var(--hint); font-size: 15px; line-height: 1.5; }

    /* ── Cards ────────────────────────────────────────────────────────────── */
    .card {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: var(--gap);
      margin-bottom: 10px;
      border: 2px solid transparent;
      transition: border-color 0.2s;
    }
    .card.invalid { border-color: #e53935; }

    .q-label {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 14px;
      line-height: 1.4;
    }

    /* ── Primary button ───────────────────────────────────────────────────── */
    .btn {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      min-height: 52px;
      padding: 12px 20px;
      border: none;
      border-radius: var(--r);
      background: var(--btn);
      color: var(--btn-text);
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: opacity 0.15s, transform 0.1s;
      font-family: inherit;
      text-align: center;
    }
    .btn:active { opacity: 0.82; transform: scale(0.98); }
    .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

    .btn-ghost {
      background: transparent;
      color: var(--link);
      font-size: 14px;
      min-height: 44px;
      font-weight: 500;
    }

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

    /* ── Option button groups ─────────────────────────────────────────────── */
    .opt-group {
      display: flex;
      gap: 8px;
    }

    .opt-btn {
      flex: 1;
      min-height: 48px;
      padding: 10px 8px;
      border: 2px solid var(--bg);
      border-radius: 10px;
      background: var(--bg);
      color: var(--text);
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      text-align: center;
      transition: all 0.15s;
      font-family: inherit;
    }
    .opt-btn.big {
      min-height: 64px;
      font-size: 18px;
    }
    .opt-btn.selected {
      border-color: var(--btn);
      background: var(--btn);
      color: var(--btn-text);
    }
    .opt-btn:active:not(.selected) {
      background: rgba(0,0,0,0.06);
    }

    /* ── Dose grid ────────────────────────────────────────────────────────── */
    .dose-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 8px;
    }
    .dose-opt {
      font-size: 13px;
      min-height: 44px;
      padding: 8px 4px;
    }

    /* ── Text inputs ──────────────────────────────────────────────────────── */
    .field-wrap { margin-bottom: 14px; }
    .field-label {
      display: block;
      font-size: 13px;
      color: var(--hint);
      margin-bottom: 5px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }

    .input {
      width: 100%;
      min-height: 52px;
      padding: 13px 15px;
      border: 2px solid var(--sec-bg);
      border-radius: var(--r);
      background: var(--bg);
      color: var(--text);
      font-size: 16px;
      font-family: inherit;
      outline: none;
      transition: border-color 0.15s;
      appearance: none;
    }
    .input:focus { border-color: var(--btn); }
    .input.err   { border-color: #e53935; }

    textarea.input {
      min-height: 90px;
      resize: vertical;
      line-height: 1.5;
      padding-top: 12px;
      cursor: text;
      caret-color: var(--text);
      -webkit-user-select: text;
      user-select: text;
    }
    textarea.input:focus {
      outline: 2px solid transparent;
      caret-color: var(--text);
    }

    .err-msg {
      color: #e53935;
      font-size: 13px;
      margin-top: 5px;
      display: none;
    }
    .err-msg.show { display: block; }

    /* ── Sliders ──────────────────────────────────────────────────────────── */
    .slider-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }
    .slider-val {
      font-size: 26px;
      font-weight: 700;
      color: var(--btn);
      min-width: 36px;
      text-align: center;
      line-height: 1;
    }
    .slider-unit { font-size: 13px; color: var(--hint); }

    input[type="range"] {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 7px;
      border-radius: 4px;
      outline: none;
      cursor: pointer;
      background: linear-gradient(
        to right,
        var(--btn) var(--pct, 50%),
        var(--sec-bg) var(--pct, 50%)
      );
      padding: 0;
      border: none;
    }
    input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--btn);
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(0,0,0,0.22);
      transition: transform 0.1s;
    }
    input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
    input[type="range"]::-moz-range-thumb {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--btn);
      cursor: pointer;
      border: none;
      box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    }
    input[type="range"]::-moz-range-track {
      height: 7px;
      border-radius: 4px;
      background: var(--sec-bg);
    }
    input[type="range"]::-moz-range-progress {
      height: 7px;
      border-radius: 4px;
      background: var(--btn);
    }

    .slider-labels {
      display: flex;
      justify-content: space-between;
      margin-top: 8px;
    }
    .slider-lbl {
      font-size: 12px;
      color: var(--hint);
      max-width: 48%;
      line-height: 1.3;
    }
    .slider-lbl:last-child { text-align: right; }

    /* ── Extra field (textarea reveal) ───────────────────────────────────── */
    .extra-field {
      display: none;
      margin-top: 12px;
    }
    .extra-field.show {
      display: block;
      animation: fadeSlide 0.2s ease;
    }
    @keyframes fadeSlide {
      from { opacity: 0; transform: translateY(-6px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ── Char counter ─────────────────────────────────────────────────────── */
    .char-counter {
      text-align: right;
      font-size: 12px;
      color: var(--hint);
      margin-top: 4px;
    }

    /* ══════════════════ FORM screen ═══════════════════════════════════════ */
    .form-hero {
      padding: 20px 0 14px;
    }
    .date-pill {
      display: inline-block;
      background: var(--btn);
      color: var(--btn-text);
      font-size: 12px;
      font-weight: 600;
      padding: 3px 12px;
      border-radius: 20px;
      margin-bottom: 8px;
      letter-spacing: 0.3px;
    }

    /* ══════════════════ SUCCESS screen ════════════════════════════════════ */
    .success-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 65vh;
      text-align: center;
      padding: 32px 0;
    }
    .ck-wrap {
      width: 92px;
      height: 92px;
      margin-bottom: 28px;
    }
    .ck-svg { width: 92px; height: 92px; }

    .ck-circle {
      fill: none;
      stroke: var(--btn);
      stroke-width: 2.5;
      stroke-dasharray: 166;
      stroke-dashoffset: 166;
      animation: ckStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.1s forwards;
    }
    .ck-check {
      fill: none;
      stroke: var(--btn);
      stroke-width: 3.5;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-dasharray: 50;
      stroke-dashoffset: 50;
      animation: ckStroke 0.35s cubic-bezier(0.65, 0, 0.45, 1) 0.72s forwards;
    }
    @keyframes ckStroke { to { stroke-dashoffset: 0; } }

    .success-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
    .success-date  { color: var(--hint); font-size: 14px; margin-bottom: 28px; line-height: 1.5; }
    .success-close {
      max-width: 280px;
      width: 100%;
    }

    /* ══════════════════ ALREADY-SUBMITTED screen ══════════════════════════ */
    .already-top {
      text-align: center;
      padding: 28px 0 18px;
    }
    .already-emoji { font-size: 56px; display: block; margin-bottom: 12px; }

    .followup-item {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: 12px var(--gap);
      margin-bottom: 8px;
    }
    .followup-time {
      font-size: 11px;
      color: var(--hint);
      margin-bottom: 4px;
    }
    .followup-text {
      font-size: 14px;
      line-height: 1.5;
      word-break: break-word;
    }

    /* ══════════════════ ADMIN HOME screen ═════════════════════════════════ */
    #screen-admin-home { padding-bottom: 24px; }

    .admin-home-top {
      text-align: center;
      padding: 28px 0 22px;
    }
    .admin-badge {
      display: inline-block;
      background: #e53935;
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      padding: 3px 10px;
      border-radius: 20px;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      margin-bottom: 14px;
    }
    .admin-home-emoji { font-size: 50px; margin-bottom: 12px; display: block; }

    .choice-btn {
      display: flex;
      align-items: center;
      gap: 14px;
      width: 100%;
      padding: 18px var(--gap);
      border: 2px solid var(--sec-bg);
      border-radius: var(--r);
      background: var(--sec-bg);
      color: var(--text);
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
      text-align: left;
      transition: all 0.15s;
      margin-bottom: 12px;
    }
    .choice-btn:active { opacity: 0.82; transform: scale(0.98); }
    .choice-btn-icon   { font-size: 28px; line-height: 1; flex-shrink: 0; }
    .choice-btn-info   { display: flex; flex-direction: column; gap: 3px; }
    .choice-btn-title  { font-size: 16px; font-weight: 600; }
    .choice-btn-sub    { font-size: 13px; color: var(--hint); font-weight: 400; }

    .choice-btn-primary {
      background: var(--btn);
      color: var(--btn-text);
      border-color: var(--btn);
    }
    .choice-btn-primary .choice-btn-sub { color: rgba(255,255,255,0.72); }

    /* ══════════════════ ADMIN PANEL screen ══════════════════════════════════ */
    #screen-admin { padding-top: 0; padding-bottom: 24px; }

    .admin-nav {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 14px 0 12px;
      margin-bottom: 14px;
      border-bottom: 1.5px solid var(--sec-bg);
    }
    .back-btn {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 6px 12px 6px 8px;
      border: none;
      border-radius: 8px;
      background: var(--sec-bg);
      color: var(--link);
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
      transition: opacity 0.15s;
      flex-shrink: 0;
    }
    .back-btn:active { opacity: 0.7; }
    .admin-nav-title { font-size: 16px; font-weight: 700; flex: 1; }
    .admin-badge-sm {
      background: #e53935;
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 20px;
      letter-spacing: 0.4px;
      text-transform: uppercase;
    }

    /* Tab bar */
    .tab-bar {
      display: flex;
      gap: 4px;
      margin-bottom: 18px;
      background: var(--sec-bg);
      padding: 4px;
      border-radius: 10px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .tab-bar::-webkit-scrollbar { display: none; }
    .tab-btn {
      flex: 1;
      min-width: 64px;
      padding: 8px 6px;
      border: none;
      border-radius: 7px;
      background: transparent;
      color: var(--hint);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
      transition: all 0.15s;
      white-space: nowrap;
    }
    .tab-btn.active {
      background: var(--bg);
      color: var(--text);
      box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    }

    /* Tab panels */
    .tab-panel { display: none; }
    .tab-panel.active { display: block; }

    /* Stats grid */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-bottom: 14px;
    }
    .stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
    .stat-card {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: 14px 12px;
      text-align: center;
    }
    .stat-num {
      font-size: 26px;
      font-weight: 700;
      color: var(--btn);
      line-height: 1.1;
    }
    .stat-lbl {
      font-size: 12px;
      color: var(--hint);
      margin-top: 4px;
      line-height: 1.3;
    }

    /* Completion bar */
    .completion-wrap {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: 14px var(--gap);
      margin-bottom: 14px;
    }
    .completion-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 13px;
    }
    .completion-lbl { color: var(--hint); }
    .completion-pct { font-weight: 700; }
    .completion-bar-bg {
      background: rgba(0,0,0,0.08);
      border-radius: 4px;
      height: 7px;
      overflow: hidden;
    }
    .completion-bar-fill {
      height: 100%;
      background: var(--btn);
      border-radius: 4px;
      transition: width 0.6s ease;
    }

    /* Section heading */
    .section-heading {
      font-size: 12px;
      font-weight: 700;
      color: var(--hint);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin: 18px 0 10px;
    }

    /* Activity list */
    .activity-item {
      display: flex;
      align-items: center;
      gap: 11px;
      padding: 10px 0;
      border-bottom: 1px solid var(--sec-bg);
    }
    .activity-item:last-child { border-bottom: none; }
    .activity-avatar {
      width: 36px; height: 36px;
      border-radius: 50%;
      background: var(--btn);
      color: var(--btn-text);
      display: flex; align-items: center; justify-content: center;
      font-size: 15px; font-weight: 700;
      flex-shrink: 0;
    }
    .activity-body { flex: 1; min-width: 0; }
    .activity-name {
      font-size: 14px; font-weight: 600;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .activity-meta { font-size: 12px; color: var(--hint); margin-top: 1px; }
    .activity-scores {
      text-align: right;
      font-size: 12px;
      color: var(--hint);
      flex-shrink: 0;
      line-height: 1.5;
    }

    /* Responsive table */
    .data-table-wrap {
      overflow-x: auto;
      border-radius: var(--r);
      border: 1.5px solid var(--sec-bg);
      margin-bottom: 12px;
      -webkit-overflow-scrolling: touch;
    }
    .data-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }
    .data-table th {
      background: var(--sec-bg);
      padding: 9px 10px;
      text-align: left;
      font-weight: 600;
      white-space: nowrap;
      color: var(--hint);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .data-table td {
      padding: 9px 10px;
      border-top: 1px solid var(--sec-bg);
      vertical-align: middle;
      white-space: nowrap;
    }
    .data-table tr:hover td { background: rgba(0,0,0,0.025); }
    .user-name { font-weight: 600; }
    .user-id   { font-size: 11px; color: var(--hint); }

    /* Inline action buttons */
    .act-btn {
      padding: 5px 10px;
      border: none;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
      transition: opacity 0.15s;
      white-space: nowrap;
    }
    .act-btn:active { opacity: 0.7; }
    .act-btn-danger  { background: #fdecea; color: #e53935; }
    .act-btn-primary { background: rgba(36,129,204,0.12); color: var(--btn); }
    .act-btn + .act-btn { margin-left: 4px; }

    /* Dropped-out badge in Users table */
    .dropped-badge {
      display: inline-block;
      font-size: 11px;
      font-weight: 700;
      color: #e53935;
      background: #fdecea;
      padding: 3px 8px;
      border-radius: 6px;
      letter-spacing: 0.3px;
    }

    /* Filter bar */
    .filter-bar {
      display: flex;
      gap: 8px;
      margin-bottom: 12px;
      flex-wrap: wrap;
      align-items: flex-end;
    }
    .filter-bar .input {
      min-height: 40px;
      font-size: 14px;
      padding: 8px 12px;
      flex: 1;
      min-width: 100px;
    }
    .filter-bar .btn {
      min-height: 40px;
      width: auto;
      padding: 0 14px;
      font-size: 14px;
      flex-shrink: 0;
    }

    /* Pagination */
    .pagination {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 10px;
    }
    .page-info { font-size: 12px; color: var(--hint); text-align: center; flex: 1; }

    /* Control card */
    .ctrl-card {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: var(--gap);
      margin-bottom: 12px;
    }
    .ctrl-card-title { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
    .ctrl-card-sub {
      font-size: 13px;
      color: var(--hint);
      margin-bottom: 14px;
      line-height: 1.45;
    }

    /* Scheduler rows */
    .job-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 0;
      border-top: 1px solid rgba(0,0,0,0.07);
      font-size: 13px;
      gap: 10px;
    }
    .job-row:first-child { border-top: none; }
    .job-id { font-weight: 600; }
    .job-next { color: var(--hint); font-size: 12px; text-align: right; }

    /* Feature flags */
    .flag-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 0;
      border-top: 1px solid rgba(0,0,0,0.07);
    }
    .flag-row:first-child { border-top: none; }
    .flag-info { flex: 1; min-width: 0; }
    .flag-name { font-size: 13px; font-weight: 700; margin-bottom: 3px; word-break: break-all; }
    .flag-desc { font-size: 12px; color: var(--hint); line-height: 1.3; }
    .flag-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .flag-scope {
      font-size: 12px;
      padding: 4px 6px;
      border: 1.5px solid var(--sec-bg);
      border-radius: 7px;
      background: var(--bg);
      color: var(--text);
      font-family: inherit;
      cursor: pointer;
      max-width: 120px;
    }
    .flag-scope:disabled { opacity: 0.5; cursor: not-allowed; }
    .flag-toggle {
      position: relative;
      display: inline-block;
      width: 44px;
      height: 24px;
      flex-shrink: 0;
    }
    .flag-toggle input { display: none; }
    .flag-toggle-slider {
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.18);
      border-radius: 24px;
      transition: background 0.2s;
      cursor: pointer;
    }
    .flag-toggle-slider::before {
      content: '';
      position: absolute;
      width: 18px; height: 18px;
      left: 3px; top: 3px;
      background: #fff;
      border-radius: 50%;
      transition: transform 0.2s;
      box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
    .flag-toggle input:checked + .flag-toggle-slider { background: var(--btn); }
    .flag-toggle input:checked + .flag-toggle-slider::before { transform: translateX(20px); }

    /* Empty state */
    .empty-state {
      text-align: center;
      padding: 28px 0;
      color: var(--hint);
      font-size: 14px;
    }

    /* ══════════════════ Admin v2 (v0.9.3) ══════════════════════════════════ */
    /* Theme-vars only — no hardcoded colors. Master-detail flexes to vertical
       on narrow viewports (Telegram WebView default). */
    .v2-master-detail {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    @media (min-width: 720px) {
      .v2-master-detail {
        flex-direction: row;
        align-items: flex-start;
      }
    }
    .v2-list-pane {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: var(--gap);
      flex: 1 1 auto;
      min-width: 0;
    }
    @media (min-width: 720px) {
      .v2-list-pane { flex: 0 0 280px; }
    }
    .v2-list-footer-action {
      margin-top: 10px;
      width: 100%;
    }
    .v2-list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      font-weight: 700;
      font-size: 14px;
    }
    .v2-list { display: flex; flex-direction: column; gap: 4px; }
    .v2-list-item {
      padding: 10px 12px;
      border-radius: 8px;
      cursor: pointer;
      background: var(--bg);
      color: var(--text);
      border: 1px solid transparent;
      font-size: 13px;
      word-break: break-all;
    }
    .v2-list-item.active {
      border-color: var(--btn);
      background: var(--btn-soft, var(--bg));
    }
    .v2-list-item-slug { font-weight: 700; }
    .v2-list-item-meta { font-size: 11px; color: var(--hint); margin-top: 2px; }
    .v2-detail-pane {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: var(--gap);
      flex: 1 1 auto;
      min-width: 0;
    }
    .v2-detail-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; word-break: break-all; }
    .v2-detail-meta  { font-size: 12px; color: var(--hint); margin-bottom: 12px; }
    .v2-detail-section { margin-top: 14px; }
    .v2-detail-section-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
    .btn-small {
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 8px;
    }
    .v2-form-row {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-bottom: 10px;
    }
    .v2-form-row label {
      font-size: 12px;
      color: var(--hint);
    }
    .v2-audit-row {
      padding: 8px 0;
      border-top: 1px solid rgba(0,0,0,0.07);
      font-size: 12px;
      line-height: 1.45;
    }
    .v2-audit-row:first-child { border-top: none; }
    .v2-audit-row-meta { color: var(--hint); font-size: 11px; }
    .v2-audit-pager {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-top: 10px;
    }

    /* ══════════════════ Reminder templates (v0.9.2) ════════════════════════ */
    .rt-card {
      background: var(--sec-bg);
      border-radius: var(--r);
      padding: var(--gap);
      margin-bottom: 12px;
    }
    .rt-card-head {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
    }
    .rt-card-title { font-size: 15px; font-weight: 700; flex: 1; }
    .rt-card-sub {
      font-size: 12px;
      color: var(--hint);
      margin-bottom: 12px;
      line-height: 1.4;
    }
    .rt-row {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
      align-items: center;
    }
    .rt-row-label {
      font-size: 12px;
      color: var(--hint);
      width: 70px;
      flex-shrink: 0;
    }
    .rt-time-input {
      width: 90px;
      padding: 8px 10px;
      border: 1.5px solid var(--sec-bg);
      border-radius: 8px;
      background: var(--bg);
      color: var(--text);
      font-family: inherit;
      font-size: 14px;
    }
    .rt-emoji-input {
      width: 60px;
      padding: 8px 10px;
      border: 1.5px solid var(--sec-bg);
      border-radius: 8px;
      background: var(--bg);
      color: var(--text);
      font-family: inherit;
      font-size: 14px;
    }
    .rt-text {
      width: 100%;
      min-height: 70px;
      padding: 10px;
      border: 1.5px solid var(--sec-bg);
      border-radius: 8px;
      background: var(--bg);
      color: var(--text);
      font-family: inherit;
      font-size: 14px;
      line-height: 1.4;
      resize: vertical;
    }
    .rt-counter {
      font-size: 11px;
      color: var(--hint);
      text-align: right;
      margin-top: 2px;
    }
    .rt-next {
      font-size: 12px;
      color: var(--hint);
      margin-top: 4px;
    }
    .rt-next.rt-warning { color: #c0392b; }
    .rt-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 10px;
    }
    .rt-card[data-slot="manual"] .rt-time-input { display: none; }

    /* ══════════════════ ADMIN MODAL ════════════════════════════════════════ */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.5);
      z-index: 700;
      align-items: flex-end;
      justify-content: center;
    }
    .modal-overlay.open { display: flex; }
    .modal-box {
      background: var(--bg);
      border-radius: 20px 20px 0 0;
      padding: var(--gap);
      padding-bottom: 32px;
      width: 100%;
      max-width: 520px;
      max-height: 80vh;
      overflow-y: auto;
    }
    .modal-handle {
      width: 36px; height: 4px;
      background: rgba(0,0,0,0.12);
      border-radius: 2px;
      margin: 0 auto 18px;
    }
    .modal-title {
      font-size: 17px;
      font-weight: 700;
      margin-bottom: 8px;
    }
    .modal-body {
      font-size: 14px;
      color: var(--hint);
      margin-bottom: 14px;
      line-height: 1.5;
    }
    .modal-actions {
      display: flex;
      gap: 10px;
      margin-top: 12px;
    }
    .modal-actions .btn { flex: 1; }

    /* ── v0.9.4 phase 6 — Groups tab + invite link overlay ────────────── */
    .v2-group-card {
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px;
      margin-bottom: 10px;
      background: var(--card-bg);
    }
    .v2-group-header {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .v2-group-count {
      font-size: 12px;
      color: var(--hint);
      margin-left: auto;
    }
    .v2-group-desc {
      font-size: 13px;
      color: var(--hint);
      margin-top: 6px;
      white-space: pre-wrap;
    }
    .invite-link-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.6);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 200;
    }
    .invite-link-box {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 20px;
      width: 90%;
      max-width: 400px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
    .invite-link-input {
      width: 100%;
      padding: 8px;
      border: 1px solid var(--border);
      border-radius: 6px;
      font-size: 12px;
      font-family: monospace;
      word-break: break-all;
    }

    /* ── v0.9.4 fix-pack: study-detail UI (B1, B2, B3) ────────────────── */

    /* B3: 5 Ukrainian tab labels don't fit in one row on ~360px screens.
       Allow horizontal scroll, hide the bar, prevent each tab from
       shrinking below its content width. The base .admin-tabs rule from
       Phase 0/3 used flex without nowrap; scope this override to the
       study-detail screen so the global admin v2 tab bar is unaffected. */
    #screen-admin-v2-study .admin-tabs {
      overflow-x: auto;
      flex-wrap: nowrap;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      scroll-behavior: smooth;
    }
    #screen-admin-v2-study .admin-tabs::-webkit-scrollbar {
      display: none;
    }
    #screen-admin-v2-study .admin-tabs .tab-btn {
      flex-shrink: 0;
      white-space: nowrap;
    }

    /* B1 + B2: explicit class-based layout for participant + response rows.
       Replaces the inline-style version that didn't expand the info column
       reliably on narrow viewports. */
    .v2sd-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 0;
      border-top: 1px solid var(--border);
      font-size: 14px;
    }
    .v2sd-row-info {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
    }
    .v2sd-row-name {
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .v2sd-row-meta {
      color: var(--hint);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .v2sd-row-action {
      flex: 0 0 auto;
      width: auto;
    }
    .v2sd-row .v2sd-row-action {
      width: auto;
      min-width: 80px;
      min-height: auto;
      padding: 6px 12px;
      white-space: nowrap;
    }

    /* ── v0.9.4 phase 7 — diff-style audit rows ──────────────────────── */
    .v2-audit-row.v2-audit-reverted {
      opacity: 0.55;
    }
    .v2-audit-row-top {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 6px;
      margin-bottom: 4px;
    }
    .v2-audit-meta {
      color: var(--hint);
      font-size: 11px;
      flex-shrink: 0;
    }
    .v2-audit-detail {
      font-size: 11px;
      color: var(--hint);
      margin-top: 2px;
    }
    .v2-audit-diff {
      font-size: 12px;
      line-height: 1.4;
      margin-top: 4px;
      word-break: break-word;
    }
    .v2-audit-old {
      color: var(--hint);
      text-decoration: line-through;
    }
    .v2-audit-new {
      color: var(--text);
    }
    .v2-badge-reverted,
    .v2-badge-revertable {
      font-size: 10px;
      padding: 1px 6px;
      border-radius: 3px;
      margin-left: 6px;
    }
    .v2-badge-reverted {
      background: var(--hint);
      color: var(--bg);
    }
    .v2-badge-revertable {
      background: rgba(255, 165, 0, 0.18);
      color: #c97f00;
      border: 1px solid rgba(255, 165, 0, 0.35);
    }

    /* ── v0.9.4 phase 8 — Settings tab rows ──────────────────────────── */
    .v2-settings-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 0;
      border-top: 1px solid rgba(0, 0, 0, 0.07);
    }
    .v2-settings-row:first-child {
      border-top: none;
    }
    .v2-settings-row-info {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
    }
    .v2-settings-meta {
      font-size: 11px;
      color: var(--hint);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .v2-settings-toggle {
      flex-shrink: 0;
      width: 22px;
      height: 22px;
      cursor: pointer;
    }

    /* ── Compact buttons inside Settings + Tools panels ──────────────────
       The base .btn rule sets width:100% + min-height:52px, which makes
       sense for primary CTAs but wastes the row in admin panels where
       the button sits next to label text. Scope the override to the
       admin v2 Settings + Tools panels so the rest of the app keeps
       its full-width primary buttons. The Tools-panel '📢 Надіслати
       зараз' broadcast button uses plain class="btn" (no .btn-outline,
       no .btn-small), so it does NOT match these rules and stays wide. */
    #v2-settings-panel button {
      width: auto;
      min-width: 80px;
      min-height: auto;
      padding: 6px 12px;
      white-space: nowrap;
    }
    #v2sd-tab-tools .btn-outline,
    #v2sd-tab-tools .btn-small {
      width: auto;
      min-width: 80px;
      min-height: auto;
      padding: 6px 12px;
      white-space: nowrap;
    }

    /* ── Admin v2: Groups tab header + per-card buttons ── */
    #v2sd-tab-groups .btn-outline,
    #v2sd-tab-groups .btn-small,
    .v2-group-card .btn-outline,
    .v2-group-card .btn-small {
      width: auto;
      min-width: 80px;
      min-height: auto;
      padding: 6px 12px;
      white-space: nowrap;
    }

    /* ── Admin v2: Audit pager + Settings v1-fallback button ── */
    #admin-v2-tab-audit .btn-small,
    #admin-v2-tab-settings > .ctrl-card .btn-outline {
      width: auto;
      min-width: 80px;
      min-height: auto;
      padding: 6px 12px;
      white-space: nowrap;
    }

/* ════════════════════════════════════════════════════════════════════════════
   v0.9.6 — Help button (?) + tooltip system
════════════════════════════════════════════════════════════════════════════ */

.help-btn {
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--hint);
    background: transparent;
    color: var(--hint);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    width: 20px;
    min-width: 20px;
    min-height: 20px;
}
.help-btn:active { border-color: var(--link); color: var(--link); }

.help-tooltip {
    display: none;
    position: fixed;
    z-index: 500;
    background: var(--secondary-bg, #1c1c1e);
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    border-radius: 12px;
    padding: 14px 16px;
    width: 280px;
    max-width: calc(100vw - 16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
/* v0.9.6.3 — UA-only help: language toggle removed. */
.help-title { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.help-text { font-size: 13px; color: var(--text); line-height: 1.45; margin-bottom: 8px; }
.help-example { font-size: 12px; color: var(--hint); font-style: italic; line-height: 1.4; margin: 0; }
.v2-tab-help-header { display: flex; align-items: center; padding: 4px 0 8px; }

/* ── Report tab ── */
.report-section { margin-bottom: 20px; }
.report-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--hint);
    margin: 0 0 10px;
}
.report-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.report-field-row { margin-bottom: 10px; }
.report-field-label-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.report-field-label {
    font-size: 13px;
    color: var(--hint);
    font-weight: 500;
}
.report-field-value {
    font-size: 14px;
    color: var(--text);
    background: var(--secondary-bg, #1c1c1e);
    padding: 8px 10px;
    border-radius: 8px;
}
.report-field-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    background: var(--secondary-bg, #1c1c1e);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.report-strobe-add {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.report-select {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    background: var(--secondary-bg, #1c1c1e);
    color: var(--text);
    font-size: 13px;
}
.report-strobe-field-row { margin-bottom: 10px; }
.report-prompt-note { font-size: 12px; color: var(--hint); margin-bottom: 8px; }
.report-prompt-area {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    background: var(--secondary-bg, #1c1c1e);
    color: var(--text);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    resize: vertical;
    line-height: 1.5;
}

/* v0.9.6.3 — descriptive weekly stats table inside the report tab. */
.report-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 8px 0;
}
.report-stats-table th,
.report-stats-table td {
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    padding: 4px 8px;
    text-align: center;
}
.report-stats-table th {
    background: var(--secondary-bg);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--hint);
}
