:root {
    --brand-gradient: linear-gradient(135deg, #3531ff, #7b5bff 55%, #f472b6);
    --sidebar-bg: #0f172a;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-link: rgba(255, 255, 255, 0.75);
    --sidebar-link-active: #fff;
    --accent: #6857ff;
    --accent-soft: #ebe9ff;
    --card-bg: #ffffff;
    --layout-bg: #eef2ff;
    --text-muted: #6b7280;
    --success-soft: #d1fae5;
    --warning-soft: #fef3c7;
    --danger-soft: #fee2e2;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    background: radial-gradient(circle at top, #f1f5ff, #e2e8f0 65%, #dee1ef);
    min-height: 100vh;
    color: #0f172a;
}

.hidden {
    display: none !important;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    flex: 0 0 250px;
    background: #0f172a;
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 2rem;
}

.sidebar .brand {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sidebar .brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border-radius: 0.65rem;
    padding: 0.5rem 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar .nav-link::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.2s ease;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar .nav-link.active::before {
    background: #fff;
}

.offcanvas-nav .nav-link.active {
    font-weight: 600;
    color: var(--accent);
}

.app-content {
    background: transparent;
}

.app-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(12px);
}

.card {
    border: 1px solid rgba(15, 23, 42, 0.04);
    border-radius: 1rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    background: var(--card-bg);
}

.alert {
    border-radius: 0.9rem;
    font-weight: 600;
    padding: 0.85rem 1.1rem;
    border: 1px solid transparent;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #047857;
}

/* Instances grid cards for better contrast */
#instances-list .card {
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

#instances-list .card .card-body {
    background: transparent;
}

#companies-list .card {
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

#companies-list .card .card-body {
    background: transparent;
}

#users-list .card {
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

#users-list .card .card-body {
    background: transparent;
}

#notifications-list .card {
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

#notifications-list .card .card-body {
    background: transparent;
}

/* HR style for notifications separator */
.notifications-hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.25), rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.25));
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}

/* Notifications message toggle */
.notif-message {
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease, border 0.2s ease;
}
.notif-message.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
}
.notif-message.expanded {
    max-height: 300px;
    opacity: 1;
    overflow: auto;
}
.notif-toggle {
    text-align: right;
    margin-top: 4px;
}

.alert-danger {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(239, 68, 68, 0.35);
    color: #b91c1c;
}

.alert-placeholder {
    width: 100%;
}

.card-stat {
    border: none;
    border-radius: 1.2rem;
    min-height: 180px;
    padding: 1.2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2);
    background: var(--brand-gradient);
}

.card-stat::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.4), transparent);
    opacity: 0.6;
}

.card-stat .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.card-stat .stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.card-stat .stat-value {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 0.25rem;
    position: relative;
    z-index: 1;
}
.card h5,
.card h6 {
    font-weight: 600;
}

.table {
    border-color: rgba(15, 23, 42, 0.04);
}

.table thead {
    background: rgba(104, 87, 255, 0.05);
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.btn-outline-primary {
    border-color: rgba(104, 87, 255, 0.4);
    color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    color: #fff;
}

.btn-outline-danger {
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.4);
}

.btn-outline-danger:hover {
    background: #f43f5e;
    color: #fff;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 98px;
    padding: 0.25rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-open {
    background: #22c55e1a;
    color: #15803d;
}

.status-connecting,
.status-qrcode,
.status-unknown {
    background: #facc151a;
    color: #b45309;
}

.status-close {
    background: #fda4af1a;
    color: #be123c;
}

.copy-toast {
    position: absolute;
    padding: 0.5rem 0.85rem;
    border-radius: 0.7rem;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 0.75rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1055;
    pointer-events: none;
}

.copy-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1080;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.confirm-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.confirm-dialog {
    background: #fff;
    border-radius: 0.9rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.3);
    width: 340px;
    max-width: 92%;
}

.confirm-dialog .actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.qr-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1070;
    padding: 1rem;
}

.qr-card {
    max-width: 520px;
    width: 100%;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

.whatsapp-card {
    border-radius: 0.75rem;
    box-shadow: inset 0 0 0 1px rgba(134, 151, 168, 0.1);
}

.auth-wrapper {
    min-height: 100vh;
    background: radial-gradient(circle at top, #312e81, #111827 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.35);
}

.auth-illustration {
    background: var(--brand-gradient);
    color: #fff;
    padding: 2rem;
}

.auth-illustration h1 {
    font-size: 1.9rem;
    font-weight: 700;
}

.auth-illustration p {
    color: rgba(255, 255, 255, 0.8);
}

.auth-form {
    padding: 2rem;
}

@media (max-width: 991px) {
    .sidebar {
        display: none;
    }
}
