:root {
    color-scheme: light;
    --bg-body: #f5f7fb;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-muted: #eef2ff;
    --text-primary: #1f2933;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-soft: rgba(148, 163, 184, 0.2);
    --shadow-strong: 0 14px 40px rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-navbar: 0 8px 24px rgba(15, 23, 42, 0.06);
    --accent: #0d6efd;
    --timeline-gradient: linear-gradient(180deg, #0d6efd 0%, rgba(13,110,253,0.2) 100%);
    --timeline-dot-border: #f5f7fb;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg-body: #0b1220;
    --bg-surface: #111c34;
    --bg-subtle: #0f172a;
    --bg-muted: #17233b;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5f5;
    --text-muted: #94a3b8;
    --border-soft: rgba(148, 163, 184, 0.25);
    --shadow-strong: 0 16px 44px rgba(3, 7, 18, 0.6);
    --shadow-soft: 0 14px 32px rgba(3, 7, 18, 0.5);
    --shadow-navbar: 0 10px 26px rgba(3, 7, 18, 0.6);
    --accent: #4f8bff;
    --timeline-gradient: linear-gradient(180deg, rgba(79, 139, 255, 0.9) 0%, rgba(79, 139, 255, 0.25) 100%);
    --timeline-dot-border: #0b1220;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--accent);
}

.navbar {
    background-color: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-navbar);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.1rem;
}

.navbar .navbar-brand,
.navbar .nav-link,
.navbar .navbar-toggler {
    color: var(--text-primary);
}

.navbar .nav-link.active,
.navbar .nav-link:focus,
.navbar .nav-link:hover {
    color: var(--accent);
}

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background-color: transparent;
    border: 0;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    color: var(--text-primary);
    font-weight: 500;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.user-menu-toggle:hover,
.user-menu.open .user-menu-toggle {
    background-color: var(--bg-muted);
    box-shadow: var(--shadow-soft);
}

.user-menu-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.user-menu-toggle .user-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.user-menu-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.user-menu-toggle:hover .user-menu-arrow,
.user-menu.open .user-menu-arrow {
    background-color: var(--accent);
    color: #ffffff;
}

.user-avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), rgba(13, 110, 253, 0.55));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

html[data-theme="dark"] .user-avatar {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.user-caret {
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

.user-menu.open .user-caret {
    transform: rotate(180deg);
}

.dropdown-menu.user-dropdown {
    min-width: 19rem;
    border: 0;
    border-radius: 1rem;
    padding: 1rem;
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-soft);
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    transform-origin: right top;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.dropdown-menu.user-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-dropdown-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.85rem;
    background-color: var(--bg-muted);
    font-size: 1.1rem;
    color: var(--accent);
}

.user-dropdown-meta .user-dropdown-title {
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown-meta .user-dropdown-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-dropdown-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.5rem;
    border-radius: 0.75rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.user-dropdown-option:focus {
    outline: none;
}

.user-dropdown-option:hover,
.user-dropdown-option:focus-visible {
    background-color: var(--bg-muted);
    transform: translateY(-1px);
}

.option-leading {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.75rem;
    background-color: rgba(13, 110, 253, 0.12);
    font-size: 1.1rem;
    flex-shrink: 0;
}

html[data-theme="dark"] .option-icon {
    background-color: rgba(79, 139, 255, 0.18);
}

.option-label {
    font-weight: 600;
    color: var(--text-primary);
}

.option-description {
    font-size: 0.8rem;
}

.user-dropdown-status {
    min-height: 1rem;
}

.user-dropdown-logout {
    border-radius: 0.75rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.user-dropdown-logout:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

html[data-theme="dark"] .user-dropdown-logout:hover {
    background-color: rgba(220, 53, 69, 0.18);
}

.user-dropdown .form-check-input {
    cursor: pointer;
}

.dropdown-menu.user-dropdown .dropdown-divider {
    margin: 0.75rem 0;
    border-color: var(--border-soft);
}

.theme-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-primary);
    transition: color 0.2s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.theme-toggle-label.rotating {
    transform: rotate(360deg);
}

.theme-toggle-label .theme-icon {
    width: 1.2rem;
    height: 1.2rem;
    display: none;
}

html[data-theme="light"] .theme-toggle-label .theme-icon-sun,
html[data-theme="dark"] .theme-toggle-label .theme-icon-moon {
    display: inline-block;
}

html[data-theme="light"] .theme-toggle-label .theme-icon-sun {
    color: #fbbf24;
}

html[data-theme="dark"] .theme-toggle-label .theme-icon-moon {
    color: #f8fafc;
}

.stat-card {
    border-radius: 16px;
}

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-muted);
    color: var(--accent);
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-badge i {
    line-height: 1;
}

.feature-icon {
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.35rem;
}

.brand-icon {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.15rem;
    border-radius: 0.9rem;
}

.stat-icon {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.25rem;
}

.section-icon {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.1rem;
    border-radius: 0.9rem;
    background-color: var(--bg-subtle);
}

.timeline-icon {
    width: 2.35rem;
    height: 2.35rem;
    font-size: 1.05rem;
    border-radius: 0.75rem;
    background-color: var(--bg-subtle);
    box-shadow: none;
}

.alert-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
    border-radius: 999px;
    background-color: rgba(220, 53, 69, 0.16);
    color: #dc3545;
    box-shadow: none;
}

