/* ASL Airlines France - Flight Safety Dashboard Styles */

:root {
    --primary: #004B93;
    --primary-dark: #003670;
    --secondary: #E6EEF5;
    --accent: #86D0F4;
    --success: #2e7d32;
    --warning: #ed6c02;
    --error: #d32f2f;
    --background: #F5F7FA;
    --white: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: var(--white);
}

/* Landing Page */
.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-header {
    background-color: var(--white);
    padding: 20px 0;
    box-shadow: var(--shadow);
}

.landing-header .logo {
    height: 50px;
}

.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 60px 20px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 32px;
}

.hero .btn-primary {
    background-color: var(--white);
    color: var(--primary);
    font-size: 1.1rem;
    padding: 16px 32px;
}

.hero .btn-primary:hover {
    background-color: var(--accent);
    color: var(--primary-dark);
}

.landing-footer {
    background-color: var(--primary-dark);
    color: var(--white);
    padding: 20px 0;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    width: 200px;
    background-color: var(--primary);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-logo {
    opacity: 0;
    width: 0;
}

.sidebar-logo img {
    height: 38px;
    filter: brightness(0) invert(1);
}

/* Collapse/expand control — lives at the bottom of the sidebar. */
.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer {
    padding: 8px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.sidebar-toggle svg {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-nav {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Logout button at bottom of sidebar */
.nav-section-bottom {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.nav-section-bottom a {
    color: rgba(255, 255, 255, 0.6);
}

.nav-section-bottom a:hover {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.1);
}

/* User avatar in header */
.header-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
}

.user-avatar-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: opacity 0.15s;
}

.header-user-avatar:hover .user-avatar-circle {
    opacity: 0.85;
}

/* User menu popover */
.user-menu-popover {
    position: fixed;
    z-index: 200;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.user-menu-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.user-menu-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.user-menu-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-menu-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-email {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    font-family: inherit;
    transition: background-color 0.15s;
}

.user-menu-item:hover {
    background-color: #f5f5f5;
}

.user-menu-item svg {
    color: #666;
    flex-shrink: 0;
}

.user-menu-version {
    text-align: right;
    padding: 6px 16px 4px;
    font-size: 11px;
    color: #aaa;
}

/* Profile & password modals */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.profile-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.profile-modal {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.profile-modal-overlay.active .profile-modal {
    transform: scale(1);
}

.profile-modal h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 20px;
}

.profile-form-group {
    margin-bottom: 16px;
}

.profile-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.profile-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.profile-form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.1);
}

.profile-form-message {
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.profile-form-message.success {
    color: #2e7d32;
}

.profile-form-message.error {
    color: #c62828;
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.profile-btn-primary {
    padding: 10px 20px;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s;
}

.profile-btn-primary:hover {
    background-color: var(--primary-dark);
}

.profile-btn-secondary {
    padding: 10px 20px;
    background-color: transparent;
    color: var(--text);
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s;
}

.profile-btn-secondary:hover {
    background-color: #f5f5f5;
}

/* ============================================================
   Permissions modal (admin/user detail)
   Wider than the default profile modal and uses a custom layout
   that does NOT rely on .profile-form-group, because that group's
   `input { width: 100% }` rule blows up checkbox layout.
   ============================================================ */

.profile-modal.permissions-modal {
    max-width: 520px;
    padding: 28px 28px 24px;
    /* The permission tree (menus + names + notifications) outgrows short
       viewports — the modal scrolls its own content, never the page. */
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;                       /* Firefox */
    scrollbar-color: #c3ccd8 transparent;
}

/* Keep the scrollbar clear of the modal's rounded corners — the default
   full-height track paints straight over the border-radius. */
.profile-modal.permissions-modal::-webkit-scrollbar {
    width: 8px;
}

.profile-modal.permissions-modal::-webkit-scrollbar-track {
    background: transparent;
    margin: 14px 0;
}

.profile-modal.permissions-modal::-webkit-scrollbar-thumb {
    background: #c3ccd8;
    border-radius: 4px;
}

.profile-modal.permissions-modal::-webkit-scrollbar-thumb:hover {
    background: #a9b5c6;
}

.perm-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.perm-section-header h4 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.perm-section-header p {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-light);
}

.perm-divider {
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.perm-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.perm-select:disabled {
    cursor: default;
}

/* Custom dropdown for the permissions modal — native <select> option lists
   are OS-rendered and can't be styled (no hover cursor), same reason the
   Crew Reports saved-filter popover exists. The trigger reuses .perm-select
   for the field look. */
.perm-dd {
    position: relative;
}

.perm-dd-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.perm-dd-btn:disabled {
    cursor: default;
    opacity: 0.65;
}

.perm-dd-label {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.perm-dd-chevron {
    flex-shrink: 0;
    color: var(--text-light);
    transition: transform 0.15s;
}

.perm-dd.open .perm-dd-btn {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.12);
}

.perm-dd.open .perm-dd-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.perm-dd-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    z-index: 500;
}

.perm-dd.open .perm-dd-menu {
    display: block;
    animation: permDdIn 0.12s ease-out;
}

@keyframes permDdIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.perm-dd-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.perm-dd-item:hover {
    background: var(--secondary);
}

.perm-dd-item.selected {
    color: var(--primary);
    font-weight: 600;
}

/* Fixed-width check slot so labels stay aligned whether or not selected. */
.perm-dd-check {
    flex-shrink: 0;
    width: 15px;
    display: flex;
    align-items: center;
    color: var(--primary);
}

.perm-dd-name {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.perm-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.12);
}

.perm-save-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 28px;
}

.perm-save-btn {
    padding: 7px 14px;
    font-size: 13px;
    display: none; /* JS toggles via inline style when role changes */
}

.perm-msg {
    font-size: 12.5px;
    color: var(--text-light);
}

.perm-msg-block {
    display: block;
    min-height: 18px;
    margin-top: 4px;
}

.perm-locked {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--secondary, #f5f7fa);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-light);
}

.perm-locked-note {
    margin: 8px 0 0;
    font-size: 12.5px;
    color: var(--text-light);
}

.perm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.perm-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s;
}

.perm-toggle:hover:not(.is-disabled) {
    background-color: var(--secondary, #f5f7fa);
    border-color: #cdd5e0;
}

.perm-toggle.is-disabled {
    cursor: default;
    opacity: 0.65;
}

/* Sub-permission: indented under its parent toggle, shown only while the
   parent permission is enabled (visibility driven from the template JS). */
.perm-subrow {
    margin-left: 26px;
}

/* Permission tree (see templates/_perm_defs.html): nesting levels mirror
   the sidebar — menu group > menu entry > screen-specific permission. */
.perm-indent-1 {
    margin-left: 26px;
}

.perm-indent-2 {
    margin-left: 52px;
}

/* Non-toggleable rows kept so the tree matches the real sidebar
   (Overview always visible; Analytics / PDF report superadmin-only). */
.perm-static {
    padding: 8px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    opacity: 0.75;
}

.perm-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--secondary, #f5f7fa);
    color: var(--text-light);
    vertical-align: 1px;
}

