/* CSS Variables - MSC Brand Colors - Dark Theme */
:root {
    /* MSC Brand Colors */
    --msc-blue-dark: #0494c8;
    --msc-blue-medium: #57b0d7;
    --msc-blue-light: #94cbe5;
    --msc-grey: #7e8586;
    --msc-orange: #ff8400;
    
    /* Dark Theme - Professional Corporate */
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --bg-active: #1e3a5f;
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    /* Accent Colors */
    --accent: #0494c8;
    --accent-hover: #06b6d4;
    --accent-light: #57b0d7;
    --accent-lighter: #94cbe5;
    --accent-pale: rgba(4, 148, 200, 0.15);
    
    /* Semantic Colors */
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #0494c8;
    --info-light: rgba(4, 148, 200, 0.15);
    
    /* Borders & Shadows */
    --border-light: #334155;
    --border-medium: #475569;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    
    /* Layout */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Legacy variables for compatibility */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --border: #334155;
    --shadow: var(--shadow-md);
    --sidebar-width: 260px;
    
    /* Typography Scale - Compact */
    --font-xs: 0.675rem;
    --font-sm: 0.8rem;
    --font-base: 0.9rem;
    --font-lg: 1rem;
    --font-xl: 1.35rem;
    --font-2xl: 1.8rem;
    
    /* Spacing Scale - Compact */
    --space-1: 3px;
    --space-2: 6px;
    --space-3: 10px;
    --space-4: 14px;
    --space-5: 18px;
    --space-6: 22px;
    --space-8: 28px;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== TOP NAVIGATION BAR ==================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

/* Brand/Logo */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--msc-blue-dark);
    letter-spacing: -0.02em;
    transition: opacity 0.2s ease;
}

.nav-brand img {
    height: 32px;
    width: auto;
}

.nav-brand:hover {
    opacity: 0.85;
}

/* Main Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Dropdown Container */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    background: transparent;
    border: none;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-dropdown-btn:hover {
    background: var(--bg-hover);
    color: var(--msc-blue-dark);
}

.nav-dropdown:hover .nav-dropdown-btn {
    background: var(--bg-hover);
    color: var(--msc-blue-dark);
}

.nav-dropdown-btn i,
.nav-dropdown-btn svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-btn i,
.nav-dropdown:hover .nav-dropdown-btn svg {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown Content */
.dropdown-content {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    z-index: 1001;
    padding: 4px;
}

.nav-dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 450;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.dropdown-content a:hover {
    background: var(--accent-pale);
    color: var(--msc-blue-dark);
}

.dropdown-content a i,
.dropdown-content a svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.dropdown-content a:hover i,
.dropdown-content a:hover svg {
    color: var(--msc-blue-dark);
}

.dropdown-placeholder {
    display: block;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Right Side (Connection Status + User) */
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Connection Status in Top Nav */
.top-nav .connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-nav .connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}

.top-nav .connection-status.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.top-nav .connection-status.disconnected .status-dot {
    background: var(--danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-dropdown-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--msc-blue-dark) 0%, var(--accent-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-avatar i,
.user-avatar svg {
    width: 14px;
    height: 14px;
}

.user-dropdown-btn .user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-btn > i,
.user-dropdown-btn > svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.user-dropdown.open .user-dropdown-btn > i,
.user-dropdown.open .user-dropdown-btn > svg {
    transform: rotate(180deg);
}

/* User Dropdown Content */
.user-dropdown-content {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    z-index: 1002;
    overflow: hidden;
}

.user-dropdown.open .user-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--msc-blue-dark) 0%, var(--accent-hover) 100%);
    color: white;
}

.user-dropdown-name {
    display: block;
    font-weight: 600;
    color: white;
    font-size: 0.85rem;
}

.user-dropdown-role {
    display: block;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 3px;
    text-transform: capitalize;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 3px 6px;
}

.user-dropdown-content > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 450;
    transition: all 0.15s ease;
}

.user-dropdown-content > a:hover {
    background: var(--accent-pale);
    color: var(--msc-blue-dark);
}

.user-dropdown-content > a i,
.user-dropdown-content > a svg {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
}

.user-dropdown-content > a:hover i,
.user-dropdown-content > a:hover svg {
    color: var(--msc-blue-dark);
}

.user-dropdown-content > a.logout-link:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.user-dropdown-content > a.logout-link:hover i,
.user-dropdown-content > a.logout-link:hover svg {
    color: var(--danger);
}

/* Lucide Icons */
.nav-icon i,
.stat-icon i,
.schedule-icon i,
.btn i,
.settings-tab i,
.btn-logout i {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    vertical-align: middle;
}

