/* truckerintel.css */

/**
 * TruckerIntelligence
 *
 * © 2026 Reinart Management LLC, d/b/a TruckerIntelligence. All Rights Reserved.
 *
 * NOTICE: This software is the proprietary Confidential Information of
 * Reinart Management LLC. Use is subject to the terms of the End User License
 * Agreement (EULA) v2.6.
 *
 * RESTRICTIONS:
 * - Unauthorized distribution, installation, or use is strictly prohibited.
 * - Reverse engineering, decompiling, unpacking (including .asar archives),
 * or attempting to derive source code is a violation of the EULA and
 * intellectual property laws.
 *
 * VIOLATORS WILL BE PROSECUTED.
 *
 * @see https://truckerintelligence.com/eula
 */

:root {
    --fi-bg: #050810;
    --fi-bg-alt: #0f172a;
    --fi-card-bg: #111827;
    --fi-border: #1f2937;
    --fi-accent: #3b82f6;
    --fi-accent-soft: rgba(59, 130, 246, 0.18);
    --fi-text: #e5e7eb;
    --fi-muted: #9ca3af;
    --fi-radius-lg: 16px;
    --fi-radius-md: 10px;
    --fi-radius-sm: 6px;
    --fi-shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.45);
    --fi-font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: radial-gradient(circle at top, #111827, #020617 55%);
    color: var(--fi-text);
    font-family: var(--fi-font-main);
}
body { font-size: 14px; }

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* HEADER */
.fi-header {
    padding: 10px 18px;
    border-bottom: 1px solid var(--fi-border);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.97), rgba(15, 23, 42, 0.86));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

/* Center column in header for status pill */
.fi-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.fi-header-left { display: flex; align-items: center; gap: 4px; }
.fi-logo { height: 86px; width: 198px; }
.fi-header-left h1 {
    margin: 0;
    letter-spacing: 0.12em;
    text-transform: none;
    font-size: 44px;
    letter-spacing: -0.03em;
    font-weight: 850;
    color: #FA0000;
}
.fi-header-status {
    font-size: 30px;
    font-weight: 800;
    padding: 10px 30px;
    border-radius: 999px;
    background: var(--fi-accent-soft);
    color: #d4d4d4;
    border: 3px solid #FA0000;
}

/* Container for title + subtitle */
.fi-header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 0; /* Removed the 12px gap */
}

/* Main title */
.fi-header-title {
    font-size: 44px;
    font-weight: 850;
    letter-spacing: -0.03em;
    font-style: italic;
    text-transform: uppercase;
    margin: 0;
    padding: 0;
    line-height: 1.0;
    display: inline-flex;
    align-items: flex-start;
    position: relative;
}

/* NEW: Trademark Symbol Styling */
.fi-header-tm {
    color: #ffffff !important;    /* Force WHITE to override the H1 red */
    font-size: 14px !important;   /* Force SMALL to override the 44px */
    position: absolute;           /* Pull it out of the text flow */
    top: 0px;                     /* Align to top */
    right: -24px;                 /* Push it to the right side */
    font-style: normal;
    letter-spacing: 0;
}


.fi-header-title-primary {
    color: #ffffff !important;     /* <-- WHITE */
}

/* red INTELLIGENCE */
.fi-header-title-accent {
    color: #FA0000;              /* matches text-brandRed */
}


/* Subline: DOMINATE YOUR LOCAL MARKET */
.fi-header-subtitle {
    margin-top: 4px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.025em;
    text-transform: uppercase;
    color: #e5e7eb;
}

/* Gradient "LOCAL MARKET" similar to site hero */
.fi-header-subtitle-accent {
    background: linear-gradient(to right, #3b82f6, #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.fi-data-link {
    color: #1E90FF;
    text-decoration: none;
    font-size: 15px;
}

.fi-data-link:hover {
    color: #ffffff;
    text-decoration: underline;
    font-size: 16px;
}

/* --- FINAL HEADER ALIGNMENT FIX (REVISED) --- */

/* 1. Set the main header-right area to be a flex container */
.fi-header-right {
    display: flex;
    align-items: flex-start;  /* THIS IS THE FIX: Aligns tops instead of centers */
    justify-content: flex-end;
    gap: 15px;
}

.fi-header-right span {
    text-align: right;
    width: 100%;
    display: block;
}

/* 2. Set the link wrapper to stack its items */
.fi-header-links-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 2px; /* Small tweak to visually align text */
}

/* 3. Style the spans inside the wrapper */
.fi-header-links-wrapper .fi-header-date,
.fi-header-links-wrapper .fi-header-website {
    font-size: 15px;
    color: var(--fi-muted);
    line-height: 1.4;
}

/* 4. Style the website link to match Main Logo */
.fi-website-link {
    font-weight: 850;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    text-decoration: none !important;
    color: #FA0000;
    font-size: 14px;
    white-space: nowrap !important;
    display: inline-block;
    width: auto;
    max-width: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fi-website-link span {
    display: inline !important;
}

.fi-website-link:hover {
    color: #FA0000;
    transform: scale(1.10);
    text-shadow: 0 0 15px rgba(250, 0, 0, 0.6);
}

/* Makes the date match subtitle color AND bold */
.fi-date-value {
    color: #d4d4d4;
    font-weight: 700;
}

/* LAYOUT */
.fi-main {
    flex: 1;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 14px;
    padding: 12px 14px 16px;
    background: radial-gradient(circle at bottom, #020617, #000000 60%);
    overflow: hidden;
}
.fi-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 5px;
}
.fi-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
}

/* CARDS */
.fi-card {
    background: radial-gradient(circle at top left, #111827, #020617 70%);
    border-radius: var(--fi-radius-lg);
    border: 1px solid var(--fi-border);
    padding: 12px 12px 10px;
    box-shadow: var(--fi-shadow-soft);
    flex-shrink: 0;
}

.fi-card h2 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
}

/* Sexy dual-color borders for all cards */
.fi-card {
    border-left: 4px solid #0033A0;  /* Blue */
    border-right: 4px solid #FA0000; /* Red */
}

/* Hover glow */
.fi-card:hover {
    box-shadow:
        0 0 20px rgba(250, 0, 0, 0.65);
    transform: translateY(-1px);
    transition: all 0.75s ease;
}



/* FORM */
.fi-label { display: block; font-size: 12px; color: var(--fi-muted); margin-bottom: 3px; }
.fi-input, .fi-select {
    width: 100%;
    padding: 6px 8px;
    border-radius: var(--fi-radius-sm);
    border: 1px solid #374151;
    background: #020617;
    color: var(--fi-text);
    font-size: 13px;
    outline: none;
}
.fi-field-group { margin-bottom: 8px; }
.fi-field-row { display: flex; gap: 8px; }
.fi-field-row .fi-field-group { flex: 1; }
.fi-checkbox-group { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.fi-checkbox { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fi-text); }
.fi-checkbox input[type="checkbox"] { width: 14px; height: 14px; }