/* Master (menu-group) select-all rows — bulk-edit convenience, not a
   stored permission; state is derived from the member checkboxes. */
.perm-master-row .perm-label {
    font-weight: 600;
}

/* Toggle row with a corner action — the action is absolutely positioned
   in the top-right of the toggle card itself (e.g. the superadmin
   "→ test send" affordance on the monthly report toggle). The toggle
   gets extra right padding so its hint text can't run under the link. */
.perm-toggle-row {
    position: relative;
}

.perm-toggle-with-action {
    padding-right: 96px;
}

.perm-toggle-action {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 2px 4px;
    cursor: pointer;
    line-height: 1.2;
}

.perm-toggle-action:hover:not(:disabled) {
    text-decoration: underline;
}

.perm-toggle-action:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Override .profile-form-group input rule that would force checkboxes
   to 100% width — these checkboxes are NOT inside a form-group. */
.perm-checkbox,
.perm-master {
    width: 18px;
    height: 18px;
    margin: 2px 0 0; /* nudge to align with label baseline */
    accent-color: var(--primary);
    cursor: inherit;
    flex-shrink: 0;
}

.perm-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.perm-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
}

.perm-hint {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.35;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-icon {
    flex-shrink: 0;
}

.nav-text {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 12px;
}

/* Submenu styles */
.nav-section {
    margin-bottom: 5px;
}

.nav-parent {
    cursor: pointer;
}

/* Collapsible group header (e.g. "FDM") — a non-link <div> styled to match
   the real nav links. */
.sidebar-nav .nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.sidebar-nav .nav-group-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-group.expanded > .nav-group-toggle {
    color: var(--white);
}

.nav-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nav-group.expanded > .nav-group-toggle .nav-chevron {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-chevron {
    display: none;
}

.nav-submenu {
    margin-left: 32px;
}

/* Group submenus are hidden until the group is expanded. */
.nav-group > .nav-submenu {
    display: none;
}

.nav-group.expanded > .nav-submenu {
    display: block;
}

.nav-submenu a {
    padding: 8px 15px;
    font-size: 0.8rem;
    font-weight: 300;
    opacity: 0.85;
}

.nav-submenu a.active,
.nav-submenu a:hover {
    opacity: 1;
    font-weight: 400;
}

.sidebar.collapsed .nav-submenu {
    display: none;
}

.sidebar.collapsed .nav-parent {
    justify-content: center;
    cursor: pointer;
}

.main-content {
    flex: 1;
    margin-left: 200px;
    width: calc(100% - 200px);
    background-color: var(--secondary);
    transition: margin-left 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-collapsed .main-content {
    margin-left: 60px;
    width: calc(100% - 60px);
}

.dashboard-header {
    background-color: var(--white);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    background-color: #E3F2FD;
    color: var(--primary);
    border-radius: 16px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    transition: all 0.2s;
}

.tag-remove:hover {
    background-color: var(--primary);
    color: white;
}

/* Breadcrumb Navigation */
/* Breadcrumb as title (Event Analysis dashboard) */
.breadcrumb-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.breadcrumb-title a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb-title a:hover {
    text-decoration: underline;
}

.breadcrumb-title .separator {
    color: #999;
    font-weight: 400;
}

.breadcrumb-title .current {
    color: var(--text);
    font-weight: 600;
}

/* Legacy breadcrumb (if still used elsewhere) */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 4px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    color: #999;
}

.breadcrumb .current {
    color: var(--text);
    font-weight: 500;
}

.header-title-section {
    display: flex;
    flex-direction: column;
}

.header-title-section h1 {
    margin: 0;
}

/* Header Actions (toggle + fullscreen) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Severity Pills in Header */
.severity-pills {
    display: flex;
    gap: 6px;
    margin-right: 100px;
}

.severity-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 16px;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.severity-pill.caution {
    background: rgba(249, 168, 37, 0.15);
    color: #b77a00;
}
.severity-pill.caution:hover {
    background: rgba(249, 168, 37, 0.3);
}
.severity-pill.caution.selected {
    background: #f9a825;
    color: white;
}

.severity-pill.warning {
    background: rgba(240, 96, 0, 0.15);
    color: #c04d00;
}
.severity-pill.warning:hover {
    background: rgba(240, 96, 0, 0.3);
}
.severity-pill.warning.selected {
    background: #F06000;
    color: white;
}

.severity-pill.alert {
    background: rgba(198, 40, 40, 0.15);
    color: #a01e1e;
}
.severity-pill.alert:hover {
    background: rgba(198, 40, 40, 0.3);
}
.severity-pill.alert.selected {
    background: #c62828;
    color: white;
}

.severity-pill.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.severity-label {
    font-weight: 500;
}

.severity-value {
    font-weight: 700;
    min-width: 2.5em;
    text-align: right;
    display: inline-block;
}

/* Metric Toggle (Count/Ratio) */
.metric-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.metric-toggle .toggle-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--white);
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.metric-toggle .toggle-btn:first-child {
    border-right: 1px solid var(--border);
}

.metric-toggle .toggle-btn.active {
    background: var(--primary);
    color: var(--white);
}

.metric-toggle .toggle-btn:hover:not(.active) {
    background: var(--secondary);
}

/* Airport Type Pills (Takeoff/Landing) - selectable pills for chart headers */
.airport-type-pills {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 8px;
}

.airport-pill {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.airport-pill:hover:not(.selected) {
    background: var(--secondary);
    border-color: var(--primary);
}

.airport-pill.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Fullscreen button */
.btn-header-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.btn-header-action:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-fullscreen:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Data table button */
.btn-data-table {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-data-table:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Feedback button */
.btn-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.btn-feedback:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Unread-ticket count on the trigger. Injected by _ticket_modal.html rather
   than added to all ten page headers, so the widget keeps its single host
   contract: an element with id="btn-feedback". */
.btn-feedback-has-badge {
    position: relative;
}

.ticket-trigger-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background-color: #c62828;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--white);
    pointer-events: none;
}

/* Ticket modal */
.ticket-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.ticket-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ticket-modal {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 28px 32px 16px;
    max-width: 480px;
    width: 90%;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.ticket-modal-overlay.active .ticket-modal {
    transform: scale(1);
}

.ticket-modal-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.ticket-modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.ticket-modal-x {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 4px 6px;
    line-height: 1;
}

.ticket-modal-x:hover {
    color: var(--text);
}

.ticket-modal-version {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    padding: 12px 0 0;
}

.ticket-field {
    margin-bottom: 16px;
}

.ticket-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.ticket-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.ticket-toggle-btn {
    flex: 1;
    padding: 7px 0;
    border: none;
    background: var(--white);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
}

.ticket-toggle-btn + .ticket-toggle-btn {
    border-left: 1px solid var(--border);
}

.ticket-toggle-btn.active {
    background: var(--primary);
    color: white;
}

.ticket-severity-pills {
    display: flex;
    gap: 8px;
}

.ticket-severity-pill {
    flex: 1;
    padding: 6px 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--white);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.ticket-severity-pill:hover {
    border-color: #999;
}

.ticket-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.ticket-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.1);
}

.ticket-textarea {
    min-height: 100px;
    resize: vertical;
}

.ticket-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    margin-top: 4px;
}

