@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #e8eaf0;
    --primary-light: #f0f1f5;
    --primary-lighter: #dce1ed;
    --accent-blue: #4361ee;
    --accent-blue-light: #4895ef;
    --accent-purple: #7209b7;
    --accent-purple-light: #9d4edd;
    --success: #06d6a0;
    --success-light: #06d6a01a;
    --warning: #f77f00;
    --warning-light: #f77f001a;
    --danger: #ef476f;
    --danger-light: #ef476f1a;
    --bg-body: #f5f6fa;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(248, 249, 250, 1);
    --bg-input: #ffffff;
    --border-color: rgba(0, 0, 0, 0.12);
    --border-light: rgba(0, 0, 0, 0.06);
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== SIDEBAR NAVIGATION ========== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    padding: 1.25rem 1rem 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-brand-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition-slow), width var(--transition-slow);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 0.25rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-nav .nav-item:hover {
    background: rgba(67, 97, 238, 0.1);
    color: var(--accent-blue);
}

.sidebar-nav .nav-item.active {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.15), rgba(114, 9, 183, 0.1));
    color: var(--accent-blue);
    font-weight: 600;
}

.sidebar-nav .nav-item i,
.sidebar-nav .nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 1rem 0.5rem;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem;
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
    box-sizing: border-box;
    transition: margin-left var(--transition-slow), width var(--transition-slow);
}

.container {
    max-width: 100%;
    margin: 0;
}

.content-section {
    display: none;
    animation: slideUp 0.35s ease;
}

.content-section.active {
    display: block;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h3,
.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0 0 0.25rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ========== GLASSMORPHISM CARDS ========== */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-normal);
    animation: slideUp 0.4s ease;
}

.card:hover {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1.25rem;
}

.card-header {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-primary);
}

