:root {
    --fondo: #f4f5f7;
    --panel: #ffffff;
    --texto: #1c2430;
    --tenue: #5d6878;
    --borde: #dde1e7;
    --acento: #1f5fbf;
    --acento-txt: #ffffff;
    --error-fondo: #fdecec;
    --error-txt: #a52222;
    --ok: #1d7a46;
    --ok-fondo: #e3f4ea;
    --aviso: #8a5a00;
    --aviso-fondo: #fff3d6;
    --gris-fondo: #eceef1;
    --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
    :root {
        --fondo: #12161c;
        --panel: #1b2129;
        --texto: #e6e9ee;
        --tenue: #9aa4b2;
        --borde: #2c343f;
        --acento: #5b9bf0;
        --acento-txt: #0d1420;
        --error-fondo: #3a1d1f;
        --error-txt: #ff9c9c;
        --ok: #6fd39b;
        --ok-fondo: #173326;
        --aviso: #f3c467;
        --aviso-fondo: #3a2e14;
        --gris-fondo: #262d37;
        --sombra: none;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--fondo);
    color: var(--texto);
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }

.marca { display: flex; align-items: center; gap: 12px; }
.logo {
    display: grid; place-items: center;
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--acento); color: var(--acento-txt);
    font-weight: 700; font-size: 18px;
}

/* Login */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
    width: 100%; max-width: 360px;
    background: var(--panel); border: 1px solid var(--borde); border-radius: 12px;
    padding: 28px; box-shadow: var(--sombra);
}
.login-card .marca { margin-bottom: 24px; }
.login-card h1 { font-size: 20px; }
.login-card .marca p { margin: 0; color: var(--tenue); font-size: 13px; }
.login-card form { display: grid; gap: 6px; }
.login-card label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.login-card input {
    font: inherit; color: inherit; background: var(--fondo);
    border: 1px solid var(--borde); border-radius: 8px; padding: 10px 12px;
}
.login-card input:focus { outline: 2px solid var(--acento); outline-offset: 1px; border-color: transparent; }
button {
    font: inherit; font-weight: 600; cursor: pointer;
    background: var(--acento); color: var(--acento-txt);
    border: 0; border-radius: 8px; padding: 10px 16px;
}
.login-card button { margin-top: 18px; }
button.secundario { background: transparent; color: var(--texto); border: 1px solid var(--borde); padding: 6px 12px; }
.alerta {
    background: var(--error-fondo); color: var(--error-txt);
    border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px;
}

/* Portal */
.barra {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--borde);
}
.sesion { display: flex; align-items: center; gap: 12px; color: var(--tenue); }
.sesion form { margin: 0; }
.contenido { max-width: 1100px; margin: 0 auto; padding: 28px 24px 48px; }
.contenido > h1 { font-size: 24px; }
.sub { color: var(--tenue); margin: 4px 0 24px; }
.vacio { color: var(--tenue); }
section { margin-bottom: 32px; }
section h2 {
    font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--tenue); margin-bottom: 12px;
}
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tarjeta {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--panel); border: 1px solid var(--borde); border-radius: 10px;
    padding: 16px; color: inherit; text-decoration: none; box-shadow: var(--sombra);
    transition: border-color .15s;
}
.tarjeta:hover, .tarjeta:focus-within { border-color: var(--acento); }
.tarjeta-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tarjeta h3 { font-size: 16px; }
.tarjeta h3 a { color: inherit; text-decoration: none; }
.tarjeta h3 a:hover { color: var(--acento); }
.tarjeta p { margin: 0; color: var(--tenue); font-size: 14px; }
.tarjeta > p:first-of-type { flex: 1; }
.acceso { font-size: 13px !important; color: var(--texto) !important; }
.acceso span, .enlaces small {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue);
}
.acceso span { margin-right: 4px; }
.enlaces { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--borde); display: grid; gap: 8px; }
.enlaces li { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: baseline; font-size: 14px; }
.enlaces a { color: var(--acento); font-weight: 600; text-decoration: none; }
.enlaces a:hover { text-decoration: underline; }
.enlaces small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.enlaces code { grid-column: 1 / -1; font-size: 12px; color: var(--tenue); word-break: break-all; }
.url { font-size: 12px; color: var(--acento); word-break: break-all; text-decoration: none; }
.url:hover { text-decoration: underline; }
.estado { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.estado-activo    { background: var(--ok-fondo);    color: var(--ok); }
.estado-pruebas   { background: var(--aviso-fondo); color: var(--aviso); }
.estado-pendiente { background: var(--gris-fondo);  color: var(--tenue); }

@media (max-width: 600px) {
    .barra { padding: 12px 16px; }
    .contenido { padding: 20px 16px 40px; }
    .sesion > span { display: none; }
}