/* BUTTONS */
.fi-button-primary, .fi-button-secondary {
    border-radius: var(--fi-radius-md);
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}
.fi-button-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    color: #e5e7eb;
    font-weight: 500;
}
.fi-button-secondary { background: #020617; border-color: #374151; color: var(--fi-muted); }
.fi-filter-actions { display: flex; gap: 8px; margin-top: 4px; }

/* MAP */
.fi-map-panel {
    /* Map owns the leftover vertical space */
    flex: 1 1 auto;
    min-height: 260px;
    border-radius: var(--fi-radius-lg);
    overflow: hidden;
    border: 1px solid var(--fi-border);
    box-shadow: var(--fi-shadow-soft);
    position: relative;
}
#fi-map { width: 100%; height: 100%; }

/* Issue 4 Fix: Prevent map glitches/flickering by optimizing transforms on tiles */
.leaflet-container .leaflet-tile-pane {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
.leaflet-tile-container {
    will-change: transform;
}
.leaflet-tile {
    /* Fix for hairline gaps between tiles often seen in Chromium/Electron */
    border: 0 !important;
}

.leaflet-container { background: #020617; }

/* Data Portal Button (Map Overlay - Leaflet Control) */
.fi-dataportal-control {
    cursor: pointer;
    /* Sexy dark/glass background */
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(5px);

    border: 1px solid #FA0000; /* Brand Red Border */
    border-radius: 999px; /* Pill shape */
    padding: 6px 15px 6px 10px;

    /* Strong shadow with subtle red glow */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(250, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fi-dataportal-control:hover {
    background: rgba(15, 23, 42, 0.95);
    /* Enhanced shadow and glow on hover */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 25px rgba(250, 0, 0, 0.6);
    transform: translateY(-1px);
}

.fi-dataportal-logo-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.fi-dataportal-title {
    /* Matching the stylized branding look */
    font-size: 16px;
    font-weight: 850;
    letter-spacing: -0.03em;
    font-style: italic;
    text-transform: uppercase;
    color: #ffffff;
}

.fi-dataportal-accent {
    color: #FA0000; /* Brand Red */
}

/* Data Portal Button (Map Overlay - Leaflet Control) (Issue 3) */
.fi-dataportal-control {
    cursor: pointer;
    /* Sexy dark/glass background */
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(5px);

    border: 1px solid #FA0000; /* Brand Red Border */
    border-radius: 999px; /* Pill shape */
    padding: 6px 15px 6px 15px; /* Adjusted padding */

    /* Strong shadow with subtle red glow */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(250, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fi-dataportal-control:hover {
    background: rgba(15, 23, 42, 0.95);
    /* Enhanced shadow and glow on hover */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 25px rgba(250, 0, 0, 0.6);
    transform: translateY(-1px);
}

.fi-dataportal-title {
    /* Matching the stylized branding look */
    font-size: 16px;
    font-weight: 850;
    letter-spacing: -0.03em;
    font-style: italic;
    text-transform: uppercase;
    /* Colors are inherited from fi-header-title-primary/accent defined elsewhere */
}

/* LEGEND */
.fi-legend {
    padding: 8px 10px;
    background: rgba(20, 20, 30, 0.85);
    border-radius: 8px;
    border: 1px solid var(--fi-border);
    color: var(--fi-text);
    box-shadow: var(--fi-shadow-soft);
}
.fi-legend strong { display: block; margin-bottom: 5px; font-size: 12px; white-space: nowrap; }
.fi-legend ul { list-style: none; margin: 0; padding: 0; }
.fi-legend li { margin-bottom: 2px; display: flex; align-items: center; font-size: 11px; white-space: nowrap; }
.fi-legend li:last-child { margin-bottom: 0; }
.fi-legend .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid #000;
    opacity: 0.9;
    flex-shrink: 0;
}

/* CLUSTER STYLES */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.5);
}
.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 3px;
    margin-top: 3px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}
.marker-cluster span { line-height: 30px; }
.cluster-red div, .cluster-orange div, .cluster-yellow div { color: #000; }
.cluster-green div { color: #000; }

/* Cluster popup text — full bright on dark map */
.fi-cluster-popup {
    color: #ffffff;
}

.leaflet-popup-content {
    max-height: 200px;
    overflow-y: auto;
    /* default color for any plain text in the popup */
    color: #ffffff;
}

.fi-cluster-popup strong {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #ffffff;
}

.fi-cluster-popup ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.fi-cluster-popup li {
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.fi-cluster-popup li:last-child {
    border-bottom: none;
}

.fi-cluster-popup .fi-cluster-link {
    color: #4DA3FF;
    text-decoration: none;
    font-weight: 600;
}

.fi-cluster-popup .fi-cluster-link:hover {
    text-decoration: underline;
    color: #77BDFF;
}


/* --- TABLE AREA: fixed strip at bottom --- */
.fi-table-panel {
    /* Fixed-height strip */
    flex: 0 0 230px;
    max-height: 260px;
    min-height: 180px;

    border-radius: var(--fi-radius-lg);
    border: 1px solid var(--fi-border);
    background: linear-gradient(to bottom, #020617, #02040c 65%);
    box-shadow: var(--fi-shadow-soft);

    position: relative;
    overflow: hidden; /* Prevent double scrollbars */
    display: flex;    /* Flex to hold the scroll wrapper */
    flex-direction: column;
}

/* NEW: Handles the scrolling internally */
.fi-table-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    /* PERFORMANCE FIX: Isolates painting/layout to this box only */
    contain: content;
}

#fi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}
#fi-table thead {
    background: rgba(15, 23, 42, 0.98);
    flex-shrink: 0;
}
#fi-table th, #fi-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#fi-table th {
    font-weight: 500;
    color: var(--fi-muted);
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.98);
    z-index: 1;
    cursor: pointer;
    user-select: none;
}
/* Column Widths */
.col-notes   { width: 4%;  text-align: center !important; }
.col-company { width: 33%; }
.col-city    { width: 13%; }
.col-state   { width: 5%;  text-align: center !important; }
.col-pu      { width: 10%; }
.col-trailers{ width: 10%; }
.col-drivers { width: 10%; }
.col-web     { width: 7%;  text-align: center !important; }
.col-phone   { width: 10%; }
.col-dot     { width: 8%; }

/* These three lines actually center the data cells */
td.col-notes { text-align: center !important; }
td.col-state { text-align: center !important; }
td.col-web   { text-align: center !important; }


#fi-table tbody {
    /* All flex/block properties are GONE */
}
#fi-table thead tr, #fi-table tbody tr {
    /* All display:table properties are GONE */
}
/* --- END SCROLLBAR FIX --- */

#fi-table tbody tr:nth-child(even) { background: rgba(15, 23, 42, 0.65); }
#fi-table tbody tr:hover { background: rgba(37, 99, 235, 0.16); }
.fi-num { text-align: right; }


/* LINK-BUTTON IN TABLE */
.fi-link-button {
    background: none; border: none; padding: 0; margin: 0;
    color: #93c5fd; text-align: left; font-size: 12px;
    cursor: pointer; font-family: var(--fi-font-main);
}
.fi-link-button:hover { text-decoration: underline; }

.fi-link-button.fi-company-has-notes {
    color: #ff8c00;              /* same orange family as your buttons */
}

/* Company has at least one active follow-up (future date) */
.fi-link-button.fi-company-has-followup {
    color: #f97316; /* slightly warmer orange */
}

/* Company has a follow-up due within 3 days (or overdue) (Issue 2 Fix) */
.fi-link-button.fi-company-followup-due-soon {
    color: #FA0000;            /* Bright Red */
    text-shadow: 0 0 6px rgba(250, 0, 0, 0.9);
}

/* Optional: make notes count red when follow-up is due soon (Issue 2 Fix) */
.fi-notes-count.fi-notes-followup-due {
    color: #FA0000;
}

.fi-notes-count {
    color: #ff8c00;
    font-weight: 600;
    text-align: center;
}

/* RESULTS / EXPORT */
.fi-results-summary { font-size: 12px; color: var(--fi-muted); margin-bottom: 6px; }
/* UPDATED EXPORT ROW LAYOUT */
.fi-export-row {
    display: flex;
    flex-wrap: wrap; /* Allows buttons to drop to a second line if needed */
    gap: 8px;
    margin-bottom: 4px;
}

/* Make buttons grow to fill the space evenly */
.fi-export-row button {
    flex: 1 1 auto;
    text-align: center;
    min-width: 100px; /* Ensures they don't get unreadable */
}
.fi-note { margin: 0; font-size: 11px; color: var(--fi-muted); }

/* DETAIL PANEL */
.fi-detail {
    border-radius: var(--fi-radius-lg);
    border: 1px solid var(--fi-border);
    background: radial-gradient(circle at top left, #020617, #02040c 70%);
    box-shadow: var(--fi-shadow-soft);

    /* Issue 2 Fix: Adjust layout for branding bar and scrolling (Flexbox) */
    padding: 0; /* Remove padding from the main container */
    display: flex;
    flex-direction: column;

    flex-shrink: 0;
    overflow-y: hidden; /* Overflow handled by the body now */
    max-height: 300px; /* Increased height slightly to accommodate branding */
}

.fi-detail.hidden { display: none; }

/* Issue 2: FLEET INTEL Branding Bar */
.fi-detail-title-bar {
    text-align: center;
    padding: 0.5px 0.5px;
    background: rgba(15, 23, 42, 0.5); /* Subtle background difference */
    border-bottom: 1px solid var(--fi-border);
    flex-shrink: 0;
}

.fi-detail-branding-title {
    /* Matching the stylized branding look (like DataPortal) */
    font-size: 28px;
    font-weight: 850;
    letter-spacing: -0.03em;
    font-style: italic;
    text-transform: uppercase;
    margin: 0;
    /* Colors: FLEET (White) is inherited from fi-header-title-primary */
}

.fi-detail-branding-accent {
    color: #0046AE; /* INTEL (Blue as requested) */
}

.fi-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    /* Issue 2 Fix: Add padding back and ensure it doesn't shrink */
    padding: 10px 12px 0;
    flex-shrink: 0;
}

.fi-detail-header-container {
    display: flex;
    align-items: center;
    gap: 15px; /* Space between name and Google link */
}

/* Ensure the H2 inside the container looks the same as before */
.fi-detail-header-container h2 {
    margin: 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%; /* Prevent name from pushing link out completely */
}

.fi-detail-close-btn { padding: 4px 8px; font-size: 11px; }

.fi-detail-body {
    min-height: 0;
    font-size: 12px;
    color: var(--fi-text);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    /* Issue 2 Fix: Add padding back and handle scrolling */
    padding: 0 12px 10px;
    overflow-y: auto;
    flex: 1;
}

.fi-detail-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 4px 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(31, 41, 55, 0.8);
}

.fi-detail-row:last-child { border-bottom: none; }

.fi-detail-label { color: var(--fi-muted); white-space: nowrap; }

.fi-detail-value { word-break: break-word; }

/* POPUP */
.fi-popup {
    font-size: 12px;
    line-height: 1.4;
    max-width: 280px;
    max-height: 300px;
}
.fi-popup .leaflet-popup-content {
    color: #333;
}
.fi-popup .leaflet-popup-content strong {
    color: #000;
}

/* RESPONSIVE */
@media (max-width: 960px) {
    #app { height: auto; overflow: auto; }
    .fi-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        overflow: visible;
        height: auto;
    }
    .fi-sidebar { order: 1; overflow-y: visible; }
    .fi-content { order: 2; min-height: 500px; }
    .fi-table-panel { max-height: 260px; }
    .fi-detail-body { grid-template-columns: 1fr; }
}

/* --- NEW: Copyright Footer (Point 4) --- */
.fi-copyright {
    font-size: 10px;
    color: var(--fi-muted);
    opacity: 0.5;
    padding: 10px 0 0 0;
}

/* PDF/PRINT STYLES */
@media print {
    /* This section is handled by the new JS exportPdf function */
}
/* --- Copyright Footer --- */
.fi-footer {
    font-size: 11px;
    color: var(--fi-muted);
    text-align: left;
    opacity: 0.7;
    padding-top: 10px;
    border-top: 1px solid var(--fi-border);
    margin-top: 10px;
}
.fi-footer p {
    margin: 4px 0;
}
.fi-footer .font-bold {
    font-weight: bold;
    color: var(--fi-text);
}
.fi-footer a {
    color: #4ea3ff;
    text-decoration: none;
}
.fi-footer a:hover {
    text-decoration: underline;
    color: #e53935;
    font-size: 12px;
}
/* --- Data Date Style --- */
.fi-header-date {
    font-size: 11px;
    color: var(--fi-muted);
    margin-right: 15px;
    align-self: center;
}

