/* Personal themes: deliberately separate from the global developer palette. */
body.theme-light,body.theme-blue{color-scheme:light;--bg:#f3f6fa;--ink:#25334b;--muted:#607089;--line:#dce3ed;--red:#336dcc;--navy:#20395e;--surface:#fff;--field:#fff;--soft:#edf2fa;background:var(--bg);color:var(--ink)}
body.theme-dark{color-scheme:dark;--bg:#24212c;--ink:#f3edf8;--muted:#c0b4cc;--line:#50465d;--red:#c5a4ed;--navy:#ded0ef;--surface:#312b3c;--field:#282332;--soft:#40364d;background:var(--bg);color:var(--ink)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(.sidebar,.topbar,.panel,.metric,dialog,.portal-shortcuts a){background:var(--surface);color:var(--ink);border-color:var(--line)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(h1,h2,h3,.metric>strong,.topbar strong,.empty h3){color:var(--ink)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(.workspace,.date-chip,.schedule,.avatar,.dialog-head button){background:var(--soft);color:var(--ink);border-color:var(--line)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(input,select,textarea){background:var(--field);color:var(--ink);border-color:var(--line)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(label,.muted,.metric-head,.metric>small,.announcement p,.workspace small,.schedule p,td small,.page-footer){color:var(--muted)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(nav a,.sidebar-bottom>a,.logout button){color:var(--ink)}
body:is(.theme-light,.theme-blue,.theme-dark) nav a:hover{background:var(--soft);color:var(--ink)}
body:is(.theme-light,.theme-blue,.theme-dark) nav a.selected{background:var(--soft);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line)}
body:is(.theme-light,.theme-blue,.theme-dark) th{background:var(--soft);color:var(--ink)}
body:is(.theme-light,.theme-blue,.theme-dark) :is(td,.group-row){border-color:var(--line)}
body:is(.theme-light,.theme-blue,.theme-dark) .btn{background:#4165a5;color:#fff;border-color:#4165a5}
body:is(.theme-light,.theme-blue,.theme-dark) .btn.secondary{background:var(--soft);color:var(--ink);border-color:var(--line)}
body.theme-dark .btn{background:#ab83d0;color:#20162b;border-color:#ab83d0}
body.theme-dark .btn.danger{background:#593347;color:#ffdae7;border-color:#966179}
body.theme-dark .welcome{background:linear-gradient(115deg,#514064,#3b324b);border:1px solid #685479}
body.theme-dark .welcome h2{color:#fff}body.theme-dark .welcome p{color:#e4d8ee}
body.theme-dark .welcome .eyebrow{color:#e3c5ff}
body.theme-dark .chart-grid{stroke:#65556f}body.theme-dark .chart-label{fill:#d4c5e1}body.theme-dark .chart-value{fill:#f3edf8}
body.theme-dark .chart-bar{fill:#c2a0e4}body.theme-dark .brand{background:#fff;border-radius:12px;padding:8px;margin-bottom:20px}
body.theme-dark .badge.green{background:#28483e;color:#b8f0d8}body.theme-dark .badge.orange{background:#59452c;color:#ffe0a7}
body.theme-dark .alert.error{background:#563444;color:#ffdae4;border-color:#956177}body.theme-dark .alert.success{background:#29483f;color:#c4f0d8;border-color:#598470}
body.theme-blue .sidebar{background:#204f8c;border-color:#204f8c;color:#fff}
body.theme-blue .sidebar :is(nav a,.sidebar-bottom>a,.logout button,.nav-label,.workspace strong){color:#fff}
body.theme-blue .sidebar :is(.workspace,.avatar){background:#30609b;color:#fff}
body.theme-blue .sidebar :is(.workspace small,.sidebar-bottom>small){color:#d9e8fc}
body.theme-blue .sidebar nav a:hover,body.theme-blue .sidebar nav a.selected{background:#376bad;color:#fff;box-shadow:none}
body.theme-blue .brand{background:#fff;border-radius:12px;padding:8px;margin-bottom:20px}
.concept-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.concept-card{padding:16px;border:1px solid var(--line);border-radius:12px;display:grid;gap:8px}
.concept-card input[type=color]{min-height:42px;width:100%;padding:4px;cursor:pointer}
@media(max-width:900px){.concept-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.concept-grid{grid-template-columns:1fr}.group-row>div{overflow-wrap:anywhere;max-width:100%}}

/* Corrección 2: mayor especificidad que las reglas generales y los estilos por rol. */
body:is(.theme-light,.theme-blue,.theme-dark) .welcome h2,
body:is(.theme-light,.theme-blue,.theme-dark) .welcome p,
body:is(.theme-light,.theme-blue,.theme-dark) .welcome .eyebrow{color:#fff}
body.theme-blue .sidebar.sidebar{background:#204f8c;color:#fff;border-color:#204f8c}
body.theme-blue .sidebar.sidebar :is(nav a,.sidebar-bottom>a,.logout button,.nav-label,.workspace strong){color:#fff}
body.theme-blue .sidebar.sidebar :is(.workspace,.avatar){background:#30609b;color:#fff}
body.theme-blue .sidebar.sidebar :is(.workspace small,.sidebar-bottom>small){color:#e0edff}
body.theme-blue .sidebar.sidebar nav a:hover,
body.theme-blue .sidebar.sidebar nav a.selected{background:#376bad;color:#fff;box-shadow:none}

/* Concept colors only affect assigned navigation links, regardless of theme. */
body #sidebar nav a[data-concept] {
 background:var(--concept-bg);
 color:var(--concept-text);
 border-left:0;
 box-shadow:none;
 transition:background-color .18s ease,box-shadow .18s ease;
}
body #sidebar nav a[data-concept] :is(span,.icon){color:inherit}
body #sidebar nav a[data-concept].selected {
 background:var(--concept-bg);
 color:var(--concept-text);
 box-shadow:inset 0 0 0 2px currentColor;
 font-weight:700;
 text-decoration:underline;
 text-underline-offset:4px;
}
body #sidebar nav a[data-concept]:hover,
body #sidebar nav a[data-concept]:focus-visible {
 background:var(--concept-hover);
 color:var(--concept-hover-text);
 box-shadow:inset 0 0 0 2px currentColor;
}
body #sidebar nav a[data-concept]:focus-visible{outline:2px solid var(--concept-text);outline-offset:-5px}
@media(prefers-reduced-motion:reduce){body #sidebar nav a[data-concept]{transition:none}}

/* El texto y el icono toman el contraste del enlace */
body #sidebar nav a[data-concept] span,
body #sidebar nav a[data-concept] .icon {
    color: inherit !important;
}

/* Hover visible sin cambiar el color elegido */
body #sidebar nav a[data-concept]:hover {
    box-shadow: inset 0 0 0 3px currentColor !important;
    text-decoration: underline;
    text-underline-offset: 4px;
}