
.tpl-card { transition: transform .15s ease, box-shadow .15s ease; border: 1px solid #e9ecef;
            border-radius: 12px; overflow: hidden; height: 100%; display: flex;
            flex-direction: column; background: #fff; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.tpl-card-img { height: 180px; background: #f8f9fa center/cover no-repeat;
                display: flex; align-items: center; justify-content: center;
                color: #adb5bd; font-size: 48px; }
.tpl-card-body { padding: 16px; flex: 1 1 auto; display: flex; flex-direction: column; }
.tpl-card-title { font-weight: 600; font-size: 1rem; margin-bottom: 4px; color: #212529; }
.tpl-card-cat { font-size: 12px; color: #6c757d; margin-bottom: 12px; }
.tpl-card-btn { margin-top: auto; border-radius: 8px; font-weight: 600; }
.tplg-chip { border-radius: 999px; padding: 6px 14px; font-size: 13px;
             background: #f1f3f5; color: #495057; border: 1px solid transparent;
             cursor: pointer; user-select: none; }
.tplg-chip:hover { background: #e9ecef; }
.tplg-chip.active { background: var(--bs-primary, #0d6efd); color: #fff; }


/* ---------- Delivery Config: Flow Preview ---------- */
.dc-flow {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dc-rule-card,
.dc-default-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color .15s ease;
}

.dc-rule-card.dc-rule-matched {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.08);
}

.dc-default-card.dc-default-active {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

/* Header */
.dc-rule-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #eef0f2;
}

.dc-rule-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

/* IF / ELSE IF / ELSE badges */
.dc-badge-if,
.dc-badge-else {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 999px;
    color: #fff;
    background: #6f42c1;
}

.dc-badge-else {
    background: #6b7280;
}

/* Matched pill */
.dc-badge-matched {
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
}

/* Body */
.dc-rule-body {
    padding: 12px 14px;
}

/* Section labels WHEN / THEN */
.dc-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    color: #9ca3af;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* Conditions list */
.dc-conditions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dc-condition-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 4px 0;
}

.dc-bullet {
    color: #9ca3af;
    font-weight: 700;
    line-height: 1;
}

.dc-field {
    background: #eef2ff;
    color: #3730a3;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dc-operator {
    color: #4b5563;
    font-weight: 500;
    font-size: 12px;
}

.dc-value {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dc-badge-case {
    background: #e5e7eb;
    color: #374151;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}

/* AND / OR connector between conditions */
.dc-connector-row {
    display: flex;
    justify-content: flex-start;
    padding-left: 16px;
    margin: 2px 0;
}

.dc-badge-connector {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    padding: 2px 8px;
    border-radius: 999px;
}

.dc-badge-info {
    background: #cffafe;
    color: #155e75;
}

.dc-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* THEN row */
.dc-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 13px;
    color: #14532d;
}

.dc-action-icon {
    font-size: 16px;
    line-height: 1;
}

.dc-action-text {
    flex-grow: 1;
}

.dc-action-target {
    color: #6b7280;
    font-size: 12px;
}

/* Preview Table Styling */
#wc-preview-table {
    font-size: 14px;
    margin-bottom: 0;
}

#wc-preview-table thead th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 8px 12px;
    white-space: nowrap;
}

#wc-preview-table tbody tr:hover {
    background-color: #f8f9fa;
}

#wc-preview-table tbody td {
    padding: 8px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

.preview-value {
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Segoe UI', sans-serif;
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#wc-preview-section .alert {
    border-radius: 8px;
}

#wc-preview-section .badge {
    font-weight: 500;
    padding: 4px 10px;
}
.p2t-toast-stack {
    position: fixed;
    top: 65px;
    right: 16px;
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.p2t-toast {
    background: var(--bg-topbar);
    border: 1px solid var(--theme-light) !important;
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: p2t-slidein .25s ease;
    pointer-events: auto;
    min-width: 220px;
    max-width: 340px;
}

@keyframes p2t-slidein {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes p2t-slideout {
    to { transform: translateX(110%); opacity: 0; }
}

.lang-item { padding: 8px 12px; transition: background 0.15s; }
.lang-item:hover { background: #f0f0f0 !important; }

.rule-card {
    border-left: 3px solid var(--theme-color, #0d6efd);
    transition: all 0.2s ease;
}

.rule-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.rule-card.inactive {
    opacity: 0.7;
    border-left-color: #6c757d;
}

#wc-preview-table {
    font-size: 14px;
}

#wc-preview-table .table-light th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.preview-value {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.status-badge {
    font-size: 11px;
    padding: 3px 10px;
}

.sample-doc-highlight {
    background: #fff3cd;
    padding: 0 4px;
    border-radius: 2px;
}