/* ============================================================
   Volt SMS System - Custom CSS
   Bootstrap 5 + Volt v1.4.1 overrides for SMS system
   ============================================================ */

/* ============================================================
   Dashboard KPI Cards (modern style)
   ============================================================ */
.kpi-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid #eef0f5;
    border-radius: 0.75rem;
    padding: 1.1rem 1.25rem;
    color: #262b40;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 1px 4px rgba(38,43,64,.05);
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(38,43,64,.10);
    border-color: #d0d4e8;
    color: #262b40;
}
.kpi-icon-wrap {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
}
.kpi-body {
    min-width: 0;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: #1a1d2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-label {
    font-size: 0.8rem;
    color: #8a92a6;
    margin-top: 0.15rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* KPI icon color variants */
.kpi-warning   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.kpi-primary   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.kpi-info      { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.kpi-success   { background: linear-gradient(135deg, #10b981, #059669); }
.kpi-danger    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.kpi-secondary { background: linear-gradient(135deg, #94a3b8, #64748b); }
.kpi-purple    { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.kpi-indigo    { background: linear-gradient(135deg, #6366f1, #4338ca); }
.kpi-teal      { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.kpi-maroon    { background: linear-gradient(135deg, #be185d, #9d174d); }
.kpi-dark      { background: linear-gradient(135deg, #374151, #1f2937); }

/* ---- Dashboard header ---- */
.dash-greeting {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8a92a6;
}
.dash-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1d2e;
    line-height: 1.3;
}
.dash-date {
    font-size: 0.82rem;
    color: #8a92a6;
    font-weight: 500;
    background: #f4f6fb;
    padding: 0.3rem 0.75rem;
    border-radius: 2rem;
}
.dash-interval-select {
    border-radius: 2rem !important;
    border: 1px solid #e2e6f0;
    font-size: 0.82rem;
    padding: 0.3rem 2rem 0.3rem 0.9rem !important;
    background-color: #f4f6fb;
    color: #4b5563;
}
.dash-interval-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.15rem rgba(59,130,246,.2);
}

/* ---- Plan Summary Card ---- */
.plan-card {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #eef0f5;
    border-radius: 1rem;
    box-shadow: 0 1px 6px rgba(38,43,64,.05);
    overflow: hidden;
    min-height: 88px;
}
.plan-card-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #fff;
    padding: 1rem 1.4rem;
    flex-shrink: 0;
    min-width: 170px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .15rem;
}
.plan-card-empty {
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
    cursor: pointer;
    transition: filter .15s;
}
.plan-card-empty:hover { filter: brightness(1.08); }
.plan-status-dot {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .8;
}
.plan-card-name {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
    margin-top: .1rem;
}
.plan-card-cycle {
    font-size: .72rem;
    opacity: .75;
    margin-top: .1rem;
}
/* Limits strip */
.plan-card-limits {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 0 .5rem;
}
.plan-limit-sep {
    width: 1px;
    height: 40px;
    background: #eef0f5;
    flex-shrink: 0;
}
.plan-limit-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .75rem 1.1rem;
    gap: .05rem;
    flex: 1;
}
.plan-limit-item i    { font-size: 1.1rem; line-height: 1; margin-bottom: .2rem; }
.plan-limit-item strong { font-size: 1.25rem; font-weight: 800; color: #1a1d2e; line-height: 1; }
.plan-limit-item span   { font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
/* Expiry panel */
.plan-card-expiry {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .85rem 1.25rem;
    border-left: 2px solid #a7f3d0;
    flex-shrink: 0;
    min-width: 100px;
    gap: .1rem;
    transition: filter .15s;
}
.plan-card-expiry:hover { filter: brightness(.97); }
.plan-expiry-val {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
}
.plan-expiry-lbl {
    font-size: .62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: .15rem;
}
/* Mobile */
@media (max-width: 767px) {
    .plan-card { flex-wrap: wrap; border-radius: .75rem; }
    .plan-card-header { min-width: 100%; padding: .85rem 1rem; border-radius: 0; }
    .plan-card-limits { padding: .25rem 0; flex-wrap: wrap; }
    .plan-limit-item { flex: 0 0 50%; padding: .6rem .75rem; }
    .plan-card-expiry { min-width: 100%; border-left: none; border-top: 2px solid; padding: .75rem; flex-direction: row; gap: .5rem; justify-content: center; }
}

/* ---- Messages Stats Bar ---- */
.msg-stats-bar {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #eef0f5;
    border-radius: 1rem;
    box-shadow: 0 1px 6px rgba(38,43,64,.05);
    overflow: hidden;
}
.msg-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.1rem 0.5rem 0.95rem;
    text-align: center;
    text-decoration: none;
    color: #1a1d2e;
    border-right: 1px solid #eef0f5;
    transition: background 0.15s ease;
    position: relative;
    gap: 0.1rem;
}
.msg-stat:last-child { border-right: none; }
.msg-stat::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent, #e2e8f0);
    opacity: 0;
    transition: opacity 0.15s ease;
}
.msg-stat:hover {
    background: #f8fafc;
    color: #1a1d2e;
}
.msg-stat:hover::after { opacity: 1; }
.msg-stat-icon {
    font-size: 1.35rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.msg-stat-num {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    color: #1a1d2e;
    letter-spacing: -.02em;
}
.msg-stat-lbl {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin-top: 0.2rem;
    white-space: nowrap;
}
/* Mobile: 4 per row, 2 rows */
@media (max-width: 767px) {
    .msg-stats-bar { flex-wrap: wrap; border-radius: .75rem; }
    .msg-stat {
        flex: 0 0 25%;
        border-bottom: 1px solid #eef0f5;
        padding: .85rem .35rem .75rem;
    }
    .msg-stat:nth-child(4n)   { border-right: none; }
    .msg-stat:nth-child(n+5)  { border-bottom: none; }
    .msg-stat-num  { font-size: 1.3rem; }
    .msg-stat-icon { font-size: 1.1rem; }
}

/* ---- Dashboard section label ---- */
.dash-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #8a92a6;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}
.dash-section-label i {
    opacity: 0.7;
}

/* ---- Legacy stat-card (kept for backward compat) ---- */
.stat-card {
    border: none;
    border-radius: 0.5rem;
    color: #fff;
    text-decoration: none;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.25) !important;
    color: #fff;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 0.875rem; opacity: 0.9; margin-top: 0.25rem; }
.stat-card .stat-icon  { font-size: 2.5rem; opacity: 0.35; position: absolute; right: 1rem; bottom: 0.75rem; }
.stat-card .card-body  { position: relative; padding: 1.25rem 1.5rem; }
.stat-card-warning  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card-primary  { background: linear-gradient(135deg, #0d6efd, #0a58ca); }
.stat-card-info     { background: linear-gradient(135deg, #0dcaf0, #0bb8d4); }
.stat-card-success  { background: linear-gradient(135deg, #198754, #157347); }
.stat-card-danger   { background: linear-gradient(135deg, #dc3545, #b02a37); }
.stat-card-secondary{ background: linear-gradient(135deg, #6c757d, #565e64); }
.stat-card-purple   { background: linear-gradient(135deg, #6f42c1, #59359a); }
.stat-card-maroon   { background: linear-gradient(135deg, #a0274a, #7e1f3b); }
.stat-card-dark     { background: linear-gradient(135deg, #212529, #343a40); }
.stat-card-teal     { background: linear-gradient(135deg, #20c997, #1aa179); }

/* ---- Page header section ---- */
.page-header {
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
}
.page-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #262b40;
    margin: 0;
}

/* ---- Card overrides ---- */
.card {
    border-radius: 0.5rem;
}
.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
}
.card-header .card-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
    color: #262b40;
}
.card-footer {
    background-color: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 0.875rem 1.25rem;
}

/* ---- Input group ---- */
.input-group-text {
    background-color: #f8f9fa;
    border-color: #d1d3e2;
    color: #66799e;
}
.form-control, .form-select {
    border-color: #d1d3e2;
}
.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, .25);
}

/* ---- Select2 Bootstrap 5 compatibility ---- */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);
    border-color: #d1d3e2;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    padding-left: 0;
    color: #212529;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + 0.75rem + 2px);
}
.select2-container--default .select2-selection--multiple {
    border-color: #d1d3e2;
    border-radius: 0.375rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.25rem 0.5rem;
}

/* ---- Select2 inside Bootstrap 5 input-group ---- */
.input-group .select2-container {
    flex: 1 1 auto;
    width: 1% !important;
    min-width: 0;
    position: relative;
}
.input-group .select2-container--default .select2-selection--single {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-left: 0 !important;
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
    height: calc(1.5em + 0.75rem + 2px);
    border-color: #d1d3e2;
}
.input-group:focus-within .select2-container--default .select2-selection--single {
    border-color: #0d6efd;
}
.input-group .select2-container--default.select2-container--open .select2-selection--single {
    border-color: #0d6efd;
}

/* Bank filter Select2 — match form-select-sm height */
#pwFilterBank + .select2-container .select2-selection--multiple,
.select2-container--default.select2-container--filter .select2-selection--multiple {
    min-height: calc(1.5em + 0.5rem + 2px) !important;
    height:     calc(1.5em + 0.5rem + 2px) !important;
    padding: 0 0.375rem !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
}
#pwFilterBank + .select2-container .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 3px !important;
    overflow: hidden !important;
    width: 100% !important;
}
#pwFilterBank + .select2-container .select2-selection--multiple .select2-selection__placeholder {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #0d6efd;
    border-color: #0a58ca;
    color: #fff;
    border-radius: 0.25rem;
    padding: 0.1rem 0.5rem;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255,255,255,.7);
    margin-right: 4px;
    border-right: none;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    background: transparent;
}

/* ---- DataTables Bootstrap 5 compatibility ---- */
div.dataTables_wrapper div.dataTables_length label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    white-space: nowrap;
    font-size: 13px;
    color: #374151;
}
div.dataTables_wrapper div.dataTables_length select {
    display: inline-block !important;
    width: auto !important;
    padding: 5px 28px 5px 10px !important;
    box-sizing: content-box !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #374151 !important;
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px 10px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    color-scheme: light !important;
    cursor: pointer;
}
div.dataTables_wrapper div.dataTables_length select:focus {
    border-color: #0d6efd !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(13,110,253,.15) !important;
}
div.dataTables_wrapper div.dataTables_filter input {
    display: inline-block !important;
    padding: 5px 12px !important;
    font-size: 13px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    background-color: #fff !important;
    color: #374151 !important;
    color-scheme: light !important;
}
div.dataTables_wrapper div.dataTables_filter input:focus {
    border-color: #0d6efd !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(13,110,253,.15) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 0.375rem;
}

/* ---- Nav tabs ---- */
.nav-tabs .nav-link {
    color: #66799e;
    font-weight: 500;
}
.nav-tabs .nav-link.active {
    color: #0d6efd;
    font-weight: 600;
}

/* ---- Sticky footer ---- */
main.content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.site-footer {
    background: #fff;
    border-top: 1px solid #eef0f5;
    width: 100%;
}

/* ---- Sidebar submenu ---- */
.sidebar-submenu-toggle {
    justify-content: flex-start;
}
.sidebar-submenu-caret {
    font-size: .7rem;
    opacity: .55;
    transition: transform .2s ease;
    flex-shrink: 0;
}
.sidebar-submenu-toggle:not(.collapsed) .sidebar-submenu-caret {
    transform: rotate(-180deg);
    opacity: .85;
}
.sidebar-submenu {
    padding-left: .75rem;
    padding-bottom: .25rem;
}
.sidebar-submenu .nav-link {
    padding-top: .3rem;
    padding-bottom: .3rem;
}
.sidebar-submenu .nav-link .sidebar-text {
    font-size: .82rem;
}
.sidebar-submenu .nav-link .sidebar-icon {
    width: 1.4rem;
    height: 1.4rem;
    background: rgba(255,255,255,.04);
}
.sidebar-submenu .nav-link .sidebar-icon i {
    font-size: .82rem;
}

/* ---- Sidebar brand pin ---- */
.sidebar-brand-pin {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem .25rem 1rem;
    margin-bottom: .25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    user-select: none;
    pointer-events: none;
}
.sidebar-brand-logo {
    flex-shrink: 0;
    border-radius: .35rem;
    object-fit: contain;
}
.sidebar-brand-name {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Sidebar icons ---- */
.sidebar .nav-link {
    display: flex;
    align-items: center;
}
.sidebar .nav-link .sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    margin-right: 0.625rem;
    border-radius: 0.375rem;
    background: rgba(255,255,255,.06);
    transition: background 0.15s;
}
.sidebar .nav-item.active > .nav-link .sidebar-icon {
    background: rgba(255,255,255,.15);
}
.sidebar .nav-link .sidebar-icon i,
.sidebar .nav-link .sidebar-icon svg {
    width: 1rem;
    height: 1rem;
    font-size: 1rem;
    color: rgba(255,255,255,.65);
    /* Remove any me-* margin from SVG inside the wrapper */
    margin: 0 !important;
    flex-shrink: 0;
}
.sidebar .nav-item.active > .nav-link .sidebar-icon i,
.sidebar .nav-item.active > .nav-link .sidebar-icon svg {
    color: #fff;
}
.sidebar .nav-link .sidebar-text {
    line-height: 1.4;
    font-size: 0.9rem;
}
.sidebar .nav-link .fa {
    width: 1rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,.65);
    margin: 0 !important;
}
.sidebar .nav-item.active > .nav-link .fa {
    color: #fff;
}

/* ---- Top navbar ---- */
.navbar-dashboard {
    background: #ffffff !important;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    padding: .5rem 1.5rem !important;
    min-height: 60px;
}
.navbar-dashboard .nav-link {
    color: #262b40;
}
.navbar-dashboard .dropdown-menu {
    min-width: 14rem;
}
.navbar-dashboard .avatar {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

/* ---- No horizontal scroll ---- */
html, body {
    overflow-x: hidden;
}

/* ---- Sidebar width override ---- */
@media (min-width: 768px) {
    .sidebar {
        width: 285px !important;
        max-width: 285px !important;
    }
}

/* ---- Content area ---- */
.content {
    padding: 0;
    overflow: visible;
}
@media (min-width: 992px) {
    main.content {
        margin-left: 285px !important;
    }
}

/* ---- Alert dismiss ---- */
.alert .btn-close {
    padding: 0.5rem;
}

/* ---- Auth pages (Volt Pro style) ---- */
.bg-soft { background-color: #f5f8fb !important; }
.shadow-soft { box-shadow: 0 .375rem 1.5rem 0 rgba(140,152,164,.125) !important; }
.border-light { border-color: #eaecf3 !important; }

/* Full-height section on lg+ */
.vh-lg-100 { min-height: 100vh; }

/* Max-width constraint for form card */
.fmxw-500 { max-width: 500px; }

/* Row that shows illustration as bg on lg+ */
.form-bg-image {
    background-repeat: no-repeat;
    background-position: center right;
    background-size: contain;
    min-height: 100vh;
}
@media (max-width: 991.98px) {
    .form-bg-image { background-image: none !important; min-height: unset; }
}

/* Form card */
.signin-inner {
    border-radius: 1rem;
}
/* Input icons */
.signin-inner .input-group-text {
    background: #f8f9fc;
    border-color: #d9dde8;
    color: #8a92a6;
    border-right: none;
}
.signin-inner .form-control {
    border-left: none;
    padding-left: .25rem;
}
.signin-inner .form-control:focus {
    border-color: #d9dde8;
    box-shadow: none;
}
.signin-inner .input-group:focus-within .input-group-text,
.signin-inner .input-group:focus-within .form-control {
    border-color: #4f46e5;
}
.signin-inner .input-group:focus-within .input-group-text {
    color: #4f46e5;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #9ca3af;
    font-size: .8rem;
    margin: 1.25rem 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e9ecef;
}

/* ---- Modal ---- */
.modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
}
.modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 0.875rem 1.25rem;
}

/* ---- Datetime input ---- */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
    cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
}

/* ---- Dropzone ---- */
.dropzone {
    border: 2px dashed #d1d3e2;
    border-radius: 0.5rem;
    background: #f8f9fa;
    min-height: 100px;
}
.dropzone:hover {
    border-color: #0d6efd;
    background: rgba(13,110,253,.04);
}

/* ---- Code prettify ---- */
.prettyprint {
    border-radius: 0.375rem;
    padding: 1rem !important;
}

/* ============================================================
   Message List (modern card style)
   ============================================================ */
.msg-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Date header */
.msg-date-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
    margin: 1rem 0 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #6b7280;
}
.msg-date-header span {
    background: #f3f4f6;
    border-radius: 2rem;
    padding: 0.25rem 0.8rem;
    border: 1px solid #e5e7eb;
}
.msg-date-header:first-child {
    margin-top: 0;
}

/* Device header */
.msg-device-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: #4b5563;
    padding: 0.35rem 0.75rem;
    margin-bottom: 0.4rem;
    background: #f9fafb;
    border-radius: 0.375rem;
    border-left: 3px solid #d1d5db;
}
.msg-device-header a {
    color: inherit;
    text-decoration: none;
}
.msg-device-header a:hover {
    color: #3b82f6;
}

/* Message card */
.msg-card {
    background: #fff;
    border-radius: 0.625rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    overflow: hidden;
    border-left-width: 4px;
}
.msg-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.07);
    transform: translateY(-1px);
}
.msg-card-inner {
    display: flex;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    gap: 0.75rem;
}

/* Status color left borders */
.msg-card-success   { border-left-color: #10b981; }
.msg-card-warning   { border-left-color: #f59e0b; }
.msg-card-info      { border-left-color: #06b6d4; }
.msg-card-primary   { border-left-color: #3b82f6; }
.msg-card-danger    { border-left-color: #ef4444; }
.msg-card-secondary { border-left-color: #9ca3af; }

/* Icon column */
.msg-icon-col {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    margin-top: 2px;
    background: #f3f4f6;
    color: #6b7280;
}
.msg-card-success   .msg-icon-col { background: #d1fae5; color: #059669; }
.msg-card-warning   .msg-icon-col { background: #fef3c7; color: #d97706; }
.msg-card-info      .msg-icon-col { background: #cffafe; color: #0891b2; }
.msg-card-primary   .msg-icon-col { background: #dbeafe; color: #2563eb; }
.msg-card-danger    .msg-icon-col { background: #fee2e2; color: #dc2626; }

/* Body column */
.msg-body-col {
    flex: 1;
    min-width: 0;
}
.msg-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.msg-header-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
    flex: 1;
    min-width: 0;
}
.msg-header-text a {
    color: inherit;
    text-decoration: none;
}
.msg-header-text a:hover {
    color: #3b82f6;
}
.msg-header-text input[type="checkbox"] {
    margin-right: 0.4rem;
    cursor: pointer;
    accent-color: #3b82f6;
    width: 14px;
    height: 14px;
}
.msg-time-text {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}
.msg-body-text {
    font-size: 0.85rem;
    color: #374151;
    line-height: 1.5;
    word-break: break-word;
    margin-bottom: 0.5rem;
}
.msg-footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* Badges */
.msg-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 2rem;
    letter-spacing: .02em;
}
.msg-badge-success   { background: #d1fae5; color: #065f46; }
.msg-badge-warning   { background: #fef3c7; color: #92400e; }
.msg-badge-info      { background: #cffafe; color: #164e63; }
.msg-badge-primary   { background: #dbeafe; color: #1e3a8a; }
.msg-badge-danger    { background: #fee2e2; color: #991b1b; }
.msg-badge-secondary { background: #f3f4f6; color: #4b5563; }

/* Reply link inside header */
.msg-header-text .reply-message {
    color: #9ca3af;
    margin-left: 0.4rem;
    font-size: 0.8rem;
}
.msg-header-text .reply-message:hover {
    color: #3b82f6;
}

/* ---- Legacy Timeline (kept for backward compat) ---- */
.timeline {
    position: relative;
    padding: 0;
    list-style: none;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 1rem;
    width: 2px;
    background: #e9ecef;
}
.timeline > li {
    position: relative;
    margin-bottom: 1rem;
    padding-left: 3rem;
}
.timeline-footer {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* ---- Webview tweaks ---- */
@media screen and (max-width: 768px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* ---- Table responsive ---- */
.table-responsive {
    border-radius: 0.375rem;
}
.table th {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #66799e;
    background: #f8f9fa;
    border-bottom-width: 1px;
}

/* ---- Notyf — custom styling ---- */
.notyf {
    z-index: 99999 !important;
}
.notyf__toast {
    border-radius: 10px !important;
    /* Không override padding ở đây — để wrapper tự quản lý.
       Padding trên toast gốc là 0 15px, cần giữ nguyên để
       .notyf__dismiss (margin-right:-15px) định vị đúng nút X */
    font-size: 0.875rem !important;
    font-family: inherit !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08) !important;
    min-width: 280px;
    max-width: 420px;
}
.notyf__toast--success {
    background: #10b981 !important;
}
.notyf__toast--error {
    background: #ef4444 !important;
}
/* Wrapper: padding đồng đều, căn top để text nhiều dòng không bị lệch */
.notyf__wrapper {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    align-items: flex-start !important;
}
/* Icon căn với dòng đầu của text */
.notyf__icon {
    margin-top: 1px !important;
    flex-shrink: 0 !important;
}
.notyf__message {
    font-weight: 500 !important;
    color: #fff !important;
    line-height: 1.5 !important;
    word-break: break-word !important;
    white-space: pre-line;
}
/* Nút X: dải dọc bên phải, bo góc khớp với toast, không dùng 50% gây ra oval */
.notyf__dismiss-btn {
    background: rgba(0,0,0,.18) !important;
    border-radius: 0 10px 10px 0 !important;
    opacity: .75 !important;
}
.notyf__dismiss-btn:hover {
    background: rgba(0,0,0,.30) !important;
    opacity: 1 !important;
}

/* ---- Phosphor Icons — global sizing & spin ---- */
.ph {
    font-size: 1em;
    line-height: 1;
    vertical-align: -0.125em;
}
@keyframes ph-spin-anim {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.ph-spin {
    display: inline-block;
    animation: ph-spin-anim 0.8s linear infinite;
}

/* ---- Realtime Live indicator ---- */
@keyframes pw-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}
#pwRealtimeStatus i.text-success {
    animation: pw-pulse 2s ease-in-out infinite;
}
#pwRealtimeStatus i.text-warning {
    animation: none;
}

/* ---- Settings Tabs ---- */
.settings-tabs {
    background: #eef2f8;
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
    border: none !important;
    flex-wrap: wrap;
    display: flex;
}
.settings-tabs .nav-item {
    flex: 0 0 auto;
}
.settings-tabs .nav-link {
    border: none !important;
    border-radius: 9px !important;
    padding: 7px 16px !important;
    font-size: 0.83rem !important;
    font-weight: 500 !important;
    color: #64748b !important;
    background: transparent !important;
    transition: all 0.18s ease !important;
    white-space: nowrap;
    line-height: 1.5;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}
.settings-tabs .nav-link i.ph {
    font-size: 1rem !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    opacity: 0.6;
    flex-shrink: 0;
    margin: 0 !important;
}
.settings-tabs .nav-link:hover {
    color: #334155 !important;
    background: rgba(255,255,255,0.65) !important;
}
.settings-tabs .nav-link:hover i.ph {
    opacity: 0.9;
}
.settings-tabs .nav-link.active {
    background: #ffffff !important;
    color: #2563eb !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.05) !important;
    font-weight: 600 !important;
}
.settings-tabs .nav-link.active i.ph {
    opacity: 1;
    color: #2563eb;
}

/* Settings Tab Content */
.settings-tab-content {
    background: #ffffff;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
}

/* ---- Checkbox inside form-label (plans, toggle fields) ---- */
.form-label input[type="checkbox"] {
    vertical-align: middle;
    margin-right: 0.35rem;
    accent-color: #0d6efd;
    width: 15px;
    height: 15px;
    cursor: pointer;
    position: relative;
    top: -1px;
}

/* ---- Badge ---- */
.badge-status {
    font-size: 0.75rem;
    padding: 0.3em 0.6em;
    border-radius: 0.25rem;
    font-weight: 600;
}
.badge-status-pending   { background: #fff3cd; color: #856404; }
.badge-status-sent      { background: #d1e7dd; color: #0a3622; }
.badge-status-delivered { background: #d1e7dd; color: #0a3622; }
.badge-status-failed    { background: #f8d7da; color: #58151c; }
.badge-status-received  { background: #cfe2ff; color: #084298; }
.badge-status-scheduled { background: #cfe2ff; color: #084298; }
.badge-status-queued    { background: #d3f0f5; color: #0a555f; }
.badge-status-canceled  { background: #e2e3e5; color: #41464b; }
