/* YBD Dashboard Styles — based on RoutiGo Support Tools */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: #DDDDDD;
    font-family: 'Roboto', Arial, Helvetica, sans-serif;
    padding: 0;
    margin: 0;
}

/* Background */
.background-white { position: fixed; width: 100%; height: 100%; background-color: #fff; }
.background-circle { box-sizing: border-box; position: fixed; aspect-ratio: 1/1; border-radius: 50%; }
.background-circle.yellow-circle-top-right { width: 72vw; top: -36vw; right: -42vw; opacity: .16; border: 8.6vw solid #ffda92; }
.background-circle.blue-circle-bottom-left { width: 50vw; bottom: -20vw; left: -25vw; opacity: .12; border: 7vw solid #7cbcf1; }

/* Main layout */
.mainbox { position: relative; width: 100%; min-height: 100vh; padding-bottom: 60px; }

/* Top bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
}
.logo-bar { display: inline-block; background: #FFFFFF; padding: 8px 12px; border-radius: 8px; }
.logo-bar svg { display: block; height: 42px; width: auto; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-user { font-size: 10pt; color: #666; font-family: Arial, Helvetica, sans-serif; }
.top-bar-title {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16pt;
    font-weight: 700;
    color: #2F96F3;
    flex: 1;
    text-align: center;
}

/* Typography */
.titletext { font-size: 20pt; font-family: Arial, Helvetica, sans-serif; color: #2F96F3; }
.subtitletext { font-size: 12pt; font-family: Arial, Helvetica, sans-serif; color: #000000; }

/* Buttons */
.custombutton {
    border: 2px solid #2F96F3;
    border-radius: 10px;
    padding: 10px 18px;
    background: #2F96F3;
    color: #fff;
    font-size: 12pt;
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
}
.custombutton:hover { background: #1b7ed6; }
.custombutton.compact {
    padding: 6px 14px;
    font-size: 10pt;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Login box */
.login-box {
    background: #fff;
    width: 400px;
    padding: 40px 30px 30px 30px;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 5px 10px 10px rgba(0,0,0,0.1);
    text-align: left;
}
.btn-container { text-align: center; }
.inputtext {
    border: 2px solid #2F96F3;
    border-radius: 10px;
    width: 260px;
    padding: 6px 10px;
    font-size: 10pt;
    font-family: Arial, Helvetica, sans-serif;
}

/* Loader */
.loader {
    display: none;
    position: fixed;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.6);
    z-index: 1100;
}
.loading {
    border: 10px solid #f3f3f3;
    border-top: 10px solid #2F96F3;
    border-radius: 50%;
    width: 80px; height: 80px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%; left: 50%;
    margin: -40px 0 0 -40px;
}
@keyframes spin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }

/* -------------------------------------------------------------------------
   Dashboard-specific styles
   ---------------------------------------------------------------------- */

/* Progress panel (week-by-week fetch progress) */
.progress-panel {
    background: #fff8e1;
    border-left: 4px solid #ff9800;
    margin: 8px 20px;
    border-radius: 0 6px 6px 0;
    padding: 10px 16px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
    color: #795548;
}
.progress-panel-header {
    font-weight: 600;
    margin-bottom: 6px;
}
.progress-list {
    max-height: 220px;   /* ~10 rows before scroll */
    overflow-y: auto;
}
.progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    color: #333;
}
.progress-item:last-child { border-bottom: none; }
.progress-checkmark       { color: #4caf50; font-weight: bold; font-size: 12pt; line-height: 1; flex-shrink: 0; }
.progress-error           { color: #f44336; font-weight: bold; font-size: 12pt; line-height: 1; flex-shrink: 0; }
.week-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top-color: #ff9800;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Refresh status banner */
.refresh-banner {
    background: #fff8e1;
    border-left: 4px solid #ff9800;
    color: #795548;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
    padding: 8px 20px;
    margin: 8px 20px;
    border-radius: 0 6px 6px 0;
}
.refresh-banner.refresh-banner-error {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

/* Controls bar */
.dashboard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 20px;
    margin: 4px 0;
}

/* Granularity toggle */
.granularity-toggle {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #2F96F3;
}
.toggle-btn {
    background: #fff;
    color: #2F96F3;
    border: none;
    padding: 6px 18px;
    font-size: 10pt;
    font-family: Arial, Helvetica, sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid #2F96F3;
}
.toggle-btn:last-child { border-right: none; }
.toggle-btn.active { background: #2F96F3; color: #fff; }
.toggle-btn:hover:not(.active) { background: #e3f2fd; }

/* Period selector */
.period-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
    color: #555;
}
.period-input {
    width: 56px;
    border: 2px solid #2F96F3;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 10pt;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
}
.period-input:focus { outline: none; border-color: #1b7ed6; }

/* Refresh area */
.refresh-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.last-updated-badge {
    font-size: 9pt;
    font-family: Arial, Helvetica, sans-serif;
    color: #888;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 4px 10px;
}

/* Charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 18px;
    padding: 8px 20px 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.chart-card {
    background: #fff;
    border-radius: 12px;
    border: 2px solid #CFE8FF;
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chart-title {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13pt;
    color: #2F96F3;
    font-weight: 700;
}
.chart-subtitle {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9pt;
    color: #888;
    margin-bottom: 8px;
}
.chart-wrap {
    position: relative;
    height: 260px;
}

/* No data message */
.no-data-msg {
    text-align: center;
    padding: 60px 20px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11pt;
    color: #666;
}

/* KPI table card (full-width, below charts) */
.table-card {
    background: #fff;
    border-radius: 12px;
    border: 2px solid #CFE8FF;
    padding: 18px 18px 14px;
    margin: 0 20px 20px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.kpi-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
}

.kpi-table thead th {
    text-align: left;
    padding: 8px 12px;
    background: #f0f7ff;
    color: #001D3D;
    font-weight: 700;
    border-bottom: 2px solid #CFE8FF;
    white-space: nowrap;
}

.kpi-table tbody tr:nth-child(even) {
    background: #f8fbff;
}

.kpi-table tbody tr:hover {
    background: #e8f3ff;
}

.kpi-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid #e8f0f8;
    color: #333;
}

.kpi-table tbody td:first-child {
    font-weight: 600;
    color: #001D3D;
}

.kpi-table .col-nt  { color: #ff9800; font-weight: 600; }
.kpi-table .col-ret { color: #9e9e9e; font-weight: 600; }
.kpi-table .col-bb  { color: #2196F3; font-weight: 600; }

@media (max-width: 600px) {
    .charts-grid { grid-template-columns: 1fr; }
    .dashboard-controls { flex-direction: column; align-items: flex-start; }
    .table-card { margin: 0 8px 20px; padding: 12px 10px 10px; }
    .kpi-table { font-size: 9pt; }
    .kpi-table thead th, .kpi-table tbody td { padding: 6px 8px; }
}