/* ========== DASHBOARD STAT CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stats-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: slideUp 0.4s ease;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stats-card:nth-child(1)::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-light)); }
.stats-card:nth-child(2)::before { background: linear-gradient(90deg, var(--success), #34ebc6); }
.stats-card:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-purple-light)); }
.stats-card:nth-child(4)::before { background: linear-gradient(90deg, var(--warning), #ffb347); }

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

.stats-number {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stats-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stats-icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(67, 97, 238, 0.1);
    color: var(--accent-blue);
}

.chart-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-height: 300px;
}

/* ========== MODERN TABLES ========== */
.table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table thead th,
.table-sm th {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: rgba(248, 249, 250, 0.9);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.table thead th:hover,
.table-sm th:hover {
    background: rgba(241, 243, 245, 1);
    color: var(--text-primary);
}

.table-sm th .sort-icon {
    margin-left: 4px;
    font-size: 0.65rem;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.table-sm th.sorted .sort-icon {
    opacity: 1;
    color: var(--accent-blue);
}

.table tbody td,
.table-sm td {
    padding: 0.35rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
    line-height: 1.4;
    font-size: 0.82rem;
}

.btn-icon {
    padding: 0.2rem 0.45rem;
    line-height: 1;
    font-size: 0.8rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-responsive {
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    overflow: auto;
}

.customer-row:hover,
.event-row:hover {
    background-color: rgba(67, 97, 238, 0.06) !important;
}

.customer-row td {
    font-size: 0.875rem;
}

.customer-row .fw-medium {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.customer-row .badge {
    font-size: 0.7rem;
}

.event-row td {
    font-size: 0.875rem;
}

/* ========== STATUS BADGES ========== */
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-draft {
    background: rgba(108, 117, 125, 0.12);
    color: #5a6370;
    border: 1px solid rgba(108, 117, 125, 0.25);
}

.status-published {
    background: rgba(6, 214, 160, 0.12);
    color: #059669;
    border: 1px solid rgba(6, 214, 160, 0.25);
}

.status-confirmed {
    background: rgba(67, 97, 238, 0.12);
    color: #3b5bdb;
    border: 1px solid rgba(67, 97, 238, 0.25);
}

.status-tentative {
    background: rgba(247, 127, 0, 0.12);
    color: #d96800;
    border: 1px solid rgba(247, 127, 0, 0.25);
}

.status-cancelled {
    background: rgba(239, 71, 111, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 71, 111, 0.25);
}

.status-completed {
    background: rgba(114, 9, 183, 0.12);
    color: #7c3aed;
    border: 1px solid rgba(114, 9, 183, 0.25);
}

.customer-type-individual {
    background: rgba(67, 97, 238, 0.1);
    color: #3b5bdb;
    border: 1px solid rgba(67, 97, 238, 0.2);
}

.customer-type-business {
    background: rgba(114, 9, 183, 0.1);
    color: #7c3aed;
    border: 1px solid rgba(114, 9, 183, 0.2);
}

.customer-type-enterprise {
    background: rgba(247, 127, 0, 0.1);
    color: #d96800;
    border: 1px solid rgba(247, 127, 0, 0.2);
}

/* ========== BUTTONS ========== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.35);
    background: linear-gradient(135deg, var(--accent-blue-light), var(--accent-purple));
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #34ebc6);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #ff6b8a);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.btn-outline-primary:hover {
    background: rgba(67, 97, 238, 0.08);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

/* ========== FORM INPUTS ========== */
.form-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-select {
    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='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mb-3 {
    margin-bottom: 1rem !important;
    position: relative;
}

/* ========== CALENDAR ========== */
#calendar {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--glass-border);
}

.fc {
    --fc-border-color: var(--border-light);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: rgba(248, 249, 250, 0.8);
    --fc-today-bg-color: rgba(67, 97, 238, 0.06);
}

.fc-event {
    cursor: pointer;
    font-size: 0.75rem !important;
    padding: 2px 6px !important;
    border-radius: var(--radius-sm) !important;
    line-height: 1.4 !important;
    border: none !important;
}

.fc-event:hover {
    filter: brightness(0.95);
}

.fc-event.fc-event-dragging {
    opacity: 0.85;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: grabbing;
    z-index: 9999 !important;
    position: fixed !important;
}

.fc-event.fc-event-mirror {
    opacity: 0.5;
    box-shadow: none;
}

.fc .fc-daygrid-event {
    margin-top: 2px !important;
    margin-bottom: 1px !important;
}

.fc .fc-daygrid-day-frame {
    min-height: 100px;
}

.fc .fc-col-header-cell {
    padding: 0.6rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(248, 249, 250, 0.95);
    color: var(--text-primary);
    border: none;
}

.fc .fc-col-header-cell a {
    color: var(--text-primary) !important;
    text-decoration: none;
}

.fc .fc-toolbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fc .fc-button {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    background: rgba(67, 97, 238, 0.1);
    border: 1px solid rgba(67, 97, 238, 0.25);
    color: var(--accent-blue);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.fc .fc-button:hover {
    background: rgba(67, 97, 238, 0.2);
}

.fc .fc-button-active {
    background: var(--accent-blue) !important;
    color: white !important;
}

.fc .fc-daygrid-day-number {
    font-size: 0.8rem;
    padding: 4px 8px;
    color: var(--text-secondary);
}

.fc .fc-daygrid-day-top {
    text-align: right;
}

.fc .fc-daygrid-day.fc-day-today {
    background: rgba(67, 97, 238, 0.04);
}

.fc-event-custom {
    border-left: 3px solid var(--success) !important;
    background: rgba(6, 214, 160, 0.08) !important;
    color: var(--text-primary) !important;
    padding: 3px 6px !important;
    margin-bottom: 2px !important;
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
}

.fc-event-custom .fc-event-title {
    white-space: normal !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== MODALS ========== */
.modal-backdrop {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.06), rgba(114, 9, 183, 0.04));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.modal-header .btn-close {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
}

/* ========== EVENT & DETAIL VIEWS ========== */
.event-card {
    transition: all var(--transition-normal);
    cursor: pointer;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: var(--radius-md);
}

.event-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.event-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.event-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.event-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.detail-view-modal .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

.detail-view-modal .detail-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-view-modal .detail-value {
    color: var(--text-primary);
}

.detail-view-modal .notes-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.detail-view-modal .notes-text {
    color: var(--warning);
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.6;
}

.notes-text table,
.detail-view-modal .notes-text table {
    border-collapse: collapse;
    margin: 0.5rem 0;
    max-width: 100%;
    white-space: normal;
}
.notes-text table th,
.notes-text table td,
.detail-view-modal .notes-text table th,
.detail-view-modal .notes-text table td {
    border: 1px solid var(--border-light, #ccc);
    padding: 0.25rem 0.5rem;
    vertical-align: top;
}
.notes-text ul,
.notes-text ol,
.detail-view-modal .notes-text ul,
.detail-view-modal .notes-text ol {
    padding-left: 1.4rem;
    margin: 0.25rem 0;
    white-space: normal;
}

/* ========== DROPDOWN VALUES ========== */
.dropdown-value-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.375rem;
    background: var(--bg-card);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.dropdown-value-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border);
}

.dropdown-value-actions {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

/* ========== AI CHAT PANEL ========== */
.ai-chat-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(67, 97, 238, 0.3);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.ai-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(67, 97, 238, 0.4);
}

.ai-chat-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--glass-border);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
    z-index: 250;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-slow);
}

