/*----------------------------------------------------------------------------
  Конструктор тестов: кабинет автора, редактор, плеер, таблица ответов.

  ВАЖНО ПРО BROWSER-DEFAULT. В теме сайта лежит правило Materialize
  input[type=...]:not(.browser-default) { padding: 0; border-bottom: ... },
  из-за которого текст в поле прижимается к краю, а рамки не видно.
  Поэтому все поля конструктора помечены классом browser-default —
  Materialize их не трогает, а всё оформление задаётся здесь.

  Корневой класс .tm-page, а не .tm: шаблон сайта вешает на <body> класс
  по адресу страницы (str_replace('/', '-', $curPage)), и короткие имена
  вроде .about уже один раз ломали вёрстку шапки.
------------------------------------------------------------------------------*/

.tm-page {
    color: #37474f;
    line-height: 1.65;
    padding-bottom: 3rem;
}

/* ─── Типовые элементы ─────────────────────────────────────────────────── */

.tm-btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    background: #fff;
    color: #37474f;
    font-size: .92rem;
    line-height: 1.3;
    cursor: pointer;
    text-transform: none;
    transition: background .15s, border-color .15s;
}
.tm-btn:hover { background: #f5f7f8; border-color: #b0bec5; color: #263238; }

.tm-btn--primary {
    background: #00897b;
    border-color: #00897b;
    color: #fff;
}
.tm-btn--primary:hover { background: #00796b; border-color: #00796b; color: #fff; }

.tm-btn--small { padding: 6px 12px; font-size: .85rem; }
.tm-btn--big   { padding: 13px 30px; font-size: 1rem; }
.tm-btn--ghost { border-style: dashed; color: #607d8b; }
.tm-btn--danger { color: #c62828; border-color: #ffcdd2; }
.tm-btn--danger:hover { background: #ffebee; border-color: #ef9a9a; }

.tm-icon {
    border: 0;
    background: none;
    color: #90a4ae;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 6px;
}
.tm-icon:hover { background: #eceff1; color: #455a64; }
.tm-icon--danger:hover { background: #ffebee; color: #c62828; }

.tm-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 13px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    line-height: 1.5;
    color: #263238;
    background: #fff;
    height: auto;
    margin: 0 0 10px;
}
.tm-input:focus { outline: none; border-color: #4db6ac; box-shadow: 0 0 0 3px rgba(77, 182, 172, .15); }
.tm-input::placeholder { color: #b0bec5; }

.tm-input--small  { max-width: 260px; display: inline-block; }
.tm-input--tiny   { width: 80px; display: inline-block; margin: 0 4px; padding: 6px 9px; }
.tm-input--select { max-width: 340px; }
.tm-textarea { min-height: 72px; resize: vertical; }

.tm-label {
    display: block;
    font-weight: 600;
    color: #263238;
    font-size: .95rem;
    margin-bottom: 6px;
}

/* Подсказка отдельным элементом после поля, а не .helper-text:
   тот абсолютно спозиционирован и не вмещается в две строки. */
.tm-hint {
    display: inline-block;
    font-size: 12px;
    color: rgba(0, 0, 0, .54);
    line-height: 1.5;
    margin: 0 0 4px;
}

.tm-sublabel {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #90a4ae;
    margin-bottom: 8px;
}

.tm-field { margin-bottom: 22px; }

/* Materialize прячет radio и checkbox (position:absolute; opacity:0) и рисует
   вместо них псевдоэлемент у соседнего <span>. В плеере разметка такая и есть —
   <input> + <span> внутри <label>, — поэтому там всё видно. А в редакторе
   отметки верных вариантов и галочки настроек стоят сами по себе, без span,
   и без этого правила они просто исчезают с экрана. */
.tm-editor input[type="checkbox"],
.tm-editor input[type="radio"] {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 16px;
    height: 16px;
    margin: 0;
    left: auto;
}

.tm-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 18px;
    font-size: .9rem;
    color: #455a64;
    cursor: pointer;
}
.tm-check input { margin: 0; }
.tm-check--points { color: #607d8b; }

.tm-danger { color: #c62828; }
.tm-nowrap { white-space: nowrap; }

.tm-note {
    background: #f5f7f8;
    border-left: 3px solid #b0bec5;
    border-radius: 0 8px 8px 0;
    padding: 12px 18px;
    margin: 0 0 22px;
}
.tm-note--warn { background: #fff8e1; border-left-color: #ffb300; }
.tm-note--ok   { background: #e8f5e9; border-left-color: #43a047; }
.tm-note--calm { background: #e0f2f1; border-left-color: #4db6ac; }
.tm-note p:last-child { margin-bottom: 0; }

.tm-locked {
    display: inline-block;
    padding: 8px 14px;
    border: 1px dashed #cfd8dc;
    border-radius: 8px;
    color: #90a4ae;
    font-size: .9rem;
}
.tm-locked--inline { padding: 6px 12px; }

.tm-empty {
    background: #fafafa;
    border-radius: 10px;
    padding: 24px 26px;
    color: #546e7a;
}
.tm-empty p:last-child { margin-bottom: 0; }
.tm-empty--inline { padding: 16px 20px; margin-bottom: 16px; }

.tm-loading { color: #90a4ae; padding: 30px 0; }

/* ─── Кабинет: панель и карточки ───────────────────────────────────────── */

.tm-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eceff1;
}
.tm-toolbar__meta {
    margin-left: auto;
    color: #78909c;
    font-size: .88rem;
}

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

.tm-card {
    border: 1px solid #eceff1;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
}
.tm-card__head { margin-bottom: 10px; }
.tm-card__title { font-size: 1.05rem; font-weight: 600; color: #263238; margin: 6px 0 0; line-height: 1.4; }
.tm-card__meta { color: #78909c; font-size: .87rem; margin-bottom: 14px; }
.tm-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tm-status {
    display: inline-block;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 3px 9px;
    border-radius: 20px;
    background: #eceff1;
    color: #607d8b;
}
.tm-status--open   { background: #e8f5e9; color: #2e7d32; }
.tm-status--closed { background: #fbe9e7; color: #bf360c; }

.tm-link-row { display: flex; gap: 8px; margin-bottom: 14px; }
.tm-link {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid #eceff1;
    border-radius: 6px;
    background: #fafafa;
    font-size: .8rem;
    color: #546e7a;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

/* ─── Редактор ─────────────────────────────────────────────────────────── */

.tm-editor__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.tm-editor__bar-right { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* Строка про акцепт оферты рядом с кнопкой публикации. */
.tm-legal {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(0, 0, 0, .54);
    margin: 0 0 18px;
}
.tm-legal a { color: #00796b; text-decoration: underline; }

.tm-tabs { display: flex; gap: 4px; border-bottom: 1px solid #eceff1; margin-bottom: 24px; }
.tm-tab {
    border: 0;
    background: none;
    padding: 10px 18px;
    font-size: .95rem;
    color: #78909c;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tm-tab.is-active { color: #00695c; border-bottom-color: #00897b; font-weight: 600; }

.tm-q {
    border: 1px solid #eceff1;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 16px;
    background: #fff;
}
.tm-q__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tm-q__num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #eceff1;
    color: #546e7a;
    font-size: .8rem;
    display: inline-flex; align-items: center; justify-content: center;
    flex: none;
}
.tm-q__type { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: #90a4ae; }
.tm-q__tools { margin-left: auto; display: flex; gap: 2px; }
.tm-q__note { color: #78909c; font-size: .88rem; margin: 6px 0; }
.tm-q__foot {
    border-top: 1px solid #f5f5f5;
    margin-top: 14px;
    padding-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.tm-options { margin: 10px 0 4px; }
.tm-option { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tm-option .tm-input { margin-bottom: 0; }
.tm-option__mark { flex: none; }

.tm-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.tm-scale .tm-input--small { margin-bottom: 0; }

.tm-matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 12px 0; }
.tm-matrix__part { min-width: 0; }
@media (max-width: 720px) { .tm-matrix { grid-template-columns: 1fr; } }

/* Панель добавления вопроса.
   Раньше это была строка серого текста и мелкие кнопки на белом фоне —
   блок читался как подпись к списку, а не как «нажми, чтобы добавить».
   Теперь это выделенная панель: своя подложка, пунктирная рамка
   и подпись заголовком. */
.tm-add {
    padding: 16px 18px;
    margin-bottom: 18px;
    border: 1px dashed #cfd8dc;
    border-radius: 12px;
    background: #f7f9fa;
}

.tm-add__label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #546e7a;
}

.tm-add__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Кнопки типов — заметные, с плюсом, чтобы назначение читалось без текста. */
.tm-add .tm-btn {
    background: #fff;
    border-color: #cfd8dc;
    font-weight: 600;
}

.tm-add .tm-btn::before {
    content: "+ ";
    color: var(--primary-color, #9575CD);
    font-weight: 700;
}

.tm-add .tm-btn:hover {
    border-color: var(--primary-color, #9575CD);
    color: var(--primary-color, #9575CD);
}

.tm-settings { max-width: 640px; }

/* ─── Плеер ────────────────────────────────────────────────────────────── */

.tm-run .tm-intro {
    background: #fafafa;
    border-radius: 10px;
    padding: 18px 22px;
    color: #546e7a;
    margin-bottom: 26px;
}

.tm-player .tm-q { padding: 20px 22px; }
.tm-player .tm-q__title { font-size: 1.02rem; font-weight: 600; color: #263238; margin-bottom: 4px; line-height: 1.5; }
.tm-player .tm-q__num { background: none; width: auto; height: auto; color: #90a4ae; margin-right: 2px; }
.tm-player .tm-q__help { color: #78909c; font-size: .88rem; margin-bottom: 12px; }
.tm-q--missing { border-color: #ef9a9a; background: #fff8f8; }
.tm-req { color: #ef9a9a; }

.tm-answer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1.5;
}
.tm-answer:hover { background: #f5f7f8; }
.tm-answer input { margin: 3px 0 0; flex: none; }

.tm-scale-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.tm-scale-label { color: #90a4ae; font-size: .85rem; }
.tm-scale-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid #eceff1;
    border-radius: 8px;
    cursor: pointer;
    min-width: 46px;
}
.tm-scale-point:hover { background: #f5f7f8; }

.tm-matrix-wrap { overflow-x: auto; margin-top: 10px; }
.tm-matrix-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tm-matrix-table th {
    font-weight: 600;
    color: #546e7a;
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid #eceff1;
    font-size: .85rem;
}
.tm-matrix-table td { padding: 10px; text-align: center; border-bottom: 1px solid #f5f5f5; }
.tm-matrix-row { text-align: left !important; color: #37474f; min-width: 180px; }

.tm-timer {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #eceff1;
    color: #546e7a;
    padding: 8px 14px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 18px;
    font-size: .9rem;
}
.tm-timer--hot { background: #ffebee; color: #c62828; }

.tm-submit { margin-top: 26px; }
.tm-submit__note { margin-top: 10px; color: #78909c; font-size: .9rem; }

.tm-done {
    background: #fafafa;
    border-radius: 12px;
    padding: 32px 30px;
    text-align: center;
}
.tm-done__title { font-size: 1.2rem; font-weight: 600; color: #263238; margin-bottom: 8px; }
.tm-done__text { color: #546e7a; }
.tm-score { font-size: 2rem; font-weight: 600; color: #00695c; margin: 16px 0 6px; }

.tm-verdict {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: .82rem;
}
.tm-verdict--ok { background: #e8f5e9; color: #2e7d32; }
.tm-verdict--no { background: #fbe9e7; color: #bf360c; }

.tm-detail { list-style: none; padding: 0; margin: 20px auto 0; max-width: 420px; text-align: left; }
.tm-detail li { padding: 6px 0; border-bottom: 1px solid #eceff1; color: #546e7a; font-size: .92rem; }
.tm-detail li.is-ok { color: #2e7d32; }
.tm-detail li.is-no { color: #c62828; }

.tm-gate { background: #fafafa; border-radius: 10px; padding: 24px 26px; max-width: 420px; }
.tm-gate__form { display: flex; gap: 10px; align-items: flex-start; }
.tm-gate__form .tm-input { margin-bottom: 0; }

/* Уведомление респонденту о том, кто собирает его ответы. */
.tm-notice {
    margin-top: 34px;
    padding: 14px 18px;
    background: #fafafa;
    border-radius: 10px;
    color: #78909c;
    font-size: .85rem;
    line-height: 1.6;
}
.tm-notice a { color: #607d8b; text-decoration: underline; }

.tm-badge {
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid #eceff1;
    color: #b0bec5;
    font-size: .82rem;
}
.tm-badge a { color: #90a4ae; }

/* ─── Таблица ответов ──────────────────────────────────────────────────── */

.tm-table-wrap { overflow-x: auto; border: 1px solid #eceff1; border-radius: 10px; }
.tm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tm-table th {
    background: #fafafa;
    color: #546e7a;
    font-weight: 600;
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid #eceff1;
    white-space: nowrap;
}
.tm-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: top;
    max-width: 280px;
}
.tm-table tr:last-child td { border-bottom: 0; }
.tm-table tr:hover td { background: #fcfcfc; }
.tm-table form { margin: 0; }
.tm-contact { color: #90a4ae; font-size: .82rem; }