/* -------------------------------------- */
/* BUTTON GLOW EFFECTS                    */
/* -------------------------------------- */

/* Base glow for all buttons */
.fi-button-primary,
.fi-button-secondary {
    transition: box-shadow 0.25s ease, transform 0.15s ease;
}

/* Blue glowing buttons (Load fleets, Apply filters) */
.fi-button-primary {
    background-color: #2d67ff;
    border: 1px solid #1f4ed1;
    color: white;
}

.fi-button-primary:hover {
    box-shadow: 0 0 12px rgba(45, 103, 255, 0.9),
                0 0 20px rgba(45, 103, 255, 0.6);
    transform: translateY(-1px);
}

/* --- CUSTOM COMPANY TOGGLE BUTTON --- */
/* --- CUSTOM COMPANY TOGGLE BUTTON --- */
#fi-only-custom-btn {
    background-color: #1e293b;
    border: 1px solid #0046AE;
    color: #fff;
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    width: 100%;
    text-transform: uppercase;
    cursor: pointer;
}

#fi-only-custom-btn:hover {
    background-color: #003380;
    box-shadow: 0 0 12px rgba(0, 70, 174, 0.9),
                0 0 20px rgba(0, 70, 174, 0.6);
    transform: translateY(-1px);
    border-color: #3b82f6;
}

#fi-only-custom-btn.active {
    background-color: #0046AE;
    border-color: #3b82f6;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 70, 174, 0.9),
                0 0 20px rgba(0, 70, 174, 0.6);
}


/* --- EXPORT EXCEL BUTTON STYLING --- */
#fi-export-excel {
    background-color: #00cc66; /* Green background */
    border: 1px solid #0046AE; /* Blue border as requested */
    color: #fff;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

#fi-export-excel:hover {
    /* Keep green background + green glow */
    background-color: #00b359;
    box-shadow: 0 0 12px rgba(0, 204, 102, 0.9),
                0 0 20px rgba(0, 204, 102, 0.6);
    transform: translateY(-1px);
    /* Maintain or darken the blue border on hover */
    border-color: #003380;
}

/* -------------------------------------- */
/* EXPORT NOTES IN NOTES WINDOW = GREEN   */
/* -------------------------------------- */

#fi-notes-export-company {
    background-color: #00cc66;
    border: 1px solid #00994d;
    font-size: 12px;
    color: #fff;
}

#fi-notes-export-company:hover {
    box-shadow: 0 0 12px rgba(0, 204, 102, 0.9),
                0 0 20px rgba(0, 204, 102, 0.6);
    transform: translateY(-1px);
    font-size: 13px;
}


/* --- EXPORT PDF BUTTON STYLING --- */
#fi-export-pdf {
    background-color: #ff8c00; /* Orange background */
    border: 1px solid #0046AE; /* Blue border as requested */
    color: #fff;
    font-weight: 600;
    /* Add transition for smooth hover effect */
    transition: all 0.2s ease-in-out;
}

#fi-export-pdf:hover {
    background-color: #e67e00; /* Slightly darker orange on hover */
    box-shadow: 0 0 12px rgba(255, 140, 0, 0.9),
                0 0 20px rgba(255, 140, 0, 0.6);
    transform: translateY(-1px);
    /* Maintain or adjust border color on hover */
    border-color: #003380; /* Slightly darker blue border on hover */
}

/* --- EXPORT FLAGS BUTTON STYLING --- */
#fi-export-flags {
    background-color: #00cc66; /* Green background */
    border: 1px solid #FA0000; /* Red border as requested */
    color: #fff;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

#fi-export-flags:hover {
    /* On hover, keep green background but add green glow */
    background-color: #00b359;
    box-shadow: 0 0 12px rgba(0, 204, 102, 0.9),
                0 0 20px rgba(0, 204, 102, 0.6);
    transform: translateY(-1px);
    /* Ensure red border persists or changes slightly if desired */
    border-color: #d90000;
}


/* Map fullscreen toggle button */
.fi-map-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    border-radius: 6px;
    border: 1px solid #2563eb;        /* blue border */
    background: rgba(37, 99, 235, 0.85); /* blue bg */
    color: white;                     /* white icon */
    font-size: 14px;
    padding: 4px 8px;
    cursor: pointer;
}

.fi-map-fullscreen-btn:hover {
    border-color: #60a5fa;
    box-shadow: 0 0 28px 8px rgba(59, 130, 246, 0.95);
    transform: translateY(-1px);
    transition: all 0.5s ease;
}


body.fi-map-fullscreen-mode .fi-map-fullscreen-btn:hover {
    border-color: #93c5fd;
    box-shadow: 0 0 35px 14px rgba(59, 130, 246, 1);
    transform: translateY(-1px);
    transition: all 0.5s ease;
}

/* Bigger button when in fullscreen */
body.fi-map-fullscreen-mode .fi-map-fullscreen-btn {
    font-size: 25px;
    padding: 10px 14px;
    border-width: 2px;
}

/* Extra-aggressive glow in fullscreen */
body.fi-map-fullscreen-mode .fi-map-fullscreen-btn:hover {
    box-shadow:
        0 0 25px rgba(59, 130, 246, 0.95),
        0 0 45px rgba(59, 130, 246, 0.9);
}


body.fi-map-fullscreen-mode .fi-sidebar,
body.fi-map-fullscreen-mode .fi-table-panel {
    display: none !important;
}

/* Issue 1c: Detail Card Positioning in Fullscreen Mode */
body.fi-map-fullscreen-mode .fi-detail {
    /* Ensure it is displayed */
    /* FIX: Must use flex to maintain internal layout structure and scrolling */
    display: flex !important;
    flex-direction: column;

    /* Position it absolutely within the fullscreen view */
    position: fixed;
    z-index: 9995; /* Above the map (9990), below modals (10000) */

    /* Position in the bottom right corner */
    right: 20px;
    bottom: 20px;

    /* Give it a fixed size appropriate for the map view */
    width: 600px;
    max-width: 90vw;
    /* FIX: Allow height to grow significantly (80% of viewport height) */
    max-height: 80vh;

    /* Ensure visibility and strong shadow */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    /* Ensure background is slightly transparent and blurred for overlay effect */
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(5px);
}

/* Ensure the 'hidden' class (applied by JS) still hides it, even in fullscreen */
/* This overrides the display: block !important above when hidden */
body.fi-map-fullscreen-mode .fi-detail.hidden {
    display: none !important;
}

body.fi-map-fullscreen-mode .fi-main {
    grid-template-columns: 1fr;
    padding: 0;
}

body.fi-map-fullscreen-mode .fi-content {
    margin: 0;
    padding: 0;
}

body.fi-map-fullscreen-mode .fi-map-panel {
    position: fixed;
    inset: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    z-index: 9990;
}

body.fi-map-fullscreen-mode #fi-map {
    width: 100vw;
    height: 100vh;
}
/* Extra tightening for very small screens */
@media (max-width: 640px) {
    .fi-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 8px 10px;
    }

    .fi-header-left {
        gap: 6px;
    }

    .fi-logo {
        width: 28px;
        height: 28px;
    }

    .fi-header-title {
        font-size: 16px;
    }

    .fi-header-subtitle {
        font-size: 11px;
    }

    .fi-header-center {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        margin-top: 4px;
    }

    .fi-header-right {
        align-items: flex-start;
        gap: 4px;
        font-size: 11px;
    }

    .fi-main {
        padding: 8px;
        gap: 8px;
    }

    .fi-sidebar {
        max-height: none;
    }

    .fi-table-panel {
        max-height: 240px;
    }

    table.fi-table th,
    table.fi-table td {
        padding: 4px 6px;
        font-size: 11px;
        white-space: nowrap;
    }

    /* Example: hide low-value columns on small screens */
    th[data-col="dot"], td[data-col="dot"],
    th[data-col="mc"],  td[data-col="mc"] {
        display: none;
    }

        .fi-footer {
        padding: 8px 10px 12px;
        font-size: 11px;
    }
}

/* ========== LICENSE ACTIVATION OVERLAY ========== */

.ti-license-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 22, 0.96);
    display: flex;
    /* Change layout to column and align center */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    padding: 20px 0;
    overflow-y: auto;
    font-family: var(--fi-font-main);
}

.ti-hidden {
    display: none !important;
}

/* NEW: Main Logo Header Styling */
.ti-license-header-logo {
    margin-bottom: 30px;
    text-align: center;
}

/* Reuse existing header styles but scale up slightly for the activation screen */
.ti-license-main-title {
    font-size: 70px !important; /* Larger than the 44px in the app header */
    line-height: 1.0;
    margin: 0;
    padding: 0;
}

/* The Panel (Card) */
.ti-license-panel {
    /* Increase size by ~25% (480px -> 600px) */
    width: min(650px, 92vw);
    background: #020617;
    border-radius: 24px;
    /* Use brand colors for border */
    border: 1px solid var(--fi-accent);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9);
    padding: 40px 48px 30px;
    color: #e5e7eb;
    max-height: min(700px, 100vh - 40px);
    overflow-y: auto;
}

/* Title inside the card */
.ti-license-title {
    /* Match requested styling: font-black uppercase italic */
    font-size: 3.0rem; /* Increased size */
    font-weight: 900; /* font-black */
    text-transform: uppercase;
    font-style: italic;
    align-items: center;
    color: #f3f4f6;
    margin: 0 0 16px 0;
    letter-spacing: -0.03em;
}

