:root {
    color-scheme: dark;
    --bg-primary: #0a0e1a;
    --bg-secondary: #131825;
    --bg-tertiary: #1a2035;
    --bg-card: #1f2937;
    --bg-hover: #2a3447;

    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    --border-color: #374151;
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);

    --font-display: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --scrollbar-track: var(--bg-primary);
    --scrollbar-thumb: var(--bg-tertiary);
    --scrollbar-thumb-hover: var(--bg-hover);
}

:root[data-theme="light"],
[data-theme="light"],
body.light-theme,
.light-theme {
    color-scheme: light;
    --bg-primary: #e6ebf1;
    --bg-secondary: #f0f4f8;
    --bg-tertiary: #e2e8f0;
    --bg-card: #f8fafc;
    --bg-hover: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;

    --border-color: #cbd5e1;

    --scrollbar-track: rgba(0, 0, 0, 0.04);
    --scrollbar-thumb: #94a3b8;
    --scrollbar-thumb-hover: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

body {
    font-family: var(--font-display);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Webkit Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-button { display: none !important; width: 0 !important; height: 0 !important; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* ── Layout ────────────────────────────────────────────────────── */

.container {
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.back-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateX(-2px);
}

.back-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
}
.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.alert-add-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.alert-add-select {
    flex: 1 1 auto;
    min-width: 0;
}

.alert-add-actions {
    display: inline-flex;
    align-items: stretch;
    gap: 0.5rem;
    flex: 0 0 auto;
    white-space: nowrap;
}

.alert-profile-menu-wrap {
    position: relative;
}

.alert-profile-trigger {
    width: 42px;
    min-height: 42px;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.alert-profile-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    display: none;
    width: max-content;
    min-width: 190px;
    max-width: calc(100vw - 1.5rem);
    padding: 0.35rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.alert-profile-menu.open {
    display: grid;
    gap: 0.2rem;
}

.alert-profile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.alert-profile-menu-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

@media (max-width: 520px) {
    .alert-add-row {
        gap: 0.4rem;
    }

    .alert-add-actions {
        gap: 0.35rem;
    }

    .alert-add-btn {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .alert-profile-menu {
        max-width: calc(100vw - 1.5rem);
    }
}

@media (max-width: 340px) {
    .alert-add-row {
        flex-wrap: wrap;
    }

    .alert-add-select {
        flex-basis: 100%;
    }
}

.alert-profile-device-list {
    display: grid;
    gap: 0.45rem;
    max-height: min(360px, 48vh);
    overflow: auto;
}

.alert-profile-device-option {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.72rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.alert-profile-device-option:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.alert-profile-device-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.alert-profile-device-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.tbl-btn {
    padding: 0.55rem 0.85rem !important;
    font-size: 0.82rem !important;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 1px;
}

/* ── Company user list row ─────────────────────────────────────── */

.co-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    gap: 0.75rem;
}

.co-user-info {
    flex: 1;
    min-width: 0;
}

.co-user-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.co-user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.co-user-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .co-user-row {
        flex-wrap: wrap;
    }
    .co-user-info {
        width: 100%;
    }
    .co-user-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ── Co-Admin Pill Toggle ──────────────────────────────────────── */

.co-admin-pill {
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.co-admin-pill:not(:disabled):hover {
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

.co-admin-pill.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

.co-admin-pill:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Alerts / Toasts ───────────────────────────────────────────── */

.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
}
.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-success);
}
.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-danger);
}
.alert-hidden { display: none; }

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    left: 2rem;
    max-width: 420px;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 99999;
    pointer-events: none;
}

.toast {
    background: #181e2e;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 0;
    width: 100%;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
}

