/* Компоненты кабинета Evo-SA поверх дизайн-системы evo.css. */

/* Уведомления */
.toast-stack { position: fixed; z-index: 9000; top: calc(var(--top-h) + 12px); right: 16px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); font-size: 13px; animation: toast-in .18s ease-out; }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.toast.ok svg { color: var(--ok); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.toast.bad svg { color: var(--bad); }
.toast svg { margin-top: 1px; }
.toast .icon-btn { margin-left: auto; width: 22px; height: 22px; }
@keyframes toast-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Модальные окна */
dialog.modal { width: min(560px, calc(100vw - 32px)); max-width: none; }
dialog.modal.wide { width: min(880px, calc(100vw - 32px)); }
dialog.modal.editor { width: min(1280px, calc(100vw - 32px)); }
dialog.modal.editor .panel-body { max-height: calc(100vh - 160px); }
dialog.modal > form { display: flex; flex-direction: column; }
dialog.modal .panel-body { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 220px); overflow: auto; }
.form-error { color: var(--bad); font-size: 13px; }
.form-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }

/* Состояния загрузки и ошибки */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 4px; min-height: 12px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.state-box { padding: 36px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.state-box strong { color: var(--ink); font-size: 15px; }
.state-box.error strong { color: var(--bad); }
.busy { pointer-events: none; opacity: .65; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Меню пользователя */
.user { position: relative; }
.user-button { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); color: var(--ink); text-align: left; font-size: 13px; }
.user-button:hover { background: var(--surface-3); }
.user-button small { display: block; color: var(--muted); font-size: 11.5px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; display: grid; gap: 2px; z-index: 50; }
.menu a, .menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 5px; border: 0; background: transparent; color: var(--ink-2); font-size: 13px; text-align: left; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .menu-meta { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); }

/* Вход и согласие */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); display: grid; gap: 16px; }
.auth-card header { display: flex; align-items: center; gap: 10px; }
.auth-card header img { height: 30px; }
.auth-card .panel-body { display: grid; gap: 14px; padding: 24px; }
.auth-card footer { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }

/* Кнопки проигрывания и шкала (проигрыватель каркаса — css/shell.css) */
.pbtn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.pbtn:disabled { opacity: .5; cursor: default; }
.seek { flex: 1; accent-color: var(--accent); min-width: 60px; }

/* Карточка диалога */
.lanes-click { cursor: pointer; }
.utt { cursor: pointer; }
.utt .txt .hl { background: color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 3px; }
.utt.inferred .txt { color: var(--ink-2); font-style: italic; }

/* Дерево коллекции */
.tree button.tw { background: transparent; border: 0; cursor: pointer; border-radius: 4px; padding: 0; }
.tree button.tw:hover { background: var(--surface-3); color: var(--ink); }
.tree button.tw[disabled] { cursor: default; background: transparent; }

/* Поля-чипсы */
.chip-input { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); min-height: 36px; background: var(--surface); cursor: text; }
.chip-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.chip-input input { border: 0; outline: 0; flex: 1; min-width: 140px; background: transparent; height: 26px; }
.chip-input .chip { cursor: default; }

/* Мелочи */
.link-button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.link-button:hover { text-decoration: underline; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
@media (max-width: 1100px) { .hide-narrow { display: none !important; } }
.readonly-note { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

.t tr.archived td { opacity: .6; }
.t tr.archived td:last-child { opacity: 1; }

/* Действия в строке таблицы */
.row-actions { display: inline-flex; gap: 2px; align-items: center; flex-wrap: nowrap; }

/* «Почему»: результат строк условия для диалога */
.why-rows { margin: 6px 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: 12.5px; }
.why-rows li { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.why-rows .f { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.why-rows .k { font-weight: 700; color: var(--accent); font-size: 11px; }
.rowhit { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 4px; font-size: 11px; font-weight: 700; border: 1px solid var(--line); }
.rowhit.y { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.rowhit.n { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.rowhit.q { color: var(--unknown); background: var(--unknown-soft); border-color: transparent; }

/* Четыре шага в ряд (правила); на узком экране — по два */
.steps-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 820px) { .steps-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