.ticket-submit-btn:hover {
    opacity: 0.9;
}

.ticket-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ticket-submit-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ticket-spinner {
    animation: ticket-spin 0.8s linear infinite;
}

@keyframes ticket-spin {
    to { transform: rotate(360deg); }
}

.ticket-message {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.ticket-error {
    background: #fef2f2;
    color: #c62828;
    border: 1px solid #fecaca;
}

.ticket-success {
    text-align: center;
    padding: 16px 0 0;
}

.ticket-success-icon {
    width: 48px;
    height: 48px;
    color: #2e7d32;
    margin-bottom: 12px;
}

.ticket-success h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
}

.ticket-success p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 20px;
}

/* Ticket tabs */
.ticket-tabs {
    display: flex;
    gap: 0;
}

.ticket-tab {
    background: none;
    border: none;
    padding: 4px 14px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.ticket-tab:hover {
    color: var(--text);
}

.ticket-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Ticket list */
.ticket-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--text-light);
    font-size: 14px;
}

.ticket-list-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--text-light);
    font-size: 14px;
}

.ticket-list-items {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Unread summary bar + mark-all-read */
.ticket-unread-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.ticket-unread-bar-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.ticket-mark-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: none;
    background: none;
    border-radius: 5px;
    color: var(--text-light);
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.ticket-mark-all-btn:hover {
    background-color: var(--secondary);
    color: var(--text);
}

/* Unread affordances on a row: accent frame, dot, bolder title */
.ticket-card-unread {
    border-color: rgba(0, 75, 147, 0.5);
    background-color: rgba(0, 75, 147, 0.04);
}

.ticket-card-unread .ticket-card-title {
    font-weight: 600;
}

.ticket-card-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin-top: 5px;
    border-radius: 50%;
    background-color: var(--primary);
}

/* Closed-tickets drawer — 'ferme' / 'ne_sera_pas_corrige' only. Collapsed by
   default so the list shows what is still moving. */
.ticket-list-none-open {
    padding: 24px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
}

.ticket-closed-drawer {
    margin-top: 10px;
}

.ticket-closed-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--secondary);
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.ticket-closed-toggle:hover {
    background-color: #dae5ef;
}

.ticket-closed-unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background-color: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ticket-closed-count {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.ticket-closed-chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.ticket-closed-items {
    max-height: 260px;
    margin-top: 8px;
}

/* Ticket card */
.ticket-card {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
    /* The list is a flex column with a max-height; without this the cards
       shrink to fit and clip their own titles instead of scrolling. */
    flex-shrink: 0;
}

.ticket-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 75, 147, 0.1);
}

.ticket-card-severity-bar {
    width: 4px;
    flex-shrink: 0;
    align-self: stretch;
}

.ticket-card-body {
    flex: 1;
    padding: 12px 14px;
    min-width: 0;
}

.ticket-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.ticket-card-icon {
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.7;
}

.ticket-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-card-time {
    font-size: 12px;
    color: var(--text-light);
}

.ticket-card-duration {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 700;
    flex-shrink: 0;
    padding: 0 14px;
    white-space: nowrap;
}

.ticket-card-version {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
    background: rgba(0, 75, 147, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}

.ticket-card-reply {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    opacity: 0.6;
    margin-left: auto;
}

/* Ticket status badge */
.ticket-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

/* Ticket detail view */
.ticket-detail-back {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-bottom: 14px;
}

.ticket-detail-back:hover {
    text-decoration: underline;
}

.ticket-detail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--text-light);
    font-size: 14px;
}

.ticket-detail-banner {
    display: flex;
    align-items: center;
    background: var(--secondary);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border-left: 4px solid var(--primary);
}

.ticket-detail-banner-body {
    flex: 1;
    min-width: 0;
}

.ticket-detail-banner-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.ticket-detail-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
}

.ticket-detail-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

.ticket-detail-duration {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 700;
    flex-shrink: 0;
    padding-left: 16px;
    white-space: nowrap;
}

.ticket-detail-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ticket-detail-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
}

.ticket-detail-pill-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ticket-detail-section {
    margin-bottom: 14px;
}

.ticket-detail-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ticket-detail-section-content {
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fafafa;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.ticket-detail-reply-section {
    margin-bottom: 14px;
}

.ticket-detail-reply-box {
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.ticket-detail-has-reply {
    background: #e8f5e9;
    border-color: #c8e6c9;
    color: var(--text);
}

.ticket-detail-no-reply {
    background: #fafafa;
    color: var(--text-light);
    font-style: italic;
}

/* Ticket screenshot & attachment styles */
.ticket-attachment-zone {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket-attachment-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.15s;
}

.ticket-attachment-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.ticket-attachment-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.ticket-attachment-btn.active:hover {
    opacity: 0.9;
}

.ticket-attachment-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ticket-attachment-count {
    font-size: 11px;
    color: var(--text-light);
}

.ticket-attachment-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.ticket-attachment-item {
    position: relative;
    width: 60px;
    height: 60px;
}

.ticket-attachment-thumb-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.ticket-attachment-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #c62828;
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ticket-attachment-remove:hover {
    background: #b71c1c;
}

.ticket-thumb-clickable {
    cursor: pointer;
}

.ticket-thumb-clickable:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 75, 147, 0.15);
}

/* Attachment lightbox */
.ticket-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10100;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.ticket-lightbox.active {
    display: flex;
}

.ticket-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.ticket-lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.ticket-lightbox-close:hover {
    opacity: 1;
}