body.light-theme .toast {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.toast-icon    { font-size: 1.5rem; line-height: 1; flex-shrink: 0; margin-top: 0.1rem; }
.toast-content { flex: 1; min-width: 0; }
.toast-title   { font-weight: 700; margin-bottom: 0.25rem; font-size: 0.95rem; line-height: 1.3; color: #f8fafc; }
body.light-theme .toast-title { color: #0f172a; }
.toast-message { font-size: 0.85rem; line-height: 1.45; color: #e2e8f0; word-break: break-word; font-weight: 500; }
body.light-theme .toast-message { color: #334155; }
.toast-success { border-left: 5px solid var(--accent-success, #10b981); }
.toast-success .toast-icon { color: var(--accent-success, #10b981); }
.toast-error   { border-left: 5px solid var(--accent-danger, #ef4444); }
.toast-error .toast-icon { color: var(--accent-danger, #ef4444); }
.toast-warning { border-left: 5px solid var(--accent-warning, #f59e0b); }
.toast-warning .toast-icon { color: var(--accent-warning, #f59e0b); }
.toast-info    { border-left: 5px solid var(--accent-primary, #3b82f6); }
.toast-info .toast-icon { color: var(--accent-primary, #3b82f6); }
.toast-critical {
    background: #1c1520;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-left: 6px solid #ef4444;
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.3), 0 16px 40px rgba(0, 0, 0, 0.8);
}
body.light-theme .toast-critical {
    background: #fff5f5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-left: 6px solid #ef4444;
}
.toast-critical .toast-icon {
    color: #ef4444;
    font-size: 1.6rem;
    animation: toast-crit-pulse 1s infinite alternate ease-in-out;
}
@keyframes toast-crit-pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
    100% { transform: scale(1.18); filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8)); }
}
.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.2rem;
    margin-left: 0.25rem;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 4px;
    opacity: 0.8;
    transition: color 0.15s, background 0.15s, opacity 0.15s;
}
.toast-close:hover {
    color: #f8fafc;
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}
body.light-theme .toast-close:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.06);
}

/* ── Loading Spinner ───────────────────────────────────────────── */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Keyframes ─────────────────────────────────────────────────── */

@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes slideUp    { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ── Devices Table ─────────────────────────────────────────────── */

.device-row-name { font-weight: 600; font-size: 0.925rem; }

.proto-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}
.status-dot.online   { background: var(--accent-success); box-shadow: 0 0 6px var(--accent-success); }
.status-dot.active   { background: var(--accent-primary); }
.status-dot.inactive { background: var(--text-muted); }

/* ── Forms ─────────────────────────────────────────────────────── */

.form-group,
#integrationFieldsPanel { margin-bottom: 1.75rem; }

.form-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.875rem 1.125rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    transition: all var(--transition-base);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.5;
}

.form-main-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
@media (min-width: 1024px) {
    .form-main-layout {
        display: grid;
        grid-template-columns: 1fr 1.2fr;
        gap: 2rem;
        align-items: start;
    }
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.config-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.config-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--accent-primary);
}

/* ── Channel Pills ─────────────────────────────────────────────── */

.channel-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.channel-pill:hover  { border-color: var(--accent-primary); }
.channel-pill.active { background: var(--accent-primary); border-color: var(--accent-primary); color: white; }
.channel-pill input  { display: none; }

/* ── Raw Data Table ────────────────────────────────────────────── */

.raw-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.raw-data-table th,
.raw-data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.raw-data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}
.raw-data-table tr:hover { background: var(--bg-hover); }

.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}
.page-info {
    margin: 0 1rem;
    color: var(--text-muted);
}

/* ── Modal Base ────────────────────────────────────────────────── */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base);
}
.modal.active { display: flex; }

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 95%;
    max-width: 700px;
    height: 90vh;           /* ← ADD THIS */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp var(--transition-base);
}

.modal-content.wide {
    max-width: 1100px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.modal-title {
    font-size: 1.75rem;
    font-weight: 700;
}
.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all var(--transition-base);
}
.modal-close:hover {
    background: var(--accent-danger);
    color: white;
    transform: rotate(90deg);
}

/* ── Modal Tabs ────────────────────────────────────────────────── */

.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 0 2rem;
}
.modal-tabs::-webkit-scrollbar { display: none; }

.modal-tab {
    flex: 0 0 auto;
    padding: 0.8rem 1.4rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-base);
    margin-bottom: -2px;
}
.modal-tab:hover  { color: var(--text-primary); background: var(--bg-hover); }
.modal-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

.modal-tab-content        { display: none; }
.modal-tab-content.active { display: block; }

/* Scrollable content area (between tabs/header and footer) */
.modal-scrollable {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.75rem 2rem;
}

/* ── Modal Footer ──────────────────────────────────────────────── */

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    gap: 0.75rem;
}

/* ── Alert Editor Modal ────────────────────────────────────────── */

#alertEditorModal .modal-content {
    max-width: 660px;
}

#alertEditorModal #alertEditorBody {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.alert-editor-right > .form-group:first-child { margin-top: 0; }

@media (min-width: 860px) {
    #alertEditorModal .modal-content { max-width: 960px; }
    .alert-editor-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 2.5rem;
        align-items: start;
    }
    .alert-editor-right > .form-group:first-child { margin-top: 1.25rem; }
}

/* ── Alerts Tab ────────────────────────────────────────────────── */

.alerts-add-row {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.alerts-add-panel {
    flex: 1;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alerts-add-panel-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.alerts-add-divider {
    width: 1px;
    background: var(--border-color);
    flex-shrink: 0;
    margin: 0.75rem 0;
}

.alerts-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.alerts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.alerts-table th,
.alerts-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.alerts-table thead th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}
.alerts-table tr.alert-data-row:hover td { background: var(--bg-hover); }
.alerts-table tr:last-child td           { border-bottom: none; }

.alerts-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
    font-size: 0.875rem;
}

.alert-type-label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; font-size: 0.85rem; }
.alert-type-label.system { color: var(--accent-primary); }
.alert-type-label.custom { color: var(--accent-warning); }

.alert-threshold-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.22rem 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}
.alert-threshold-badge small { font-size: 0.68rem; color: var(--text-muted); }

