/*
 * Shared presentation for the three simple dictionaries:
 * expense types, lead sources and payment sources.
 * Card geometry comes entirely from components/card-items.css.
 * Modal geometry, header and footer come from components/modal.css.
 */
.crm-dict-page {
    min-width: 0;
    color: var(--crm-text);
    /* Compact only the simple dictionary cards; other CRM cards keep global spacing. */
    --crm-card-item-padding: 12px;
}

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

.crm-dict-head .crm-page-head-title {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}

.crm-dict-head .crm-page-head-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

/* Only the desktop action is visible above 900px. */
.crm-dict-head .crm-page-head-mobile-actions {
    display: none;
}

.crm-dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: var(--crm-card-item-gap);
}

.crm-dict-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    color: var(--crm-text);
    cursor: pointer;
    text-align: left;
}

.crm-dict-card-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.crm-dict-card-title {
    min-width: 0;
    font-size: 16px;
    line-height: 1.25;
    font-weight: var(--crm-font-weight-medium);
    overflow-wrap: anywhere;
}

.crm-dict-card-address {
    color: var(--crm-muted);
    font-size: 13px;
    font-weight: var(--crm-font-weight-regular);
    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;
    font-size: 12px;
    line-height: 1;
    font-weight: var(--crm-font-weight-regular);
    white-space: nowrap;
}

.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-card-item-radius);
    background: transparent;
    color: var(--crm-muted);
    font-size: 14px;
    text-align: center;
}

.crm-dict-error {
    color: var(--crm-danger);
}

/* Only the form controls are dictionary-specific. */
.crm-modal-shell > form.crm-dict-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
}

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

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

.crm-dict-field input,
.crm-dict-field textarea,
.crm-dict-field select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: var(--crm-modal-field-height);
    padding: var(--crm-modal-field-padding-y) var(--crm-modal-field-padding-x);
    border: 1px solid var(--crm-modal-field-border);
    border-radius: var(--crm-modal-field-radius);
    background: var(--crm-modal-field-bg);
    color: var(--crm-modal-field-text);
    font: inherit;
    font-size: var(--crm-modal-field-font-size);
    font-weight: var(--crm-font-weight-regular);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

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

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

@media (max-width: 900px) {
    .crm-dict-page {
        --crm-card-item-padding: 10px;
    }

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

    .crm-dict-head .crm-page-head-mobile-actions {
        display: flex;
        grid-column: 2;
        grid-row: 1;
        align-items: center;
        justify-self: end;
    }

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