/* Anonymize pilots button */
.btn-anonymize {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-anonymize:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-anonymize.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Print button */
.btn-print {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-print:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 40px;
}

.dashboard-header h1 {
    font-size: 1.25rem;
    color: var(--text);
    margin: 0;
}

.header-slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.date-range-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    width: 340px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range-text .date-label {
    color: var(--text-light);
    font-weight: 400;
}

.date-range-text .date-value {
    font-weight: 700;
    font-size: 1rem;
}

/* Clickable date values */
.date-picker-trigger {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.date-picker-trigger:hover {
    background-color: rgba(0, 75, 147, 0.1);
}

/* Hidden date inputs for Flatpickr */
.hidden-date-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Ensure Flatpickr calendar doesn't affect layout */
.header-slider-container .flatpickr-calendar {
    position: absolute;
}

/* Flatpickr theme customization to match ASL design */
.flatpickr-calendar {
    font-family: 'Inter', sans-serif;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.flatpickr-day:hover {
    background: rgba(0, 75, 147, 0.1);
}

.flatpickr-months .flatpickr-month {
    background: var(--primary);
    color: white;
    border-radius: 8px 8px 0 0;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #393939;
    background: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='none' stroke='%236d6d6d' stroke-width='1.5' d='M1 1l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    padding-right: 14px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.flatpickr-current-month input.cur-year {
    color: white;
    font-weight: 600;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Year dropdown in header - match month dropdown exactly */
.flatpickr-current-month .flatpickr-year-dropdown {
    color: #393939;
    font-weight: inherit;
    font-size: inherit;
    font-family: inherit;
    background: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='none' stroke='%236d6d6d' stroke-width='1.5' d='M1 1l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    padding-right: 14px;
    border: none;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.flatpickr-current-month .flatpickr-year-dropdown:hover {
    background: rgba(0, 0, 0, 0.05) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='none' stroke='%236d6d6d' stroke-width='1.5' d='M1 1l3 3 3-3'/%3E%3C/svg%3E") no-repeat right center;
}

/* Hide the numInputWrapper background that shows through */
.flatpickr-current-month .numInputWrapper {
    background: transparent;
}

.flatpickr-current-month .numInputWrapper:hover {
    background: transparent;
}

.flatpickr-current-month .flatpickr-year-dropdown:focus {
    outline: none;
}

.flatpickr-weekday {
    color: var(--primary);
    font-weight: 600;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    fill: white;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: rgba(255, 255, 255, 0.8);
}

/* Hide the up/down arrows on year input */
.flatpickr-current-month .numInputWrapper span {
    display: none;
}

/* Year dropdown options (when open) */
.flatpickr-year-dropdown option {
    background: #f5f5f5;
    color: #393939;
    padding: 8px 20px;
    text-indent: 8px;
}

.flatpickr-year-dropdown option:checked,
.flatpickr-year-dropdown option:hover {
    background: var(--primary);
    color: white;
}

.dashboard-body {
    padding: 12px 24px 12px 24px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Report page content */
.report-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* PDF Loading State */
.pdf-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-light);
}

.pdf-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* PDF Error State */
.pdf-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-light);
}

.pdf-error span {
    font-size: 1rem;
    color: #c62828;
}

/* PDF Viewer */
#pdf-viewer {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: none;
}

/* Event Analysis Dashboard Grid: 3 columns, map spans 2 rows */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.dashboard-grid > .chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-grid > .chart-card .chart-container {
    flex: 1;
    min-height: 0;
}

/* Bottom charts wrapper: spans 2 columns, contains 3 equal sub-columns */
.bottom-charts-wrapper {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    min-height: 0;
}

.bottom-charts-wrapper .chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.bottom-charts-wrapper .chart-container {
    flex: 1;
    min-height: 0;
}

/* No-airport layout: when relevant_airport is 'none', hide airport chart and map */
/* Time chart spans full width in row 1, bottom charts get full width in row 2 */
.dashboard-grid.no-airport-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.dashboard-grid.no-airport-layout > .chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-grid.no-airport-layout > .chart-card .chart-container {
    flex: 1;
    min-height: 0;
}

/* Bottom charts wrapper in no-airport mode: full width with 3 equal columns */
.dashboard-grid.no-airport-layout .bottom-charts-wrapper {
    grid-column: 1;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    min-height: 0;
}

/* Date Range Section */
.date-range-section {
    background-color: var(--white);
    border-radius: 8px;
    padding: 16px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.date-range-display {
    text-align: center;
    margin-bottom: 12px;
}

.date-range-display span {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

/* Date Preset Buttons */
.date-preset-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.date-preset-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.date-preset-btn:hover {
    background: var(--primary);
    color: white;
}

.date-preset-btn.selected {
    background: var(--primary);
    color: white;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.kpi-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.kpi-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.kpi-card h3 {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.kpi-card.info {
    border-left-color: #616161;
}

.kpi-card.info .value {
    color: #616161;
}

.kpi-card.caution {
    border-left-color: #f9a825;
}

.kpi-card.caution .value {
    color: #f9a825;
}

.kpi-card.warning {
    border-left-color: #F06000;
}

.kpi-card.warning .value {
    color: #F06000;
}

.kpi-card.alert {
    border-left-color: #c62828;
}

.kpi-card.alert .value {
    color: #c62828;
}

.kpi-card.mixed {
    border-left-color: #9080B0;
}

.kpi-card.mixed .value {
    color: #9080B0;
}

/* Clickable KPI cards */
.kpi-card.clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-card.clickable.selected {
    box-shadow: 0 0 0 2px var(--primary), var(--shadow);
}

.kpi-card.caution.selected {
    box-shadow: 0 0 0 2px #f9a825, var(--shadow);
}

.kpi-card.warning.selected {
    box-shadow: 0 0 0 2px #F06000, var(--shadow);
}

.kpi-card.alert.selected {
    box-shadow: 0 0 0 2px #c62828, var(--shadow);
}

.kpi-card.mixed.selected {
    box-shadow: 0 0 0 2px #9080B0, var(--shadow);
}

/* Top Charts Row: Time + Airport (2 equal columns) */
.top-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.top-charts-row .chart-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.top-charts-row .chart-container {
    flex: 1;
    min-height: 0;
}

.map-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    grid-row: span 2;
    min-height: 0;
    position: relative;
}

.map-card h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 8px;
}

#goAroundMap, #eventMap {
    flex: 1;
    min-height: 0;
    border-radius: 6px;
    z-index: 1;
}

/* Leaflet tooltip styling to match Chart.js tooltip */
.leaflet-tooltip.airport-tooltip {
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25) !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
}

.leaflet-tooltip.airport-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.8) !important;
}

.leaflet-tooltip.airport-tooltip.leaflet-tooltip-bottom::before {
    border-bottom-color: rgba(0, 0, 0, 0.8) !important;
}

.leaflet-tooltip.airport-tooltip.leaflet-tooltip-left::before {
    border-left-color: rgba(0, 0, 0, 0.8) !important;
}

.leaflet-tooltip.airport-tooltip.leaflet-tooltip-right::before {
    border-right-color: rgba(0, 0, 0, 0.8) !important;
}

.airport-tooltip .tooltip-title {
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 13px;
}

.airport-tooltip .tooltip-body {
    display: flex;
    align-items: center;
    gap: 8px;
}

.airport-tooltip .tooltip-color-box {
    width: 10px;
    height: 10px;
    background-color: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.airport-tooltip .tooltip-footer {
    margin-top: 3px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Bottom row: Pilots + Aircraft Type (3 equal columns) */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 0;
    flex: 1;
    min-height: 0;
}

.bottom-row .chart-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
}

/* Pilot charts - compact */
.chart-card-pilots .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.chart-card-pilots .chart-container canvas {
    max-width: 100%;
}

/* Aircraft type pie chart */
.pie-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.chart-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 16px;
    min-width: 0;
    min-height: 0;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.chart-header h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin: 0;
}

.chart-header-buttons {
    display: flex;
    gap: 8px;
}

.chart-card h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 8px;
}

.btn-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-reset svg {
    flex-shrink: 0;
}

.chart-container {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* No data display */
.no-data-message {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
    align-items: center;
    background-color: var(--secondary);
    border-radius: 6px;
    z-index: 5;
}

.no-data-message.visible {
    display: flex;
}

.no-data-message span {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
}

/* Analytics page grid */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.analytics-grid .chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.analytics-grid .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.fp-pies-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 16px 16px;
    flex: 1;
    min-height: 0;
}

