/* ═══════════════════════════════════════════════════════════════
   BSC DASHBOARD  ·  Professional Design System
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
    /* Brand */
    --brand-primary:   #0A246A;
    --brand-secondary: #1a3a8a;
    --brand-accent:    #2563EB;
    --brand-gold:      #E8A838;

    /* Milha colors */
    --fm-color: #2563EB;
    --fm-bg:    #DBEAFE;
    --fm-dark:  #1D4ED8;

    --lm-color: #16A34A;
    --lm-bg:    #DCFCE7;
    --lm-dark:  #15803D;

    --lh-color: #EA580C;
    --lh-bg:    #FFEDD5;
    --lh-dark:  #C2410C;

    --sf-color: #7C3AED;
    --sf-bg:    #EDE9FE;
    --sf-dark:  #6D28D9;

    /* UI */
    --surface:       #FFFFFF;
    --surface-2:     #F8FAFC;
    --bg:            #EEF2F7;
    --border:        #E2E8F0;
    --border-strong: #CBD5E1;

    /* Text */
    --text-primary:  #0F172A;
    --text-secondary:#475569;
    --text-muted:    #94A3B8;

    /* Semantic */
    --green:   #16A34A;
    --red:     #DC2626;
    --yellow:  #D97706;
    --blue:    #2563EB;

    /* Radii & Shadows */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.08);

    /* Transitions */
    --t: 0.18s ease;

    /* Legacy compat */
    --dark-blue:    #0A246A;
    --border-color: #E2E8F0;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ──────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 13.5px;
    line-height: 1.5;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* ── Container ─────────────────────────────────────────────────── */
.dashboard-container {
    max-width: 1900px;
    margin: 0 auto;
    background: var(--bg);
    padding: 0 0 32px;
}

/* ══════════════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════════════ */
.excel-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #163080 60%, #1a3a8a 100%);
    color: #fff;
    padding: 0 24px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 16px rgba(10,36,106,.4);
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 500;
}

.header-left {
    position: absolute;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.jm-td-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.3);
    background: rgba(255,255,255,.08);
}

.jm-text {
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
}

.td-box {
    background: var(--brand-gold);
    color: var(--brand-primary);
    font-weight: 900;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: -2px;
    letter-spacing: .5px;
}

.header-buttons {
    position: absolute;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Header Buttons ────────────────────────────────────────────── */
.header-buttons button {
    border: none;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 12.5px;
    color: #fff;
    transition: all var(--t);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: .2px;
}

.header-buttons button:hover {
    transform: translateY(-1px);
    filter: brightness(1.12);
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.header-buttons button:active { transform: translateY(0); }

.btn-export {
    background: #166534;
    border: 1px solid rgba(255,255,255,.15) !important;
}
.btn-print {
    background: #1D4ED8;
    border: 1px solid rgba(255,255,255,.15) !important;
}

/* ══════════════════════════════════════════════════════════════════
   DATE CARD
══════════════════════════════════════════════════════════════════ */
.date-section-container {
    display: flex;
    justify-content: flex-end;
    padding: 14px 24px 6px;
}

.date-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.date-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════════════
   GRID & COLUMNS
══════════════════════════════════════════════════════════════════ */
.excel-grid {
    display: flex;
    gap: 20px;
    margin: 16px 20px 24px;
}
.col-left  { flex: 1; min-width: 0; }
.col-right { flex: 1; min-width: 0; }

/* ── Section Titles ────────────────────────────────────────────── */
.section-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.title-fm {
    color: var(--fm-dark);
    background: var(--fm-bg);
    border-left: 4px solid var(--fm-color);
}
.title-lm {
    color: var(--lm-dark);
    background: var(--lm-bg);
    border-left: 4px solid var(--lm-color);
}
.title-lh {
    color: var(--lh-dark);
    background: var(--lh-bg);
    border-left: 4px solid var(--lh-color);
}
.title-sf {
    color: var(--sf-dark);
    background: var(--sf-bg);
    border-left: 4px solid var(--sf-color);
}

/* ══════════════════════════════════════════════════════════════════
   EXCEL TABLES
══════════════════════════════════════════════════════════════════ */
.excel-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    margin-bottom: 0;
    background: var(--surface);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    border-top: none;
}

.excel-table th {
    font-weight: 600;
    font-size: 11.5px;
    padding: 10px 10px;
    text-align: center;
    border-bottom: 2px solid rgba(0,0,0,.1);
    border-right: 1px solid rgba(0,0,0,.07);
    letter-spacing: .3px;
    white-space: nowrap;
}

.excel-table td {
    padding: 9px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    transition: background var(--t);
}

.excel-table th:last-child,
.excel-table td:last-child { border-right: none; }

.excel-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
    padding-left: 14px;
}

/* Table hover */
.excel-table tbody tr:hover td {
    background-color: #F1F5FF;
    cursor: pointer;
}