.ai-chat-panel.open {
    right: 0;
    animation: slideInRight 0.4s ease;
}

.ai-chat-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.06), rgba(114, 9, 183, 0.04));
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
    animation: slideUp 0.25s ease;
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: rgba(248, 249, 250, 1);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.ai-chat-input {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.5rem;
}

.ai-chat-input input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.ai-chat-input input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
    outline: none;
}

.ai-chat-input button {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

/* ========== AI EMAIL PARSER ========== */
.email-parser-section {
    animation: slideUp 0.4s ease;
}

.email-parser-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

.email-parser-card .card-header {
    background: transparent;
    border: none;
    padding: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.email-parser-card .card-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.email-parser-results {
    background: rgba(248, 249, 250, 0.9);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
}

.email-parser-results .result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.email-parser-results .result-item:last-child {
    border-bottom: none;
}

.email-parser-results .result-label {
    color: var(--text-muted);
    font-weight: 500;
}

.email-parser-results .result-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ========== LIST GROUP ========== */
.list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 0.6rem 0.875rem;
    font-size: 0.85rem;
    background: transparent;
    color: var(--text-primary);
}

.list-group-item:last-child {
    border-bottom: none;
}

/* ========== ALERTS ========== */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    backdrop-filter: blur(8px);
}

.alert-success {
    background: var(--success-light);
    color: #059669;
    border: 1px solid rgba(6, 214, 160, 0.2);
}

.alert-danger {
    background: var(--danger-light);
    color: #dc2626;
    border: 1px solid rgba(239, 71, 111, 0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: #d96800;
    border: 1px solid rgba(247, 127, 0, 0.2);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    min-width: 320px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    animation: slideInRight 0.35s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
}

/* ========== LOADING SPINNER ========== */
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

.loading-spinner-sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

/* ========== CUSTOMER SUGGESTIONS ========== */
#customer-suggestions {
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-top: 2px;
}

.customer-suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.customer-suggestion:hover {
    background: rgba(67, 97, 238, 0.08);
}

#customer-suggestions .list-group-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
}

#customer-suggestions .list-group-item:hover {
    background: rgba(67, 97, 238, 0.08);
}

/* ========== BRREG AUTOCOMPLETE ========== */
.brreg-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.brreg-autocomplete-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    transition: background var(--transition-fast);
}

.brreg-autocomplete-item:hover {
    background: rgba(67, 97, 238, 0.08);
}

.brreg-company-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.brreg-company-details {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.brreg-no-results, .brreg-loading {
    padding: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    font-size: 0.85rem;
}

.brreg-message {
    margin-bottom: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: none;
}

#customer-company:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.12);
}

