/* ── Panel principal ──────────────────────────────────────── */
.lexia-panel {
    max-width:   900px;
    margin:      0 auto;
    font-family: var(--lexia-font, system-ui, sans-serif);
}

/* ── Header ───────────────────────────────────────────────── */
.lexia-panel__header {
    display:       flex;
    align-items:   center;
    gap:           1.5rem;
    padding:       1.5rem;
    background:    var(--lexia-primary, #1a237e);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    color:         #fff;
}

.lexia-panel__avatar img { border-radius: 50%; }
.lexia-panel__avatar-guest {
    width:           60px;
    height:          60px;
    background:      rgba(255,255,255,.2);
    border-radius:   50%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       2rem;
}

.lexia-panel__user h2 {
    color:  #fff;
    margin: 0 0 .5rem;
}
.lexia-panel__guest-msg {
    color:     rgba(255,255,255,.8);
    font-size: .9rem;
    margin:    .5rem 0 0;
}
.lexia-panel__last {
    color:     var(--lexia-text-muted, #546e7a);
    font-size: .85rem;
    text-align: right;
    margin-top: 1rem;
}

/* ── Badge nivel ──────────────────────────────────────────── */
.lexia-nivel-badge {
    display:       inline-flex;
    align-items:   center;
    padding:       .3rem .8rem;
    border-radius: 50px;
    font-size:     .85rem;
    font-weight:   700;
}
.lexia-nivel-badge--principiante { background: rgba(255,255,255,.15); color: #fff; }
.lexia-nivel-badge--intermedio   { background: #e3f2fd; color: #1565c0; }
.lexia-nivel-badge--avanzado     { background: #e8f5e9; color: #2e7d32; }
.lexia-nivel-badge--experto      { background: #fff8e1; color: #f57f17; }

/* ── Tabs ─────────────────────────────────────────────────── */
.lexia-panel__tabs {
    display:         flex;
    gap:             4px;
    border-bottom:   2px solid var(--lexia-primary, #1a237e);
    margin-bottom:   1.5rem;
    overflow-x:      auto;
    scrollbar-width: none;
}
.lexia-panel__tab {
    padding:       .6rem 1.2rem;
    border:        none;
    background:    #f0f0f0;
    border-radius: 8px 8px 0 0;
    cursor:        pointer;
    font-size:     .9rem;
    white-space:   nowrap;
    transition:    all .15s;
}
.lexia-panel__tab:hover  { background: #e0e0e0; }
.lexia-panel__tab.active {
    background: var(--lexia-primary, #1a237e);
    color:      #fff;
}

/* ── Panes ────────────────────────────────────────────────── */
.lexia-panel__pane        { display: none; }
.lexia-panel__pane.active { display: block; }
.lexia-panel__loading     { padding: 2rem; text-align: center; color: #888; }
.lexia-panel__empty       { padding: 2rem; text-align: center; color: #888; font-size: 1rem; }

/* ── Stats ────────────────────────────────────────────────── */
.lexia-panel-stats {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap:                   1rem;
    margin-bottom:         2rem;
}
.lexia-pstat {
    text-align:    center;
    padding:       1.25rem 1rem;
    background:    #fff;
    border-radius: 10px;
    box-shadow:    0 2px 10px rgba(0,0,0,.07);
}
.lexia-pstat__num {
    font-size:   2rem;
    font-weight: 800;
    color:       var(--lexia-primary, #1a237e);
    line-height: 1.1;
}
.lexia-pstat__lbl { font-size: .8rem; color: #777; margin-top: .3rem; }
.lexia-pstat--ok  .lexia-pstat__num { color: #2e7d32; }
.lexia-pstat--err .lexia-pstat__num { color: #c62828; }
.lexia-pstat--warn .lexia-pstat__num { color: #e65100; }

/* ── Nivel ELO ────────────────────────────────────────────── */
.lexia-panel-nivel-wrap {
    background:    #fff;
    border-radius: 10px;
    padding:       1.5rem;
    box-shadow:    0 2px 10px rgba(0,0,0,.07);
}
.lexia-panel-nivel__header {
    display:         flex;
    align-items:     center;
    gap:             .75rem;
    flex-wrap:       wrap;
    margin-bottom:   .75rem;
    font-size:       .95rem;
}
.lexia-panel-nivel__labels {
    display:         flex;
    justify-content: space-between;
    font-size:       .75rem;
    color:           #999;
    margin-top:      .4rem;
}
.lexia-progress {
    height:        10px;
    background:    #e0e0e0;
    border-radius: 50px;
    overflow:      hidden;
}
.lexia-progress__bar {
    height:        100%;
    background:    linear-gradient(90deg, var(--lexia-primary, #1a237e), #42a5f5);
    border-radius: 50px;
    transition:    width .5s ease;
}

/* ── Tabla historial ──────────────────────────────────────── */
.lexia-panel-tabla { overflow-x: auto; }
.lexia-tabla {
    width:           100%;
    border-collapse: collapse;
    font-size:       .9rem;
}
.lexia-tabla th {
    background:  var(--lexia-primary, #1a237e);
    color:       #fff;
    padding:     .6rem .75rem;
    text-align:  left;
    font-weight: 600;
}
.lexia-tabla td {
    padding:     .6rem .75rem;
    border-bottom: 1px solid #eee;
}
.lexia-tabla tr:hover td { background: #f9f9f9; }
.lexia-ok  { color: #2e7d32; font-weight: 700; }
.lexia-err { color: #c62828; font-weight: 700; }

/* ── Toolbar ──────────────────────────────────────────────── */
.lexia-panel-toolbar {
    display:       flex;
    gap:           1rem;
    align-items:   center;
    flex-wrap:     wrap;
    margin-bottom: 1rem;
}
.lexia-panel-search {
    flex:          1;
    min-width:     200px;
    padding:       .5rem 1rem;
    border:        1px solid #ddd;
    border-radius: 6px;
    font-size:     .9rem;
}

/* ── Lista items (falladas/evitadas) ──────────────────────── */
.lexia-panel-lista { display: flex; flex-direction: column; gap: .6rem; }
.lexia-panel-item {
    display:       flex;
    align-items:   center;
    gap:           1rem;
    padding:       .75rem 1rem;
    background:    #fff;
    border-radius: 8px;
    box-shadow:    0 1px 6px rgba(0,0,0,.06);
}
.lexia-panel-item__info { flex: 1; min-width: 0; }
.lexia-panel-item__badge {
    display:       inline-block;
    background:    #e3f2fd;
    color:         #1565c0;
    font-size:     .75rem;
    font-weight:   700;
    padding:       .15rem .6rem;
    border-radius: 50px;
    margin-bottom: .3rem;
}
.lexia-panel-item__id {
    font-size:    .75rem;
    color:        #aaa;
    margin-left:  .5rem;
}
.lexia-panel-item__veces {
    font-size:    .75rem;
    color:        #e65100;
    font-weight:  700;
    margin-left:  .5rem;
}
.lexia-panel-item__texto {
    font-size: .9rem;
    color:     var(--lexia-text, #1a1a2e);
    margin:    .2rem 0 0;
}

/* ── Progreso por temas ───────────────────────────────────── */
.lexia-prog-area { margin-bottom: 2rem; }
.lexia-prog-area__title {
    font-size:     1.1rem;
    color:         var(--lexia-primary, #1a237e);
    border-left:   4px solid;
    padding-left:  .75rem;
    margin-bottom: 1rem;
}
.lexia-prog-tema { margin-bottom: 1rem; }
.lexia-prog-tema__header {
    display:         flex;
    align-items:     center;
    gap:             .5rem;
    flex-wrap:       wrap;
    margin-bottom:   .4rem;
    font-size:       .9rem;
}
.lexia-prog-tema__header span:first-child {
    flex:      1;
    min-width: 0;
    color:     var(--lexia-text, #1a1a2e);
}

/* ── Guest ────────────────────────────────────────────────── */
.lexia-panel__guest {
    display:         flex;
    justify-content: center;
    padding:         3rem 1rem;
}
.lexia-panel__guest-card {
    text-align:    center;
    max-width:     500px;
    padding:       3rem 2rem;
    background:    #fff;
    border-radius: 16px;
    box-shadow:    0 4px 24px rgba(0,0,0,.08);
}
.lexia-panel__guest-card h3 {
    color:       var(--lexia-primary, #1a237e);
    margin:      0 0 1rem;
    font-size:   1.4rem;
}
.lexia-panel__guest-card p {
    color:       var(--lexia-text-muted, #546e7a);
    margin:      0 0 1rem;
    line-height: 1.6;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .lexia-panel__header  { flex-direction: column; text-align: center; }
    .lexia-panel-stats    { grid-template-columns: repeat(2, 1fr); }
    .lexia-panel__tab     { padding: .5rem .75rem; font-size: .8rem; }
}