.fp-pie-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fp-pie-wrapper h4 {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin: 0 0 8px 0;
    flex-shrink: 0;
}

.fp-pie-wrapper .chart-container {
    flex: 1;
    min-height: 0;
}

@media (max-width: 900px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        overflow-y: auto;
    }
    .analytics-grid .chart-card {
        min-height: 300px;
    }
    .fp-pies-container {
        grid-template-columns: 1fr;
    }
}

.chart-container.has-no-data canvas {
    visibility: hidden;
}

/* Filters */
.filters {
    background-color: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.filters h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text);
}

.filter-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 6px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
    background-color: var(--white);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.1);
}

/* Data Table */
.data-table-container {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-table-header h3 {
    font-size: 1rem;
    color: var(--text);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: var(--background);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background-color: var(--background);
}

.data-table td {
    font-size: 0.9rem;
}

/* Severity badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Level 0 - Information (Gray) */
.badge-info {
    background-color: #f5f5f5;
    color: #616161;
}

/* Level 1 - Caution (Yellow) */
.badge-caution {
    background-color: #fff9c4;
    color: #f9a825;
}

/* Level 2 - Warning (Orange) */
.badge-warning {
    background-color: #fff3e0;
    color: #F06000;
}

/* Level 3 - Alert (Red) */
.badge-alert {
    background-color: #ffebee;
    color: #c62828;
}

.badge-default {
    background-color: #e3f2fd;
    color: var(--primary);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1200px) {
    /* Event Analysis: Stack to 2 columns, map below */
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }

    .dashboard-grid > .map-card {
        grid-column: span 2;
        grid-row: auto;
        height: 300px;
    }

    .bottom-charts-wrapper {
        grid-column: span 2;
        grid-template-columns: 1fr 1fr;
    }

    .bottom-charts-wrapper .chart-card-pie {
        grid-column: span 2;
    }
}

/* ===== Overview Dashboard Layout ===== */
.overview-content {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left Column: Contains Events by Type and Events by Pilots */
.overview-left-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow: hidden;
}

/* Event Types Chart Card - Takes half height */
.event-types-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    flex: 1;
}

.event-types-card .chart-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Inner wrapper for the canvas - height set dynamically by JS */
.event-types-chart-wrapper {
    position: relative;
    width: 100%;
    /* Height will be set dynamically based on number of bars */
}

/* Event Pilots Chart Card - Takes half height */
.event-pilots-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    flex: 1;
}

.event-pilots-card .chart-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Inner wrapper for the pilots canvas - height set dynamically by JS */
.event-pilots-chart-wrapper {
    position: relative;
    width: 100%;
    /* Height will be set dynamically based on number of bars */
}

/* Event pilots wrapper - same as event types wrapper */
.event-pilots-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.event-pilots-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===== Event Type Search Field ===== */
.event-type-search {
    position: relative;
    display: flex;
    align-items: center;
}

.event-type-search input {
    width: 140px;
    height: 28px;
    padding: 4px 28px 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.event-type-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 75, 147, 0.1);
}

.event-type-search input::placeholder {
    color: #999;
}

.event-type-search .search-clear {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.event-type-search .search-clear:hover {
    background: #e0e0e0;
    color: #666;
}

/* ===== Event Types Chart Auto-Scale ===== */

/* Container wrapper for event types (holds scrollable chart and sticky X-axis) */
.event-types-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Make event-types-container scrollable within wrapper */
.event-types-wrapper .event-types-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* X-axis overlay (visible during auto-scale mode) - positioned at bottom */
.event-types-wrapper .xaxis-overlay,
.event-pilots-wrapper .xaxis-overlay {
    height: 40px;
    flex-shrink: 0;
    background: white;
    display: flex;
    flex-direction: column;
    /* padding-left set dynamically by JS based on chart Y-axis width */
    padding-right: 10px;
    border-top: 1px solid var(--border);
}

.event-types-wrapper .xaxis-overlay .xaxis-ticks,
.event-pilots-wrapper .xaxis-overlay .xaxis-ticks {
    flex: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 4px;
    font-size: 10px;
    color: #666;
}

.event-types-wrapper .xaxis-overlay .xaxis-tick,
.event-pilots-wrapper .xaxis-overlay .xaxis-tick {
    line-height: 1;
}

/* First and last ticks stay at edges without overflow */

.event-types-wrapper .xaxis-overlay .xaxis-title,
.event-pilots-wrapper .xaxis-overlay .xaxis-title {
    font-size: 11px;
    color: #666;
    text-align: center;
    padding-bottom: 4px;
}

/* Events Over Time Chart Card */
.events-time-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.events-time-card .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.events-time-card canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Right column container - holds Events over Time + new charts row */
.overview-right-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

/* Events over time takes ~60% of right column height */
.overview-right-column .events-time-card {
    flex: 1.2;
    min-height: 0;
}

/* Bottom charts row - two equal columns */
.overview-bottom-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    flex: 0.8;
    min-height: 0;
}

/* New chart cards - match existing chart-card styling */
.overview-bottom-charts .chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Airport chart container wrapper (holds sticky Y-axis and scrollable chart) */
.overview-airport-chart .chart-container-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
}

/* Airport bar chart container */
.overview-airport-chart .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}


/* Toggle view button (show all / show first 15) */
.btn-toggle-view {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-toggle-view:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-toggle-view.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Inner wrapper for airport chart (non-scrollable mode) */
.overview-airport-chart .chart-inner-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Non-scrollable mode: canvas fills wrapper */
.overview-airport-chart .chart-inner-wrapper canvas {
    width: 100%;
    height: 100%;
}

/* Scrollable mode: canvas has fixed dimensions set by JS */
.overview-airport-chart .chart-container.scrollable .chart-inner-wrapper canvas {
    /* Dimensions set via JS - don't override */
}

/* Scrollable airport chart container (horizontal scroll) */
.overview-airport-chart .chart-container.scrollable {
    overflow-x: auto;
    overflow-y: hidden;
}

.overview-airport-chart .chart-container.scrollable .chart-inner-wrapper {
    position: relative;
    width: auto; /* Override base 100% - JS sets actual width */
    height: 100%;
    flex-shrink: 0;
}

/* Chart header buttons container */
.chart-header-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Auto-scale icon button */
.btn-autoscale {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-autoscale:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-autoscale.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Y-axis overlay (visible during auto-scale mode) */
.overview-airport-chart .yaxis-overlay {
    width: 50px;
    flex-shrink: 0;
    background: white;
    display: flex;
    flex-direction: row;
    /* padding-top and padding-bottom set dynamically by JS based on chart area */
}

.overview-airport-chart .yaxis-overlay .yaxis-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
}

.overview-airport-chart .yaxis-overlay .yaxis-ticks {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding-right: 4px;
    font-size: 10px;
    color: #666;
}

.overview-airport-chart .yaxis-overlay .yaxis-tick {
    line-height: 1;
}

/* Align tick text with chart gridlines */
.overview-airport-chart .yaxis-overlay .yaxis-tick:first-child {
    transform: translateY(-50%);
}

.overview-airport-chart .yaxis-overlay .yaxis-tick:last-child {
    transform: translateY(-50%);
}

/* Pilots chart wrapper for vertical scrolling */
.chart-card-pilots .pilots-chart-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Scrollable pilots chart container (vertical scroll) */
.chart-card-pilots .chart-container.scrollable-vertical {
    overflow-y: auto;
    overflow-x: hidden;
}

.chart-card-pilots .chart-container.scrollable-vertical .chart-inner-wrapper {
    position: relative;
    width: 100%;
    height: auto; /* JS sets actual height */
    flex-shrink: 0;
}

/* Sticky X-axis for pilots charts */
.chart-card-pilots .sticky-xaxis {
    display: flex;
    flex-direction: column;
    background: white;
    flex-shrink: 0;
    /* Padding matches Chart.js chart area - adjusted by JS */
}

.chart-card-pilots .sticky-xaxis .xaxis-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
    border-top: 1px solid #e0e0e0;
    padding-top: 4px;
}