#business-info {
    background: rgba(248, 249, 250, 0.9);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.875rem;
    margin-top: 0.75rem;
}

#business-info h6 {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.4rem;
}

#business-info .form-control[readonly] {
    background: rgba(248, 249, 250, 0.8);
    opacity: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-color: var(--border-light);
}

/* ========== QUILL EDITOR ========== */
.quill-editor, #event-description-editor {
    font-size: 0.875rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.ql-toolbar {
    padding: 6px !important;
    border-color: var(--border-color) !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
    background: rgba(248, 249, 250, 0.9);
}

.ql-toolbar .ql-formats {
    margin-right: 8px !important;
}

.ql-toolbar .ql-stroke {
    stroke: var(--text-secondary) !important;
}

.ql-toolbar .ql-fill {
    fill: var(--text-secondary) !important;
}

.ql-toolbar .ql-picker-label {
    color: var(--text-secondary) !important;
}

.ql-container {
    border-color: var(--border-color) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

#event-description-editor {
    height: 120px !important;
}

/* ========== LOGIN WRAPPER ========== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-body);
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--glass-shadow);
    animation: slideUp 0.5s ease;
}

.login-brand {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    margin-bottom: 2rem;
}

/* ========== SIDEBAR NAV ITEMS ========== */
.sidebar-logo {
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-subtitle {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* ========== SIDEBAR COLLAPSE BUTTON ========== */
.sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-slow);
    line-height: 1;
    padding: 0;
}
.sidebar-collapse-btn:hover {
    background: var(--primary-light);
    color: var(--text-primary);
}

/* ========== SIDEBAR COLLAPSED STATE ========== */
.sidebar.sidebar-collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.sidebar-collapsed .sidebar-brand-inner {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}
.sidebar.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}
.sidebar.sidebar-collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
    margin: 0 auto;
}
.sidebar.sidebar-collapsed .nav-label {
    display: none;
}
.sidebar.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}
.sidebar.sidebar-collapsed .nav-icon {
    margin: 0;
}
.sidebar.sidebar-collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
}

.sidebar-collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-item:hover {
    background: rgba(67, 97, 238, 0.08);
    color: var(--accent-blue);
}

.sidebar-nav .nav-item.active {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.15), rgba(114, 9, 183, 0.1));
    color: var(--accent-blue);
    font-weight: 600;
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-user {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* ========== STATS ROW ========== */
.dashboard-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dash-filter-btn {
    padding: 0.35rem 0.9rem;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 2rem;
    background: var(--glass-bg, rgba(255,255,255,0.7));
    color: var(--text-secondary, #64748b);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.dash-filter-btn:hover {
    border-color: var(--accent-blue, #4361ee);
    color: var(--accent-blue, #4361ee);
    background: rgba(67,97,238,0.07);
}

.dash-filter-btn.active {
    background: var(--accent-blue, #4361ee);
    border-color: var(--accent-blue, #4361ee);
    color: #fff;
    box-shadow: 0 2px 8px rgba(67,97,238,0.25);
}

.dashboard-custom-dates {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.dash-date-label {
    font-size: 0.82rem;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
    margin-bottom: 0;
}

.dash-date-input {
    width: 140px;
    font-size: 0.85rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: slideUp 0.4s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-light)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--success), #34ebc6); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-purple-light)); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--warning), #ffb347); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ========== CHARTS ROW ========== */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-height: 300px;
    position: relative;
    height: 350px;
}

.chart-card canvas {
    max-height: 280px !important;
}

.chart-card h6 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
}

/* ========== AI CHAT FAB ========== */
.ai-chat-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(67, 97, 238, 0.3);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.ai-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(67, 97, 238, 0.4);
}

/* ========== AI CHAT INPUT AREA ========== */
.ai-chat-input-area {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.5rem;
}

.ai-chat-input-area input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.ai-chat-input-area input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
    outline: none;
}

.ai-chat-input-area button {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

/* ========== SIDEBAR TOGGLE MOBILE ========== */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 150;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.25rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: rgba(67, 97, 238, 0.1);
}

/* ========== NAVBAR (legacy support) ========== */
.navbar {
    padding: 0.5rem 1rem;
    background: var(--glass-bg) !important;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}

.navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary) !important;
}