/* Blue "Activation" text */
.ti-license-title-accent {
    color: var(--fi-accent); /* Brand Blue #3b82f6 */
}

/* Body text (Subtitle) */
.ti-license-subtitle {
    margin: 0 0 20px 0;
    font-size: 1.1rem; /* Increased size */
    color: #d1d5db;
    line-height: 1.5;
}

/* Removed .ti-license-summary as it's no longer used */

/* NEW: Version Info Styling */
.ti-license-version-info {
    font-size: 1.5rem;
    color: #3b82f6;
    display: flex;
    margin-bottom: 24px;
    justify-content: center;
    text-align: left;
}

/* Input Label */
.ti-license-label {
    display: block;
    font-size: 0.9rem; /* Increased size */
    color: #9ca3af;
    margin-bottom: 6px;
}

/* Input Field */
.ti-license-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #374151;
    background: #020617;
    color: #f9fafb;
    font-size: 1.1rem; /* Increased size */
    outline: none;
    box-sizing: border-box;
}

.ti-license-input::placeholder {
    color: #4b5563;
}

.ti-license-input:focus {
    border-color: var(--fi-accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

/* Activate Button */
.ti-license-button {
    width: 100%;
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 999px;
    border: none;
    font-size: 1.1rem; /* Increased size */
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    color: #f9fafb;
    box-shadow: 0 15px 40px rgba(37, 99, 235, 0.5);
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;
}

.ti-license-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 50px rgba(37, 99, 235, 0.7);
}

.ti-license-button:active {
    transform: translateY(0);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    opacity: 0.95;
}

/* Error Message */
.ti-license-error {
    min-height: 20px;
    margin-top: 12px;
    font-size: 1.2rem;
    text-transform: uppercase;
    font-style: italic;
    color: #FA0000;
    text-align: center;
}

/* NEW: Expiry Info Styling (below button/error) */
.ti-license-expiry-info {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-top: 12px;
    text-align: center;
}

/* Footnotes (EULA and Legal Disclaimer) */
.ti-license-footnote {
    font-size: 0.85rem; /* Slightly larger */
    color: #6b7280;
    text-align: center;
    line-height: 1.5;
}

.ti-license-eula-agreement {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #374151;
}

.ti-license-legal-disclaimer {
    margin-top: 12px;
    color: #4b5563; /* Slightly dimmer for the legal warning */
}

/* EULA Link Styling (Lighter Blue) */
.ti-license-eula-link {
    /* Use a lighter, more readable blue: #60a5fa */
    color: #60a5fa;
    text-decoration: none;
    font-weight: 500;
    /* Remove fixed font sizes to inherit from parent */
    font-size: inherit;
}

.ti-license-eula-link:hover {
    color: #FA0000; /* Brand Red on hover */
    text-decoration: underline;
    /* Remove fixed font sizes to inherit from parent */
    font-size: inherit;
}

/* NEW: Bottom Copyright Footer Styling */
.ti-license-bottom-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.8rem;
    color: #4b5563;
    max-width: 600px;
    line-height: 1.6;
}

.ti-license-bottom-footer p {
    margin: 0;
}

#eula-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.eula-hidden {
    display: none !important;
}

.eula-panel {
    background: #0d1117;
    padding: 24px;
    border-radius: 12px;

    /* wider + taller */
    width: 95%;
    max-width: 1800px;
    height: 90vh;
    max-height: 90vh;

    /* single scroll bar on the panel */
    overflow-y: auto;
    overflow-x: hidden;

    color: #e5e7eb;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}


.eula-panel h2 {
    margin-top: 0;
}

#eula-content,
.eula-content {
    margin-top: 12px;
    max-height: none;        /* let the panel control height */
    overflow-y: visible;     /* no inner scrollbar */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#eula-close {
    background: transparent;
    color: #ef4444;                 /* red text */
    border: 1px solid #ef4444;      /* red border */
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;      /* shows as CLOSE */
    margin-top: 16px;
}

#eula-close:hover {
    background: #ef4444;
    color: #ffffff;                 /* white text on hover */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}


/* --- Simplified License Banner (Two States Only) --- */

.ti-expiry-banner {
    margin: 6px 0 6px;
    padding: 10px 10px;
    border-radius: 999px;
    font-size: 0.8rem;   /* was 0.9rem */
    font-weight: 600;
    text-align: center;
    transition: all 0.25s ease;
}

/* ACTIVE (Blue Theme) */
.ti-expiry-active {
    background: rgba(0, 30, 60, 0.75);
    border: 1px solid #2a7fff;
    color: #cfe6ff;
}

.ti-expiry-active:hover {
    box-shadow: 0 0 80px rgba(0, 37, 250, 0.55);
    border-color: #4da3ff;
}

/* EXPIRED (Red Theme) */
.ti-expiry-expired {
    background: rgba(60, 0, 0, 0.75);
    border: 1px solid #ff0000;
    color: #ffffff;
}

.ti-expiry-expired:hover {
    box-shadow: 0 0 80px rgba(179, 0, 0, 0.55);
    border-color: #f80000;
}

.ti-expiry-banner a {
    color: #ffd45e;
    text-decoration: underline;
}

.ti-expiry-banner a:hover {
    text-decoration: none;
}

.ti-expiry-hidden {
    display: none;
}

.fi-table-cell-google {
    text-align: center;
    white-space: nowrap;
}

.fi-google-button {
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #444;
    background-color: #111;
    color: #fff;
    cursor: pointer;
}

.fi-google-button:hover {
    border-color: #e53935;
    color: #e53935;
    text-decoration: underline;
    font-size: 13px;
}

.fi-popup-google-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 18px;
    color: #4ea3ff;
    text-decoration: underline;
}

.fi-detail-google-link {
    font-size: 18px;
    font-weight: 700;
    margin-left: 12px;
    color: #4ea3ff;
    text-decoration: underline;
    cursor: pointer;
}

.fi-detail-google-link:hover,
.fi-popup-google-link:hover {
    color: #e53935;
    font-size: 19px;
}

.fi-table-cell-google {
    text-align: center;
    width: 60px;
}

.fi-google-button {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ffffff;
    background-color: #111;
    color: #4ea3ff;
    cursor: pointer;
    white-space: nowrap;
}

.fi-google-button:hover {
    border-color: #e53935;
    color: #e53935;
}

/* Force smaller, consistent formatting inside EULA modal only */
.eula-scope * {
    font-size: 13px !important;
    line-height: 1.45;
}

.eula-scope h1,
.eula-scope h2,
.eula-scope h3 {
    font-size: 16px !important;
}

.eula-scope p,
.eula-scope li,
.eula-scope div {
    font-size: 13px !important;
}
.fi-detail-email-link {
    color: #4ea3ff;
    text-decoration: none;
    cursor: pointer;
}

.fi-detail-email-link:hover {
    color: #e53935;
    text-decoration: underline;
    font-size: 13px;
}

/* MAP LINKS IN POPUP + DETAIL CARD */
.fi-popup-maps-link,
.fi-detail-maps-link,
.fi-safer-link {
    color: #4ea3ff; /* brand blue */
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}

.fi-popup-maps-link:hover,
.fi-detail-maps-link:hover,
.fi-safer-link:hover {
    color: #e53935; /* red hover */
    font-size: 13px;
    text-decoration: underline;
}

/* Make map popup taller and reduce scrolling */
.leaflet-popup-content {
    max-height: 380px !important;
    overflow-y: auto;
}

.leaflet-popup-content-wrapper {
    max-height: 400px !important;
}

/* Custom Scrollbars for Webkit/Electron */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #020617;
}
::-webkit-scrollbar-thumb {
    background: #1f2937;
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3b82f6; /* Brand Blue hover */
}
/* --- SEXY CARGO CHIPS (RED EDITION) --- */

/* 1. Hide the actual ugly checkbox input */
.fi-checkbox-hidden {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* 2. The Grid Container */
.fi-chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 5px;
}

/* 3. The Visual Chip (The Label) */
.fi-chip {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;

    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(6px);

    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;

    color: #b0b8c6;
    cursor: pointer;

    transition: all 0.15s ease;
}

/* Hover */
.fi-chip:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
    transform: translateY(-1px);
}

/* Checked */
.fi-checkbox-hidden:checked + .fi-chip {
    background: rgba(250, 0, 0, 0.20);
    border-color: #FA0000;
    color: #fff;
    box-shadow: 0 0 10px rgba(250, 0, 0, 0.55);
}

/* --- CRM / NOTES SYSTEM (PRO EDITION) --- */

/* Generic Modal Overlay (Used by Notes and Alerts) - Consolidated */
.fi-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* FIX: Force hide */
.fi-modal.hidden { display: none !important; }

/* Modal Content (The Panel itself) - Consolidated */
.fi-modal-content {
    /* UPDATED: MUCH LARGER SIZE */
    width: 1400px;
    max-width: 92vw;
    height: 92vh;

    background: #0f172a;
    border: 1px solid #3b82f6;
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.25); /* Larger glow */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 20px; /* More breathing room */
    overflow: hidden; /* Contain children */
}

/* Modal Layout Definitions (Based on HTML structure) - Consolidated */
.fi-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--fi-border);
}

.fi-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #fff;
}

/* (Issue 1b) Container for buttons in the modal header */
.fi-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fi-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contain children */
    padding-top: 15px;
}

.fi-notes-entry {
    margin-bottom: 20px;
    /* (Issue 1a) Entry area is fixed height based on content, doesn't shrink */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* (Issue 1a) Make textarea taller in the modal */
#fi-notes-modal .fi-textarea {
    min-height: 150px;
}

.fi-notes-actions {
    display: flex;
    justify-content: center; /* Center the button */
    margin-top: 15px;
}