.chart-card-pilots .sticky-xaxis .xaxis-ticks span {
    text-align: center;
    min-width: 20px;
}

.chart-card-pilots .sticky-xaxis .xaxis-ticks span:first-child {
    text-align: left;
}

.chart-card-pilots .sticky-xaxis .xaxis-ticks span:last-child {
    text-align: right;
}

.chart-card-pilots .sticky-xaxis .xaxis-title {
    text-align: center;
    font-size: 11px;
    color: #666;
    padding-top: 2px;
}

/* Aircraft type pie chart container */
.overview-airframe-chart .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.overview-airframe-chart canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Responsive: Stack charts on smaller screens */
@media (max-width: 1200px) {
    .overview-content {
        grid-template-columns: 1fr;
    }

    .overview-bottom-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .top-charts-row {
        grid-template-columns: 1fr;
    }

    .bottom-row {
        grid-template-columns: 1fr;
    }

    /* Event Analysis: Single column on small screens */
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .dashboard-grid > .map-card {
        grid-column: 1;
        height: 250px;
    }

    .bottom-charts-wrapper {
        grid-column: 1;
        grid-template-columns: 1fr;
    }

    .bottom-charts-wrapper .chart-card-pie {
        grid-column: 1;
    }

    /* No-airport layout responsive adjustments */
    .dashboard-grid.no-airport-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .dashboard-grid.no-airport-layout .bottom-charts-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .dashboard {
        flex-direction: column;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-row {
        flex-direction: column;
    }

    .hero h1 {
        font-size: 2rem;
    }
}

/* ===== Data Table Modal ===== */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 95vw;
    max-width: 1600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title-group {
    flex: 1;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.modal-tabs {
    display: flex;
    gap: 0;
}

.modal-tab {
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-tab:first-child {
    border-radius: 6px 0 0 6px;
}

.modal-tab:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.modal-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.modal-tab:hover:not(.active) {
    background: #e8e8e8;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 4px 0 0 0;
    font-weight: 400;
}

.modal-header .event-count {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 12px;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-light);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--background);
    color: var(--text);
}

/* Modal Body with Scrollable Table */
.modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

/* Data Table in Modal */
.modal-body .data-table {
    width: 100%;
    border-collapse: collapse;
}

.modal-body .data-table th {
    position: sticky;
    top: 0;
    background-color: var(--background);
    z-index: 10;
}

.modal-body .data-table th,
.modal-body .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.modal-body .data-table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-body .data-table td {
    font-size: 0.8rem;
}

.modal-body .data-table tr:hover {
    background-color: var(--background);
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-footer .pagination-info {
    font-size: 0.875rem;
    color: var(--text-light);
}

.btn-show-all {
    margin-left: 12px;
    padding: 4px 10px;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-show-all:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Loading state inside modal */
.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-light);
}

/* ===== Admin Page ===== */

/* Admin panel tab rail (Users / Permission Groups) — plain links, the URL
   carries the active tab. */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    flex-shrink: 0;
}

.admin-tab {
    padding: 9px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.12s, border-color 0.12s;
}

.admin-tab:hover {
    color: var(--text);
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.admin-content {
    padding: 24px;
    /* Table-centric page: the content area scrolls, the page never does.
       Needed since the Permission Groups card joined the users table. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.admin-content .data-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-content .data-table th,
.admin-content .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.admin-content .data-table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--background);
}

.admin-content .data-table tr:hover {
    background-color: var(--background);
}

.admin-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-icon-warn:hover { background: #f9a825; border-color: #f9a825; }
.btn-icon-success:hover { background: var(--success); border-color: var(--success); }
.btn-icon-danger:hover { background: var(--error); border-color: var(--error); }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active { background: #e8f5e9; color: #2e7d32; }
.status-locked { background: #ffebee; color: #c62828; }
.status-admin { background: #e3f2fd; color: #1565c0; }

.btn-primary-sm {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary-sm:hover { background: var(--primary-dark); }

/* User detail page */
.user-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text-light);
    transition: all 0.2s;
}

.back-link:hover {
    background: var(--secondary);
    color: var(--primary);
}

