/*
 * Документ острова: восемь панелей с полями (1.txt §186).
 *
 * Страница длинная и её заполняют долго, поэтому панель с долей заполненного
 * держится липкой сверху — как в чеклисте публикации. Поля крупные:
 * это редактор документа, а не анкета.
 */

.gd--doc {
    padding-bottom: var(--section-gap);
}

/* Полоса состояния */

.doc-bar {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr minmax(300px, auto);
    align-items: center;
    gap: 20px;
    padding: 18px var(--card-pad);
    position: sticky;
    top: calc(var(--header-h) + 8px);
    z-index: 3;
}

.doc-bar__value {
    display: flex;
    flex-direction: column;
}

.doc-bar__percent {
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
}

.doc-bar.is-full .doc-bar__percent {
    color: var(--success);
}

.doc-bar__count {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
}

.doc-bar__track {
    height: 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
    overflow: hidden;
}

.doc-bar__fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--primary);
    transition: width var(--transition);
}

.doc-bar.is-full .doc-bar__fill {
    background: var(--success);
}

.doc-bar__side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.doc-bar__state {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    text-align: right;
}

.doc-bar__state.is-dirty {
    color: var(--warning);
    font-weight: 700;
}

.doc-bar__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.doc-storage {
    margin: 14px 2px 0;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: var(--lh-body);
}

/* Перенос каркаса */

.doc-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px var(--card-pad);
    margin-bottom: 18px;
    border-color: rgba(104, 80, 245, .28);
    background: rgba(104, 80, 245, .06);
}

.doc-note__icon {
    flex: none;
    color: var(--purple);
}

.doc-note p {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    line-height: var(--lh-body);
}

.doc-note a {
    color: var(--purple);
    font-weight: 700;
    white-space: nowrap;
}

/* Панель части документа */

.doc-block {
    margin-top: var(--gap);
    padding: var(--card-pad);
    scroll-margin-top: calc(var(--header-h) + 96px);
}

.doc-block__head {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: start;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.doc-block__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-soft);
    color: var(--primary);
}

.doc-block__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-h3);
    font-weight: 800;
    letter-spacing: -.01em;
}

.doc-block__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    background: var(--bg-active);
    color: var(--brand-900);
    font-size: var(--fs-xs);
    font-weight: 800;
}

.doc-block__summary {
    margin-top: 6px;
    max-width: 74ch;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    line-height: var(--lh-body);
}

.doc-block__count {
    align-self: center;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    white-space: nowrap;
}

.doc-block__count.is-full {
    background: rgba(47, 177, 112, .12);
    color: var(--success);
}

/* Поля */

.doc-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap-sm);
    margin-top: 18px;
}

.doc-field {
    display: flex;
    flex-direction: column;
}

.doc-field--line {
    grid-column: 1 / -1;
    max-width: 520px;
}

.doc-field__label {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.doc-field__hint {
    margin: 4px 0 10px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    line-height: var(--lh-body);
}

.doc-field__input,
.doc-field__area {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-sm);
    line-height: var(--lh-body);
    transition: border-color var(--transition), background var(--transition);
}

.doc-field__area {
    flex: 1;
    min-height: 96px;
    resize: vertical;
}

.doc-field__input::placeholder,
.doc-field__area::placeholder {
    color: var(--text-muted);
}

.doc-field__input:hover,
.doc-field__area:hover {
    border-color: var(--cyan-300);
}

.doc-field__input:focus,
.doc-field__area:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(59, 101, 248, .12);
}

@media (max-width: 1024px) {
    .doc-bar {
        grid-template-columns: 1fr;
        gap: 14px;
        position: static;
    }

    .doc-bar__side {
        align-items: flex-start;
    }

    .doc-bar__state,
    .doc-bar__actions {
        text-align: left;
        justify-content: flex-start;
    }

    .doc-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .doc-block__head {
        grid-template-columns: 36px 1fr;
    }

    .doc-block__icon {
        width: 36px;
        height: 36px;
    }

    .doc-block__count {
        grid-column: 2;
        justify-self: start;
    }

    .doc-field--line {
        max-width: none;
    }
}