.schedule-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 6px;
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--accent-primary);
}
.schedule-badge small { display: block; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.7rem; }

/* ── Alert History Table ────────────────────────────────────────── */

.alert-history-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.alert-history-wrap::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.alert-history-wrap::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 0 0 12px 12px;
}
.alert-history-wrap::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
.alert-history-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.alert-history-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.alert-history-table th,
.alert-history-table td {
    padding: 0.75rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.alert-history-table thead th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}
.alert-history-table tr:hover td { background: var(--bg-hover); }
.alert-history-table tr:last-child td { border-bottom: none; }

.alert-hist-channel-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    line-height: 1.2;
    white-space: nowrap;
    transition: transform 0.15s ease;
}
.alert-hist-channel-badge.sent {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.28);
}
.alert-hist-channel-badge.failed {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.28);
}
.alert-hist-channel-badge.skipped {
    background: rgba(156, 163, 175, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(156, 163, 175, 0.25);
}

/* ── Severity Badges ────────────────────────────────────────────── */
.severity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 6px;
    line-height: 1.2;
    text-transform: capitalize;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.severity-badge i.mdi {
    font-size: 0.8rem;
}
.severity-badge.sev-info {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #3b82f6 !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
}
.severity-badge.sev-warning {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
}
.severity-badge.sev-critical {
    background: rgba(239, 68, 68, 0.14) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

/* ── Day Picker ────────────────────────────────────────────────── */

.day-picker { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.day-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 34px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.18s;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}
.day-pill input[type=checkbox] { display: none; }
.day-pill:hover  { border-color: var(--accent-primary); color: var(--text-primary); }
.day-pill.active { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }

/* ── Toggle Switch ─────────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-primary); border-color: var(--accent-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); background: white; }

/* ── Command Modal ─────────────────────────────────────────────── */

.command-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.command-tabs::-webkit-scrollbar { display: none; }

.command-tab {
    flex: 0 0 auto;
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: -1px;
}
.command-tab:hover  { color: var(--text-primary); background: var(--bg-hover); }
.command-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

.command-tab-content        { display: none; }
.command-tab-content.active { display: block; }
#historyCommandTab          { margin-top: 0; padding-top: 0; }

.command-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.command-subtab {
    padding: 0.625rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}
.command-subtab:hover  { border-color: var(--accent-primary); color: var(--text-primary); }
.command-subtab.active { background: var(--accent-primary); border-color: var(--accent-primary); color: white; }

.command-subtab-content        { display: none; }
.command-subtab-content.active { display: block; }

.command-info-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.command-info-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.command-preview-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.command-preview-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}
.command-preview-hex {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    color: var(--accent-primary);
    word-break: break-all;
    margin-bottom: 0.75rem;
}
.command-preview-ascii {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    word-break: break-all;
}
.command-preview-ascii::before {
    content: 'ASCII: ';
    color: var(--text-secondary);
    font-weight: 600;
}
.command-preview-ascii.no-prefix::before {
    content: 'JSON Payload: ';
    color: var(--accent-primary);
    font-weight: 600;
}

.command-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.command-history-table th,
.command-history-table td {
    padding: 0.75rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.command-history-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.command-history-table td:nth-child(1),
.command-history-table td:nth-child(2),
.command-history-table td:nth-child(3),
.command-history-table td:nth-child(5) {
    white-space: nowrap;
    width: 1%;
}
.command-history-table tr:hover { background: var(--bg-hover); }

.command-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.command-status.pending   { background: rgba(59, 130, 246, 0.15); color: var(--accent-primary); }
.command-status.sent      { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.command-status.acked     { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.command-status.received  { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.command-status.canceled,
.command-status.cancelled,
.command-status.failed,
.command-status.timeout   { background: rgba(239, 68, 68, 0.15);  color: var(--accent-danger); }

.command-direction {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.command-direction.sent     { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.command-direction.received { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }

.btn-cancel-command,
.btn-delete-command {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1;
    transition: all 0.15s;
}
.btn-cancel-command:hover,
.btn-delete-command:hover {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.1);
}

.command-payload,
.command-response {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-muted);
    width: 100%;
    min-width: 160px;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 700px) {
    .alerts-add-row     { flex-direction: column; }
    .alerts-add-divider { width: auto; height: 1px; margin: 0; }
}

/* ── Mobile: Device Table ───────────────────────────────────────── */

/* Company column hidden by default; shown only for admins via JS-added class */
.company-col { display: none; }

.devices-table.show-company-col .company-col { display: table-cell; }

@media (max-width: 900px) {
    .devices-table.show-company-col .company-col { display: none; }
}

.company-table th:nth-child(3),
.company-table td:nth-child(3) {
    display: table-cell !important;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }
    .container {
        padding: 0.5rem;
    }
    /* Header: stack buttons below title */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .header > div:last-child {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* Make action buttons stack vertically */
    .device-actions {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .device-actions .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        white-space: nowrap;
    }

    /* Shrink action column */
    .devices-table th:last-child,
    .devices-table td:last-child {
        width: auto;
    }

    /* Users table has different columns — hide Created on compact screens */
    #usersTable th:nth-last-child(2),
    #usersTable td:nth-last-child(2) {
        display: none;
    }
}

#userModalBody {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
    align-items: start;
}

#userModalMfaQr {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#userModalMfaQr:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4) !important;
}

#qrZoomModal .modal-content {
    max-width: 380px !important;
    width: 90% !important;
    height: auto !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    text-align: center;
    padding: 1.5rem;
    align-items: center;
    margin: auto;
}

#qrZoomTarget {
    display: inline-flex;
    padding: 12px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    margin: 0 auto 1rem;
    max-width: 100%;
}