/* Zebra stripes */
.excel-table tbody tr:nth-child(even) td {
    background-color: var(--surface-2);
}
.excel-table tbody tr:nth-child(even):hover td {
    background-color: #F1F5FF;
}

/* Table header themes */
.table-fm th { background: linear-gradient(to bottom, #DBEAFE, #EFF6FF); color: var(--fm-dark); }
.table-lm th { background: linear-gradient(to bottom, #DCFCE7, #F0FDF4); color: var(--lm-dark); }
.table-lh th { background: linear-gradient(to bottom, #FFEDD5, #FFF7ED); color: var(--lh-dark); }
.table-sf th { background: linear-gradient(to bottom, #EDE9FE, #F5F3FF); color: var(--sf-dark); }

/* Hidden media column */
.col-media          { display: none !important; }
body.show-media .col-media { display: table-cell !important; }

/* ══════════════════════════════════════════════════════════════════
   STATUS COLORS  (values in tables)
══════════════════════════════════════════════════════════════════ */
.text-red      { color: var(--red)   !important; }
.text-red-val  { color: var(--red)   !important; font-weight: 700 !important; }
.text-green    { color: var(--green) !important; }
.text-green-val{ color: var(--green) !important; font-weight: 700 !important; }
.text-yellow   { color: var(--yellow)!important; font-weight: 600 !important; }

/* ── Status text in last column ────────────────────────────────── */
.excel-table td:last-child {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .2px;
}

/* ══════════════════════════════════════════════════════════════════
   GLOBAL TASKS TABLE
══════════════════════════════════════════════════════════════════ */
.tasks-section-wrapper {
    margin: 0 20px 32px;
}

.tasks-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.tasks-table th {
    background: linear-gradient(to bottom, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    font-weight: 600;
    font-size: 11.5px;
    padding: 12px 14px;
    text-align: left;
    letter-spacing: .4px;
    text-transform: uppercase;
    border-right: 1px solid rgba(255,255,255,.1);
}

.tasks-table th:last-child { border-right: none; }

.tasks-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

.tasks-table td:last-child {
    text-align: center;
    border-right: none;
}

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

.tasks-table tr:hover td {
    background: #F1F5FF;
}

.tasks-table tr:nth-child(even) td {
    background: var(--surface-2);
}
.tasks-table tr:nth-child(even):hover td {
    background: #F1F5FF;
}

/* Status pills in tasks */
.status-red    { color: var(--red);    font-weight: 700; }
.status-green  { color: var(--green);  font-weight: 700; }
.status-yellow { color: var(--yellow); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════════
   MANUAL DATA HIGHLIGHT
══════════════════════════════════════════════════════════════════ */
body.highlight-manual td[data-manual="true"] {
    background: #FFFBEB !important;
    border: 1.5px solid #F59E0B !important;
    color: #92400E !important;
    transition: all 0.3s ease;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(10,36,106,.5);
    backdrop-filter: blur(4px);
    animation: fadeInOverlay .2s ease;
}

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

.modal-content {
    background: var(--surface);
    margin: 4% auto;
    border-radius: var(--radius-lg);
    width: min(820px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s ease;
}

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

.modal-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h2, .modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.close {
    color: rgba(255,255,255,.8);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: color var(--t);
    background: none;
    border: none;
    padding: 0 4px;
}
.close:hover { color: #fff; }

.modal-body {
    padding: 22px 24px;
}

/* ── Modal Form ────────────────────────────────────────────────── */
.action-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 4px;
}

.action-form input,
.action-form select,
.action-form textarea {
    padding: 10px 12px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color var(--t), box-shadow var(--t);
    outline: none;
}

.action-form input:focus,
.action-form select:focus,
.action-form textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.btn-save {
    background: var(--brand-primary);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all var(--t);
}
.btn-save:hover { background: var(--brand-secondary); transform: translateY(-1px); }

.btn-delete {
    background: var(--red);
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 12.5px;
    transition: all var(--t);
}
.btn-delete:hover { filter: brightness(1.1); }

/* ══════════════════════════════════════════════════════════════════
   CUSTOM MULTISELECT
══════════════════════════════════════════════════════════════════ */
.custom-multiselect { position: relative; width: 100%; }

.custom-multiselect .select-box {
    padding: 10px 12px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: border-color var(--t);
}
.custom-multiselect .select-box:hover { border-color: var(--blue); }

.custom-multiselect .checkboxes-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    z-index: 500;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    flex-direction: column;
    padding: 4px 0;
}

.custom-multiselect .checkboxes-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    cursor: pointer;
    margin: 0 !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    color: var(--text-primary);
    text-transform: none !important;
    letter-spacing: 0 !important;
    transition: background var(--t);
}
.custom-multiselect .checkboxes-dropdown label:hover { background: var(--surface-2); }

.custom-multiselect .checkboxes-dropdown input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: auto !important;
    accent-color: var(--blue);
}
