/*
 * Проекты веб-чата Гермеса: блок «Проекты» в боковой панели, подменю «Переместить в проект»
 * и окно создания/правки проекта. Подключается после hermes-shell.css, цвета только из токенов.
 */

.hermes-dashboard .projects-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin: 0;
}

.hermes-dashboard .projects-nav__header {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.25rem 0 0;
}

.hermes-dashboard .projects-nav__toggle {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.125rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--hermes-soft);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.hermes-dashboard .projects-nav__toggle:hover {
    color: var(--hermes-text);
}

.hermes-dashboard .projects-nav__toggle h2 {
    margin: 0;
    color: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.hermes-dashboard .projects-nav__chevron {
    flex: 0 0 auto;
    width: 0.8rem;
    height: 0.8rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 140ms ease;
}

.hermes-dashboard .projects-nav__chevron--open {
    transform: rotate(90deg);
}

.hermes-dashboard .projects-nav__total {
    margin-left: auto;
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}

.hermes-dashboard .projects-nav__add,
.hermes-dashboard .projects-row__action,
.hermes-dashboard .projects-header__clear {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    color: var(--hermes-dim);
    background: transparent;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.hermes-dashboard .projects-nav__add:hover:not(:disabled),
.hermes-dashboard .projects-row__action:hover:not(:disabled),
.hermes-dashboard .projects-header__clear:hover {
    color: var(--hermes-text);
    background: var(--hermes-hover);
}

.hermes-dashboard .projects-nav__add:disabled,
.hermes-dashboard .projects-row__action:disabled {
    opacity: 0.45;
    cursor: default;
}

.hermes-dashboard .projects-nav__add svg,
.hermes-dashboard .projects-row__action svg,
.hermes-dashboard .projects-header__clear svg,
.hermes-dashboard .projects-header__new svg,
.hermes-dashboard .session-project-menu__summary svg,
.hermes-dashboard .project-files__remove svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hermes-dashboard .projects-nav__empty {
    margin: 0;
    padding: 0.25rem 0.625rem;
    color: var(--hermes-soft);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.hermes-dashboard .projects-nav__list {
    display: grid;
    gap: 0.0625rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hermes-dashboard .projects-row {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 0.5rem;
}

.hermes-dashboard .projects-row:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .projects-row--active,
.hermes-dashboard .projects-row--active:hover {
    background: var(--hermes-active);
}

.hermes-dashboard .projects-row__link {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    min-height: 2.125rem;
    padding: 0.25rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--hermes-muted);
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .projects-row--active .projects-row__link {
    color: var(--hermes-text);
}

.hermes-dashboard .projects-row__link:focus-visible,
.hermes-dashboard .projects-nav__toggle:focus-visible,
.hermes-dashboard .projects-nav__add:focus-visible,
.hermes-dashboard .projects-row__action:focus-visible,
.hermes-dashboard .projects-header__new:focus-visible,
.hermes-dashboard .projects-header__clear:focus-visible {
    outline: 2px solid var(--hermes-accent);
    outline-offset: -2px;
}

.hermes-dashboard .projects-row__icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 0.375rem;
    background: rgb(var(--hermes-accent-rgb) / 0.16);
    box-shadow: inset 0 -2px 0 var(--project-accent, transparent);
    font-size: 0.8125rem;
    line-height: 1;
}

.hermes-dashboard .projects-row__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .projects-row__count {
    flex: 0 0 auto;
    color: var(--hermes-soft);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.hermes-dashboard .projects-row__actions {
    display: none;
    flex: 0 0 auto;
    padding-right: 0.125rem;
}

.hermes-dashboard .projects-row:hover .projects-row__actions,
.hermes-dashboard .projects-row:focus-within .projects-row__actions {
    display: inline-flex;
}

.hermes-dashboard .projects-row:hover .projects-row__count,
.hermes-dashboard .projects-row:focus-within .projects-row__count {
    display: none;
}

.hermes-dashboard .projects-row__confirm {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
}

.hermes-dashboard .projects-row__confirm span {
    flex: 1 1 100%;
}

.hermes-dashboard .projects-row__danger,
.hermes-dashboard .projects-row__cancel {
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.5rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.hermes-dashboard .projects-row__danger {
    border-color: transparent;
    color: var(--hermes-danger);
}

.hermes-dashboard .projects-row__danger:hover:not(:disabled),
.hermes-dashboard .projects-row__cancel:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .projects-header {
    display: grid;
    gap: 0.375rem;
    margin: 0.5rem 0.25rem 0;
    padding: 0.5rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.625rem;
    background: rgb(var(--hermes-accent-rgb) / 0.08);
}

.hermes-dashboard .projects-header__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.hermes-dashboard .projects-header__title strong {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 0.875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .projects-header__new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--hermes-line-strong);
    border-radius: 0.5rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease;
}

.hermes-dashboard .projects-header__new:hover:not(:disabled) {
    background: var(--hermes-hover);
}

.hermes-dashboard .projects-header__new:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ---------- подменю «Переместить в проект» ---------- */

.hermes-dashboard .session-project-menu {
    margin: 0;
}

.hermes-dashboard .session-project-menu__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    cursor: pointer;
}

.hermes-dashboard .session-project-menu__summary::-webkit-details-marker {
    display: none;
}

.hermes-dashboard .session-project-menu__list {
    display: grid;
    gap: 0.0625rem;
    max-height: 12rem;
    margin-top: 0.125rem;
    padding-left: 0.5rem;
    overflow-y: auto;
}

.hermes-dashboard .session-project-menu__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.hermes-dashboard .session-project-menu__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .session-project-menu__check {
    color: var(--hermes-accent-hi);
}

/* ---------- окно проекта ---------- */

.hermes-dashboard .project-dialog {
    display: flex;
    flex-direction: column;
    width: min(38rem, 100%);
    max-height: 100%;
    overflow: hidden;
    border: 1px solid var(--hermes-line);
    border-radius: 1rem;
    color: var(--hermes-text);
    background: var(--hermes-panel);
    box-shadow: 0 24px 64px rgb(var(--hermes-shadow-rgb) / calc(0.4 * var(--hermes-shadow-a)));
    outline: 0;
}

.hermes-dashboard .project-dialog__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3.5rem;
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    border-bottom: 1px solid var(--hermes-line);
}

.hermes-dashboard .project-dialog__header h1 {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
}

.hermes-dashboard .project-dialog__body {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    overflow-y: auto;
}

.hermes-dashboard .project-field {
    display: grid;
    gap: 0.375rem;
}

.hermes-dashboard .project-field > label,
.hermes-dashboard .project-field__label {
    color: var(--hermes-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.hermes-dashboard .project-field__hint {
    margin: 0;
    color: var(--hermes-soft);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.hermes-dashboard .project-field__name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hermes-dashboard .project-dialog__emoji {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    border: 1px solid var(--hermes-line);
    border-radius: 10px;
    background: rgb(var(--hermes-accent-rgb) / 0.12);
    font-size: 1.25rem;
}

.hermes-dashboard .project-dialog input,
.hermes-dashboard .project-dialog textarea {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.62rem 0.68rem;
    color: var(--hermes-text);
    border: 1px solid rgb(var(--hermes-ink-rgb) / calc(0.11 * var(--hermes-line-a)));
    border-radius: 10px;
    background: rgb(var(--hermes-bg-2-rgb) / 0.72);
    font: inherit;
}

.hermes-dashboard .project-dialog textarea {
    resize: vertical;
    line-height: 1.5;
}

.hermes-dashboard .project-dialog input:focus-visible,
.hermes-dashboard .project-dialog textarea:focus-visible {
    outline: 2px solid var(--hermes-accent);
    outline-offset: 1px;
    border-color: rgb(var(--hermes-accent-rgb) / 0.5);
}

.hermes-dashboard .project-field__counter {
    margin: 0;
    color: var(--hermes-soft);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.hermes-dashboard .project-field__counter--limit {
    color: var(--hermes-danger);
}

.hermes-dashboard .project-emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.hermes-dashboard .project-emoji-picker__option {
    width: 2.125rem;
    height: 2.125rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    font-size: 1.0625rem;
    cursor: pointer;
}

.hermes-dashboard .project-emoji-picker__option:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .project-emoji-picker__option--active {
    border-color: var(--hermes-line-strong);
    background: var(--hermes-active);
}

.hermes-dashboard .project-files {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hermes-dashboard .project-files li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
}

.hermes-dashboard .project-files__path {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .project-files__remove {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    border-radius: 0.375rem;
    color: var(--hermes-dim);
    background: transparent;
    cursor: pointer;
}

.hermes-dashboard .project-files__remove:hover {
    color: var(--hermes-text);
    background: var(--hermes-hover);
}

.hermes-dashboard .project-files__add {
    justify-self: start;
}

.hermes-dashboard .project-picker {
    display: grid;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.625rem;
}

.hermes-dashboard .project-picker__up {
    justify-self: start;
    max-width: 100%;
    padding: 0.125rem 0.375rem;
    overflow: hidden;
    border: 0;
    border-radius: 0.375rem;
    color: var(--hermes-dim);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.hermes-dashboard .project-picker__up:hover {
    color: var(--hermes-text);
    background: var(--hermes-hover);
}

.hermes-dashboard .project-picker__empty {
    margin: 0;
    padding: 0.25rem 0.5rem;
    color: var(--hermes-soft);
    font-size: 0.8125rem;
}

.hermes-dashboard .project-picker__list {
    display: grid;
    gap: 0.0625rem;
    max-height: 13rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.hermes-dashboard .project-picker__entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2rem;
    padding: 0.25rem 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .project-picker__entry:hover:not(:disabled) {
    background: var(--hermes-hover);
}

.hermes-dashboard .project-picker__entry:disabled {
    color: var(--hermes-soft);
    cursor: default;
}

.hermes-dashboard .project-picker__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .project-picker__state {
    flex: 0 0 auto;
    color: var(--hermes-success-ink, var(--hermes-soft));
    font-size: 0.75rem;
}

.hermes-dashboard .project-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

@media (max-width: 760px) {
    .hermes-dashboard .project-dialog {
        width: 100%;
        height: 100%;
        border-radius: 0.75rem;
    }

    .hermes-dashboard .project-dialog__body {
        padding: 1rem;
    }

    .hermes-dashboard .project-dialog__footer {
        position: sticky;
        bottom: 0;
        padding-bottom: 0.25rem;
        background: var(--hermes-panel);
    }

    /* На телефоне нет hover: действия проекта видны всегда. */
    .hermes-dashboard .projects-row__actions {
        display: inline-flex;
    }

    .hermes-dashboard .projects-row__count {
        display: none;
    }
}

/* Раскрытый список: от карточки остаётся только кнопка нового чата под подсвеченной строкой. */
.hermes-dashboard .projects-header--compact {
    margin-top: 0.25rem;
    padding: 0;
    border-color: transparent;
    background: transparent;
}

/* Инструкция установки приложения — нативный <dialog> в top layer, поверх меню и боковой панели. */
.hermes-dashboard .install-dialog {
    width: min(26rem, calc(100% - 2rem));
    /* окно проекта на телефоне растягивается на весь экран — инструкции это не нужно */
    height: fit-content;
    max-height: calc(100% - 2rem);
    margin: auto;
    padding: 0;
}

.hermes-dashboard .install-dialog:not([open]) {
    display: none;
}

.hermes-dashboard .install-dialog::backdrop {
    background: rgb(0 0 0 / 0.5);
}

.hermes-dashboard .install-dialog__steps {
    display: grid;
    gap: 0.625rem;
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.5;
}

.hermes-dashboard .install-dialog__icon {
    width: 1.125rem;
    height: 1.125rem;
    vertical-align: -0.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
