/* ── Config Manager Styles ──────────────────────────── */

.config-manager {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #1a1a2e;
}

/* Header */
.cm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

    .cm-header h1 {
        font-size: 1.5rem;
        font-weight: 600;
        color: #1a1a2e;
        margin: 0;
    }

/* Buttons */
.btn {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

    .btn-primary:hover {
        background: #1d4ed8;
    }

.btn-outline {
    background: transparent;
    color: #374151;
    border-color: #d1d5db;
}

    .btn-outline:hover {
        background: #f9fafb;
    }

.btn-ghost {
    background: transparent;
    color: #6b7280;
    border: none;
}

    .btn-ghost:hover {
        color: #374151;
    }

.cm-actions {
    display: flex;
    gap: 0.5rem;
}

/* Filter Bar */
.cm-filter-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.input-search {
    flex: 1;
    min-width: 220px;
    padding: 0.45rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}

.input-select {
    padding: 0.45rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #fff;
}

/* Table */
.cm-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.cm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

    .cm-table thead th {
        padding: 0.75rem 1rem;
        text-align: left;
        background: #f8fafc;
        color: #6b7280;
        font-weight: 600;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        border-bottom: 1px solid #e5e7eb;
    }

    .cm-table tbody tr {
        border-bottom: 1px solid #f3f4f6;
        transition: background 0.15s;
    }

        .cm-table tbody tr:last-child {
            border-bottom: none;
        }

        .cm-table tbody tr:hover {
            background: #f8fafc;
        }

    .cm-table td {
        padding: 0.7rem 1rem;
        vertical-align: middle;
    }

.param-row.readonly {
    background: #fafafa;
}

/* Cells */
.cell-key {
    min-width: 220px;
}

.key-label {
    font-weight: 500;
    color: #1e293b;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    display: block;
}

.key-desc {
    color: #94a3b8;
    font-size: 0.78rem;
    display: block;
    margin-top: 2px;
}

.cell-date {
    color: #9ca3af;
    font-size: 0.8rem;
    white-space: nowrap;
}

.value-static {
    color: #374151;
}

/* Inline Edit */
.value-edit-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.input-value {
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
    width: 100%;
    max-width: 280px;
    transition: border-color 0.15s;
}

    .input-value:focus {
        outline: none;
        border-color: #3b82f6;
    }

.input-bool {
    max-width: 100px;
    cursor: pointer;
    background: #fff;
}

.btn-save, .btn-cancel {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-save {
    background: #dcfce7;
    color: #16a34a;
    border-color: #bbf7d0;
}

    .btn-save:hover {
        background: #bbf7d0;
    }

.btn-cancel {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

    .btn-cancel:hover {
        background: #fecaca;
    }

.hidden {
    display: none !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-cat {
    background: #eff6ff;
    color: #2563eb;
}

.badge-type {
    background: #f0fdf4;
    color: #16a34a;
}

.badge-ro {
    background: #f9fafb;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    font-size: 0.72rem;
}

.badge-action-add {
    background: #dcfce7;
    color: #15803d;
}

.badge-action-update {
    background: #fef9c3;
    color: #854d0e;
}

.badge-action-delete {
    background: #fee2e2;
    color: #b91c1c;
}

/* Action Buttons */
.btn-icon {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #9ca3af;
}

    .btn-icon:hover {
        background: #f1f5f9;
        color: #374151;
    }

.cell-actions {
    white-space: nowrap;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #1e293b;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    animation: slideUp 0.25s ease;
}

    .toast.success {
        background: #15803d;
    }

    .toast.error {
        background: #dc2626;
    }

@keyframes slideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 1.75rem;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

    .modal-box h2 {
        margin: 0 0 1.25rem;
        font-size: 1.1rem;
        font-weight: 600;
    }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

    .form-group.full-width {
        grid-column: 1 / -1;
    }

    .form-group label {
        font-size: 0.8rem;
        font-weight: 500;
        color: #374151;
    }

    .form-group input[type="text"],
    .form-group select {
        padding: 0.45rem 0.7rem;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font-size: 0.875rem;
        width: 100%;
    }

        .form-group input[type="text"]:focus,
        .form-group select:focus {
            outline: none;
            border-color: #3b82f6;
        }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

/* History */
.history-table {
    width: 100%;
}

.history-content {
    max-height: 380px;
    overflow-y: auto;
}

.no-history {
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
}

.cell-old {
    color: #dc2626;
}

.cell-new {
    color: #16a34a;
}
