/* ==============================================
   Kalku-Buddy, Bavaria Entertainment
   Tool-spezifisches CSS. Palette, Tokens und Pico-Overrides kommen aus
   dem zentralen Tinte-Theme (css/bavaria-theme.css, in base.html VOR
   dieser Datei eingebunden). Hier nur noch Kalku-eigene Komponenten;
   alle --t-* und --pico-* erbt das Markup vom Master (BENT-1366).
   ============================================== */


/* ========================================
   LOGIN-PAGE (eigene Top-Level-Klassen)
   ======================================== */

.login-body {
    background: var(--t-bg);
    color: var(--t-ink);
    font-family: var(--f-sans);
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}
.login-frame {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.login-wordmark {
    font-family: var(--f-serif);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--t-ink);
    margin-bottom: 4px;
    text-transform: none;
}
.login-card {
    background: var(--t-card);
    border: 1px solid var(--t-rule);
    border-radius: 12px;
    padding: 32px;
    margin: 0;
}
.login-headline {
    font-size: 32px;
    line-height: 1.1;
    margin: 0 0 8px;
    font-weight: 500;
    text-transform: none;
}
.login-sub {
    font-size: 14px;
    color: var(--t-ink-soft);
    line-height: 1.55;
    margin: 0 0 20px;
}
.login-error {
    background: var(--t-red-tint);
    color: var(--t-red);
    border-left: 3px solid var(--t-red);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.login-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--t-ink);
    letter-spacing: -0.005em;
    margin: 4px 0 -2px;
}
.login-form input[type="password"] {
    padding: 10px 14px;
    border: 1px solid var(--t-rule);
    border-radius: 8px;
    font-family: var(--f-sans);
    font-size: 14px;
    background: var(--t-card);
    color: var(--t-ink);
    margin-bottom: 8px;
}
.login-form input[type="password"]:focus {
    border-color: var(--t-teal-hi);
    outline: none;
}
.login-cta {
    width: 100%;
    background: var(--t-teal);
    border: 1px solid var(--t-teal);
    color: #fff;
    font-family: var(--f-sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.login-cta:hover { background: #155561; border-color: #155561; }
.login-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 11px;
    color: var(--t-muted);
}
.login-footer a {
    color: var(--t-muted);
    text-decoration: none;
}
.login-footer a:hover { color: var(--t-teal); }


/* ========================================
   STATUS-PILLS — Projekt-Status (in-Body)
   ======================================== */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--t-hairline);
    color: var(--t-ink-soft);
    border: 1px solid var(--t-rule);
}

.status-pill.status-neu             { background: var(--t-hairline); color: var(--t-muted); }
.status-pill.status-uebersicht      { background: var(--t-teal-tint); color: var(--t-teal); border-color: rgba(27,109,124,0.2); }
.status-pill.status-fragen          { background: var(--t-amber-tint); color: var(--t-amber); border-color: rgba(184,116,42,0.2); }
.status-pill.status-mengengeruest   { background: var(--t-green-tint); color: var(--t-green); border-color: rgba(46,125,50,0.2); }
.status-pill.status-abgeschlossen   { background: var(--t-teal); color: #fff; border-color: var(--t-teal); }
.status-pill.status-referenz_uebernommen { background: var(--t-green); color: #fff; border-color: var(--t-green); }

/* Referenz-Loop (BENT-915) — Kennzeichnung in Projekt- und Referenzliste */
.referenz-ausstehend { color: var(--t-amber); }
.referenz-validiert  { color: var(--t-green); }

/* Treffsicherheits-Abgleich (BENT-916) — Match-Status + Kennzahlen-Karten */
.match-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border: 1px solid var(--t-rule);
    white-space: nowrap;
}
.match-pill.match-gematcht   { background: var(--t-green-tint); color: var(--t-green); border-color: rgba(46,125,50,0.2); }
.match-pill.match-uebersehen { background: var(--t-amber-tint); color: var(--t-amber); border-color: rgba(184,116,42,0.2); }
.match-pill.match-zu_viel    { background: var(--t-teal-tint); color: var(--t-teal); border-color: rgba(27,109,124,0.2); }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.kpi-card {
    background: var(--t-card);
    border: 1px solid var(--t-rule);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-card .kpi-value {
    font-size: 1.5em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--t-ink);
}
.kpi-card .kpi-label {
    font-size: 12px;
    color: var(--t-muted);
}


/* ========================================
   FLASH — Hinweise oben
   ======================================== */

article.flash {
    position: relative;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-radius: var(--be-radius);
    margin: 0 0 1rem;
    box-shadow: none;
    border-width: 1px;
    border-style: solid;
}

article.flash-error,
article.flash-danger { background: var(--t-red-tint); color: var(--t-red); border-color: rgba(162,58,44,0.25); }
article.flash-success { background: var(--t-green-tint); color: var(--t-green); border-color: rgba(46,125,50,0.25); }
article.flash-info { background: var(--t-teal-tint); color: var(--t-teal); border-color: rgba(27,109,124,0.2); }
article.flash-warning,
article.flash-warn { background: var(--t-amber-tint); color: var(--t-amber); border-color: rgba(184,116,42,0.25); }

.flash-dismiss {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    opacity: 0.6;
}
.flash-dismiss:hover { opacity: 1; }

.status-warn {
    background: var(--t-amber-tint);
    border: 1px solid rgba(184,116,42,0.25);
    color: var(--t-amber);
    padding: 0.75rem 1rem;
    border-radius: var(--be-radius);
    margin-bottom: 1rem;
}

.status-warn ul { margin: 0.25rem 0 0 1rem; }


/* ========================================
   ÜBERSICHTS-DEFINITIONSLISTE (projekt_view)
   ======================================== */

dl.uebersicht dt {
    font-weight: 600;
    margin-top: 0.6rem;
    color: var(--t-ink);
}
dl.uebersicht dd {
    margin-left: 0;
    color: var(--t-ink-soft);
}


/* ========================================
   TABLES
   ======================================== */

main article table {
    margin-top: 0.5rem;
}

main article th {
    color: var(--t-muted);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--t-rule);
}