.nav-tabs {
    margin-bottom: 1rem !important;
    border-bottom: 1px solid var(--border-light);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    color: var(--accent-blue);
    border: none;
    background: rgba(67, 97, 238, 0.06);
}

.nav-tabs .nav-link.active {
    color: white;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
}

/* ========== UTILITY ========== */
.row {
    --bs-gutter-x: 1rem;
}

.container.mt-4 {
    margin-top: 1.5rem !important;
}

.d-flex.justify-content-between.align-items-center.mb-3 {
    margin-bottom: 1rem !important;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ========== MOBILE TOPBAR + BACKDROP ========== */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 140;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}

.mobile-brand {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-menu-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

body.sidebar-open {
    overflow: hidden;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .sidebar-brand-text,
    .sidebar-nav-item span,
    .sidebar-section-label {
        display: none;
    }
    .main-content {
        margin-left: var(--sidebar-collapsed);
        width: calc(100% - var(--sidebar-collapsed));
    }
    .detail-view-modal .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-topbar { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        width: min(86vw, var(--sidebar-width));
        z-index: 200;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
    }
    .sidebar.mobile-open,
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-brand-text,
    .sidebar-nav-item span,
    .sidebar-section-label {
        display: revert;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    .container { padding: 0 0.75rem; }
    .modal-dialog { margin: 0.5rem; }
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl { max-width: calc(100% - 1rem); }
    .modal-body { padding: 1rem; max-height: calc(100vh - 8rem); overflow-y: auto; }
    #inboxEmailModal .modal-body { max-height: none; overflow: hidden; padding: 0; }
    .modal-header { padding: 1rem; }
    .modal-footer { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .dashboard-filter-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .dash-filter-btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.75rem;
    }
    .dash-date-input {
        width: 120px;
    }
    .stats-grid, .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .stats-card, .stat-card {
        padding: 1rem;
    }
    .stats-number, .stat-value {
        font-size: 1.5rem;
    }
    .charts-row {
        grid-template-columns: 1fr !important;
    }
    .ai-chat-panel {
        width: 100%;
        right: -100%;
    }
    .detail-view-modal .detail-grid {
        grid-template-columns: 1fr;
    }
    .nav-tabs { flex-wrap: wrap; }
    .nav-tabs .nav-item { margin-bottom: 0.25rem; }

    /* Touch-friendly inputs / buttons */
    .form-control, .form-select {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 0.7rem 0.875rem;
    }
    .btn { padding: 0.65rem 1rem; min-height: 44px; }
    .btn-sm { padding: 0.5rem 0.75rem; min-height: 36px; }
    .table-responsive { -webkit-overflow-scrolling: touch; }

    /* Page header: stack title and actions */
    .page-header.d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .page-header h2 { font-size: 1.4rem; }

    /* Calendar more compact */
    .fc .fc-toolbar { flex-wrap: wrap; gap: 0.5rem; }
    .fc .fc-toolbar-title { font-size: 1rem; }
    .fc .fc-button { padding: 0.4rem 0.6rem; font-size: 0.75rem; }
    .fc .fc-daygrid-day-frame { min-height: 60px; }

    /* AI chat FAB out of the way of bottom UI */
    .ai-chat-btn, .ai-chat-fab {
        bottom: 1rem;
        right: 1rem;
        width: 52px;
        height: 52px;
    }

    /* Toasts span full width on small screens */
    .toast-container {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    .toast { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid, .stats-row {
        grid-template-columns: 1fr;
    }
    .table-sm td,
    .table-sm th {
        padding: 0.5rem 0.5rem;
        font-size: 0.78rem;
    }
}

/* Safe-area for notch devices when installed as PWA */
@supports (padding: env(safe-area-inset-top)) {
    .mobile-topbar {
        padding-top: env(safe-area-inset-top);
        height: calc(56px + env(safe-area-inset-top));
    }
    .sidebar {
        padding-top: env(safe-area-inset-top);
    }
}

.msg-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-input);
}

.msg-dropzone:hover,
.msg-dropzone.drag-over {
    border-color: var(--accent-blue);
    background: rgba(67, 97, 238, 0.05);
}

.msg-dropzone.drag-over {
    transform: scale(1.01);
}

/* Multi-select filter dropdown (Arrangementer page) */
.ms-filter-dropdown {
    position: relative;
    display: inline-block;
}
.ms-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 14px;
    line-height: 1.4;
    white-space: nowrap;
}
.ms-filter-toggle .ms-filter-count {
    font-weight: 600;
    margin-left: 2px;
}
.ms-filter-toggle .ms-filter-clear {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    opacity: 0.85;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 2px;
}
.ms-filter-toggle .ms-filter-clear:hover {
    opacity: 1;
}
.ms-filter-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1050;
    min-width: 220px;
    max-width: 320px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 8px;
}
.ms-filter-panel[hidden] { display: none; }
.ms-filter-search-wrap { margin-bottom: 6px; }
.ms-filter-search { font-size: 0.8rem; }
.ms-filter-options {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ms-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    margin: 0;
    user-select: none;
}
.ms-filter-option:hover { background: #f4f4f8; }
.ms-filter-option input[type="checkbox"] {
    margin: 0;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}
.ms-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex: 0 0 auto;
}
.ms-filter-option-label {
    flex: 1 1 auto;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 576px) {
    .ms-filter-panel {
        min-width: 200px;
        max-width: 90vw;
    }
    .ms-filter-option { padding: 8px; font-size: 0.88rem; }
    .ms-filter-option input[type="checkbox"] { width: 18px; height: 18px; }
}

