.crm-dict-page {
    color: var(--crm-text);
}

.crm-dict-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
}

.crm-dict-content {
    padding: 18px;
}

.crm-dict-intro {
    margin: 0 0 14px;
    color: var(--crm-muted);
    font-size: 14px;
    line-height: 1.35;
}

.crm-dict-meta {
    margin-bottom: 12px;
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 500;
}

.crm-dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.crm-dict-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    min-height: 112px;
    padding: 16px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius-lg);
    background: var(--crm-surface);
    color: var(--crm-text);
    box-shadow: var(--crm-shadow-soft);
    cursor: pointer;
    text-align: left;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.crm-dict-card:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, .28);
    box-shadow: var(--crm-shadow);
}

.crm-dict-card.is-inactive {
    background: rgba(255, 255, 255, .72);
}

.crm-dict-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.crm-dict-card-title {
    min-width: 0;
    font-size: 17px;
    line-height: 1.18;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.crm-dict-card-address {
    color: var(--crm-muted);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.crm-dict-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 9px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1;
    font-weight: 500;
}

.crm-dict-status.is-active {
    color: var(--crm-success);
    background: rgba(22, 163, 74, .12);
}

.crm-dict-status.is-inactive {
    color: var(--crm-danger);
    background: rgba(220, 38, 38, .10);
}

.crm-dict-empty,
.crm-dict-error {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px dashed var(--crm-border);
    border-radius: var(--crm-radius-lg);
    color: var(--crm-muted);
    background: var(--crm-surface-soft);
    text-align: center;
}

.crm-dict-error {
    color: var(--crm-danger);
    background: rgba(220, 38, 38, .06);
}

.crm-dict-modal-root.is-open {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: 28px 18px;
    background: rgba(3, 8, 20, .72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.crm-dict-modal {
    width: min(620px, 100%);
    max-height: min(620px, calc(100dvh - 56px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
}

.crm-dict-modal .crm-modal-head-title h2 {
    margin: 0;
}

.crm-dict-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 20px;
    background: var(--crm-surface);
}

.crm-dict-form {
    display: grid;
    gap: 14px;
}

.crm-dict-field {
    display: grid;
    gap: 7px;
}

.crm-dict-field > span {
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: 500;
}

.crm-dict-field input,
.crm-dict-field textarea,
.crm-dict-field select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-btn-radius);
    background: #fff;
    color: var(--crm-text);
    padding: 10px 12px;
    font: inherit;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.crm-dict-field textarea {
    min-height: 84px;
    resize: vertical;
}

.crm-dict-field input:focus,
.crm-dict-field textarea:focus,
.crm-dict-field select:focus {
    border-color: rgba(37, 99, 235, .58);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.crm-dict-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--crm-border);
    background: var(--crm-surface);
}

.crm-dict-modal .crm-icon-btn .crm-icon,
.crm-dict-modal .crm-btn .crm-icon {
    width: 18px;
    height: 18px;
}

@media (max-width: 900px) {
    .crm-dict-head {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .crm-dict-head .crm-page-head-actions {
        display: none;
    }

    .crm-dict-head .crm-page-head-mobile-actions {
        display: flex;
    }

    .crm-dict-content {
        padding: 14px;
    }

    .crm-dict-grid {
        grid-template-columns: 1fr;
    }

    .crm-dict-modal-root.is-open {
        align-items: stretch;
        justify-items: stretch;
        padding: 0;
    }

    .crm-dict-modal {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .crm-dict-modal-footer {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .crm-dict-modal-footer .crm-btn {
        flex: 1 1 0;
    }
}