#qrZoomTarget canvas,
#qrZoomTarget img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

@media (max-height: 600px) {
    #qrZoomModal .modal-content {
        padding: 1rem;
        max-height: 95vh !important;
    }
    #qrZoomTarget {
        padding: 8px;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 640px) {
    #userModalBody { grid-template-columns: 1fr; }
    #userModal .modal-content { max-width: 95vw; }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }
}

/* ── Responsive Modal ─────────────────────────────────────────── */

@media (max-width: 550px) {
    .command-tab {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    .command-subtab {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    .command-tab-content .form-actions .btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .command-tab {
        padding: 0.6rem 0.875rem;
        font-size: 0.8rem;
    }
    .command-subtab {
        padding: 0.45rem 0.75rem;
        font-size: 0.775rem;
    }
    .command-tab-content .form-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.775rem;
    }
}

@media (max-width: 550px) {
    .modal-header {
        padding: 1.1rem 1.25rem 0.875rem;
    }
    .modal-scrollable {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 0.875rem 1rem 0.75rem;
    }
    .modal-scrollable {
        padding: 1rem;
    }
}

@media (max-width: 550px) {
    .modal-footer {
        padding: 0.875rem 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    .modal-footer > .btn {
        justify-content: center;
    }
    .modal-footer > div {
        width: 100%;
    }
    .modal-footer > div > .btn {
        flex: 1;
        justify-content: center;
    }
}

/* Driver modal two-column layout — collapses to one column on mobile */
.driver-modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .driver-modal-columns {
        grid-template-columns: 1fr;
    }
}

.datetime-picker-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.datetime-picker-wrap .form-input {
    width: 100%;
    padding-right: 2.4rem;
}

.datetime-picker-btn {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
    z-index: 2;
}

.datetime-picker-btn:hover {
    color: var(--accent-primary);
}

.datetime-picker-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    border: none;
    padding: 0;
    margin: 0;
    z-index: 1;
}

