/* church-settings.css — Credit display / Books we use / Our music library /
   Standing preferences (church-settings.html Sections D/A/B/C). Companion to the
   page's inline <style> block; kept separate because these sections need a wider,
   table-heavy layout the 600px settings-container was never meant to hold. */

.church-admin-container {
    max-width: 1100px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.church-admin-container .settings-card {
    overflow-x: visible;
}

.cs-caption {
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
    margin: -0.25rem 0 1rem;
}

.cs-error {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #dc2626;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.cs-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cs-search {
    padding: 6px 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 240px;
    box-sizing: border-box;
}

.cs-search:focus {
    outline: none;
    border-color: #003366;
    box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.1);
}

.cs-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0;
}

.cs-table thead {
    background: #f6f7f9;
}

.cs-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted, #6b7280);
    border-bottom: 2px solid var(--border, #e5e7eb);
    white-space: nowrap;
}

.cs-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    vertical-align: middle;
}

.cs-table tbody tr:hover {
    background: #f9fafb;
}

.cs-table tr.cs-row-editing {
    background: #fffbeb;
}

.cs-table tr.cs-row-editing:hover {
    background: #fffbeb;
}

.cs-cell-actions {
    text-align: right;
    white-space: nowrap;
}

.cs-muted {
    color: var(--muted, #6b7280);
}

.cs-empty {
    text-align: center;
    padding: 20px;
    color: var(--muted, #6b7280);
}

.cs-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    background: #dcfce7;
    color: #166534;
}

.cs-btn {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border, #e5e7eb);
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
}

.cs-btn:hover {
    background: #f6f7f9;
}

.cs-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cs-btn-sm {
    font-size: 0.75rem;
    padding: 3px 8px;
}

.cs-btn-primary {
    background: #003366;
    color: #fff;
    border-color: #003366;
}

.cs-btn-primary:hover {
    background: #004488;
}

.cs-btn-danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

.cs-btn-danger:hover {
    background: #b91c1c;
}

.cs-inline-input,
.cs-inline-select {
    padding: 4px 6px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 4px;
    font-size: 0.85rem;
    width: 100%;
    box-sizing: border-box;
}

.cs-inline-input.cs-narrow {
    width: 70px;
}

.cs-checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.cs-actions-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.cs-actions-stack .cs-inline-input {
    width: 140px;
}

.cs-actions-stack-buttons {
    display: flex;
    gap: 6px;
}

.cs-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
}

.cs-pager-buttons {
    display: flex;
    gap: 8px;
}

/* --- Credit display (Section D): token legend, church default, per-type rules --- */

.cs-credit-legend {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 16px;
}

.cs-credit-legend-title {
    margin: 0 0 6px;
    font-weight: 600;
}

.cs-credit-legend ul {
    margin: 0 0 8px;
    padding-left: 18px;
    columns: 2;
}

.cs-credit-legend li {
    margin-bottom: 2px;
    break-inside: avoid;
}

.cs-credit-legend p:last-child {
    margin: 0;
    color: var(--muted, #6b7280);
}

.cs-credit-legend code {
    background: #eef2ff;
    border-radius: 3px;
    padding: 0 3px;
    font-size: 0.8rem;
}

.cs-credit-subhead {
    font-size: 0.95rem;
    margin: 16px 0 8px;
    color: #374151;
}

.cs-credit-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.cs-inline-input.cs-credit-format {
    width: 240px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cs-credit-preview {
    font-size: 0.85rem;
    color: #374151;
    margin-top: 6px;
    min-height: 1.2em;
}

.cs-credit-preview-label {
    display: inline-block;
    min-width: 72px;
    color: var(--muted, #6b7280);
}

.cs-credit-preview-sample {
    color: var(--muted, #6b7280);
    font-style: italic;
}

.cs-credit-preview.cs-credit-preview-bad {
    color: #dc2626;
}

/* In flight: the shown credits belong to the previous template, so dim them
   rather than leaving them looking like the answer for what has just been typed. */
.cs-credit-preview.cs-credit-preview-stale {
    opacity: 0.45;
}

.cs-credit-row-msg {
    font-size: 0.8rem;
    color: var(--muted, #6b7280);
}

.cs-credit-row-msg.cs-bad {
    color: #dc2626;
}

@media (max-width: 768px) {
    .cs-table th,
    .cs-table td {
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    .cs-search {
        min-width: 0;
        flex: 1 1 100%;
    }

    .cs-actions-stack .cs-inline-input {
        width: 100px;
    }

    .cs-credit-legend ul {
        columns: 1;
    }

    .cs-inline-input.cs-credit-format {
        width: 100%;
    }
}
