/* Kairos Policy · sign in (templates/login.html).

   Two columns: the form on the paper, and the page's one grey band holding the
   home map's "who governs" layer with two facts of the day. The band is filled
   by login-page.js from /api/login/snapshot, a public, CDN-cached payload, so
   the page itself never waits on the database.

   Light only — the theme script is not loaded here, so the :root tokens (the
   light palette) apply. Below 1000px the band folds under the form. */

html, body { margin: 0; }
body { background: var(--bg-primary); color: var(--text-primary); }

.login {
    display: grid;
    grid-template-columns: minmax(400px, 36%) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
}
.login > * { min-height: 0; overflow: auto; box-sizing: border-box; }

/* ---- The form side ------------------------------------------------------- */

.login-side { display: flex; flex-direction: column; padding: 40px 56px 32px; }
.login-brand { display: inline-flex; align-self: flex-start; text-decoration: none; }
.login-brand .brand-logo { height: 28px; }
.login-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 380px;
    padding: 40px 0;
}
.login-title { margin: 0 0 10px; font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; }
.login-lede { margin: 0 0 32px; font-size: var(--text-md); line-height: 1.55; color: var(--text-secondary); }
.login-form { padding-top: 24px; border-top: 1px solid var(--border-color); }
.login-form-title { margin: 0 0 16px; font-size: var(--text-md); font-weight: 700; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-input::placeholder { color: var(--text-tertiary); }
.login-btn { width: 100%; height: 44px; margin-top: 6px; font-size: var(--text-md); }
.error-message {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--accent-red-soft);
    color: var(--accent-red);
    font-size: var(--text-base);
    font-weight: 600;
}
.login-access { margin: 20px 0 0; font-size: var(--text-sm); line-height: 1.5; color: var(--text-tertiary); }
.login-access a { color: var(--accent); font-weight: 600; text-decoration: none; }
.login-access a:hover { text-decoration: underline; }

.login-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.login-foot p { margin: 0; font-size: var(--text-xs); line-height: 1.5; color: var(--text-tertiary); }
.login-foot em { font-style: normal; font-weight: 600; color: var(--text-secondary); }

/* ---- The band: who governs Europe ---------------------------------------- */

.login-panel {
    display: grid;
    /* title · lede · map (takes what is left) · legend · facts */
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    padding: 40px 48px 28px;
    background: var(--bg-tertiary);
}
.login-panel h2 { margin: 0 0 6px; font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; }
.login-panel-lede { margin: 0; min-height: 1.5em; font-size: var(--text-base); line-height: 1.5; color: var(--text-secondary); }
.login-panel-lede b { color: var(--text-primary); }

.login-map { position: relative; min-height: 0; margin: 8px 0; }
.login-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-map .ctx { fill: var(--bg-hover); stroke: var(--bg-tertiary); }
.login-map .cty { stroke: var(--bg-tertiary); }

/* The families, in the home map's colours (home-page.js FAM). */
.fam-ppe    { fill: var(--color-center-right); background: var(--color-center-right); }
.fam-sd     { fill: var(--color-center-left);  background: var(--color-center-left); }
.fam-renew  { fill: var(--color-liberal);      background: var(--color-liberal); }
.fam-dcha   { fill: var(--color-far-right);    background: var(--color-far-right); }
.fam-izq    { fill: var(--color-far-left);     background: var(--color-far-left); }
.fam-verdes { fill: var(--color-green);        background: var(--color-green); }
.fam-otros  { fill: var(--bias-center);        background: var(--bias-center); }

.login-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.login-legend li { display: inline-flex; align-items: center; gap: 7px; }
.login-legend i { width: 10px; height: 10px; border-radius: 2px; }
.login-legend b { font-weight: 600; color: var(--text-primary); }

.login-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px 32px;
    margin: 0;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.login-facts:empty { display: none; }
.login-facts dt { margin-bottom: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary); }
.login-facts dd {
    margin: 0;
    font-size: var(--text-base);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.login-facts .headline { font-size: var(--text-md); }
.login-facts .code { margin-right: 4px; vertical-align: 1px; }
.login-facts .flag { margin-right: 4px; }
.login-facts .when { color: var(--text-tertiary); font-size: var(--text-sm); }

/* ---- Below 1000px: one column, the band under the form -------------------- */

@media (max-width: 999px) {
    .login { grid-template-columns: minmax(0, 1fr); height: auto; }
    .login > * { overflow: visible; }
    .login-side { padding: 28px 20px; }
    .login-body { max-width: 440px; }
    .login-panel { grid-template-rows: none; padding: 32px 20px 28px; }
    .login-map { height: min(92vw, 480px); }
}