.alert-icon-warning {
    background-color: rgba(255, 193, 7, 0.22);
    color: #ffc107;
}

.card:hover .icon-badge {
    transform: translateY(-2px);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.page-title-group .page-title {
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card {
    background-color: var(--bg-surface);
    border-color: var(--border-soft);
    box-shadow: var(--shadow-strong);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.card.shadow-sm {
    box-shadow: var(--shadow-soft) !important;
}

.list-group-item {
    background-color: var(--bg-surface);
    border-color: var(--border-soft);
    color: inherit;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.badge.text-bg-light {
    color: var(--text-primary);
    background-color: var(--bg-subtle) !important;
    border: 1px solid var(--border-soft);
}

.badge.text-bg-primary {
    box-shadow: 0 8px 18px rgba(13, 110, 253, 0.45);
}

.dropdown-menu {
    background-color: var(--bg-surface);
    border-color: var(--border-soft);
    color: var(--text-primary);
}

.dropdown-item {
    color: inherit;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: rgba(13, 110, 253, 0.12);
    color: var(--accent);
}

.navbar .nav-link .nav-icon {
    margin-right: 0.55rem;
    font-size: 1.05rem;
}

.navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding-inline: 0.75rem;
}

.navbar .nav-link.active {
    font-weight: 600;
}

.nav-pills .nav-link .bi {
    margin-right: 0.35rem;
}

.nav-pills .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.form-control,
.form-select {
    color: inherit;
    background-color: var(--bg-surface);
    border-color: var(--border-soft);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(13, 110, 253, 0.4);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.table {
    color: inherit;
}

.table thead th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background-color: var(--bg-subtle);
    border-bottom: 1px solid var(--border-soft);
}

.table tbody tr {
    border-color: var(--border-soft);
}

.alert {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-soft);
}

.list-group-timeline {
    max-height: 320px;
    overflow-y: auto;
}

.question-item {
    transition: background-color 0.2s ease;
}

.question-item .bi-chevron-right {
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.6;
}

.question-item:hover {
    background-color: var(--bg-subtle);
}

.question-item:hover .bi-chevron-right {
    transform: translateX(4px);
    opacity: 1;
}

.table thead th .bi {
    margin-right: 0.35rem;
    font-size: 1rem;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.timeline {
    position: relative;
    margin-left: 1rem;
    padding-left: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.3rem;
    top: 0.2rem;
    bottom: 0.2rem;
    width: 2px;
    background: var(--timeline-gradient);
}

.timeline-item {
    margin-bottom: 1.5rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.15rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--timeline-dot-border);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.timeline-item-user::before {
    background-color: #6c757d;
}

.timeline-item-aska::before {
    background-color: var(--accent);
}

.timeline-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.25rem;
    margin-left: -0.5rem;
    color: var(--text-muted);
}

.timeline-bubble {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-author {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.toast {
    opacity: 1;
}