main article td {
    border-bottom: 1px solid var(--t-hairline);
    vertical-align: top;
}

main article tr:last-child td {
    border-bottom: none;
}

/* Mengengerüst-Tabelle (BENT-461 follow-up) — fixe Spalten + Inputs auf 100% */
.mengengeruest-table {
    table-layout: fixed;
    width: 100%;
}
.mengengeruest-table .col-position    { width: 30%; }
.mengengeruest-table .col-menge       { width: 6em; }
.mengengeruest-table .col-einheit     { width: 8em; }
.mengengeruest-table .col-begruendung { width: auto; }

.mengengeruest-table td {
    padding: 0.5rem 0.5rem;
    word-wrap: break-word;
}
.mengengeruest-table td input[type="text"] {
    width: 100%;
    margin: 0;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}
.mengengeruest-table td small {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--t-ink-soft);
}
.mengengeruest-table td small em {
    color: var(--t-muted);
}


/* ========================================
   FORMS
   ======================================== */

main article fieldset {
    border: 1px solid var(--t-rule);
    border-radius: var(--be-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: var(--t-card);
}

main article fieldset legend {
    padding: 0 0.5rem;
    font-size: 0.95rem;
    color: var(--t-ink);
}

main article fieldset textarea {
    margin-top: 0.5rem;
}

/* Frage-Karte (BENT-462) — eigene Box ohne fieldset/legend, damit der amber
   Border-Left durchgaengig ist und die Headline nicht "rausragt". */
.frage {
    border: 1px solid var(--t-rule);
    border-radius: var(--be-radius);
    background: var(--t-card);
    padding: 1rem 1.25rem 1.25rem;
    margin-bottom: 1rem;
}
.frage__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: var(--t-ink);
    line-height: 1.45;
}
.frage__kontext {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--t-muted);
}
.frage__label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--t-muted);
    margin-bottom: 0.25rem;
}
.frage textarea {
    margin-bottom: 0;
}

/* Unbeantwortete Frage — durchgaengiger amber Border-Left */
.frage--offen {
    border-left: 3px solid var(--t-amber);
    background: rgba(184, 116, 42, 0.04);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    align-items: center;
}

.form-actions button[type="submit"] {
    margin: 0;
}


/* ========================================
   LOADING-OVERLAY
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(246, 244, 238, 0.94);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}
.loading-overlay.is-active { display: flex; }

.spinner {
    width: 56px;
    height: 56px;
    border: 5px solid var(--t-hairline);
    border-top-color: var(--t-teal-hi);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 1.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-title {
    font-family: var(--f-serif);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--t-ink);
    margin-bottom: 0.5rem;
}
.loading-step {
    color: var(--t-muted);
    font-size: 0.95rem;
    text-align: center;
    max-width: 28rem;
    min-height: 2.5em;
}
.loading-step.is-done::before {
    content: "✓ ";
    color: var(--t-teal-hi);
    font-weight: bold;
}
.loading-elapsed {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--t-faint);
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Utility-Klassen (BENT-835: Inline-Styles ausgelagert)
   ======================================== */
.inline-form { display: inline; margin: 0; }
.meta-inline { color: var(--t-muted); margin-left: 0.5rem; }
.ki-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--t-muted);
    background: var(--t-hairline);
    border-radius: 0.4rem;
    vertical-align: middle;
}

/* ========================================
   Utilities (tool-lokal, ersetzen fruehere Inline-Styles, BENT-1366)
   ======================================== */
.u-prewrap { white-space: pre-wrap; }
.u-ml-sm { margin-left: 0.75rem; }
.u-m0 { margin: 0; }
.treatment-pre { white-space: pre-wrap; font-size: 0.85rem; }