/* (Issue 1c) Make Save Note button wide */
.fi-save-note-btn {
    width: 90%;
}

.fi-notes-history {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fi-notes-history h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: var(--fi-text);
}

.fi-notes-list {
    flex: 1;
    overflow-y: auto;
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- NOTE ITEMS --- */
.fi-note-item {
    background: #1e293b;
    border-left: 4px solid #FA0000;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    border-left-color: #FA0000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); /* Ensure shadow exists */
}

/* Hover effect */
.fi-note-item:hover {
    background: #283548;
    transform: translateX(2px);
}

/* EXPANDED STATE (When clicked) */
.fi-note-item.expanded {
    background: #1e293b;
    border: 1px solid #3b82f6; /* Blue border when open */
    border-left: 4px solid #3b82f6;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* Note Header Layout (Issue 4 adjustment) - Consolidated */
.fi-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically align meta and delete button */
    margin-bottom: 8px;
    /* Removed border-bottom from previous conflicting definitions */
}

.fi-note-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fi-note-subject {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.fi-note-date {
    font-size: 11px;
    color: #94a3b8;
}

/* THE DELETE BUTTON (Issue 4 Fix) - Consolidated */
.fi-note-delete {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--fi-radius-md);

    /* Red Solid Button */
    background-color: #FA0000;
    border: 1px solid #d40000;
    color: #fff;

    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: box-shadow 0.25s ease, transform 0.15s ease;

    /* Reset properties from previous conflicting styles */
    line-height: normal;
    opacity: 1;
}

.fi-note-delete:hover {
    background-color: #ff3333;
    /* Red Glow */
    box-shadow: 0 0 12px rgba(250, 0, 0, 0.9),
                0 0 20px rgba(250, 0, 0, 0.6);
    transform: translateY(-1px);
}

.fi-note-body {
    font-size: 13px;
    color: #e2e8f0; /* 1a: Slightly brighter text */
    line-height: 1.6; /* 1a: More readable line height */

    /* 1a: Add some padding and background to distinguish the text block */
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 4px;
    margin-top: 5px;

    /* Logic to truncate long text until clicked */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Show only 2 lines by default */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    /* Fix for long strings without spaces (like your screenshot) */
    word-break: break-word;
    white-space: pre-wrap;
}

/* Show FULL text when expanded */
.fi-note-item.expanded .fi-note-body {
    -webkit-line-clamp: unset;
    overflow: visible;
    color: #fff; /* Brighter text when open */
}

.fi-note-empty {
    text-align: center;
    color: #64748b;
    margin-top: 40px;
    font-style: italic;
}

/* --- FOLLOW-UP CONTROLS IN NOTES INPUT AREA (Issue 5) --- */

/* Follow-up Container Layout */
.fi-followup-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.fi-date-input-wrapper {
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 250px; /* Wider to accommodate label */
}

/* (Issue 1d) Label for the date input */
.fi-date-input-label {
    color: var(--fi-muted);
    font-size: 12px;
    margin-right: 8px;
    white-space: nowrap;
}

/* Date Input Styling (to ensure visibility and clickability) (Issue 5 Fix) */
.fi-date-input {
    /* Inherits .fi-input styles */
    cursor: pointer;
    padding: 8px 10px; /* Increased padding for easier clicking and matching chip height */
    width: 100%;
}

/* Improve usability of native date picker on webkit (Electron) (Issue 5 Fix) */
.fi-date-input::-webkit-calendar-picker-indicator {
    filter: invert(1); /* Make the icon visible on dark background */
    cursor: pointer;
}

/* Active follow-up note: red background to stand out */
.fi-note-item.fi-note-followup-active {
    background: #451016;                /* dark red background */
    border-left-color: #ef4444;         /* bright red edge */
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

/* Follow-up metadata row inside a note */
.fi-note-followup-line {
    margin-top: 8px; /* Increased margin */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #e5e7eb;
    border-top: 1px solid rgba(255,255,255,0.1); /* Divider line */
    padding-top: 8px;
}

.fi-note-followup-line-completed {
    opacity: 0.85;
    color: #9ca3af;
}

.fi-note-followup-label {
    font-weight: 600;
}

.fi-note-followup-status {
    padding: 4px 15px; /* Increased padding */
    border-radius: 9999px;
    /* font-size handled by CSS variable now, but provide fallback */
    font-size: var(--note-meta-font-size, 11px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}

/* Scheduled: Subtle blue */
.fi-status-scheduled {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

/* Due Soon: Prominent Orange (Issue 3) */
.fi-status-duesoon {
    /* Orange background matching View Notes button */
    background-color: #ff8c00;
    border: 1px solid #cc7000;
    color: #fff;
    /* Make it wider */
    min-width: 150px;
}

/* Overdue: Prominent Red */
.fi-status-overdue {
    background-color: #FA0000;
    border: 1px solid #d40000;
    color: #fff;
    min-width: 150px;
    box-shadow: 0 0 8px rgba(250, 0, 0, 0.5);
}

.fi-note-followup-completed {
    font-style: italic;
}

/* MARK DONE BUTTON (Issue 3 Fix) */
.fi-note-followup-complete-btn {
    margin-left: auto;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--fi-radius-md);

    /* Green Solid Button (Matches Export Excel) */
    background-color: #00cc66;
    border: 1px solid #00994d;
    color: #fff;

    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: box-shadow 0.25s ease, transform 0.15s ease;
}

.fi-note-followup-complete-btn:hover {
    background-color: #00e673; /* Lighter green */
    box-shadow: 0 0 12px rgba(0, 204, 102, 0.9),
                0 0 20px rgba(0, 204, 102, 0.6);
    transform: translateY(-1px);
}

/* --- VIBRANT BUTTONS (MATCHES EXPORT BUTTONS) --- */

/* Base Button Structure (Layout Only) */
.fi-notes-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff; /* Always White Text */

    border-radius: 10px; /* Matches your other buttons */
    cursor: pointer;
    transition: all 0.2s ease;

    /* Ensure they stack/grow correctly */
    flex: 1;
}

/* Base Hover Movement */
.fi-notes-trigger-btn:hover {
    transform: translateY(-1px);
}

/* --- VARIANT 1: VIEW/ADD NOTES (ORANGE - Matches Export PDF) --- */
.fi-notes-trigger-btn.view-mode {
    background-color: #ff8c00; /* Solid Orange */
    border: 1px solid #cc7000;
}

.fi-notes-trigger-btn.view-mode:hover {
    background-color: #ff9f1a; /* Lighter Orange */
    box-shadow: 0 0 12px rgba(255, 140, 0, 0.9),
                0 0 20px rgba(255, 140, 0, 0.6);
}

/* --- VARIANT 2: EXPORT COMPANY NOTES (GREEN - Matches Export CSV) --- */
.fi-notes-trigger-btn.export-mode {
    background-color: #00cc66; /* Solid Green */
    border: 1px solid #00994d;
}

.fi-notes-trigger-btn.export-mode:hover {
    background-color: #00e673; /* Lighter Green */
    box-shadow: 0 0 12px rgba(0, 204, 102, 0.9),
                0 0 20px rgba(0, 204, 102, 0.6);
}

/* FIX: Force the notes modal to hide when it has the 'hidden' class */
.fi-notes-modal.hidden {
    display: none !important;
}

/* --- EXPORT NOTES BUTTON STYLING (Issue 4) --- */
#fi-export-notes {
    background-color: #00cc66; /* Green */
    border: 1px solid #FFDF00; /* Slightly darker green border */
    color: #fff;
    font-weight: 600;
    /* Add transition for smooth hover effect */
    transition: all 0.2s ease-in-out;
}

#fi-export-notes:hover {
    background-color: #00b359; /* Slightly darker green on hover */
    box-shadow: 0 0 12px rgba(0, 204, 102, 0.9),
                0 0 20px rgba(0, 204, 102, 0.6);
    transform: translateY(-1px);
    /* Ensure border color also transitions if you want */
    border-color: #FFDF00;
}

/* --- FIX CLOSE BUTTON STYLE --- */
#fi-notes-close {
    background: transparent;
    color: #ef4444; /* Red Text */
    border: 1px solid #ef4444; /* Red Border */
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

#fi-notes-close:hover {
    background: #ef4444;
    color: #ffffff; /* White Text on Hover */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Detail panel Close = match notes Close button */
#fi-detail-close {
    background: transparent;
    color: #ef4444; /* Red Text */
    border: 1px solid #ef4444; /* Red Border */
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

#fi-detail-close:hover {
    background: #ef4444;
    color: #ffffff; /* White Text on Hover */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Clear buttons: blue-outline ghost, invert on hover */
#fi-clear-state,
#fi-clear-filters {
    background: transparent;
    color: var(--fi-muted);
    border: 1px solid var(--fi-accent);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

#fi-clear-state:hover,
#fi-clear-filters:hover {
    background: #ffffff;
    color: var(--fi-accent);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}


/* ------------------------------------------------------- */
/* LEAFLET ZOOM CONTROL — DARK / NEON MATCHING APP STYLE   */
/* ------------------------------------------------------- */

.leaflet-control-zoom {
    box-shadow: none !important;
    border: none !important;
}

.leaflet-control-zoom a {
    background: rgba(20, 25, 40, 0.92) !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 153, 255, 0.35) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 22px !important;
    font-weight: 600;
    border-radius: 10px !important;
    text-align: center;
    transition: all 0.18s ease-in-out;
    backdrop-filter: blur(4px);
}

/* Hover */
.leaflet-control-zoom a:hover {
    background: rgba(0, 153, 255, 0.85) !important;
    border-color: rgba(0, 153, 255, 1) !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(0, 153, 255, 0.9),
                0 0 20px rgba(0, 153, 255, 0.6) !important;
    transform: translateY(-1px);
}