.datetime-picker-wrap.is-native .datetime-picker-btn,
.datetime-picker-wrap.is-native .datetime-picker-native {
    display: none;
}

.datetime-picker-wrap.is-native .form-input {
    padding-right: 0.75rem;
}

/* ── Company Management Entity Chips (Users & Devices) ───────────── */
.cmp-entity-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    max-width: 320px;
}

.cmp-entity-list.expanded {
    max-height: 140px;
    overflow-y: auto;
    padding-right: 0.25rem;
    scrollbar-width: thin;
}

.cmp-chip {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    gap: 0.25rem;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.35;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
    max-width: 140px;
    white-space: nowrap;
    user-select: none;
}

.devices-table td .cmp-chip {
    max-width: 180px;
}

[data-theme="light"] .cmp-chip,
body.light-theme .cmp-chip {
    background: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.22);
    color: var(--text-secondary);
}

.cmp-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cmp-chip i {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.cmp-chip.user-admin {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.08);
}

.cmp-chip.user-admin i {
    color: var(--accent-primary);
}

.cmp-more-btn,
.cmp-less-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    color: var(--accent-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    user-select: none;
    font-family: inherit;
}

.cmp-more-btn:hover,
.cmp-less-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary-hover, var(--accent-primary));
}

.cmp-empty-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* ── Custom Multi-Select Dropdown ────────────────────────────────── */
.custom-multi-select {
    position: relative;
    width: 100%;
}

.custom-multi-select.open {
    z-index: 1050;
}

#deviceAssignedUsersGroup:has(.custom-multi-select.open) {
    position: relative;
    z-index: 1050;
}

.multi-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    cursor: pointer;
    text-align: left;
    user-select: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    min-height: 40px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    color: var(--text-primary);
}

.multi-select-btn:focus,
.custom-multi-select.open .multi-select-btn {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.multi-select-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.multi-select-label.placeholder {
    color: var(--text-muted);
}

.multi-select-arrow {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.custom-multi-select.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card, var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    z-index: 2000;
    max-height: 260px;
    overflow: hidden;
    flex-direction: column;
}

.custom-multi-select:not(.open) .multi-select-dropdown {
    display: none !important;
}

.custom-multi-select.open .multi-select-dropdown {
    display: flex !important;
}

.multi-select-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.multi-select-search-wrap i {
    color: var(--text-muted);
    font-size: 1rem;
}

.multi-select-search {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
}

.multi-select-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.multi-select-action-btn {
    background: none;
    border: none;
    padding: 0.15rem 0.35rem;
    font-size: 0.75rem;
    color: var(--accent-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    font-family: inherit;
}

.multi-select-action-btn:hover {
    background: var(--bg-hover);
}

.multi-select-options {
    flex: 1;
    overflow-y: auto;
    padding: 0.3rem 0;
    max-height: 180px;
    scrollbar-width: thin;
}

.multi-select-opt {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
    user-select: none;
    color: var(--text-primary);
}

.multi-select-opt:hover {
    background: var(--bg-hover);
}

.multi-select-opt input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.multi-select-opt-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.multi-select-opt-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-opt-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Send Notification Modal ────────────────────────────────────── */

.notify-modal-grid {
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (max-width: 720px) {
    .notify-modal-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.notify-recipients-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.notify-composer-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.notify-users-box {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 350px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.notify-users-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.35rem;
}

.notify-user-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base);
    margin-bottom: 2px;
    user-select: none;
}

.notify-user-row:hover {
    background: var(--bg-hover);
}

.notify-user-row.selected {
    background: rgba(59, 130, 246, 0.1);
}

.user-list-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    border: 1.5px solid var(--border-color);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

#usersTable td,
#driversTableBody td {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.user-name-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 36px;
    line-height: 1.2;
}

.user-driver-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    line-height: 1;
    margin-top: 2px;
}

.notify-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.notify-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.notify-select-all-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    user-select: none;
    transition: background var(--transition-base);
}

.notify-select-all-row:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}


.notify-delivery-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.notify-delivery-hint i {
    font-size: 16px;
    color: var(--accent-primary);
    flex-shrink: 0;
}


