/*
 * Раздел «Память» в настройках: что Гермес знает о человеке, его заметки и общая память пространства.
 * Цвета только из токенов app.css, чтобы светлая и тёмная темы работали одинаково.
 */

.hermes-dashboard .memory-panel {
    display: grid;
    gap: 1.25rem;
}

.hermes-dashboard .memory-section {
    display: grid;
    gap: 0.625rem;
    padding: 1rem 1.125rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.75rem;
}

.hermes-dashboard .memory-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.hermes-dashboard .memory-section__head h3 {
    margin: 0;
    font-size: 1rem;
}

.hermes-dashboard .memory-section__hint {
    margin: 0;
}

.hermes-dashboard .memory-meter {
    display: grid;
    gap: 0.25rem;
}

.hermes-dashboard .memory-meter__bar {
    height: 0.375rem;
    border-radius: 999px;
    background: var(--hermes-hover);
    overflow: hidden;
}

.hermes-dashboard .memory-meter__bar > span {
    display: block;
    height: 100%;
    min-width: 0.25rem;
    border-radius: inherit;
    background: var(--hermes-accent);
    transition: width 0.25s ease;
}

.hermes-dashboard .memory-meter--full .memory-meter__bar > span {
    background: rgb(var(--hermes-danger-rgb));
}

.hermes-dashboard .memory-meter__text {
    color: var(--hermes-soft);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.hermes-dashboard .memory-empty {
    margin: 0;
    padding: 0.5rem 0;
    color: var(--hermes-soft);
    font-size: 0.875rem;
}

.hermes-dashboard .memory-entries {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hermes-dashboard .memory-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.5rem 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    background: var(--hermes-bg-2);
}

.hermes-dashboard .memory-entry__text {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Редактирование, подтверждение удаления и поле добавления занимают всю ширину записи. */
.hermes-dashboard .memory-entry > .memory-textarea,
.hermes-dashboard .memory-entry > .memory-edit-footer {
    grid-column: 1 / -1;
}

.hermes-dashboard .memory-actions {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.hermes-dashboard .memory-actions--row {
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

.hermes-dashboard .memory-entry:hover .memory-actions--row,
.hermes-dashboard .memory-entry:focus-within .memory-actions--row {
    opacity: 1;
}

.hermes-dashboard .memory-delete:hover:not(:disabled) {
    color: var(--hermes-danger-ink);
}

.hermes-dashboard .memory-textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--hermes-line-strong);
    border-radius: 0.5rem;
    background: var(--hermes-panel);
    color: inherit;
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.55;
    resize: vertical;
}

.hermes-dashboard .memory-textarea:focus-visible {
    outline: 2px solid var(--hermes-accent);
    outline-offset: 1px;
}

.hermes-dashboard .memory-edit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.hermes-dashboard .memory-counter {
    color: var(--hermes-soft);
    font-variant-numeric: tabular-nums;
}

.hermes-dashboard .memory-counter--over {
    color: var(--hermes-danger-ink);
}

.hermes-dashboard .memory-add {
    display: grid;
    gap: 0.5rem;
}

.hermes-dashboard .memory-add-button {
    justify-self: start;
}

@media (max-width: 760px) {
    .hermes-dashboard .memory-section {
        padding: 0.875rem;
    }

    .hermes-dashboard .memory-actions--row {
        opacity: 1;
    }

    .hermes-dashboard .memory-edit-footer {
        align-items: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hermes-dashboard .memory-meter__bar > span,
    .hermes-dashboard .memory-actions--row {
        transition: none;
    }
}