/* Remove the split line between + and - */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    border-bottom: none !important;
}

/* --------------------------------------------------- */
/* FINAL: LEAFLET POPUP — FULL BRIGHT TEXT             */
/* --------------------------------------------------- */

.fi-popup .leaflet-popup-content-wrapper {
    background: rgba(7, 12, 23, 0.96);
    border-radius: 12px;

    /* Blue Border */
    border: 1px solid #1E90FF;

    /* Blue Glow */
    box-shadow:
        0 0 16px rgba(30, 144, 255, 0.60),
        0 20px 40px rgba(0, 0, 0, 0.75);

    padding: 10px 14px;
    color: #FFFFFF !important;   /* DEFAULT TEXT = PURE WHITE */
}

.fi-popup .leaflet-popup-content {
    margin: 6px 4px;
    font-size: 13px;
    line-height: 1.45;
    color: #FFFFFF !important;
}

/* Pointer triangle */
.fi-popup .leaflet-popup-tip {
    background: rgba(7, 12, 23, 0.96);
    border: 1px solid #1E90FF;
}

/* TITLE (example: "3 Fleets at this Location:") */
.fi-cluster-popup strong {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    color: #FFFFFF !important;
}

/* Fleet name links */
.fi-cluster-popup a.fi-cluster-link {
    color: #4DA3FF !important;     /* bright blue */
    font-weight: 700;
    text-decoration: none;
}

.fi-cluster-popup a.fi-cluster-link:hover {
    color: #77BDFF !important;
    text-decoration: underline;
}

/* PU counts — MAKE THEM WHITE */
.fi-cluster-popup .fi-subtext,
.fi-cluster-popup span {
    color: #FFFFFF !important;     /* force white */
    opacity: 1 !important;         /* no dimming */
}

/* List dividers */
.fi-cluster-popup li {
    padding: 5px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.20);
}

.fi-cluster-popup li:first-of-type {
    border-top: none;
}

/* Close button “X” */
.fi-popup .leaflet-popup-close-button {
    color: #FFFFFF !important;
    font-size: 18px;
    font-weight: bold;
}



/* Allow Leaflet popups to auto-size horizontally */
.leaflet-popup {
    max-width: none !important;
}

.leaflet-popup-content-wrapper {
    max-width: none !important;
}

.leaflet-popup-content {
    width: max-content !important;
    max-width: 60vw !important; /* no wider than 60% of screen */
    white-space: nowrap;
}


/* Small fade-in */

