/* Alerting Management Interface - Enhanced Visual Design */

/* ===== Reset & Base ===== */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

/* ===== Layout ===== */
.alerting-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 28px;
}

.alerting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.alerting-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
}

.alerting-header h1 .header-accent {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Tabs ===== */
.tab-bar {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 28px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 8px;
    transition: all 0.25s ease;
    position: relative;
}

.tab-btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.06);
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    font-weight: 600;
}

.tab-btn .tab-icon {
    margin-right: 6px;
    font-size: 1rem;
    vertical-align: -1px;
}

.tab-panel {
    display: none;
    animation: fadeInPanel 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Stat Cards ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(1)::before { background: #3b82f6; }
.stat-card:nth-child(2)::before { background: #8b5cf6; }
.stat-card:nth-child(3)::before { background: #06b6d4; }
.stat-card:nth-child(4)::before { background: #22c55e; }

.stat-card:nth-child(1):hover { box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12); }
.stat-card:nth-child(2):hover { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12); }
.stat-card:nth-child(3):hover { box-shadow: 0 8px 24px rgba(6, 182, 212, 0.12); }
.stat-card:nth-child(4):hover { box-shadow: 0 8px 24px rgba(34, 197, 94, 0.12); }

.stat-card .stat-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
    display: block;
    transition: transform 0.3s;
}

.stat-card:hover .stat-icon {
    transform: scale(1.15);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card .stat-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* ===== Usage Bar ===== */
.usage-bar-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.usage-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
}

.usage-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.usage-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.usage-bar-fill.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.usage-bar-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ===== Pushover rate-limit tile ===== */
.rate-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 4px 0;
}

.rate-bar > div {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rate-bar > div.warn {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.rate-bar > div.exhausted {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

[data-theme="dark"] #rateLimitCard { background: #1e293b; border-color: #334155; }
[data-theme="dark"] #rateLimitCard .usage-bar-label { color: #94a3b8; }
[data-theme="dark"] #rateLimitCard #rateRemaining { color: #f1f5f9; }
[data-theme="dark"] #rateLimitCard #rateStatus { color: #64748b; }
[data-theme="dark"] .rate-bar { background: #334155; }

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #6366f1;
    font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.25);
}
.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}

.btn-outline {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #475569;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-outline:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-icon {
    padding: 7px;
    min-width: 34px;
    justify-content: center;
}

/* ===== Focus Styles (keyboard accessibility) ===== */
.btn:focus-visible,
.tab-btn:focus-visible,
.channel-tab:focus-visible,
.send-ch-btn:focus-visible,
.pri-btn:focus-visible,
.modal-close:focus-visible,
.sp-test:focus-visible,
.dispatch-expand:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #f1f5f9; color: #475569; }

/* ===== Toggle Switch ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: all 0.25s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #1e293b;
    background: #fff;
    box-sizing: border-box;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-control::placeholder {
    color: #94a3b8;
}

select.form-control {
    appearance: auto;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

.form-hint-details { margin-top: 6px; font-size: 0.85rem; }
.form-hint-details summary { cursor: pointer; color: #2563eb; }
.form-hint-details code { background: #f1f5f9; padding: 2px 5px; border-radius: 3px; margin: 0 2px; }
[data-theme="dark"] .form-hint-details code { background: #1e293b; }

/* ===== Pushover user-key validator ===== */
.validate-result {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.validate-result.valid { background: #dcfce7; color: #14532d; }
.validate-result.invalid { background: #fee2e2; color: #7f1d1d; }
[data-theme="dark"] .validate-result.valid { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .validate-result.invalid { background: #7f1d1d; color: #fecaca; }

/* ===== Modal Overlay ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.modal-overlay.active {
    display: flex;
    animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: modalSlideIn 0.25s ease;
}

.modal.modal-wide {
    max-width: 900px;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

/* ===== Confirm Overlay ===== */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1300;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.confirm-overlay.active {
    display: flex;
    animation: overlayFadeIn 0.2s ease;
}

.confirm-box {
    background: #fff;
    border-radius: 16px;
    padding: 36px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.25s ease;
}

.confirm-box .confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
}

.confirm-box h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.confirm-box p {
    color: #64748b;
    margin: 0 0 28px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 22px;
    border-radius: 12px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: toastIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast::before {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.toast-success::before { content: '\2713'; }
.toast-error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-error::before { content: '\2717'; }
.toast-info { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.toast-info::before { content: '\2139'; }
.toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.toast-warning::before { content: '\26A0'; }

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(0.9); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(40px) scale(0.9); }
}

/* ===== Sounds Grid ===== */
.sounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.sound-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.sound-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.sound-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.sound-used {
    font-size: 0.7rem;
    color: #8b5cf6;
    font-weight: 500;
    margin-top: 2px;
}

/* ===== Notification Preview ===== */
.notif-preview {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-radius: 16px;
    padding: 20px 24px;
    color: #f1f5f9;
    margin-bottom: 24px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.notif-preview::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.notif-preview .preview-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 1rem;
}

.notif-preview .preview-message {
    color: #cbd5e1;
    line-height: 1.5;
}

.notif-preview .preview-meta {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== Glance Form ===== */
.glance-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.glance-preview .preview-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ===== Search / Filter ===== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: #94a3b8;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Loading ===== */
.loading-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 14px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== Hour Chart ===== */
.chart-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.hour-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100px;
    padding: 0 4px;
}

.hour-bar {
    flex: 1;
    background: linear-gradient(180deg, #3b82f6, #60a5fa);
    border-radius: 4px 4px 0 0;
    min-height: 3px;
    transition: height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.hour-bar:hover {
    background: linear-gradient(180deg, #2563eb, #3b82f6);
    box-shadow: 0 -2px 8px rgba(59, 130, 246, 0.3);
}

.hour-labels {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding: 0 4px;
}

.hour-labels span {
    flex: 1;
    text-align: center;
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 500;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination .page-info {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

/* ===== Section Headings ===== */
.section-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 28px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-heading .heading-icon {
    font-size: 1.1rem;
}

/* ===== Receipt Status ===== */
.receipt-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Card Panel (used for form sections) ===== */
.card-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card-panel .panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Modal Form Sections ===== */
.modal-section {
    margin-bottom: 20px;
}

.modal-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 8px;
    margin-bottom: 14px;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
}

.modal-section-header:hover {
    border-bottom-color: #3b82f6;
}

.modal-section-header .section-icon {
    font-size: 1rem;
}

.modal-section-header .section-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
    flex: 1;
}

.modal-section-header .section-toggle {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.2s;
}

.modal-section-header .section-toggle.collapsed {
    transform: rotate(-90deg);
}

.modal-section-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.modal-section-body.collapsed {
    max-height: 0 !important;
    overflow: hidden;
}

/* ===== Rule Preview Card ===== */
.rule-preview {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-radius: 12px;
    padding: 16px 20px;
    color: #f1f5f9;
    margin-bottom: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.rule-preview::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.rule-preview .rp-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.rule-preview .rp-meta {
    font-size: 0.72rem;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.rule-preview .rp-meta .rp-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rp-badge.pri-lowest { background: rgba(100, 116, 139, 0.3); color: #94a3b8; }
.rp-badge.pri-low { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
.rp-badge.pri-normal { background: rgba(34, 197, 94, 0.25); color: #86efac; }
.rp-badge.pri-high { background: rgba(245, 158, 11, 0.3); color: #fcd34d; }
.rp-badge.pri-emergency { background: rgba(239, 68, 68, 0.3); color: #fca5a5; }

/* ===== Sound Picker (in modal) ===== */
.sound-picker {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.sound-picker-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    min-height: 40px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.sound-picker-selected .sp-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.sound-picker-selected .sp-placeholder {
    font-size: 0.85rem;
    color: #94a3b8;
}

.sound-picker-selected .sp-clear {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.sound-picker-selected .sp-clear:hover {
    background: #fee2e2;
    color: #ef4444;
}

.sound-picker-search {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.sound-picker-search input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.8rem;
    background: #fff;
    box-sizing: border-box;
}

.sound-picker-search input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.sound-picker-search {
    position: relative;
}

.sound-picker-search .sp-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.8rem;
    pointer-events: none;
}

.sound-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.sp-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    gap: 6px;
}

.sp-card:hover {
    border-color: #93c5fd;
    background: #f0f7ff;
}

.sp-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.sp-card .sp-info {
    min-width: 0;
    flex: 1;
}

.sp-card .sp-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-card .sp-key {
    font-size: 0.65rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-card .sp-test {
    background: none;
    border: 1px solid #d1d5db;
    color: #64748b;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s;
}

.sp-card .sp-test:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.sound-picker-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* ===== Priority Buttons ===== */
.priority-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pri-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 6px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}

.pri-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pri-btn[data-priority="-2"] { border-color: #d1d5db; }
.pri-btn[data-priority="-2"].active { background: #94a3b8; border-color: #94a3b8; color: #fff; }
.pri-btn[data-priority="-2"]:hover { border-color: #94a3b8; }

.pri-btn[data-priority="-1"] { border-color: #bfdbfe; }
.pri-btn[data-priority="-1"].active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.pri-btn[data-priority="-1"]:hover { border-color: #3b82f6; }

.pri-btn[data-priority="0"] { border-color: #bbf7d0; }
.pri-btn[data-priority="0"].active { background: #22c55e; border-color: #22c55e; color: #fff; }
.pri-btn[data-priority="0"]:hover { border-color: #22c55e; }

.pri-btn[data-priority="1"] { border-color: #fed7aa; }
.pri-btn[data-priority="1"].active { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.pri-btn[data-priority="1"]:hover { border-color: #f59e0b; }

.pri-btn[data-priority="2"] { border-color: #fecaca; }
.pri-btn[data-priority="2"].active { background: #ef4444; border-color: #ef4444; color: #fff; }
.pri-btn[data-priority="2"]:hover { border-color: #ef4444; }

/* ===== Duplicate Button ===== */
.btn-duplicate {
    background: #f8fafc;
    border: 1px solid #d1d5db;
    color: #64748b;
}
.btn-duplicate:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #3b82f6;
}

/* ===== Dark Theme Overrides ===== */
[data-theme="dark"] .alerting-wrapper { color: #e2e8f0; }
[data-theme="dark"] .alerting-header h1 { color: #f1f5f9; }

[data-theme="dark"] .tab-bar { background: #1e293b; }
[data-theme="dark"] .tab-btn { color: #94a3b8; }
[data-theme="dark"] .tab-btn:hover { color: #60a5fa; background: rgba(96, 165, 250, 0.08); }
[data-theme="dark"] .tab-btn.active { color: #fff; background: linear-gradient(135deg, #3b82f6, #2563eb); }

[data-theme="dark"] .stat-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .stat-card:hover { border-color: rgba(96, 165, 250, 0.3); }
[data-theme="dark"] .stat-card .stat-value { color: #f1f5f9; }
[data-theme="dark"] .stat-card .stat-label { color: #64748b; }
[data-theme="dark"] .stat-card .stat-sub { color: #64748b; }

[data-theme="dark"] .usage-bar-container { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .usage-bar { background: #334155; }
[data-theme="dark"] .usage-bar-label { color: #94a3b8; }

[data-theme="dark"] .table-wrapper { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .data-table th { background: rgba(0, 0, 0, 0.2); color: #64748b; border-bottom-color: #334155; }
[data-theme="dark"] .data-table td { color: #cbd5e1; border-bottom-color: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .data-table code { background: #334155; color: #a78bfa; }

[data-theme="dark"] .btn-outline { background: #1e293b; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .btn-outline:hover:not(:disabled) { background: #334155; border-color: #64748b; }

[data-theme="dark"] .form-control {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
}
[data-theme="dark"] .form-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}
[data-theme="dark"] .form-control::placeholder { color: #475569; }
[data-theme="dark"] .form-group label { color: #94a3b8; }

[data-theme="dark"] .modal { background: #1e293b; box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .modal-header { border-bottom-color: #334155; }
[data-theme="dark"] .modal-header h3 { color: #f1f5f9; }
[data-theme="dark"] .modal-footer { border-top-color: #334155; background: rgba(0, 0, 0, 0.15); }
[data-theme="dark"] .modal-close { background: #334155; color: #94a3b8; }
[data-theme="dark"] .modal-close:hover { background: #475569; color: #f1f5f9; }

[data-theme="dark"] .confirm-box { background: #1e293b; box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .confirm-box h3 { color: #f1f5f9; }
[data-theme="dark"] .confirm-box p { color: #94a3b8; }

[data-theme="dark"] .sound-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .sound-card:hover { border-color: #60a5fa; box-shadow: 0 4px 12px rgba(96, 165, 250, 0.15); }
[data-theme="dark"] .sound-name { color: #f1f5f9; }
[data-theme="dark"] .sound-used { color: #a78bfa; }

[data-theme="dark"] .notif-preview { background: linear-gradient(135deg, #0a0f1a, #0f172a); border-color: rgba(255, 255, 255, 0.06); }

[data-theme="dark"] .glance-preview { background: #0f172a; border-color: #334155; }

[data-theme="dark"] .section-heading { color: #f1f5f9; border-bottom-color: #334155; }

[data-theme="dark"] .chart-container { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .card-panel { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .card-panel .panel-title { color: #f1f5f9; border-bottom-color: #334155; }

[data-theme="dark"] .badge-success { background: rgba(34, 197, 94, 0.15); color: #6ee7b7; }
[data-theme="dark"] .badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
[data-theme="dark"] .badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
[data-theme="dark"] .badge-info { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
[data-theme="dark"] .badge-neutral { background: #334155; color: #cbd5e1; }

[data-theme="dark"] .toggle-slider { background: #475569; }

[data-theme="dark"] .empty-state { color: #475569; }

[data-theme="dark"] .loading-spinner { border-color: #334155; border-top-color: #60a5fa; }
[data-theme="dark"] .loading-overlay { color: #64748b; }

[data-theme="dark"] .hour-bar { background: linear-gradient(180deg, #60a5fa, #3b82f6); }
[data-theme="dark"] .hour-bar:hover { background: linear-gradient(180deg, #93c5fd, #60a5fa); }

[data-theme="dark"] .form-hint { color: #64748b; }

/* Dark: Modal sections */
[data-theme="dark"] .modal-section-header { border-bottom-color: #334155; }
[data-theme="dark"] .modal-section-header:hover { border-bottom-color: #60a5fa; }
[data-theme="dark"] .modal-section-header .section-label { color: #94a3b8; }
[data-theme="dark"] .modal-section-header .section-toggle { color: #64748b; }

/* Dark: Rule preview */
[data-theme="dark"] .rule-preview { background: linear-gradient(135deg, #0a0f1a, #0f172a); border-color: rgba(255, 255, 255, 0.06); }

/* Dark: Sound picker */
[data-theme="dark"] .sound-picker { background: #0f172a; border-color: #475569; }
[data-theme="dark"] .sound-picker-selected { background: #1e293b; border-bottom-color: #334155; }
[data-theme="dark"] .sound-picker-selected .sp-value { color: #f1f5f9; }
[data-theme="dark"] .sound-picker-selected .sp-placeholder { color: #475569; }
[data-theme="dark"] .sound-picker-selected .sp-clear:hover { background: rgba(239, 68, 68, 0.2); }
[data-theme="dark"] .sound-picker-search { border-bottom-color: #334155; }
[data-theme="dark"] .sound-picker-search input { background: #0f172a; border-color: #475569; color: #f1f5f9; }
[data-theme="dark"] .sound-picker-search input:focus { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15); }
[data-theme="dark"] .sp-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .sp-card:hover { border-color: #60a5fa; background: rgba(96, 165, 250, 0.08); }
[data-theme="dark"] .sp-card.selected { border-color: #3b82f6; background: rgba(59, 130, 246, 0.15); }
[data-theme="dark"] .sp-card .sp-name { color: #f1f5f9; }
[data-theme="dark"] .sp-card .sp-key { color: #64748b; }
[data-theme="dark"] .sp-card .sp-test { border-color: #475569; color: #94a3b8; }
[data-theme="dark"] .sp-card .sp-test:hover { background: #3b82f6; border-color: #3b82f6; color: #fff; }
[data-theme="dark"] .sound-picker-empty { color: #475569; }

/* Dark: Priority buttons */
[data-theme="dark"] .pri-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .pri-btn:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
[data-theme="dark"] .pri-btn[data-priority="-2"]:hover { border-color: #64748b; }
[data-theme="dark"] .pri-btn[data-priority="-1"]:hover { border-color: #60a5fa; }
[data-theme="dark"] .pri-btn[data-priority="0"]:hover { border-color: #4ade80; }
[data-theme="dark"] .pri-btn[data-priority="1"]:hover { border-color: #fbbf24; }
[data-theme="dark"] .pri-btn[data-priority="2"]:hover { border-color: #f87171; }

/* Dark: Duplicate button */
[data-theme="dark"] .btn-duplicate { background: #1e293b; border-color: #475569; color: #94a3b8; }
[data-theme="dark"] .btn-duplicate:hover:not(:disabled) { background: rgba(96, 165, 250, 0.1); border-color: #60a5fa; color: #60a5fa; }

/* ===== Channel Sub-Tabs ===== */
.channel-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.channel-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 7px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.channel-tab:hover { color: #3b82f6; background: rgba(59, 130, 246, 0.06); }
.channel-tab.active { color: #fff; background: linear-gradient(135deg, #3b82f6, #2563eb); font-weight: 600; }

.channel-panel { display: none; animation: fadeInPanel 0.2s ease; }
.channel-panel.active { display: block; }

/* ===== Channel Badges ===== */
.badge-pushover { background: #dbeafe; color: #1e40af; }
.badge-email { background: #ede9fe; color: #5b21b6; }
.badge-sms { background: #dcfce7; color: #166534; }
.badge-webhook { background: #ffedd5; color: #9a3412; }
.badge-gchat { background: #ccfbf1; color: #115e59; }
.badge-gchat-direct { background: #d1fae5; color: #065f46; }

/* Channel dots */
.channel-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 2px;
}
.dot-pushover { background: #3b82f6; }
.dot-email { background: #8b5cf6; }
.dot-sms { background: #22c55e; }
.dot-webhook { background: #f97316; }
.dot-gchat { background: #14b8a6; }
.dot-gchat-direct { background: #0d7c66; }

/* ===== Channel Toggle Rows (Rule Modal) ===== */
.channel-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.channel-toggle-label {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-expand-btn {
    font-size: 0.72rem !important;
    padding: 4px 10px !important;
}

.channel-config-body {
    padding: 12px 0 8px 56px;
    border-bottom: 1px solid #f1f5f9;
}

/* ===== Space Picker ===== */
.space-picker {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.space-picker-search {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.space-picker-search input {
    font-size: 0.82rem;
}
.space-picker-list {
    max-height: 240px;
    overflow-y: auto;
}
.space-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
}
.space-item:last-child { border-bottom: none; }
.space-item:hover { background: #f1f5f9; }
.space-item-name {
    flex: 1;
    font-weight: 500;
    color: #334155;
}
.space-item-id {
    font-size: 0.72rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}
.space-picker-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
}
[data-theme="dark"] .space-picker { border-color: #374151; }
[data-theme="dark"] .space-picker-search { background: #1e293b; border-color: #374151; }
[data-theme="dark"] .space-item { border-color: #1e293b; }
[data-theme="dark"] .space-item:hover { background: #1e293b; }
[data-theme="dark"] .space-item-name { color: #e2e8f0; }
[data-theme="dark"] .space-item-id { background: #1e293b; color: #64748b; }

/* ===== Send Channel Selector ===== */
.send-channel-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.send-ch-btn {
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.send-ch-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.send-ch-btn.active { border-color: #3b82f6; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.send-ch-btn.active .channel-dot { background: #fff; }

/* ===== Character Counter (SMS) ===== */
.char-counter {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
    font-weight: 600;
}
.char-counter.warning { color: #f59e0b; }
.char-counter.danger { color: #ef4444; }

/* ===== Key-Value Rows (Webhook Headers) ===== */
.kv-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
}

.kv-row .kv-key { flex: 1; }
.kv-row .kv-value { flex: 2; }

/* ===== Dispatch Group (History) ===== */
.dispatch-group {
    border-left: 3px solid #3b82f6;
    margin-bottom: 2px;
}

.dispatch-expand {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
}
.dispatch-expand:hover { text-decoration: underline; }

/* ===== History Filter Bar ===== */
.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.history-filters .form-control {
    width: auto;
    min-width: 140px;
}

.history-filters .search-input {
    flex: 1;
    min-width: 200px;
}

/* ===== Channel Config Card ===== */
.channel-config-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.channel-config-card .channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.channel-config-card .channel-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== URL Entry Rows ===== */
.url-entry-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
}
.url-entry-row input { flex: 1; }

/* ===== Stats Row 5-col ===== */
.stats-row-5 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card:nth-child(5)::before { background: #14b8a6; }
.stat-card:nth-child(5):hover { box-shadow: 0 8px 24px rgba(20, 184, 166, 0.12); }

/* ===== Dark Theme: New Components ===== */
[data-theme="dark"] .channel-tabs { background: #1e293b; }
[data-theme="dark"] .channel-tab { color: #94a3b8; }
[data-theme="dark"] .channel-tab:hover { color: #60a5fa; background: rgba(96, 165, 250, 0.08); }
[data-theme="dark"] .channel-tab.active { color: #fff; }

[data-theme="dark"] .badge-pushover { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
[data-theme="dark"] .badge-email { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
[data-theme="dark"] .badge-sms { background: rgba(34, 197, 94, 0.15); color: #86efac; }
[data-theme="dark"] .badge-webhook { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
[data-theme="dark"] .badge-gchat { background: rgba(20, 184, 166, 0.15); color: #5eead4; }
[data-theme="dark"] .badge-gchat-direct { background: rgba(13, 124, 102, 0.2); color: #6ee7b7; }

[data-theme="dark"] .channel-toggle-row { border-bottom-color: #334155; }
[data-theme="dark"] .channel-toggle-label { color: #f1f5f9; }
[data-theme="dark"] .channel-config-body { border-bottom-color: #334155; }
[data-theme="dark"] .channel-config-body pre { background: #0f172a !important; color: #e2e8f0; }

.webhook-preview-json { background: #f1f5f9; padding: 12px; border-radius: 6px; overflow-x: auto; font-size: 0.85rem; }
[data-theme="dark"] .webhook-preview-json { background: #0f172a; color: #e2e8f0; }

[data-theme="dark"] .pagination .page-info { color: #94a3b8; }

[data-theme="dark"] .send-ch-btn { background: #1e293b; border-color: #475569; color: #94a3b8; }
[data-theme="dark"] .send-ch-btn:hover { border-color: #60a5fa; color: #60a5fa; }
[data-theme="dark"] .send-ch-btn.active { border-color: #3b82f6; }

[data-theme="dark"] .char-counter { color: #64748b; }
[data-theme="dark"] .char-counter.warning { color: #fbbf24; }
[data-theme="dark"] .char-counter.danger { color: #f87171; }

[data-theme="dark"] .kv-row .kv-key,
[data-theme="dark"] .kv-row .kv-value { background: #0f172a; border-color: #475569; color: #f1f5f9; }

[data-theme="dark"] .dispatch-group { border-left-color: #60a5fa; }
[data-theme="dark"] .dispatch-expand { color: #60a5fa; }

[data-theme="dark"] .history-filters .form-control { background: #0f172a; border-color: #475569; color: #f1f5f9; }

[data-theme="dark"] .channel-config-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .channel-config-card .channel-name { color: #f1f5f9; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .stats-row {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .alerting-wrapper { padding: 14px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .stats-row-5 { grid-template-columns: 1fr 1fr; }
    .sounds-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
    .modal { width: 95%; }
    .modal.modal-wide { max-width: 95%; }
    .tab-btn { padding: 8px 14px; font-size: 0.78rem; }
    .tab-btn .tab-icon { display: none; }
    .stat-card { padding: 18px; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .sound-picker-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 200px; }
    .priority-buttons { gap: 4px; }
    .pri-btn { min-width: 60px; padding: 6px 4px; font-size: 0.65rem; }
    .channel-config-body { padding-left: 0; }
    .history-filters { flex-direction: column; }
    .history-filters .form-control { width: 100%; }
    .send-channel-selector { gap: 4px; }
    .send-ch-btn { padding: 6px 10px; font-size: 0.75rem; }
    .kv-row { flex-direction: column; }
}

@media (max-width: 600px) {
    .stats-row { grid-template-columns: 1fr; }
    .stats-row-5 { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .btn { justify-content: center; }
    .alerting-header { flex-direction: column; align-items: flex-start; }
    .tab-bar { border-radius: 8px; }
    .channel-tabs { border-radius: 8px; }
    .channel-toggle-row { flex-wrap: wrap; }
}

/* Pushover Send: attachment thumbnail preview */
.attach-preview {
    max-width: 160px;
    max-height: 120px;
    margin-top: 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
[data-theme="dark"] .attach-preview { border-color: #334155; }