/* ========== CALENDAR VIEW SELECTOR ========== */
.cal-view-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.cal-view-btn {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.03);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
}
.cal-view-btn:hover {
    background: rgba(67,97,238,0.08);
    color: var(--accent-blue);
    border-color: rgba(67,97,238,0.3);
}
.cal-view-btn.active {
    background: linear-gradient(135deg, rgba(67,97,238,0.15), rgba(114,9,183,0.1));
    color: var(--accent-blue);
    border-color: rgba(67,97,238,0.4);
    font-weight: 600;
}

/* ========== SHARED ALT VIEW HEADER ========== */
.cal-alt-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}
.cal-alt-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}
.cal-timeline-mode-btns {
    display: flex;
    gap: 0.35rem;
}

/* ========== AGENDA VIEW ========== */
#calendar-agenda {
    animation: slideUp 0.3s ease;
}
.cal-agenda-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}
.cal-agenda-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.cal-agenda-day {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.cal-agenda-day-header {
    padding: 0.6rem 1rem;
    background: rgba(67,97,238,0.07);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-light);
}
.cal-agenda-event {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.cal-agenda-event:last-child {
    border-bottom: none;
}
.cal-agenda-event:hover {
    background: rgba(67,97,238,0.05) !important;
}
.cal-agenda-event-time {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 90px;
    padding-top: 2px;
}
.cal-agenda-event-info {
    flex: 1;
    min-width: 0;
}
.cal-agenda-event-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-agenda-event-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 2px;
    flex-wrap: wrap;
}
.cal-agenda-event-meta span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.cal-agenda-event-meta span + span::before {
    content: '·';
    margin-right: 0.5rem;
}
.cal-agenda-event-status {
    flex-shrink: 0;
}

/* ========== TIMELINE VIEW ========== */
#calendar-timeline {
    animation: slideUp 0.3s ease;
}
.cal-timeline-wrap {
    overflow-x: auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}