@keyframes ti-webview-fade-in {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.crm-status-pill {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 10px;
}
.crm-status-due { background: #ef4444; color: white; }
.crm-status-future { background: #f59e0b; color: black; }
.crm-status-done { color: #4ade80; font-style: italic; }

.crm-complete-btn {
    background: transparent;
    border: 1px solid #4ade80;
    color: #4ade80;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    padding: 2px 8px;
    text-transform: uppercase;
}
.crm-complete-btn:hover { background: #4ade80; color: #000; }

.fi-export-column {
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 8px;
    margin-bottom: 4px;
    align-items: center; /* Center items horizontally */
    width: 100%; /* Ensure container takes full width of card */
}

/* Set buttons to 80% width. */
.fi-export-column button {
    width: 90%;
    text-align: center;
}

/* Ensure the summary text ("0 Fleets Shown") is also centered */
.fi-results-summary {
    text-align: center;
}

/* --- CRM FILTER BUTTONS (Issue 4) --- */
.fi-crm-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.fi-crm-filter-btn {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--fi-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;

    /* Default state (Blue Primary Style - Issue 4) */
    background: #0046AE;
    border: 1px solid #FFD451;
    color: #e5e7eb;
}

.fi-crm-filter-btn:hover {
    /* Blue Glow */
    box-shadow: 0 0 12px rgba(45, 103, 255, 0.9),
                0 0 20px rgba(45, 103, 255, 0.6);
    transform: translateY(-1px);
}

/* Active state (Orange - like View Notes) */
.fi-crm-filter-btn.active {
    background: #ff8c00;
    border-color: #ffffff;
    color: #ffffff;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.fi-crm-filter-btn.active:hover {
    background-color: #cc7000;
    box-shadow: 0 0 12px rgba(255, 140, 0, 0.9),
                0 0 20px rgba(255, 140, 0, 0.6);
    transform: translateY(-1px);
        /* Maintain or darken the blue border on hover */
        border-color: #ffffff;
}

.fi-import-btn {
    background-color: #008000; /* Teal (Issue 4) */
    border: 1px solid #0046AE;
    color: #fff;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.fi-import-btn:hover {
    background-color: #006666;
    box-shadow: 0 0 12px rgba(0, 128, 128, 0.9),
                0 0 20px rgba(0, 128, 128, 0.6);
    transform: translateY(-1px);
    border-color: #003380;
}

/* --- SEXY ALERT BOX  --- */

/* Styling for the Alert Content container */
.fi-alert-content {
    width: 360px;
    background: #0f172a; /* Dark Blue-Black */
    border: 1px solid #3b82f6; /* Blue Border */
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.4); /* Strong Blue Glow */
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: popIn 0.2s ease-out;
    max-height: min(1000px, 100vh - 40px);
    overflow-y: auto;
}

.fi-alert-header {
    margin: 0;
    color: #3b82f6; /* Brand Blue */
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 800;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    padding-bottom: 12px;
}

.fi-alert-body {
    color: #e2e8f0;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
}

.ti-live-demo-brand {
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.ti-live-demo-brand-white {
    color: #ffffff;
}

.ti-live-demo-brand-red {
    color: #FA0000;
}

.ti-live-demo-brand-blue {
    color: #3b82f6;
}

.ti-live-demo-brand-green {
    color: #22c55e;
}

/* Tiny animation to make it pop */
@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.fi-alert-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* ============================= */
/* Embedded Browser Overlay (Issue 5 Restored) */
/* ============================= */

#ti-webview-overlay {
    position: fixed;
    inset: 40px;           /* KEEPS THE MARGINS (Not full screen) */
    background: rgba(5, 8, 16, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 16px;   /* Rounded corners */
    border: 1px solid var(--fi-accent);
    box-shadow: 0 0 60px rgba(59, 130, 246, 0.3), 0 24px 80px rgba(0, 0, 0, 0.9);
    z-index: 15000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ti-webview-overlay.ti-webview-hidden {
    display: none;
}

.ti-webview-chrome {
    /* Increase height slightly to accommodate input field and branding */
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--fi-border);
    flex-shrink: 0;
    gap: 15px; /* Add spacing between elements */
}

/* --- NEW: Branding in Webview --- */
.ti-webview-branding {
    display: flex;
    align-items: center;
}

/* Reuse main header style but scale it down for the webview chrome */
.ti-webview-brand-text {
    font-size: 24px !important; /* Scaled down from 44px */
    line-height: 1.0;
    margin: 0;
    padding: 0;
}

/* --- NEW: URL Input Bar --- */
.ti-webview-url-input {
    flex: 1; /* Takes up the remaining space */
    height: 38px;
    padding: 0 15px;
    border-radius: 8px;
    border: 1px solid #374151;
    background: #020617;
    color: #f9fafb;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.ti-webview-url-input:focus {
    border-color: var(--fi-accent);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.ti-webview-url-input[readonly] {
    /* Style if navigation is disabled */
    cursor: default;
}

#ti-webview-element {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff; /* Content background */
}

.ti-webview-nav-controls,
.ti-webview-actions {
    display: flex;
    gap: 8px;
}

.ti-webview-chrome button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.18s ease-in-out;
}

.ti-webview-chrome button:hover {
    background: var(--fi-accent);
    border-color: var(--fi-accent);
}

.ti-webview-chrome button:disabled {
    opacity: 0.5;
    cursor: default;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.ti-webview-logo-img {
    margin-right: 2px !important;
    width: 32px;   /* or 36 / 40 if you like the look better */
    height: 32px;
    object-fit: contain;
}

/* --- Centered Button Row (Issue 4) --- */
.fi-button-row-centered {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.fi-button-row-centered button {
    width: 40%; /* 40% width as requested */
    text-align: center;
}

/* --- NOTES MODAL INPUT STYLING (Issue 3) --- */

/* Ensure textarea has base styling and matches the theme */
.fi-textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px; /* Slightly rounder corners */
    border: 1px solid #334155; /* Subtle border */
    background: #020617; /* Dark background */
    color: var(--fi-text);
    /* Use CSS variable for font size */
    font-size: var(--note-input-font-size, 14px);
    outline: none;
    resize: vertical;
    font-family: var(--fi-font-main);
    line-height: 1.6;
}

/* Subject Line Specific Styling */
#fi-note-subject {
    padding: 12px 15px;
    border-radius: 8px;
    background: #020617;
    border: 1px solid #334155;
    /* Use CSS variable for font size */
    font-size: var(--note-input-font-size, 16px);
    margin-bottom: 10px;
}

/* Notes Body Textarea Specific Styling */
#fi-notes-modal .fi-textarea {
    min-height: 150px; /* Ensure sufficient height */
}

/* Focus state for inputs in modal */
#fi-notes-modal .fi-input:focus,
#fi-notes-modal .fi-textarea:focus {
    border-color: var(--fi-accent);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

/* --- FONT SIZE CONTROLS (Issue 3) --- */
.fi-font-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--fi-border);
    border-radius: 6px;
    overflow: hidden;
    margin-right: 10px;
}

.fi-font-btn {
    background: transparent;
    border: none;
    color: var(--fi-muted);
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.fi-font-btn:not(:last-child) {
    border-right: 1px solid var(--fi-border);
}

.fi-font-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.fi-font-btn.active {
    background-color: var(--fi-accent);
    color: #ffffff;
}

/* Font Size Classes applied to the modal content container */
/* Define CSS variables for font sizes */
.fi-modal-content.font-sm {
    --note-font-size: 14px; /* Default/Minimum */
    --note-meta-font-size: 12px;
    --note-input-font-size: 14px;
}
.fi-modal-content.font-md {
    --note-font-size: 18px;
    --note-meta-font-size: 14px;
    --note-input-font-size: 18px;
}
.fi-modal-content.font-lg {
    --note-font-size: 22px;
    --note-meta-font-size: 16px;
    --note-input-font-size: 22px;
}

/* Apply the variables */
.fi-note-body,
.fi-note-subject {
    font-size: var(--note-font-size);
}

.fi-note-date,
.fi-note-followup-line {
    font-size: var(--note-meta-font-size);
}

/* ============================= */
/* Custom Loading Indicator      */
/* ============================= */

.ti-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000; /* Above everything else */
}

/* Ensure ti-hidden works (it should already be defined in the license section) */
.ti-loading-overlay.ti-hidden {
    display: none !important;
}

.ti-spinner-container {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ti-spinner-logo {
    width: 120px;     /* tune to match the ring */
    height: 120px;
    object-fit: cover; /* Ensure it fills the space */
    border-radius: 50%; /* Circle crop */
    z-index: 2;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.ti-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    /* Create a partial border using conic-gradient */
    background: conic-gradient(
        from 0deg,
        #FA0000 0%,      /* Red */
        #FA0000 30%,     /* Red */
        transparent 35%  /* Transparent gap */
    );
    animation: ti-spin 1.2s linear infinite;
}

/* Mask the inner part of the ring to create the border effect */
.ti-spinner-ring::before {
    content: '';
    position: absolute;
    inset: 5px; /* This defines the thickness of the ring */
    border-radius: 50%;
    /* This background should match the logo background color from the image */
    background: #050810;
}

@keyframes ti-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* SPECIFIC OVERRIDE FOR MAP DRAGGING */
.leaflet-grab, .leaflet-dragging .leaflet-grab {
    cursor: crosshair !important;
}
/* ========== IN-APP BROWSER (WEBVIEW) ========== */


.ti-webview-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #020617;
    border-bottom: 1px solid var(--fi-border);
    gap: 15px;
}

/* Data Portal Branding */
.ti-webview-branding {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 10px;
}


.ti-webview-branding-title {
    /* Matching the main TruckerIntelligence header style */
    font-size: 24px;
    font-weight: 850;
    letter-spacing: -0.03em;
    font-style: italic;
    text-transform: uppercase;
    margin: 0;
    padding: 0;
    line-height: 1.0;
    color: #ffffff; /* DATA (White) */
}

.ti-webview-branding-accent {
    color: #FA0000; /* PORTAL (Brand Red) */
}

.ti-webview-controls, .ti-webview-actions {
    display: flex;
    gap: 8px;
}

/* --- ADDRESS BAR CONTAINER (The Wrapper) --- */
.ti-webview-address-bar {
    flex: 1;              /* This tells the wrapper to eat up all available space */
    display: flex;        /* Keeps the input inside aligned */
    margin: 0 10px;       /* Adds a little breathing room on sides */
}

/* --- THE INPUT ITSELF --- */
/* Note: I included both class names you might be using just to be safe */
.ti-webview-url-input,
.ti-webview-input {
    width: 100%;          /* Forces input to fill the wrapper */
    height: 38px;
    padding: 0 15px;
    border-radius: 8px;
    border: 1px solid #374151;
    background: #020617;
    color: #f9fafb;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.ti-webview-url-input:focus,
.ti-webview-input:focus {
    border-color: var(--fi-accent);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.ti-webview-input:read-only {
    /* Style for PDF preview mode */
    background: #1e293b;
    color: #9ca3af;
    cursor: default;
}

.ti-webview-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #374151;
    background: #1e293b;
    color: var(--fi-text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ti-webview-btn:hover {
    background: var(--fi-accent);
    border-color: var(--fi-accent);
    color: #fff;
}

.ti-webview-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #1e293b;
    color: var(--fi-text);
    border-color: #374151;
}

.ti-webview-close-btn {
    background: #ef4444;
    border-color: #dc2626;
    color: #fff;
}

.ti-webview-close-btn:hover {
    background: #f87171;
}

.ti-webview-body {
    flex: 1;
    background: #fff; /* Default background for web content */
    overflow: hidden;
}

.ti-webview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

@keyframes ti-webview-fade-in {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.fi-sidebar-notice {
    color: #4ea3ff;
    text-decoration: none;
    cursor: pointer;
}

.fi-sidebar-notice:hover {
    color: #e53935;
    text-decoration: underline;
    font-size: 13px;
}

/* --- BACKUP / LOAD BUTTON STYLE --- */
.fi-btn-backup-outline {
    background: #3b82f6;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    width: 90%;
    text-align: center;
    display: inline-block;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.fi-btn-backup-outline:hover {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* --- DANGER / RESET BUTTON STYLE --- */
.fi-btn-danger-outline {
    background: transparent;
    color: #FA0000; /* Red Text */
    border: 1px solid #ffffff; /* Red Border */
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    width: 90%; /* Match export buttons */
    text-align: center;
    display: inline-block;
    letter-spacing: 0.05em;
}

.fi-btn-danger-outline:hover {
    background: #FA0000;
    color: #ffffff; /* White Text on Hover */
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* --- TECHNICAL USER GUIDE BUTTON STYLING --- */
#fi-open-user-guide {
    background-color: #ff8c00; /* Orange background */
    border: 1px solid #0046AE; /* Blue border */
    color: #fff;
    font-weight: 600;

    /* FIX WIDTH: Center the button and match the 90% width of the Reset button */
    display: block;           /* Ensures margins work for centering */
    width: 90%;
    margin: 0 auto 12px auto; /* Centers the button horizontally */

    /* FIX HEIGHT: Add vertical padding to match the height of other buttons */
    padding: 10px 0;

    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

#fi-open-user-guide:hover {
    background-color: #e67e00; /* Darker orange on hover */
    box-shadow: 0 0 12px rgba(255, 140, 0, 0.9),
                0 0 20px rgba(255, 140, 0, 0.6);
    transform: translateY(-1px);
    border-color: #003380;
}

/* --- EULA BUTTON STYLING --- */
#fi-open-eula-pdf {
    background-color: #0046AE; /* Brand Blue */
    border: 1px solid #3b82f6; /* Lighter Blue border for contrast */
    color: #fff;
    font-weight: 600;

    /* Exact dimensions of the Technical User Guide Button */
    display: block;
    width: 90%;
    margin: 5px auto 15px auto;
    padding: 10px 0;

    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

#fi-open-eula-pdf:hover {
    background-color: #003380; /* Darker blue on hover */
    /* Blue Glow Effect */
    box-shadow: 0 0 12px rgba(0, 70, 174, 0.9),
                0 0 20px rgba(0, 70, 174, 0.6);
    transform: translateY(-1px);
    border-color: #ffffff; /* White border pop on hover */
}

/* --- NEW: Map Theme Toggle Button --- */
.fi-map-theme-btn {
    position: absolute;
    top: 10px;
    right: 50px; /* Positioned to the left of the fullscreen button */
    z-index: 1000;
    border-radius: 6px;
    border: 1px solid #2563eb;        /* Matching Blue Border */
    background: rgba(37, 99, 235, 0.85); /* Matching Blue BG */
    color: white;
    font-size: 18px; /* Slightly larger icon */
    padding: 0px 8px;
    height: 30px; /* Match height */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fi-map-theme-btn:hover {
    border-color: #60a5fa;
    box-shadow: 0 0 28px 8px rgba(59, 130, 246, 0.95);
    transform: translateY(-1px);
    transition: all 0.5s ease;
}

/* --- Fullscreen Mode: Large Theme Button --- */
body.fi-map-fullscreen-mode .fi-map-theme-btn {
    /* Make it big like the X button */
    font-size: 25px;
    padding: 10.2px 16px;
    height: auto; /* Let padding determine height */
    border-width: 2px;

    /* Move it to the left of the X button so they sit side-by-side */
    right: 75px;
    top: 10px;
}

/* Match the aggressive glow of the X button when hovering in fullscreen */
body.fi-map-fullscreen-mode .fi-map-theme-btn:hover {
    border-color: #93c5fd;
    box-shadow:
        0 0 25px rgba(59, 130, 246, 0.95),
        0 0 45px rgba(59, 130, 246, 0.9);
    transform: translateY(-1px);
}
/* --- SIDEBAR TOGGLE (HAMBURGER) --- */
.fi-sidebar-toggle {
    background: transparent;
    border: 1px solid #1f2937; /* Dark border by default */
    color: #3b82f6;            /* Brand Blue */
    font-size: 24px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease; /* Smooth animation */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;        /* Spacing from title */
}

/* GROW AND GLOW EFFECT */
.fi-sidebar-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #ffffff;

    /* Grow */
    transform: scale(1.15);

    /* Glow (Box + Text) */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6),
                0 0 30px rgba(59, 130, 246, 0.2);
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

/* --- ANIMATED GRID LAYOUT --- */

/* The state when sidebar is closed */
.fi-main.sidebar-closed {
    /* Collapse the first column (sidebar) to 0 */
    grid-template-columns: 0px minmax(0, 1fr);
    /* Remove the gap so the map hits the left edge cleanly */
    gap: 14px 0px;
}

/* Handle the sidebar content fading out */
.fi-sidebar {
    transition: opacity 0.2s ease, transform 0.3s ease, visibility 0.3s;
    transform-origin: left center;
    min-width: 320px; /* Prevent content from squishing during animation */
}

.fi-main.sidebar-closed .fi-sidebar {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateX(-20px);
}

/* --- TABLE FULLSCREEN BUTTON --- */
.fi-table-fullscreen-btn {
    position: absolute;
    top: 2px;          /* Moved UP */
    right: 6px;        /* Moved RIGHT */
    z-index: 50;

    border-radius: 6px;
    border: 1px solid #2563eb;
    background: rgba(37, 99, 235, 0.85);
    color: white;

    font-size: 14px;
    padding: 2px 8px;  /* Slightly reduced vertical padding to fit the header better */
    cursor: pointer;
    transition: all 0.2s ease;

    /* Slight shadow by default */
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* GLOW AND GROW HOVER */
.fi-table-fullscreen-btn:hover {
    border-color: #60a5fa;
    /* Neon Blue Glow */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.95),
                0 0 25px rgba(59, 130, 246, 0.6);
    /* Grow */
    transform: scale(1.15) translateY(-1px);
    transition: all 0.3s ease;
}

/* Active State (When in Fullscreen) - Extra Bright */
body.fi-table-fullscreen-mode .fi-table-fullscreen-btn {
    background: #2563eb;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    font-size: 18px; /* Bigger X */
    padding: 6px 12px;
}

/* --- TABLE FULLSCREEN MODE STATE --- */
body.fi-table-fullscreen-mode .fi-sidebar,
body.fi-table-fullscreen-mode .fi-map-panel {
    display: none !important;
}

body.fi-table-fullscreen-mode .fi-main {
    grid-template-columns: 1fr !important;
}

body.fi-table-fullscreen-mode .fi-table-panel {
    flex: 1 1 auto !important;
    max-height: none !important;
    min-height: 0 !important;
    margin-bottom: 0;
}

/* Make button distinct when active */
body.fi-table-fullscreen-mode .fi-table-fullscreen-btn {
    background: #2563eb;
    color: white;
    border-color: white;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.8);
}

/* --- PAGINATION BAR --- */
.fi-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #0f172a;
    border-top: 1px solid #1f2937;
    flex-shrink: 0; /* Prevent collapsing */
    z-index: 10;
}

.fi-page-info {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 600;
}

.fi-pagination-buttons {
    display: flex;
    gap: 8px;
}

.fi-page-btn {
    background: transparent;
    border: 1px solid #374151;
    color: #e5e7eb;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fi-page-btn:hover:not(:disabled) {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.fi-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #1f2937;
}

/* --- PAGINATION CENTER CONTROLS --- */
.fi-pagination-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fi-page-label {
    color: #9ca3af;
    font-size: 12px;
    font-weight: 600;
}

.fi-page-input {
    background: #020617;
    border: 1px solid #374151;
    color: #e5e7eb;
    border-radius: 4px;
    width: 60px;
    padding: 3px 6px;
    font-size: 12px;
    text-align: center;
    outline: none;
}

.fi-page-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.4);
}

/* Remove spinner arrows from number input */
.fi-page-input::-webkit-outer-spin-button,
.fi-page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fi-page-btn-small {
    background: transparent;
    border: 1px solid #374151;
    color: #3b82f6;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.fi-page-btn-small:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #fff;
}

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

/* Live web demo: real app shell with selected desktop-only features hidden. */
body.ti-live-demo #ti-license-overlay,
body.ti-live-demo #ti-webview-overlay,
body.ti-live-demo .ti-expiry-banner,
body.ti-live-demo .ti-live-demo-hidden {
    display: none !important;
}

body.ti-live-demo #fi-load-state,
body.ti-live-demo #fi-clear-state,
body.ti-live-demo #fi-open-user-guide,
body.ti-live-demo #fi-backup-data,
body.ti-live-demo #fi-load-data,
body.ti-live-demo #fi-import-file-input,
body.ti-live-demo #fi-only-custom-btn {
    display: none !important;
}

