.nib-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.nib-tab {
    background-color: #495057;
    color: #f8f9fa;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px 6px 0 0;
    font-size: 0.9rem;
    font-family: inherit;
    border: none;
    cursor: pointer;
    display: inline-block;
}

.nib-tab:hover {
    background-color: #5a6268;
    color: #ffffff;
}

.nib-tab.active-tab {
    color: #ffc107;
    background-color: #343a40;
    font-weight: bold;
}

.nib-navbar-group {
    position: sticky;
    top: 0;
    z-index: 1030;
}

.nib-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 1.5rem;
}

.nib-subtab {
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px 6px 0 0;
    font-size: 0.85rem;
    font-family: inherit;
    border: none;
    cursor: pointer;
}

.nib-subtab:hover {
    background-color: #dee2e6;
}

.nib-subtab.active-tab {
    background-color: #343a40;
    color: #ffc107;
    font-weight: bold;
}

.nib-trends-layout {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
}

.nib-ad-vertical {
    width: 160px;
    background-color: #f1f3f5;
    border: 1px dashed #ced4da;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 0.8rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .nib-trends-layout { flex-direction: column; }
    .nib-ad-vertical { width: 100%; min-height: 100px; }
}

.nib-footer {
    position: sticky;
    bottom: 0;
    background-color: #212529;
    color: #adb5bd;
    padding: 3px 0;
    font-size: 0.8rem;
    z-index: 1020;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.nib-chart-container {
    position: relative;
    flex: 1;
    min-height: 0;
}

.nib-chart-section {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.sleep-section {
    margin-bottom: 0.1rem;  
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    border-radius: 2px;
}

.nib-time-input {
    max-width: 90px;
}

.nib-meridiem-btn {
    font-weight: 400;
    border: none;
    min-width: 44px;
}

.nib-meridiem-btn.nib-meridiem-am {
    background-color: #ffc107;
    color: #212529;
}

.nib-meridiem-btn.nib-meridiem-pm {
    background-color: #212529;
    color: #fff;
}

.nib-meridiem-btn.nib-meridiem-active {
    background-color: #198754 !important;
    color: #fff !important;
    font-weight: 700;
}

/* --- Micronutrient boxes (Totals / Trends) --- */

.nib-nutrient-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.nib-nutrient-box {
    width: 150px;
    border-radius: 12px;
    padding: 12px;
    color: #fff;
}

.nib-nutrient-box-vitamin {
    background-color: #E8720C;
}

.nib-nutrient-box-mineral {
    background-color: #4472C4;
}

.nib-nutrient-box-other {
    background-color: #fff;
    color: #212529;
    border: 1px solid #212529;
}

.nib-nutrient-box-label {
    font-weight: 700;
    margin-bottom: 6px;
}

.nib-nutrient-box-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
    font-size: 0.8rem;
}

.nib-nutrient-box-list li {
    margin-bottom: 2px;
}

.nib-nutrient-empty {
    opacity: 0.85;
    font-style: italic;
}

/* --- Daily Goals: metabolic adjustment slider --- */

.nib-metabolism-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #0d6efd, #f8f9fa 50%, #E8720C);
    outline: none;
    margin: 6px 0 2px;
}

.nib-metabolism-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #212529;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

.nib-metabolism-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #212529;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

/* --- Daily Goals: carb priority slider --- */

.nib-carb-priority-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #198754, #ffe9a8);
    outline: none;
    margin: 6px 0 2px;
}

.nib-carb-priority-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #212529;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

.nib-carb-priority-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #212529;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

/* --- Daily Goals: recommendation result boxes --- */

.nib-goal-box {
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
    min-width: 76px;
}

.nib-goal-box-label {
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.15;
}

.nib-goal-box-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.nib-goal-box-dark {
    background-color: #212529;
}

.nib-goal-box-dark .nib-goal-box-label {
    color: #fff;
}

.nib-goal-box-gray {
    background-color: #e9ecef;
}

.nib-goal-box-blue {
    background-color: #d6ecff;
}

.nib-goal-box-green {
    background-color: #d9f2df;
}

.nib-goal-box-yellow {
    background-color: #ffe9a8;
}

.nib-goal-box-value-red {
    color: #dc3545;
}

.nib-goal-box-value-blue {
    color: #0d6efd;
}

.nib-goal-box-value-green {
    color: #198754;
}

.nib-goal-box-group {
    border: 2px solid #212529;
    border-radius: 10px;
    padding: 6px;
}

/* --- Food Check-Ins: time-of-day slider --- */

.nib-time-slider-wrap {
    position: relative;
    margin-top: 22px;
    margin-bottom: 4px;
}

.nib-time-slider-label {
    position: absolute;
    top: -20px;
    font-size: 0.8rem;
    color: #212529;
    white-space: nowrap;
    pointer-events: none;
}

.nib-time-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #0d6efd;
    outline: none;
    margin: 0;
}

.nib-time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #212529;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

.nib-time-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #212529;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0,0,0,0.4);
}

.nib-time-slider:disabled::-webkit-slider-thumb,
.nib-time-slider:disabled::-moz-range-thumb {
    cursor: default;
}