.cal-timeline-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 700px;
    font-size: 0.8rem;
}
.cal-timeline-table thead th {
    padding: 0.5rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: rgba(248,249,250,0.95);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    text-align: center;
}
.cal-timeline-table thead th.cal-timeline-today-hdr {
    background: rgba(67,97,238,0.1);
    color: var(--accent-blue);
}
.cal-timeline-room-col {
    min-width: 120px;
    text-align: left !important;
}
.cal-timeline-room-name {
    padding: 0.5rem 0.75rem !important;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: rgba(248,249,250,0.6);
    border-right: 1px solid var(--border-light);
    white-space: nowrap;
    vertical-align: top !important;
}
.cal-timeline-cell {
    padding: 0.3rem !important;
    vertical-align: top !important;
    min-width: 100px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}
.cal-timeline-cell.cal-timeline-today-cell {
    background: rgba(67,97,238,0.04);
}
.cal-timeline-event {
    display: block;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    margin-bottom: 0.2rem;
    cursor: pointer;
    transition: filter var(--transition-fast);
    overflow: hidden;
}
.cal-timeline-event:hover {
    filter: brightness(0.94);
}
.cal-timeline-event-time {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: block;
    white-space: nowrap;
}
.cal-timeline-event-title {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Day mode timeline */
.cal-timeline-day-wrap {
    min-width: 0;
}
.cal-timeline-day-table {
    table-layout: fixed;
    min-width: 900px;
}
.cal-timeline-hour-hdr {
    min-width: 60px !important;
    font-size: 0.65rem !important;
    padding: 0.35rem 0.25rem !important;
}
.cal-timeline-hours-cell {
    padding: 0 !important;
    position: relative;
    height: 48px;
    vertical-align: middle !important;
}
.cal-timeline-hours-row {
    display: flex;
    height: 100%;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.cal-timeline-hour-slot {
    flex: 1;
    border-right: 1px solid var(--border-light);
    height: 100%;
}
.cal-timeline-abs-event {
    position: absolute;
    top: 4px;
    bottom: 4px;
    border-radius: 4px;
    padding: 1px 4px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: filter var(--transition-fast);
    min-width: 24px;
    z-index: 1;
}
.cal-timeline-abs-event:hover {
    filter: brightness(0.92);
    z-index: 2;
}

/* ========== HEATMAP VIEW ========== */
#calendar-heatmap {
    animation: slideUp 0.3s ease;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}
.cal-heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.cal-heatmap-year {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
}
.cal-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.cal-heatmap-legend-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.cal-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.25rem;
}
.cal-heatmap-month {
    min-width: 0;
}
.cal-heatmap-month-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cal-heatmap-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-heatmap-day-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: 1px 0;
    text-transform: uppercase;
}
.cal-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform var(--transition-fast), filter var(--transition-fast);
    color: transparent;
    min-height: 14px;
    min-width: 14px;
}
.cal-heatmap-cell:not(.empty):hover {
    transform: scale(1.25);
    color: var(--text-primary) !important;
    filter: brightness(0.9);
    z-index: 1;
    position: relative;
}
.cal-heatmap-cell.empty {
    cursor: default;
    background: transparent;
}
.cal-heatmap-cell.intensity-0 {
    background: rgba(67,97,238,0.06);
    color: transparent;
}
.cal-heatmap-cell.intensity-1 {
    background: rgba(67,97,238,0.22);
}
.cal-heatmap-cell.intensity-2 {
    background: rgba(67,97,238,0.42);
}
.cal-heatmap-cell.intensity-3 {
    background: rgba(67,97,238,0.62);
}
.cal-heatmap-cell.intensity-4 {
    background: rgba(67,97,238,0.82);
}
.cal-heatmap-cell.today {
    outline: 2px solid var(--accent-blue);
    outline-offset: 1px;
}

@media (max-width: 768px) {
    .cal-heatmap-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }
    .cal-timeline-day-table {
        min-width: 600px;
    }
}
@media (max-width: 480px) {
    .cal-alt-title { font-size: 0.85rem; }
    .cal-agenda-event-time { min-width: 72px; }
}