.stat-icon i {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.schedule-icon i {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.btn i {
    margin-right: 6px;
    vertical-align: -2px;
}

.settings-tab i {
    margin-right: 6px;
    vertical-align: -3px;
}

.btn-logout i {
    width: 16px;
    height: 16px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

/* Tooltip styles */
.nav-tooltip {
    position: fixed;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 8px 14px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #fff;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.nav-tooltip.visible {
    opacity: 1;
}

/* Widget table styles */
.widget-table-container {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
}

.widget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: fixed;
}

.widget-table td,
.widget-table th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    padding: 6px 8px;
}

.widget-table td:first-child,
.widget-table th:first-child {
    width: 30px;
    max-width: 30px;
}

.widget-table td:last-child,
.widget-table th:last-child {
    width: 60px;
    max-width: 60px;
    text-align: right;
}

.widget-table th {
    text-align: left;
    padding: 7px 10px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

.widget-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.widget-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.widget-table tbody tr:hover {
    background: rgba(4, 148, 200, 0.1);
}

.widget-table .count-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}

.widget-table .contact-name {
    font-weight: 500;
}

.widget-table .company-name {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Compact table variant */
.widget-table.compact th,
.widget-table.compact td {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.widget-table.compact .count-badge {
    padding: 2px 8px;
    font-size: 0.75rem;
}

/* SLA Summary Widget */
.sla-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
}

.sla-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.sla-count {
    font-size: 2rem;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.sla-count.overdue {
    color: var(--danger);
}

.sla-count.warning {
    color: var(--warning);
}

.sla-count.ok {
    color: var(--success);
}

.sla-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.sla-label-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* SLA table cell colors */
td.overdue {
    color: var(--danger);
    font-weight: 600;
}

td.warning {
    color: var(--warning);
    font-weight: 600;
}

/* Modal tabs */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.modal-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.modal-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.modal-summary {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Stat widgets - 1 column x 1 row (6 across) */
.widget.stat-widget {
    grid-column: span 1;
    grid-row: span 1;
    justify-self: stretch;
    align-self: start;
    height: 100px !important;
    max-height: 100px !important;
    min-height: 100px !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden;
    padding: 0 !important;
}

.widget.stat-widget .stat-card {
    margin: 0;
    height: 100px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8px 12px;
    gap: 4px;
    box-sizing: border-box;
    border-radius: var(--radius);
}

.widget.stat-widget .stat-label {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-bottom: 4px;
}

.widget.stat-widget .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.widget.stat-widget .stat-detail {
    font-size: 0.65rem;
    line-height: 1.2;
    color: var(--text-secondary);
}

.widget.stat-widget .stat-card.clickable {
    cursor: pointer;
}

.widget.stat-widget .stat-card.clickable:hover {
    background: rgba(4, 148, 200, 0.15);
}

.widget.stat-widget .widget-drag-handle {
    top: 4px;
    right: 4px;
}

/* Kill rate summary in modal */
.kill-rate-summary {
    display: flex;
    gap: 24px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-value.text-success {
    color: #10b981;
}

.summary-value.text-danger {
    color: #ef4444;
}

.sidebar.collapsed .sidebar-header h1,
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .status-text,
.sidebar.collapsed .connection-status {
    display: none;
    visibility: hidden;
    width: 0;
    opacity: 0;
}

.sidebar.collapsed .nav-icon {
    margin: 0;
    font-size: 1.1rem;
}

.sidebar.collapsed .sidebar-header {
    padding: 10px;
    justify-content: center;
    flex-direction: row;
}

.sidebar.collapsed .sidebar-toggle {
    position: static;
    margin: 0 auto;
}

/* ==================== SIDEBAR HEADER ==================== */
.sidebar-header {
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    width: 100%;
    max-width: 160px;
    margin-bottom: 2px;
    background: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar-header h1 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-light);
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.sidebar-header .sidebar-toggle {
    position: absolute;
    top: 12px;
    right: 10px;
}

/* ==================== USER INFO SECTION ==================== */
.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.user-role {
    font-size: 0.65rem;
    color: var(--accent-light);
    text-transform: capitalize;
    font-weight: 500;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-logout i {
    width: 16px;
    height: 16px;
}

.btn-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.sidebar.collapsed .sidebar-user {
    padding: 10px;
    justify-content: center;
}

.sidebar.collapsed .user-info {
    display: none;
}

/* Card header row */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header-row h3 {
    margin: 0;
}

/* Form styles */
.form-inline .form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: var(--font-xs);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input,
.form-group select {
    padding: 7px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    min-width: 180px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(4, 148, 200, 0.15);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Modal small */
.modal-small {
    max-width: 500px;
}

/* Permissions table */
.permissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.permissions-table th,
.permissions-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.permissions-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.permissions-table td:last-child {
    text-align: center;
    width: 60px;
}

.permissions-table th:last-child {
    text-align: center;
    width: 60px;
}

.permissions-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.permissions-note {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    margin: 4px 0;
}

/* Company access checkboxes in user modal */
.company-access-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
}

.company-access-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.company-access-item:last-child {
    border-bottom: none;
}

.company-access-item:hover {
    background: rgba(4, 148, 200, 0.05);
}

.company-access-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.company-access-item label {
    cursor: pointer;
    font-size: 0.9rem;
    margin: 0;
}

.company-access-empty {
    padding: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

/* Permissions page */
.permission-reference-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.permission-category {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.permission-category:last-child {
    border-bottom: none;
}

.permission-category-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin: 0 0 10px 0;
}

.permission-ref-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.permission-ref-list li {
    margin-bottom: 6px;
}

.permissions-modal-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    padding: 12px 0;
}

.permission-modal-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.permission-modal-checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.permissions-role-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.text-muted {
    color: var(--text-secondary);
    font-weight: normal;
}

/* ==================== NAVIGATION SECTIONS ==================== */
/* Collapsible sections (Database, Dashboards, Settings) */

.nav-section {
    margin-top: 4px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: var(--radius);
}

.nav-section-header:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-section-header .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.nav-section-header .nav-icon i {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.nav-section-header .nav-text {
    flex: 1;
}

.nav-section-header .nav-chevron {
    font-size: 0.6rem;
    transition: transform 0.2s;
    opacity: 0.6;
}

/* Add button in section header */
.nav-section-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(4, 148, 200, 0.1);
    border: none;
    border-radius: 4px;
    color: var(--accent);
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
}

.nav-section-add-btn i {
    width: 14px;
    height: 14px;
}

.nav-section-header:hover .nav-section-add-btn {
    opacity: 1;
}

.nav-section-add-btn:hover {
    background: rgba(4, 148, 200, 0.25);
    transform: scale(1.1);
}

.nav-section.collapsed .nav-chevron {
    transform: rotate(-90deg);
}

/* Section items container */
.nav-section-items {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    padding: 4px 6px 8px 6px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-section.collapsed .nav-section-items {
    max-height: 0;
    opacity: 0;
    padding: 0 6px;
    border-top: none;
}

/* Sub-items within sections */
.nav-section-items .nav-item {
    padding: 8px 10px !important;
    margin: 2px 0;
    font-size: 0.8rem;
    font-weight: 400;
    border-radius: 6px;
}

.nav-section-items .nav-item .nav-icon {
    width: 18px;
    height: 18px;
}

.nav-section-items .nav-item .nav-icon i {
    width: 16px;
    height: 16px;
}

.nav-section-items .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-section-items .nav-item.active {
    background: var(--accent);
    box-shadow: 0 2px 6px rgba(4, 148, 200, 0.25);
}

/* Collapsed sidebar section styles */
.sidebar.collapsed .nav-section-header .nav-text,
.sidebar.collapsed .nav-section-header .nav-chevron,
.sidebar.collapsed .nav-section-add-btn {
    display: none;
}

.sidebar.collapsed .nav-section-items {
    display: none;
}

.sidebar.collapsed .nav-section {
    background: transparent;
}

/* ==================== SUBSECTION HEADERS ==================== */
/* Category headers within Dashboards (Internal, Managed, Co-Managed) */

.nav-subsection-header {
    display: flex;
    align-items: center;
    padding: 12px 8px 6px 8px;
    color: var(--accent-light);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    position: relative;
}

.nav-subsection-header::before {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    top: 4px;
    height: 1px;
    background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

.nav-subsection-header:first-child {
    margin-top: 0;
    padding-top: 8px;
}

.nav-subsection-header:first-child::before {
    display: none;
}

.sidebar.collapsed .nav-subsection-header {
    display: none;
}

/* Welcome page */
.welcome-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 65vh;
}

.welcome-content {
    text-align: center;
    padding: 32px;
}

.welcome-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

.welcome-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* Navigation Tile Grid */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 8px;
}

.nav-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.nav-tile:hover {
    border-color: var(--msc-blue-medium);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.nav-tile .tile-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-tile .tile-icon i,
.nav-tile .tile-icon svg {
    width: 24px;
    height: 24px;
    color: white;
    stroke: white;
}

.nav-tile .tile-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.nav-tile .tile-content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* Tile category sections */
.tile-section-header {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.tile-category-section {
    margin-bottom: 24px;
}

.tile-category-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tile-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.tile-empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 12px;
    font-size: 0.9rem;
}

/* Dashboard header with title and add button */
.dashboards-header .header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Tiny Add Dashboard button */
.btn-add-dashboard-tiny {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--msc-blue-light);
    background: var(--accent-pale);
    border: 1px solid var(--msc-blue-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-add-dashboard-tiny:hover {
    background: var(--msc-blue-dark);
    border-color: var(--msc-blue-dark);
    color: white;
}

.btn-add-dashboard-tiny i,
.btn-add-dashboard-tiny svg {
    width: 10px;
    height: 10px;
}

/* 4-Column Categories Grid */
.tile-categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 8px;
}

@media (max-width: 1200px) {
    .tile-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tile-categories-grid {
        grid-template-columns: 1fr;
    }
}

.tile-category-column {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 200px;
}

.tile-category-column .tile-category-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    padding-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tile-column-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Small tiles - uniform size */
.nav-tile-small {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.nav-tile-small:hover {
    border-color: var(--msc-blue-medium);
    background: var(--bg-hover);
    transform: translateX(2px);
}

.tile-icon-small {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tile-icon-small i,
.tile-icon-small svg {
    width: 14px;
    height: 14px;
    color: white;
    stroke: white;
}

.tile-content-small {
    flex: 1;
    min-width: 0;
}

.tile-content-small h4 {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Edit/delete buttons for small tiles */
.nav-tile-small .tile-edit-btn,
.nav-tile-small .tile-delete-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tile-small .tile-edit-btn {
    right: 28px;
    color: #60a5fa;
}

.nav-tile-small .tile-delete-btn {
    right: 4px;
    color: #f87171;
}

.nav-tile-small:hover .tile-edit-btn,
.nav-tile-small:hover .tile-delete-btn,
.nav-tile-small:hover .tile-mats-btn {
    opacity: 1;
}

.nav-tile-small .tile-edit-btn i,
.nav-tile-small .tile-delete-btn i,
.nav-tile-small .tile-mats-btn i,
.nav-tile-small .tile-edit-btn svg,
.nav-tile-small .tile-delete-btn svg,
.nav-tile-small .tile-mats-btn svg {
    width: 12px;
    height: 12px;
}

/* MATS button for managing schools */
.nav-tile-small .tile-mats-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 52px;
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(139, 92, 246, 0.7);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-tile-small .tile-mats-btn:hover {
    background: rgba(139, 92, 246, 1);
}

/* MATS Modal Styles */
.mats-parent-info {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.mats-section {
    margin-bottom: 20px;
}

.mats-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mats-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mats-section-header h4 {
    margin: 0;
}

.mats-children-list {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.mats-child-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.mats-child-item:last-child {
    margin-bottom: 0;
}

.mats-child-name {
    flex: 1;
    color: var(--text-primary);
}

.mats-child-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.mats-child-badge.autotask {
    background: var(--primary);
    color: white;
}

.mats-remove-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mats-remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.mats-remove-btn i,
.mats-remove-btn svg {
    width: 14px;
    height: 14px;
}

.mats-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
    padding: 8px;
    margin: 0;
}

.mats-add-section {
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.mats-search-container {
    position: relative;
}

.mats-search-container input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.mats-search-container input:focus {
    outline: none;
    border-color: var(--primary);
}

.mats-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    margin-top: 4px;
    box-shadow: var(--shadow-md);
}

.mats-search-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
}

.mats-search-item:last-child {
    border-bottom: none;
}

.mats-search-item:hover {
    background: var(--bg-hover);
}

/* Toggle switch for Autotask children */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 36px;
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Tile action buttons */
.nav-tile {
    position: relative;
}

.tile-edit-btn,
.tile-delete-btn {
    position: absolute;
    top: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.tile-edit-btn {
    right: 40px;
    background: var(--primary);
    color: white;
}

.tile-delete-btn {
    right: 8px;
    background: var(--danger);
    color: white;
}

.nav-tile:hover .tile-edit-btn,
.nav-tile:hover .tile-delete-btn {
    opacity: 1;
}

.tile-edit-btn:hover {
    background: var(--primary-hover);
}

.tile-delete-btn:hover {
    background: #dc2626;
}

.tile-edit-btn i,
.tile-delete-btn i,
.tile-edit-btn svg,
.tile-delete-btn svg {
    width: 14px;
    height: 14px;
}

/* Tile category sections */
.tile-section-header {
    margin-bottom: 16px;
    padding: 0 8px;
}

/* Add Dashboard button - compact style */
.btn-add-dashboard {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--msc-blue-light);
    background: var(--accent-pale);
    border: 1px solid var(--msc-blue-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-dashboard:hover {
    background: var(--msc-blue-dark);
    border-color: var(--msc-blue-dark);
    color: white;
}

.btn-add-dashboard i,
.btn-add-dashboard svg {
    width: 12px;
    height: 12px;
}

/* Legacy company section styles - kept for compatibility */
.company-section {
    margin-top: 4px;
}

.company-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
    transition: color 0.2s;
}

.company-section-header:hover {
    color: var(--text-primary);
}

.company-section-header .chevron {
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.company-section.collapsed .chevron {
    transform: rotate(-90deg);
}

.company-section-list {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.company-section.collapsed .company-section-list {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* ==================== DASHBOARD NAV ITEMS ==================== */
/* Individual dashboard items in the sidebar */

.company-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 400;
    border-radius: 6px;
    margin: 2px 0;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.company-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.company-nav-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 6px rgba(4, 148, 200, 0.25);
}

.company-nav-item .company-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.company-nav-item.active .company-dot {
    background: white !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.company-nav-item .company-label {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Company delete button */
.company-delete-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s;
}

.company-delete-btn i {
    width: 12px;
    height: 12px;
}

.company-nav-item:hover .company-delete-btn {
    display: flex;
}

.company-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.company-nav-item.active .company-delete-btn {
    color: rgba(255, 255, 255, 0.7);
}

.company-nav-item.active .company-delete-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Internal dashboard edit button */
.internal-edit-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s;
}

.internal-edit-btn i {
    width: 12px;
    height: 12px;
}

.company-nav-item:hover .internal-edit-btn {
    display: flex;
}

.internal-edit-btn:hover {
    opacity: 1;
    background: rgba(4, 148, 200, 0.2);
    color: var(--accent);
}

.company-nav-item.active .internal-edit-btn {
    color: rgba(255, 255, 255, 0.7);
}

.company-nav-item.active .internal-edit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Draggable dashboard items */
.draggable-dashboard {
    cursor: grab;
}

.draggable-dashboard:active {
    cursor: grabbing;
}

.draggable-dashboard.dragging,
.internal-dashboard-item.dragging {
    opacity: 0.5;
    background: var(--bg-hover);
}

.draggable-dashboard.drag-over,
.internal-dashboard-item.drag-over {
    border-top: 2px solid var(--accent);
    margin-top: -2px;
}

/* Internal dashboard items - draggable and renameable */
.internal-dashboard-item[draggable="true"] {
    cursor: grab;
}

.internal-dashboard-item[draggable="true"]:active {
    cursor: grabbing;
}

/* Hide company section when sidebar collapsed */
.sidebar.collapsed .company-section {
    display: none;
}

/* Company search results */
.company-search-results {
    max-height: 300px;
    overflow-y: auto;
}

.company-search-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.company-search-item:hover:not(.disabled) {
    background: rgba(4, 148, 200, 0.1);
}

.company-search-item.disabled {
    opacity: 0.5;
    cursor: default;
}

.company-search-item .company-name {
    font-size: 0.9rem;
}

.company-search-item .add-icon {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.2rem;
}

.company-search-item .badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--bg-primary);
    border-radius: 10px;
    color: var(--text-secondary);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-admin {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.badge-user {
    background: rgba(4, 148, 200, 0.2);
    color: #0494c8;
}

.badge-viewer {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

/* URL cell for TV displays */
.url-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.url-cell code {
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-sm i {
    width: 14px;
    height: 14px;
}

/* Info list for TV displays */
.info-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.info-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list li strong {
    color: var(--text-primary);
}

/* Action buttons */
.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1rem;
    transition: background 0.2s ease;
}

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

.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.sidebar-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 8px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Main navigation items (top-level) */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius);
    margin-bottom: 0;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--accent) 0%, rgba(4, 148, 200, 0.7) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(4, 148, 200, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: white;
    border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.nav-item .nav-icon i {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Navigation divider */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 4px;
    opacity: 0.5;
}

.nav-icon {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.disconnected {
    background: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 0;
    margin-top: 52px; /* Account for fixed top nav */
    padding: 20px 28px;
    min-height: calc(100vh - 52px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    background: var(--bg-page);
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    margin-bottom: 20px;
}

.view-header.compact {
    margin-bottom: 4px;
}

.view-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: var(--space-1);
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.view-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.view-header.compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.view-header.compact h2 {
    font-size: clamp(1rem, 2vh, 1.5rem);
    margin-bottom: 0;
}

/* Dashboard title row with settings */
.dashboard-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-settings-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.dashboard-settings-btn i {
    width: 16px;
    height: 16px;
}

.admin-only {
    display: none;
}

body.is-admin .admin-only {
    display: flex;
}

/* Refresh countdown indicator */
.refresh-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-xs);
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-countdown:hover {
    color: var(--text-secondary);
    border-color: var(--accent);
    background: var(--bg-hover);
}

/* Refresh Settings Popup */
.refresh-settings-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 200px;
}

.refresh-settings-popup.active {
    display: block;
}

.refresh-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.refresh-settings-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.refresh-settings-close:hover {
    color: var(--text-primary);
}

.refresh-settings-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 10px 12px;
}

.refresh-option {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.refresh-option.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.refresh-settings-custom {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}

.refresh-settings-custom input {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.refresh-settings-custom input:focus {
    outline: none;
    border-color: var(--accent);
}

.refresh-countdown .refresh-icon {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.refresh-countdown.refreshing .refresh-icon {
    animation: spin 1s linear infinite;
}

#countdownValue {
    font-weight: 600;
    min-width: 18px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.subtitle {
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.last-updated {
    color: var(--text-muted);
    font-size: var(--font-xs);
    margin-left: 8px;
}

.last-updated::before {
    content: "•";
    margin-right: 8px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    max-width: 100%;
}

/* Widget refresh flash animation */
@keyframes widgetRefresh {
    0% { opacity: 1; }
    50% { opacity: 0.5; background: rgba(4, 148, 200, 0.15); }
    100% { opacity: 1; }
}

.widget.refreshing,
.widget.refreshing .stat-card,
.widget.refreshing .card {
    animation: widgetRefresh 0.4s ease-out;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--msc-blue-dark);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(4, 148, 200, 0.1) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--accent-hover);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: clamp(10px, 1.2vh, 16px);
    margin-bottom: 0;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
    overflow: hidden;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

/* Large chart widgets - span 2 columns (3 across), height auto */
.card-large {
    grid-column: span 2 !important;
    grid-row: span 1;
    height: 350px;
    max-height: 350px;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 12px;
}

.card-large h3 {
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    margin-bottom: 2px;
}

.card-large .chart-subtitle {
    font-size: clamp(0.5rem, 0.7vw, 0.65rem);
    margin-bottom: 4px;
}

.card-large .chart-container {
    height: calc(100% - 50px);
    position: relative;
}

/* Half-width widgets (legacy) */
.card-half {
    grid-column: span 2;
    grid-row: span 1;
    height: 350px;
    max-height: 350px;
    min-width: 0;
    overflow: hidden;
    padding: 8px 12px;
}

.card-half h3 {
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    margin-bottom: 2px;
}

.card-half .chart-subtitle {
    font-size: clamp(0.5rem, 0.7vw, 0.65rem);
    margin-bottom: 4px;
}

.card-half .chart-container {
    height: calc(100% - 50px);
    position: relative;
}

.card-half h3 {
    font-size: clamp(0.8rem, 1.2vw, 1.1rem);
}

.card-half .chart-subtitle {
    font-size: clamp(0.5rem, 0.8vw, 0.75rem);
}

/* Draggable Widgets */
.widgets-container {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: auto;
    grid-auto-flow: dense;
    gap: 8px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.widget {
    position: relative;
    cursor: move;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    resize: none;
    overflow: hidden;
    max-width: 100%;
}

/* Large widgets need minimum dimensions */
.widget.card-large,
.widget.card-half {
    min-height: 300px;
    grid-column: span 2 !important;
    width: 100% !important;
}

/* Full-width card - spans all columns */
.card-full-width {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: auto;
    height: auto;
    padding: 16px;
}

.card-full-width .widget-table-container {
    max-height: 600px;
    overflow-y: auto;
}

.widget:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.widget.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.widget.drag-over {
    border: 2px dashed var(--accent);
    background: rgba(4, 148, 200, 0.1);
}

.widget-drag-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: grab;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.2s ease, background 0.2s ease;
    user-select: none;
}

.widget:hover .widget-drag-handle {
    opacity: 1;
    background: var(--bg-primary);
}

.widget-drag-handle:active {
    cursor: grabbing;
}

.widget-placeholder {
    border: 2px dashed var(--border);
    background: var(--bg-primary);
    border-radius: var(--radius);
    min-height: 200px;
}

/* Resize handle styling */
.widget::-webkit-resizer {
    background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
    border-radius: 0 0 var(--radius) 0;
}

.widget-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, var(--text-secondary) 50%);
    border-radius: 0 0 var(--radius) 0;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.widget:hover .widget-resize-handle {
    opacity: 1;
    background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
}

.card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

/* Table List */
.table-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.table-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.table-item .table-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* Table Select */
.table-select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 200px;
    cursor: pointer;
}

.table-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Filters */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(4, 148, 200, 0.15);
}

.filter-group input::placeholder {
    color: var(--text-secondary);
}

.filter-actions {
    display: flex;
    gap: 12px;
}

#filteredCount {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: normal;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--accent);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tr:hover td {
    background: rgba(4, 148, 200, 0.08);
}

.data-table td {
    color: var(--text-primary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination button {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: var(--text-secondary);
}

/* Query Editor */
.query-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.query-editor textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    min-height: 150px;
    resize: none;
}

.query-editor textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(4, 148, 200, 0.15);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-primary {
    background: var(--msc-blue-dark);
    color: white;
    box-shadow: 0 1px 3px rgba(4, 148, 200, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Ghost button */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: rgba(4, 148, 200, 0.1);
    color: var(--text-primary);
}

/* Success button */
.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

/* Ghost button - Tertiary actions */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Utilities */
.loading {
    color: var(--text-secondary);
    font-style: italic;
}

.placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.error {
    color: var(--danger);
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius);
}

/* Table Info */
.table-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.column-badge {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 0.8rem;
}

.column-badge .column-name {
    font-weight: 600;
    color: var(--accent);
}

.column-badge .column-type {
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Sync View */
.sync-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* API Threshold Status */
.api-threshold-status {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
}

.threshold-loading {
    color: var(--text-muted);
    font-style: italic;
}

.threshold-meter {
    margin-bottom: 12px;
}

.threshold-meter-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.threshold-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

.threshold-meter-fill.ok { background: var(--success); }
.threshold-meter-fill.warning { background: var(--warning); }
.threshold-meter-fill.critical { background: var(--danger); }

.threshold-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.threshold-stat {
    text-align: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.threshold-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.threshold-stat-value.ok { color: var(--success); }
.threshold-stat-value.warning { color: var(--warning); }
.threshold-stat-value.critical { color: var(--danger); }

.threshold-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.sync-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(4, 148, 200, 0.1);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    border: none;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sync-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
    display: none;
}

.sync-result.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.sync-result.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.sync-result.loading {
    display: block;
    background: rgba(4, 148, 200, 0.1);
    border: 1px solid var(--msc-blue-dark);
    color: var(--msc-blue-dark);
}

.sync-times {
    display: grid;
    gap: 12px;
}

.sync-time-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.sync-time-item .label {
    font-weight: 500;
    color: var(--text-primary);
}

.sync-time-item .time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.schedule-info {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.schedule-icon {
    font-size: 1.5rem;
}

.schedule-name {
    flex: 1;
    font-weight: 500;
}

.schedule-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.scheduler-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.scheduler-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
}

.status-indicator.stopped {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-indicator.running {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* Schedule Configuration */
.schedule-config-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.schedule-config-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.business-hours-config {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-row label {
    min-width: 100px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.config-row span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.schedule-select,
.schedule-select-sm {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.schedule-select-sm {
    padding: 6px 8px;
}

.schedule-input,
.schedule-input-time {
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 70px;
    text-align: center;
}

.schedule-input-time {
    width: 100px;
}

.schedule-jobs-config {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-job-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.job-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.job-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.job-name {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.job-config {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.schedule-job-row:has(input[type="checkbox"]:not(:checked)) .job-config {
    opacity: 0.5;
    pointer-events: none;
}

.schedule-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

/* Management Dashboard */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
    max-width: 100%;
}

.chart-card {
    min-height: 400px;
}

.chart-card-wide {
    min-height: 350px;
}

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

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

.chart-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 16px;
    margin-top: -8px;
}

.stat-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.kill-rate-card.success .stat-value {
    color: var(--success);
}

.kill-rate-card.warning .stat-value {
    color: var(--warning);
}

.kill-rate-card.danger .stat-value {
    color: var(--danger);
}

@media (max-width: 1200px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .widgets-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .widgets-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .widgets-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .widgets-container {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group {
    margin-bottom: 12px;
}

.modal-body .form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.modal-body .form-select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.modal-body .form-select:hover {
    border-color: var(--accent);
}

.modal-body .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(4, 148, 200, 0.2);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-card);
}

.modal-large {
    max-width: 900px;
    width: 95%;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.pagination-controls button {
    min-width: 100px;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pageInfo {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
}

.ticket-summary {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tab buttons for kill rate view */
.tab-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.tab-buttons .btn {
    min-width: 120px;
}

/* Clickable table rows */
.data-table tr.clickable-row {
    cursor: pointer;
    transition: background 0.2s ease;
}

.data-table tr.clickable-row:hover {
    background: rgba(4, 148, 200, 0.1);
}

/* Ticket Detail View */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ticket-detail-item {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.ticket-detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.ticket-detail-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.ticket-detail-full {
    grid-column: span 2;
}

.ticket-description {
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}

.modal-body .data-table {
    font-size: 0.8rem;
}

.modal-body .data-table th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.modal-body .data-table td {
    max-width: 250px;
}

.ticket-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.ticket-link:hover {
    text-decoration: underline;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.new {
    background: rgba(4, 148, 200, 0.2);
    color: #0494c8;
}

.status-badge.in-progress {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.status-badge.awaiting {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Stale ticket styling */
.stale-row {
    background: rgba(245, 158, 11, 0.1) !important;
}

.stale-row:hover {
    background: rgba(245, 158, 11, 0.15) !important;
}

td.stale {
    color: #f59e0b;
    font-weight: 500;
}

/* Version info in sidebar */
.version-info {
    margin-top: 6px;
    font-size: 0.6rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.sidebar.collapsed .version-info {
    display: none;
}

/* Environment banner */
.env-banner {
    padding: 4px 12px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.env-banner.dev {
    background: #f59e0b;
    color: #000;
}

.env-banner.prod {
    display: none !important;
}

/* Deployment section */
.deploy-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.deploy-env-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: center;
}

.deploy-env-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.deploy-env-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: capitalize;
}

.deploy-env-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.deploy-actions {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-warning {
    background: #f59e0b;
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-warning:hover {
    background: #d97706;
}

/* API Config Form */
.api-config-form {
    max-width: 600px;
}

.api-config-form .form-group {
    margin-bottom: 12px;
}

.api-config-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.api-config-form input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.api-config-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(4, 148, 200, 0.15);
}

.form-actions-inline {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.settings-tab {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
    position: relative;
}

.settings-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.settings-tab.active {
    background: var(--accent);
    color: white;
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.settings-content {
    display: none;
}

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

/* Autotask Tabs */
.autotask-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.autotask-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.autotask-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.autotask-tab.active {
    background: var(--accent);
    color: white;
}

.autotask-tab i {
    width: 18px;
    height: 18px;
}

.autotask-tab-content {
    display: none;
}

.autotask-tab-content.active {
    display: block;
}

/* ==================== INTEGRATIONS ==================== */

/* Integrations Grid */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding: 8px 0;
}

/* Integration Tile */
.integration-tile {
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.integration-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.integration-tile:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--accent);
}

.integration-tile:hover::before {
    opacity: 1;
}

.integration-tile.coming-soon {
    opacity: 0.5;
    cursor: not-allowed;
}

.integration-tile.coming-soon:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.integration-tile.coming-soon::before {
    display: none;
}

/* Tile Logo */
.integration-tile-logo {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.integration-tile-logo img {
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
}

.integration-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--accent);
}

.integration-tile-icon i {
    width: 32px;
    height: 32px;
}

/* Tile Content */
.integration-tile-content h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.integration-tile-content p {
    margin: 8px 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Tile Status */
.integration-tile-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.integration-tile-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.integration-tile-status.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.integration-tile-status.disconnected .status-dot {
    background: var(--danger);
}

.integration-tile-status.checking .status-dot {
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

.integration-tile-status .status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Integration Header with Back Button */
.integration-header {
    position: relative;
}

.integration-header .btn-back {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.integration-header .btn-back:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.integration-header .btn-back i {
    width: 16px;
    height: 16px;
}

.integration-header h2 {
    padding-top: 48px;
}

/* Integration Tabs (generic - reusable for all integrations) */
.integration-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.integration-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.integration-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.integration-tab.active {
    background: var(--accent);
    color: white;
}

.integration-tab i {
    width: 18px;
    height: 18px;
}

.integration-tab-content {
    display: none;
}

.integration-tab-content.active {
    display: block;
}

/* Account Stats (for UptimeRobot, etc.) */
.account-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.account-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.account-stat .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.account-stat .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* API Info Grid */
.api-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.api-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.api-info-item i {
    width: 24px;
    height: 24px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.api-info-item strong {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.api-info-item p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Devices List */
.devices-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.device-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.device-status.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.device-status.offline {
    background: var(--danger);
}

.device-name {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.device-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Domains List (Datto SaaS Protection) */
.domains-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.domain-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.domain-name {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

.domain-stats {
    display: flex;
    gap: 16px;
}

.domain-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.domain-stats .stat svg {
    width: 14px;
    height: 14px;
}

/* Deploy Actions Grid */
.deploy-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
}

.deploy-action-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.deploy-action-item h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.deploy-action-item p {
    margin: 0 0 12px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Database Info Grid */
.db-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.db-info-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
}

.db-info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.db-info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

/* Rollback row highlight */
.data-table tr.rollback-selected {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.data-table tr.rollback-selectable {
    cursor: pointer;
}

.data-table tr.rollback-selectable:hover {
    background: rgba(4, 148, 200, 0.1);
}

.data-table tr.current-commit {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid var(--success);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, 
        var(--bg-primary) 25%, 
        var(--bg-secondary) 50%, 
        var(--bg-primary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.full {
    width: 100%;
}

.skeleton-card {
    height: 100px;
    border-radius: var(--radius);
}

.skeleton-chart {
    height: 300px;
    border-radius: var(--radius);
}

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

/* Fade in animation for dynamically loaded content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Spin animation for loading indicators */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Pulse animation for attention */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Global transition for interactive elements */
a, button, input, select, textarea,
.card, .stat-card, .nav-item, .widget {
    transition: all 0.2s ease;
}

/* Hover lift effect */
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .deploy-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .db-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .main-content {
        padding: 20px 16px;
    }
}

/* Dashboard Settings Styles */
.widget-settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.widget-settings-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.widget-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.widget-settings-header h4 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.widget-settings-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-xs);
    color: var(--text-secondary);
}

.widget-filter-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.widget-filter-section label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 100px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-checkbox-item:hover {
    border-color: var(--accent);
}

.filter-checkbox-item input[type="checkbox"] {
    width: 12px;
    height: 12px;
    cursor: pointer;
}

.filter-checkbox-item.excluded {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.filter-checkbox-item.excluded:hover {
    opacity: 0.9;
}

/* Dropdown filter styles */
.filter-dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-dropdown {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.filter-dropdown:hover {
    border-color: var(--accent);
}

.filter-dropdown:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(4, 148, 200, 0.2);
}

/* Search filter styles */
.filter-search-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.filter-search-input {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.75rem;
}

.filter-search-input:hover {
    border-color: var(--accent);
}

.filter-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(4, 148, 200, 0.2);
}

.filter-search-input::placeholder {
    color: var(--text-secondary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-result-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item.no-results {
    color: var(--text-secondary);
    cursor: default;
}

.search-result-item.no-results:hover {
    background: transparent;
}

.excluded-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 20px;
}

.excluded-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 2px 8px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excluded-tag button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.excluded-tag button:hover {
    background: rgba(255,255,255,0.4);
}

.dashboard-settings-info {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dashboard-settings-info strong {
    color: var(--text-primary);
}

/* Compact modal body for dashboard settings */
#dashboardSettingsModal .modal-body {
    padding: 12px 16px;
    max-height: 70vh;
}

#dashboardSettingsModal .modal-footer {
    padding: 10px 16px;
}

/* ==================== REPORTS ==================== */

/* Report Builder */
.report-builder {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 32px 20px;
}

.report-builder-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 720px;
    width: 100%;
    box-shadow: var(--shadow);
}

.report-builder-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.report-builder-card h3 i {
    color: var(--accent);
}

.report-builder-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.report-builder-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-builder-form .form-group label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-builder-form .form-row {
    display: flex;
    gap: 16px;
}

.report-builder-form .form-row .form-group {
    flex: 1;
}

.report-builder-form .form-select {
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.report-builder-form .form-select:hover {
    border-color: var(--accent);
}

.report-builder-form .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(4, 148, 200, 0.2);
}

.report-builder-form .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    margin-top: 4px;
    width: 100%;
    max-width: 240px;
}

/* Report Sections Filter */
.report-sections-filter label {
    margin-bottom: 2px;
}

.section-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.section-checkboxes .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    white-space: normal;
    line-height: 1.35;
}

.section-checkboxes .checkbox-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.section-checkboxes .checkbox-label:hover {
    color: var(--accent);
}

/* Report Exclusions Filter */
.report-exclusions-filter label {
    margin-bottom: 2px;
}

.report-exclusions-filter .filter-search-container {
    position: relative;
}

.report-exclusions-filter .filter-search-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.report-exclusions-filter .filter-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.report-exclusions-filter .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow);
}

.report-exclusions-filter .search-results.show {
    display: block;
}

.report-exclusions-filter .search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.report-exclusions-filter .search-result-item:hover {
    background: var(--bg-hover);
}

.report-exclusions-filter .search-result-item:last-child {
    border-bottom: none;
}

.excluded-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.excluded-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--accent);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
}

.excluded-tag .remove-tag {
    cursor: pointer;
    opacity: 0.8;
    font-weight: bold;
}

.excluded-tag .remove-tag:hover {
    opacity: 1;
}

@media (max-width: 640px) {
    .section-checkboxes {
        grid-template-columns: 1fr;
    }
    .report-builder-card {
        padding: 20px 16px;
    }
}

/* Report Preview Wrapper */
.report-preview-wrapper {
    padding: 20px;
}

.report-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 20px;
}

.report-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
}

/* Report Preview (White background for PDF) */
.report-preview {
    background: white;
    max-width: 210mm;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Report Pages */
.report-page {
    padding: 40px;
    min-height: 280mm;
    box-sizing: border-box;
    background-color: #ffffff;
}

/* PDF Export mode - remove min-height for proper PDF generation */
.pdf-export .report-page {
    min-height: auto !important;
    padding: 30px;
}

.pdf-export .report-cover {
    min-height: auto !important;
    padding: 80px 40px;
}

.pdf-export .report-chart-container {
    max-height: 300px;
    overflow: hidden;
}

.pdf-export .report-chart-container img {
    max-height: 280px;
    width: auto;
    margin: 0 auto;
    display: block;
}

.report-page:last-child {
    page-break-after: auto;
}

/* Cover Page */
.report-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1e293b;
    color: white;
    text-align: center;
}

.report-cover-content {
    max-width: 400px;
}

.report-logo-placeholder {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 40px;
}

.report-logo-placeholder i {
    width: 50px;
    height: 50px;
    color: #0494c8;
}

.report-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: white;
}

.report-company-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0494c8;
    margin-bottom: 16px;
}

.report-period {
    font-size: 1.25rem;
    color: #94a3b8;
    margin-bottom: 40px;
}

.report-generated {
    font-size: 0.875rem;
    color: #64748b;
}

/* Report Sections */
.report-section {
    background: white;
    color: #1e293b;
}

.report-section-header {
    border-bottom: 2px solid #0494c8;
    padding-bottom: 16px;
    margin-bottom: 32px;
}

.report-section-header h2 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 4px;
}

.report-section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.report-section-content {
    color: #334155;
}

/* Report Stats Row */
.report-stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 32px;
}

.report-stat-card {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.report-stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.report-stat-label {
    font-size: 0.875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-stat-opened .report-stat-value {
    color: #0494c8;
}

.report-stat-closed .report-stat-value {
    color: #22c55e;
}

.report-stat-net.positive .report-stat-value {
    color: #22c55e;
}

.report-stat-net.negative .report-stat-value {
    color: #f59e0b;
}

/* Report Chart */
.report-chart-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.report-chart-container h4 {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 16px;
}

.report-chart-container canvas {
    max-height: 300px;
}

/* Report Summary */
.report-section-summary {
    background: #f8fafc;
    border-left: 4px solid #0494c8;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.report-section-summary p {
    margin: 0;
}

/* Placeholder Sections */
.report-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #94a3b8;
}

.report-placeholder i {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.report-placeholder p {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Report Tables */
.report-table-container {
    margin-top: 24px;
}

.report-table-container h4 {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 12px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.report-table thead {
    background: #f1f5f9;
}

.report-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.875rem;
    border-bottom: 2px solid #e2e8f0;
}

.report-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #334155;
}

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

.report-table tbody tr:hover {
    background: #f8fafc;
}

.report-table .rank {
    display: inline-block;
    background: #0494c8;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-right: 8px;
}

/* Report Comparison Section */
.report-comparison {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.report-comparison-card {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.report-comparison-card h4 {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0494c8;
}

.comparison-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
}

.comparison-label {
    color: #64748b;
}

.comparison-value {
    font-weight: 600;
    color: #1e293b;
}

.comparison-change {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-weight: 600;
}

.change-up {
    color: #f59e0b;
}

.change-down {
    color: #22c55e;
}

.change-neutral {
    color: #64748b;
}

/* Table of Contents */
.report-toc .toc-list {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.toc-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.toc-number {
    font-weight: 600;
    color: #0494c8;
    min-width: 100px;
    font-size: 0.9rem;
}

.toc-title {
    color: #1e293b;
    font-size: 1rem;
}

.toc-summary {
    background: #f1f5f9;
    border-left: 4px solid #0494c8;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
}

.toc-summary p {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Report Notes */
.report-notes {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.report-notes p {
    font-size: 1rem;
    line-height: 1.8;
    color: #334155;
    margin: 0;
}

.report-footer-info {
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 12px;
    padding: 20px 24px;
}

.report-footer-info p {
    margin: 8px 0;
    font-size: 0.875rem;
}

.report-footer-info strong {
    color: #94a3b8;
}

/* No data message */
.report-no-data {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    padding: 40px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #e2e8f0;
}

/* Spin animation for loading */
.spin {
    animation: spin 1s linear infinite;
}

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

/* Print/PDF styles */
@media print {
    .report-preview {
        box-shadow: none;
        max-width: none;
    }
    
    .report-page {
        page-break-after: always;
        padding: 20mm;
    }
    
    .report-actions {
        display: none;
    }
}

/* PDF Generation specific styles (applied via JS) */
.generating-pdf .report-page {
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.generating-pdf .report-cover {
    background: #1e293b !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.generating-pdf .report-section-header {
    background: #f1f5f9 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.generating-pdf .report-stat-card {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.generating-pdf canvas {
    max-width: 100% !important;
    height: auto !important;
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px 12px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-tabs {
        flex-wrap: wrap;
    }
}

/* ==================== AUTO-CANCEL RULES ==================== */

/* Card header with actions */
.card-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header-with-actions h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    vertical-align: middle;
    margin-right: 8px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
    border-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
    background-color: white;
}

/* Conditions cell */
.conditions-cell {
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 300px;
}

.conditions-cell em {
    color: var(--text-secondary);
}

/* Title and reason cells */
.title-cell,
.reason-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty and loading cells */
.empty-cell,
.loading-cell {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px !important;
    font-style: italic;
}

/* Input with select (email pattern) */
.input-with-select {
    display: flex;
    gap: 8px;
}

.input-with-select input {
    flex: 1;
}

.input-with-select select {
    width: 140px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Form help text */
.form-help {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Modal medium size */
.modal-medium {
    max-width: 600px;
}

/* Modal for auto-cancel */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Warning text style */
.warning {
    color: var(--warning);
}

/* ==================== CASH FLOW FORECASTER ==================== */

.cashflow-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.cashflow-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.cashflow-header-actions select {
    min-width: 150px;
}

/* Scenario selector dropdown */
.scenario-selector-wrapper {
    position: relative;
}

.scenario-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    margin-top: 4px;
}

.scenario-dropdown.show {
    display: block;
}

.scenario-dropdown-content {
    padding: 8px 0;
    max-height: 300px;
    overflow-y: auto;
}

.scenario-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.scenario-checkbox-item:hover {
    background: var(--bg-primary);
}

.scenario-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.scenario-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scenario-checkbox-label {
    flex: 1;
    font-size: 0.9rem;
}

.scenario-checkbox-label.is-base {
    font-weight: 600;
}

/* KPI Grid */
.cashflow-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

/* Row 1: Balance, Receivables, Payables - 3 equal columns */
.cashflow-kpi-row-1 {
    grid-template-columns: repeat(3, 1fr);
}

/* Row 2: Projections - 5 equal columns, smaller cards */
.cashflow-kpi-row-2 {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}

/* Smaller KPI cards for projection row */
.kpi-card.kpi-card-sm {
    padding: 10px 8px;
}

.kpi-card-sm .kpi-label {
    font-size: 0.65rem;
    margin-bottom: 4px;
}

.kpi-card-sm .kpi-value {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.kpi-card-sm .kpi-detail {
    font-size: 0.6rem;
}

.kpi-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.kpi-value.kpi-positive {
    color: var(--success);
}

.kpi-value.kpi-negative {
    color: var(--danger);
}

.kpi-value.kpi-warning {
    color: var(--danger);
}

.kpi-detail {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Responsive: Stack projection cards on smaller screens */
@media (max-width: 900px) {
    .cashflow-kpi-row-1 {
        grid-template-columns: repeat(3, 1fr);
    }
    .cashflow-kpi-row-2 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .cashflow-kpi-row-1,
    .cashflow-kpi-row-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Cash Flow Chart */
.cashflow-chart-card {
    margin-bottom: 16px;
}

.cashflow-chart-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.cashflow-chart-card .card-header h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 0.85rem;
}

.chart-controls {
    display: flex;
    gap: 6px;
}

.chart-controls button.active {
    background: var(--primary);
    color: white;
}

.cashflow-chart-container {
    padding: 14px;
    height: 300px;
}

/* Dual Chart Layout (Helm-style) */
.cashflow-charts-wrapper {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cashflow-balance-chart {
    height: 160px;
    position: relative;
    padding-bottom: 8px;
}

.cashflow-transactions-chart {
    height: 220px;
    position: relative;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.chart-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.chart-legend-inline {
    position: absolute;
    top: 3px;
    right: 0;
    display: flex;
    gap: 20px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    z-index: 10;
}

.chart-legend-inline .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-legend-inline .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Transaction Subtabs */
.transactions-subtabs {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.transactions-subtabs .subtab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.transactions-subtabs .subtab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.transactions-subtabs .subtab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.transactions-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: auto;
    padding-right: 10px;
}

.per-page-select {
    padding: 5px 10px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 10px;
}

.per-page-select:hover {
    border-color: var(--primary);
}

.per-page-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Compact Transaction Table */
.compact-table {
    font-size: 0.85rem;
}

.compact-table th,
.compact-table td {
    padding: 8px 10px;
}

.compact-table .txn-company {
    font-weight: 500;
}

.compact-table .txn-invoice-num {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.compact-table .txn-date {
    white-space: nowrap;
    font-size: 0.8rem;
}

.compact-table .row-overdue {
    background: rgba(231, 76, 60, 0.1);
}

/* Inline Input Styling */
.inline-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 6px;
    font-size: 0.8rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.inline-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.inline-input:hover {
    border-color: var(--text-secondary);
}

.adr-input {
    width: 55px;
    text-align: center;
}

.adr-input.adr-calculated {
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.4);
}

.adr-input.adr-manual {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.4);
}

.expected-date-input {
    width: 130px;
}

/* Recalc ADR button in subtabs */
.transactions-subtabs .btn {
    margin-left: 10px;
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Cashflow Tabs */
.cashflow-tabs {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.cashflow-tabs .tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-x: auto;
}

.cashflow-tabs .tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.cashflow-tabs .tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.cashflow-tabs .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-secondary);
}

.cashflow-tabs .tab-content {
    display: none;
    padding: 14px;
}

.cashflow-tabs .tab-content.active {
    display: block;
}

/* Manual Entry Form */
.manual-entry-form {
    padding: 20px;
    margin-bottom: 0;
}

.manual-entry-form h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
}

.manual-entry-form .form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.manual-entry-form .form-group {
    flex: 1;
    min-width: 150px;
}

.manual-entry-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.manual-entry-form input,
.manual-entry-form select,
.manual-entry-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Patterns Header */
.patterns-header,
.scenarios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.patterns-header p,
.scenarios-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    flex: 1;
}

/* Patterns Subtabs */
.patterns-subtabs {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.patterns-subtabs .subtab-group {
    display: flex;
    gap: 0;
}

.patterns-subtabs .subtab {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.patterns-subtabs .subtab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.patterns-subtabs .subtab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.patterns-subtabs .subtab-separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 10px;
    align-self: center;
}

.patterns-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
    padding-right: 10px;
}

/* ==================== FORECASTING RULES ==================== */

/* Rules Header */
.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rules-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rules-search {
    position: relative;
    display: flex;
    align-items: center;
}

.rules-search i {
    position: absolute;
    left: 10px;
    color: var(--text-secondary);
    width: 14px;
    height: 14px;
}

.rules-search input {
    padding-left: 32px;
    font-size: 0.85rem;
    height: 32px;
}

.rules-search input {
    padding-left: 36px;
    width: 220px;
}

.rules-group-by {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-group-by label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rules-group-by select {
    min-width: 120px;
}

/* Rules Filters Panel */
.rules-filters {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

/* Rules List */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rules-group {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.rules-group-header {
    padding: 8px 12px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.rules-group-header:hover {
    background: var(--bg-secondary);
}

.rules-group-header .collapse-icon {
    display: flex;
    transition: transform 0.2s;
}

.rules-group-header .collapse-icon svg {
    width: 14px;
    height: 14px;
}

.rules-group.collapsed .rules-group-header .collapse-icon {
    transform: rotate(-90deg);
}

.rules-group-header .group-count {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: auto;
}

.rules-group-content {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.rules-group.collapsed .rules-group-content {
    display: none;
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
}

.rules-table th {
    text-align: left;
    padding: 6px 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.rules-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.85rem;
}

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

.rules-table tr:hover {
    background: var(--bg-primary);
}

.rules-table .rule-name {
    font-weight: 500;
    font-size: 0.85rem;
}

.rules-table .rule-contact {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.rules-table .rule-inactive {
    opacity: 0.5;
}

.rules-table .rule-pattern {
    background: rgba(var(--info-rgb, 52, 152, 219), 0.05);
}

.rules-table .rule-pattern .rule-name .badge {
    font-size: 0.6rem;
    margin-left: 6px;
    vertical-align: middle;
}

.pattern-active-indicator {
    color: var(--success);
    font-size: 0.75rem;
}

.rule-actions {
    display: flex;
    gap: 3px;
    justify-content: flex-end;
}

.rule-actions .btn-icon {
    padding: 4px 8px;
}

.rule-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Rule Modal - Compact */
.modal-wide {
    max-width: 920px;
    width: 98%;
}

.modal-wide .modal-body {
    padding: 0;
    overflow: visible;
}

.rule-form-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0;
}

.rule-form-section {
    padding: 15px 20px;
}

.rule-form-section:first-child {
    border-right: 1px solid var(--border);
}

.rule-form-section:last-child {
    min-width: 420px;
}

.rule-form-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.rule-form-section .form-group {
    margin-bottom: 10px;
}

.rule-form-section .form-group:last-child {
    margin-bottom: 0;
}

.rule-form-section .form-group label {
    font-size: 0.75rem;
    margin-bottom: 3px;
}

.rule-form-section input,
.rule-form-section select {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.rule-form-section .form-row {
    display: flex;
    gap: 10px;
}

.rule-form-section .flex-1 {
    flex: 1;
}

.repeat-every-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.repeat-every-row input {
    width: 50px;
}

.repeat-every-row span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Searchable Select */
.searchable-select {
    width: 100%;
}

/* Day Picker Compact */
.day-picker {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    min-width: 280px;
}

.day-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 6px;
}

.day-picker-btn {
    width: 100%;
    min-width: 32px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
    padding: 0;
}

.day-picker-btn:hover {
    border-color: var(--primary);
}

.day-picker-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.day-picker-last {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.day-picker-last:hover {
    border-color: var(--primary);
}

.day-picker-last.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Ends Row */
.ends-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ends-row input[type="date"] {
    width: 140px;
    padding: 6px 8px;
    font-size: 0.85rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    font-size: 0.85rem;
    white-space: nowrap;
}

.radio-label input[type="radio"] {
    width: 14px;
    height: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .rule-form-grid {
        grid-template-columns: 1fr;
    }
    
    .rule-form-section:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .rules-header-left {
        width: 100%;
    }
    
    .rules-search input {
        width: 100%;
    }
}

/* Scenarios Grid */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.scenario-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.scenario-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.scenario-card-header h4 {
    margin: 0;
    font-size: 1rem;
}

.scenario-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 12px 0;
}

.scenario-actions {
    display: flex;
    gap: 8px;
}

/* Amount styling */
.amount-positive {
    color: var(--success);
    font-weight: 500;
}

.amount-negative {
    color: var(--danger);
    font-weight: 500;
}

/* Ignored pattern row */
.ignored-pattern {
    opacity: 0.5;
}

/* Bank Accounts Toggle List */
.bank-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bank-account-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.bank-account-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bank-account-name {
    font-weight: 500;
}

.bank-account-balance {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Modal sizes */
.modal-small {
    max-width: 450px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Alert styling */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert a {
    color: inherit;
    text-decoration: underline;
}

/* No data styling */
.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px !important;
    font-style: italic;
}

/* Clickable KPI cards */
.kpi-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

/* Large modal */
.modal-large {
    max-width: 800px;
    max-height: 80vh;
}

.modal-large .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* KPI Detail table */
.kpi-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.kpi-detail-table th,
.kpi-detail-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.kpi-detail-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.kpi-detail-table tr:hover {
    background: var(--bg-primary);
}

.kpi-detail-total {
    font-weight: 600;
    background: var(--bg-primary) !important;
}

/* KPI breakdown summary */
.kpi-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.kpi-breakdown-item {
    text-align: center;
}

.kpi-breakdown-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-breakdown-value {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Overdue styling */
.row-overdue {
    background: rgba(239, 68, 68, 0.1) !important;
}

.badge-overdue {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--warning);
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ==================== ACCOUNTS TAB ==================== */

.accounts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

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

.account-name {
    font-weight: 500;
}

.account-number {
    font-size: 0.8rem;
    margin-top: 2px;
}

.scheduled-transfers-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.bank-accounts-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.bank-accounts-section h4,
.scheduled-transfers-section h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: 600;
}

.scheduled-transfers-section h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: 600;
}

.scheduled-transfers-section .text-secondary {
    font-size: 0.85rem;
    margin-bottom: 15px;
}

/* Small modal variant */
.modal-sm {
    max-width: 450px;
}