.flight-status-ok { color: #2e7d32; font-weight: 600; }
.flight-status-missing { color: #c62828; font-weight: 600; display: block; text-align: center; }

.source-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 3px;
    letter-spacing: 0.02em;
}
.source-tag.airline { background: #E6EEF5; color: #004B93; }
.source-tag.fdw { background: #E8F5E9; color: #2e7d32; }
.source-tag.odw { background: #FFF3E0; color: #F06000; }

.fdw-metric-toggle {
    display: flex;
    gap: 2px;
    background: #f0f0f0;
    border-radius: 6px;
    padding: 2px;
}
.fdw-metric-btn {
    padding: 3px 10px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s;
}
.fdw-metric-btn:hover { color: var(--text); }
.fdw-metric-btn.active {
    background: var(--primary);
    color: white;
}

.fdw-target-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 3px 4px 3px 8px;
}
/* Aircraft detail — flights card expand/collapse */
.flights-expand-btn {
    background: var(--white, #fff);
    border: 1px solid var(--border, #d5dae1);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light, #6b7280);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.flights-expand-btn:hover {
    background: var(--secondary, #E6EEF5);
    color: var(--primary, #004B93);
    border-color: var(--primary, #004B93);
}
.dashboard-body.flights-expanded #charts-row {
    display: none !important;
}

.fdw-target-input {
    width: 56px;
    padding: 3px 4px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
    background: white;
}
.fdw-target-input:focus { outline: none; border-color: var(--primary); }
.fdw-target-unit {
    font-size: 0.7rem;
    color: var(--text-light);
}
.fdw-target-save-btn {
    padding: 3px 8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}
.fdw-target-save-btn:hover { opacity: 0.9; }
.fdw-target-status {
    font-size: 0.7rem;
    color: var(--text-light);
}
.fdw-target-status.set { color: #2e7d32; }
.fdw-target-status.error { color: #c62828; }

.source-tags-grid {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 3px;
}
.source-tag-placeholder {
    display: inline-block;
    width: 44px;
}
.source-tags-grid .source-tag {
    width: 44px;
    text-align: center;
    box-sizing: border-box;
    margin-right: 0;
    padding: 2px 0;
}

.user-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    box-sizing: border-box;
}

.user-detail-grid .user-info-card {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.user-detail-grid .chart-card:nth-child(2) {
    grid-column: 1 / -1;
}

.user-detail-grid .chart-card {
    min-height: 0;
}

.user-detail-grid .chart-card .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.user-info-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.user-info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.user-info-value {
    font-size: 0.95rem;
    font-weight: 500;
}

/* ============================================================
   Processing / FDM Compliance Dashboard
   ============================================================ */

/* Block Hours + FDW + ODW; a fourth column appears with the airline card. */
/* auto-fit, not a fixed column count: cards on this row come and go
   (the airline card only when a manifest is uploaded; Block Hours moved to
   Overview in v2.3.0), and display:none items create no track — so the
   visible cards always spread across the full row width. */
.processing-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.kpi-card.compliant {
    border-left-color: #2e7d32;
}

.kpi-card.compliant .value {
    color: #2e7d32;
}

.kpi-card.at-risk {
    border-left-color: #f9a825;
}

.kpi-card.at-risk .value {
    color: #f9a825;
}

.kpi-card.non-compliant {
    border-left-color: #c62828;
}

.kpi-card.non-compliant .value {
    color: #c62828;
}

.kpi-card.partial {
    border-left-color: #9e9e9e;
}

.kpi-card.partial .value {
    color: #9e9e9e;
}

.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.badge-partial {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #e0e0e0;
    color: #616161;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.processing-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.processing-charts-grid .chart-card {
    min-height: 320px;
}

.processing-charts-grid .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.fleet-table-container {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.fleet-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
}

.fleet-table-header h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin: 0;
}

.fleet-table-scroll {
    max-height: 500px;
    overflow-y: auto;
}

.processing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.processing-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.processing-table th {
    background-color: var(--secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.processing-table th:hover {
    background-color: #d6dee7;
}

.processing-table th .sort-arrow {
    margin-left: 4px;
    opacity: 0.3;
}

.processing-table th.sorted .sort-arrow {
    opacity: 1;
}

.processing-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.processing-table tbody tr:hover {
    background-color: var(--secondary);
}

.processing-table th.section-start,
.processing-table td.section-start {
    border-left: 2px solid var(--border, #d5dae1);
}

/* Block-hours cell. The coverage chip only renders below 90%, so a clean
   number means "we have the data" and a chipped one means "read with care". */
.processing-table td.hours-cell {
    font-variant-numeric: tabular-nums;
}

.hours-value {
    font-weight: 600;
}

.hours-coverage {
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 4px;
    background-color: rgba(249, 168, 37, 0.18);
    color: #8a6100;
    font-size: 11px;
    font-weight: 600;
}

.hours-none {
    color: var(--text-light);
}

.processing-table tbody tr.row-collection-failure {
    background-color: rgba(198, 40, 40, 0.08);
}

.processing-table tbody tr.row-collection-failure:hover {
    background-color: rgba(198, 40, 40, 0.14);
}

.processing-table tbody tr.row-collection-failure td:first-child::before {
    content: "⚠ ";
    color: #c62828;
    font-weight: 700;
}

/* Data Collection Failure floating tooltip (follows mouse) */
.collection-failure-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 240px;
    background: #ffffff;
    border-radius: 8px;
    border-left: 4px solid #c62828;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    padding: 12px 14px 10px;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.45;
    color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease;
    z-index: 10000;
    pointer-events: none;
}

.collection-failure-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.collection-failure-tooltip .cft-title {
    font-size: 13px;
    font-weight: 700;
    color: #c62828;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.collection-failure-tooltip dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 14px;
    margin: 0;
}

.collection-failure-tooltip dt {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.collection-failure-tooltip dd {
    margin: 0;
    color: #222;
    font-weight: 600;
    text-align: right;
}

.collection-failure-tooltip .cft-days {
    font-weight: 500;
    color: #c62828;
    margin-left: 4px;
}

#cl-data-identification-list,
#cl-data-correction-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#cl-data-identification-list .failure-row,
#cl-data-correction-list .failure-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 9px 12px;
    border-radius: 8px;
    background: #f7f9fb;
    border: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.78rem;
    line-height: 1.3;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

#cl-data-identification-list .failure-row:hover,
#cl-data-correction-list .failure-row:hover {
    background: #eff3f7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

#cl-data-identification-list .failure-row a.failure-tail,
#cl-data-correction-list .failure-row a.failure-tail {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--primary);
    background: #fff;
    border: 1px solid rgba(0, 75, 147, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
}

#cl-data-identification-list .failure-row a.failure-tail:hover,
#cl-data-correction-list .failure-row a.failure-tail:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

#cl-data-identification-list .failure-row .failure-timeline,
#cl-data-correction-list .failure-row .failure-timeline {
    color: var(--text-light);
    font-size: 0.76rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#cl-data-identification-list .failure-row .failure-timeline > span,
#cl-data-correction-list .failure-row .failure-timeline > span {
    white-space: nowrap;
}

#cl-data-identification-list .failure-row .failure-timeline strong,
#cl-data-correction-list .failure-row .failure-timeline strong {
    color: var(--text);
    font-weight: 600;
}

#cl-data-identification-list .failure-metric,
#cl-data-correction-list .failure-metric {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e8f5e9;
    color: #2e7d32;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

#cl-data-correction-list .failure-metric.urgent {
    background: #ffebee;
    color: #c62828;
    box-shadow: inset 0 0 0 1px rgba(198, 40, 40, 0.22);
}

#cl-data-correction-list .failure-row.urgent-row {
    background: #fff5f5;
    border-color: rgba(198, 40, 40, 0.18);
    border-left: 3px solid #c62828;
    padding-left: 10px;
}

.rate-compliant {
    color: #2e7d32;
    font-weight: 600;
}

.rate-at-risk {
    color: #f9a825;
    font-weight: 600;
}

.rate-non-compliant {
    color: #c62828;
    font-weight: 600;
}

.badge-exempt {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #e0e0e0;
    color: #616161;
    text-transform: uppercase;
}

.badge-ok {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #e8f5e9;
    color: #2e7d32;
    text-transform: uppercase;
}

.badge-warn {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #fff8e1;
    color: #f9a825;
    text-transform: uppercase;
}

.badge-overdue {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #fce4ec;
    color: #c62828;
    text-transform: uppercase;
}

.rate-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.rate-badge.good {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.rate-badge.ok {
    background-color: #fff8e1;
    color: #e6a700;
}

.rate-badge.bad {
    background-color: #fce4ec;
    color: #c62828;
}

.rate-badge.neutral {
    background-color: #f5f5f5;
    color: #9e9e9e;
}

.processing-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    flex-shrink: 0;
}

.compliance-checklist {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 16px;
}

.compliance-checklist h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin: 0 0 12px 0;
}

.compliance-item {
    border-bottom: 1px solid var(--border);
}

.compliance-item:last-child {
    border-bottom: none;
}

.compliance-summary {
    display: flex;
    align-items: center;
    padding: 10px 0;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.compliance-summary::-webkit-details-marker {
    display: none;
}

.compliance-summary:hover .compliance-label {
    color: var(--primary);
}

.compliance-chevron {
    color: var(--text-light);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.compliance-item[open] > .compliance-summary > .compliance-chevron {
    transform: rotate(180deg);
}

.compliance-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.compliance-status.green { background-color: #2e7d32; }
.compliance-status.yellow { background-color: #f9a825; }
.compliance-status.red { background-color: #c62828; }
.compliance-status.gray { background-color: #9e9e9e; }

.compliance-label {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    transition: color 0.15s ease;
}

.compliance-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    background: #f2f2f2;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.2px;
    line-height: 1.3;
    white-space: nowrap;
}

.compliance-value.green {
    background: #e8f5e9;
    color: #2e7d32;
    box-shadow: inset 0 0 0 1px rgba(46, 125, 50, 0.18);
}

.compliance-value.red {
    background: #ffebee;
    color: #c62828;
    box-shadow: inset 0 0 0 1px rgba(198, 40, 40, 0.22);
}

.compliance-value .threshold {
    opacity: 0.58;
    font-weight: 500;
    margin-left: 3px;
}

.compliance-detail {
    padding: 0 8px 14px 22px;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
}

.compliance-detail-ref {
    font-weight: 600;
    color: var(--text);
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.compliance-detail p {
    margin: 0 0 8px;
}

.compliance-detail p:last-child {
    margin-bottom: 0;
}

.compliance-detail-howto {
    margin-top: 10px !important;
    padding: 8px 10px;
    background: var(--secondary);
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.5;
}

.gap-card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 16px;
}

.gap-card h3 {
    font-size: 0.9rem;
    color: var(--text);
    margin: 0 0 12px 0;
}

.gap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.gap-item:last-child {
    border-bottom: none;
}

.gap-item .tail {
    font-weight: 600;
    color: var(--text);
}

.gap-item .days {
    color: #c62828;
    font-weight: 600;
}

.gap-notice {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 12px;
    padding: 8px;
    background-color: var(--secondary);
    border-radius: 4px;
}

.btn-toggle-exempt {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--background);
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle-exempt:hover {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-toggle-exempt.active {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

@media (max-width: 900px) {
    .processing-kpi-row {
        grid-template-columns: 1fr;
    }

    .processing-charts-grid {
        grid-template-columns: 1fr;
    }

    .processing-bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* Print styles - for screenshot print window */
@media print {
    @page {
        size: A4 landscape;
        margin: 0;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ============================================================
   Overview page (fleet activity BI)
   ============================================================ */

.ov-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.ov-kpi-row .kpi-card { position: relative; }

/* Badge sits top-right of its KPI card */
.ov-kpi-row .accuracy-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* One-viewport contract (see the dashboard_designer skill): .dashboard-body
   is overflow:hidden, the KPI row is fixed-height, and .ov-content fills the
   remainder. Every card is a flex column whose .chart-container gets
   flex:1 + min-height:0 with an absolutely-positioned canvas — the same
   mechanics as the Events dashboard — so charts absorb the leftover space
   instead of dictating a page height. */

.ov-content {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.ov-aircraft-card { flex: 1.5; min-width: 0; }

.ov-right-column {
    flex: 3.5;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ov-trend-card { flex: 0.85; min-height: 0; }

/* Type | Captains | First Officers. Without can_view_pilot_names the two
   pilot cards are not rendered and .ov-single gives Type the full row. */
.ov-bottom-charts {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.ov-bottom-charts.ov-single { grid-template-columns: 1fr; }

.ov-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ov-card .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.ov-card canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Cards with a "Show all N" toggle (Captains / First Officers): the canvas
   lives in an inner wrapper whose height JS sets to 25px/bar in show-all
   mode, and the CONTAINER scrolls — so the canvas must size with the
   wrapper, not be absolutely pinned to the container. */
.ov-scroll-card .chart-container { overflow: hidden; }

.ov-scroll-card .chart-container.scrollable-vertical {
    overflow-y: auto;
    overflow-x: hidden;
}

.ov-scroll-card .chart-inner-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.ov-scroll-card canvas {
    position: static;
    width: 100% !important;
    height: 100% !important;
}

.ov-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.ov-card-head h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ov-card-note {
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--text-light);
    margin-left: 8px;
}

/* Small screens are the one sanctioned exception to no-page-scroll:
   stack the cards at fixed heights and let the body scroll. */
@media (max-width: 1100px) {
    .ov-page { overflow-y: auto; }
    .ov-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .ov-content { flex-direction: column; }
    .ov-aircraft-card { flex: none; height: 420px; }
    .ov-right-column { flex: none; }
    .ov-trend-card { flex: none; height: 300px; }
    .ov-bottom-charts { grid-template-columns: 1fr; }
    .ov-bottom-charts .chart-card { height: 320px; }
}

/* Data accuracy badge. Colour encodes coverage of the figure it sits next
   to: green = trust it, amber = read with care, red = broad. Informational,
   not clickable — hovering shows the app-standard dark tooltip (see
   ::after below) explaining what the percentage means. */
.accuracy-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    color: var(--text);
    cursor: default;
}

/* Hover explainer — the app-standard dark tooltip (matches Chart.js,
   .airport-tooltip and .collection-failure-tooltip): rgba(0,0,0,0.8),
   white Inter 13px, radius 6, soft shadow. Structured like the chart
   tooltips: bold title, short body lines, muted footer — never one
   dense paragraph. */
.accuracy-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    white-space: normal;
    text-align: left;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.accuracy-tooltip::before {
    content: '';
    position: absolute;
    top: -12px;
    right: 14px;
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
}

.accuracy-tooltip-title {
    font-weight: 700;
}

.accuracy-tooltip-pct {
    font-weight: 700;
}

.accuracy-tooltip-line {
    color: rgba(255, 255, 255, 0.92);
}

.accuracy-tooltip-footer {
    margin-top: 1px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.accuracy-badge:hover .accuracy-tooltip {
    opacity: 1;
    visibility: visible;
}

.accuracy-badge .accuracy-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.accuracy-badge .accuracy-badge-label { color: var(--text-light); font-weight: 500; }

.ov-card-head h3 { flex: 1; min-width: 0; }

.accuracy-badge.good { background: #e8f5e9; border-color: #c8e6c9; }
.accuracy-badge.good .accuracy-badge-dot { background: #2e7d32; }
.accuracy-badge.good .accuracy-badge-value { color: #2e7d32; }

.accuracy-badge.warn { background: #fff8e1; border-color: #ffecb3; }
.accuracy-badge.warn .accuracy-badge-dot { background: #f9a825; }
.accuracy-badge.warn .accuracy-badge-value { color: #b28704; }

.accuracy-badge.bad { background: #ffebee; border-color: #ffcdd2; }
.accuracy-badge.bad .accuracy-badge-dot { background: #c62828; }
.accuracy-badge.bad .accuracy-badge-value { color: #c62828; }