body.ti-live-demo #fi-state-select,
body.ti-live-demo #fi-city,
body.ti-live-demo #fi-radius {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(37, 99, 235, 0.12);
    color: #dbeafe;
    cursor: not-allowed;
}

body.ti-live-demo .ti-live-demo-notice {
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 10px 0 12px;
    background: rgba(37, 99, 235, 0.14);
    color: #dbeafe;
    font-size: 0.84rem;
    line-height: 1.45;
}

body.ti-live-demo .fi-table-scroll-wrapper {
    overflow-x: auto;
}

body.ti-live-demo .ti-live-demo-purchase-control {
    border: 1px solid #FA0000;
    border-radius: 999px;
    padding: 8px 18px;
    background: rgba(2, 6, 23, 0.9);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), 0 0 14px rgba(250, 0, 0, 0.36);
    text-decoration: none !important;
}

body.ti-live-demo .ti-live-demo-purchase-control:hover,
body.ti-live-demo .ti-live-demo-purchase-control:focus {
    border-color: #ff2b2b;
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.62), 0 0 24px rgba(250, 0, 0, 0.58);
    outline: none;
}

body.ti-live-demo .ti-live-demo-purchase-control .fi-dataportal-title {
    font-size: 16px;
    letter-spacing: 0;
    white-space: nowrap;
}

body.ti-live-demo .ti-live-demo-purchase-accent {
    color: #FA0000;
}

.ti-live-demo-splash {
    position: fixed;
    inset: 0;
    z-index: 200000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(2, 6, 23, 0.96), rgba(8, 19, 39, 0.95)),
        radial-gradient(circle at 50% 0%, rgba(0, 70, 174, 0.18), transparent 42%);
    color: #e5e7eb;
}

.ti-live-demo-splash-panel {
    width: min(980px, 100%);
    max-height: min(840px, calc(100vh - 56px));
    overflow-y: auto;
    border: 1px solid rgba(59, 130, 246, 0.55);
    border-radius: 8px;
    background: rgba(3, 7, 18, 0.96);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: clamp(24px, 4vw, 48px);
}

.ti-live-demo-splash-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid rgba(34, 197, 94, 0.65);
    border-radius: 4px;
    color: #86efac;
    background: rgba(22, 101, 52, 0.18);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.ti-live-demo-splash h2 {
    margin: 18px 0 12px;
    color: #ffffff;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 0.95;
    font-style: italic;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.ti-live-demo-splash h2 strong {
    color: #FA0000;
    font-weight: 900;
}

.ti-live-demo-splash h2 small {
    display: block;
    margin-top: 10px;
    color: #60a5fa;
    font-size: clamp(16px, 2.2vw, 24px);
    font-style: normal;
    letter-spacing: 0.08em;
}

.ti-live-demo-splash-lede {
    max-width: 820px;
    margin: 0 0 24px;
    color: #cbd5e1;
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.42;
    font-weight: 700;
}

.ti-live-demo-splash-device {
    display: inline-flex;
    align-items: center;
    margin: 0 0 4px;
    border: 1px solid rgba(96, 165, 250, 0.5);
    border-radius: 6px;
    padding: 9px 12px;
    background: rgba(30, 64, 175, 0.22);
    color: #dbeafe;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 900;
}

.ti-live-demo-splash-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 26px 0;
}

.ti-live-demo-splash-grid div {
    min-height: 148px;
    border: 1px solid rgba(59, 130, 246, 0.36);
    border-radius: 8px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.92);
}

.ti-live-demo-splash-grid span {
    display: block;
    margin-bottom: 10px;
    color: #93c5fd;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ti-live-demo-splash-grid strong {
    display: block;
    color: #ffffff;
    font-size: 19px;
    line-height: 1.15;
    font-weight: 900;
}

.ti-live-demo-splash-grid small {
    display: block;
    margin-top: 10px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.35;
}

.ti-live-demo-splash-note {
    margin: 0;
    border-left: 3px solid #FA0000;
    padding: 12px 14px;
    background: rgba(127, 29, 29, 0.18);
    color: #fecaca;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
}

.ti-live-demo-splash-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 26px;
}

.ti-live-demo-splash-actions button,
.ti-live-demo-splash-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 6px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

.ti-live-demo-splash-actions button {
    border: 1px solid #2563eb;
    color: #ffffff;
    background: #2563eb;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

.ti-live-demo-splash-actions button:hover,
.ti-live-demo-splash-actions button:focus {
    background: #3b82f6;
    outline: none;
}

.ti-live-demo-splash-actions a {
    border: 1px solid rgba(96, 165, 250, 0.6);
    color: #bfdbfe;
    background: rgba(30, 41, 59, 0.92);
}

.ti-live-demo-splash-actions a:hover,
.ti-live-demo-splash-actions a:focus {
    border-color: #93c5fd;
    color: #ffffff;
    outline: none;
}

.ti-live-demo-splash-actions #ti-live-demo-splash-purchase {
    border-color: rgba(250, 0, 0, 0.86);
    color: #ffffff;
    background: rgba(127, 29, 29, 0.78);
}

.ti-live-demo-splash-actions #ti-live-demo-splash-purchase:hover,
.ti-live-demo-splash-actions #ti-live-demo-splash-purchase:focus {
    border-color: #ff2b2b;
    background: rgba(153, 27, 27, 0.96);
}

@media (max-width: 900px) {
    .ti-live-demo-splash-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .ti-live-demo-splash {
        align-items: flex-start;
        padding: 14px;
    }

    .ti-live-demo-splash-panel {
        max-height: calc(100vh - 28px);
        padding: 22px;
    }

    .ti-live-demo-splash-grid {
        grid-template-columns: 1fr;
    }

    .ti-live-demo-splash-actions button,
    .ti-live-demo-splash-actions a {
        width: 100%;
    }
}
