/* === LAYOUT GENERAL === */
.nbm-app {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 600px;
}

/* === SIDEBAR === */
.nbm-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px 0;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.nbm-sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 20px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 16px;
}

.nbm-avatar {
    width: 48px;
    height: 48px;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.nbm-user-name {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
}

.nbm-user-meta {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.nbm-nav {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
}

.nbm-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: #555;
    transition: all 0.2s;
    font-family: inherit;
}

.nbm-nav-item:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.nbm-nav-item.active {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.nbm-nav-icon {
    font-size: 18px;
}

/* === MAIN CONTENT === */
.nbm-main {
    flex: 1;
    min-width: 0;
}

.nbm-tab {
    display: none;
}

.nbm-tab.active {
    display: block;
}

.nbm-section {
    margin-bottom: 32px;
}

.nbm-section h2 {
    font-size: 26px;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.nbm-section h3 {
    font-size: 18px;
    margin: 0 0 16px 0;
    color: #333;
}

.nbm-subtitle {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 14px;
}

/* === CARDS === */
.nbm-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.nbm-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s;
}

.nbm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.nbm-card-label {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.nbm-card-value {
    font-size: 30px;
    font-weight: 700;
    color: #2e7d32;
}

.nbm-card-value span {
    font-size: 14px;
    font-weight: 400;
    color: #888;
}

.nbm-card-sub {
    margin-top: 4px;
    color: #666;
    font-size: 13px;
}

/* === PROGRESO === */
.nbm-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.nbm-progress-item {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
}

.nbm-progress-label {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.nbm-progress-value {
    font-size: 24px;
    font-weight: 700;
    color: #555;
}

.nbm-progress-value.positive { color: #2e7d32; }
.nbm-progress-value.negative { color: #c62828; }

/* === LISTA MEDICIONES === */
.nbm-compare-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 18px;
    background: #f5f5f5;
    border-radius: 10px;
}

#nbm-compare-count {
    flex: 1;
    color: #666;
    font-size: 14px;
}

.nbm-btn {
    background: #2e7d32;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nbm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nbm-btn-secondary {
    background: transparent;
    color: #666;
    border: 1px solid #ccc;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.nbm-mediciones-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nbm-medicion-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.2s;
}

.nbm-medicion-item:hover {
    border-color: #2e7d32;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.1);
}

.nbm-medicion-item.selected {
    background: #e8f5e9;
    border-color: #2e7d32;
}

.nbm-medicion-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.nbm-medicion-info {
    flex: 1;
    cursor: pointer;
}

.nbm-medicion-fecha {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
}

.nbm-medicion-fecha strong {
    font-size: 15px;
    color: #1a1a1a;
}

.nbm-medicion-fecha span {
    font-size: 13px;
    color: #888;
}

.nbm-medicion-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
}

.nbm-medicion-stats strong {
    color: #2e7d32;
}

.nbm-ver-detalle {
    background: transparent;
    border: 1px solid #2e7d32;
    color: #2e7d32;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.nbm-ver-detalle:hover {
    background: #2e7d32;
    color: #fff;
}

/* === MODAL === */
.nbm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.nbm-modal-content {
    background: #fff;
    border-radius: 14px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

.nbm-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f0f0f0;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    color: #555;
}

.nbm-modal-close:hover {
    background: #e0e0e0;
}

/* === GRÁFICOS === */
.nbm-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 16px;
}

.nbm-chart-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
}

.nbm-chart-box canvas {
    max-height: 240px;
}

/* === HERRAMIENTAS === */
.nbm-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.nbm-tool-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.nbm-tool-card:not(.disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.nbm-tool-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nbm-tool-icon {
    font-size: 38px;
    margin-bottom: 12px;
}

.nbm-tool-card h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #1a1a1a;
}

.nbm-tool-card p {
    margin: 0;
    font-size: 13px;
    color: #777;
}

.nbm-tool-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 10px;
    background: #f5f5f5;
    color: #888;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === EMPTY === */
.nbm-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background: #fafafa;
    border-radius: 12px;
}

/* === DETALLE EN MODAL === */
.nbm-detalle-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e8f5e9;
}

.nbm-detalle-grupo {
    margin-bottom: 24px;
}

.nbm-detalle-grupo h4 {
    color: #2e7d32;
    margin: 0 0 12px 0;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nbm-detalle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.nbm-detalle-item {
    background: #fafafa;
    padding: 12px 14px;
    border-radius: 8px;
}

.nbm-detalle-item-label {
    color: #888;
    font-size: 12px;
    margin-bottom: 4px;
}

.nbm-detalle-item-value {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
}

/* === COMPARACIÓN === */
.nbm-compare-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.nbm-compare-table th,
.nbm-compare-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.nbm-compare-table th {
    background: #f5f5f5;
    font-size: 13px;
    color: #333;
}

.nbm-compare-table td:first-child,
.nbm-compare-table th:first-child {
    text-align: left;
    font-weight: 500;
    background: #fafafa;
}

.nbm-compare-table tr:hover td {
    background: #fafafa;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .nbm-app {
        flex-direction: column;
    }
    .nbm-sidebar {
        width: 100%;
        position: relative;
    }
    .nbm-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    .nbm-nav-item {
        flex-shrink: 0;
    }
}

@media (max-width: 600px) {
    .nbm-cards { grid-template-columns: repeat(2, 1fr); }
    .nbm-card-value { font-size: 22px; }
    .nbm-medicion-item { flex-wrap: wrap; }
    .nbm-charts-grid { grid-template-columns: 1fr; }
}

.nbm-medicion-acc {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.nbm-medicion-acc[open] {
    border-color: #2e7d32;
    box-shadow: 0 2px 8px rgba(46,125,50,0.1);
}
.nbm-medicion-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.nbm-medicion-summary::-webkit-details-marker { display: none; }
.nbm-medicion-summary:hover { background: #fafafa; }
.nbm-summary-check { display: flex; align-items: center; }
.nbm-summary-arrow {
    color: #888;
    font-size: 12px;
    transition: transform 0.2s;
}
.nbm-medicion-acc[open] .nbm-summary-arrow { transform: rotate(180deg); }
.nbm-medicion-detalle {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.nbm-detalle-item.nbm-highlight {
    background: #e8f5e9;
    border: 1px solid #2e7d32;
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px;
}
.nbm-detalle-item.nbm-highlight .nbm-detalle-item-label {
    color: #2e7d32;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
}
.nbm-detalle-item.nbm-highlight .nbm-detalle-item-value {
    font-size: 28px;
    font-weight: 700;
    color: #2e7d32;
}

.nbm-chart-pie {
    grid-column: 1 / -1;
}
.nbm-chart-pie canvas {
    max-height: 380px !important;
}

.nbm-tool-card { 
    text-decoration: none;
    color: inherit;
    display: block;
}
.nbm-badge-active {
    background: #2e7d32 !important;
    color: #fff !important;
}