/* ── Kaizen Focus Web — global styles ──
   MudBlazor carries the component look; this file holds the login pages
   (static SSR, no Mud), shared utility classes, and framework error UI. */

:root {
    --kfw-accent: #4F46E5;
    --kfw-accent-dark: #4338CA;
    --kfw-ink: #0F172A;
    --kfw-muted: #64748B;
    --kfw-border: #E2E8F0;
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

h1:focus { outline: none; }

.kfw-mono { font-family: Consolas, "Cascadia Mono", monospace; letter-spacing: .06em; }
.kfw-nums { font-variant-numeric: tabular-nums; }

/* ── App chrome ── */
.kfw-appbar { border-bottom: 1px solid var(--mud-palette-lines-default); }
.kfw-drawer { border-right: 1px solid var(--mud-palette-lines-default); }
.kfw-logout-form { display: inline-flex; margin: 0; }

.kfw-nav-group {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    padding: 18px 16px 6px;
}

.kfw-card { border: 1px solid var(--mud-palette-lines-default); border-radius: 12px; }

/* ── Login (static pages) ── */
.kfw-login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #EEF2FF 0%, #F8FAFC 45%, #EEF2FF 100%);
}

@media (prefers-color-scheme: dark) {
    .kfw-login-bg { background: linear-gradient(160deg, #0B1220 0%, #111A2E 60%, #16204a 100%); }
    .kfw-login-card { background: #111A2E !important; border-color: #24304A !important; }
    .kfw-login-title { color: #E2E8F0 !important; }
    .kfw-label, .kfw-sent { color: #CBD5E1 !important; }
    .kfw-input { background: #0B1220 !important; color: #E2E8F0 !important; border-color: #24304A !important; }
    .kfw-hint, .kfw-footnote, .kfw-login-sub, .kfw-login-foot { color: #7C8AA5 !important; }
}

.kfw-login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--kfw-border);
    border-radius: 16px;
    padding: 34px 34px 22px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, .08);
}

.kfw-login-brand { text-align: center; margin-bottom: 22px; }
.kfw-login-logo { font-size: 40px; line-height: 1; }
.kfw-login-title { font-size: 22px; font-weight: 800; color: var(--kfw-ink); margin-top: 8px; }
.kfw-login-sub { font-size: 13px; color: var(--kfw-muted); margin-top: 2px; }

.kfw-login-form { display: flex; flex-direction: column; }

.kfw-label { font-size: 13px; font-weight: 600; color: #334155; margin: 10px 0 6px; }

.kfw-input {
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 16px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    text-transform: uppercase;
}

.kfw-input:focus { border-color: var(--kfw-accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }

.kfw-otp {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 12px;
    font-family: Consolas, monospace;
}

.kfw-hint { font-size: 12px; color: var(--kfw-muted); margin-top: 7px; line-height: 1.5; }

.kfw-turnstile { margin-top: 14px; }

.kfw-btn {
    margin-top: 16px;
    background: var(--kfw-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 13px;
    cursor: pointer;
    transition: background .15s;
}

.kfw-btn:hover { background: var(--kfw-accent-dark); }

.kfw-error {
    margin-top: 12px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #B91C1C;
    font-size: 13px;
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.5;
}

.kfw-sent {
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    color: #3730A3;
    font-size: 13.5px;
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.5;
}

.kfw-footnote { font-size: 12px; color: var(--kfw-muted); margin-top: 12px; text-align: center; line-height: 1.5; }

.kfw-resend-form { text-align: center; margin-top: 10px; }

.kfw-link {
    background: none;
    border: none;
    color: var(--kfw-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
}

.kfw-login-foot {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--kfw-border);
    text-align: center;
    font-size: 11.5px;
    color: var(--kfw-muted);
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.kfw-login-foot a { color: var(--kfw-muted); }

/* ── Data visuals ── */
.kfw-splitbar {
    display: flex;
    width: 100%;
    border-radius: 5px;
    overflow: hidden;
    background: var(--mud-palette-lines-default);
}

.kfw-splitbar > i { display: block; height: 100%; }

.kfw-daystrip { display: flex; align-items: flex-end; gap: 3px; height: 46px; }
.kfw-daystrip .kfw-daycol { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; border-radius: 3px 3px 0 0; overflow: hidden; background: var(--mud-palette-lines-default); min-width: 6px; }
.kfw-daystrip .kfw-daycol i { display: block; width: 100%; }

.kfw-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ── Attendance table (print-friendly desktop parity) ── */
.kfw-att-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.kfw-att-table th {
    position: sticky; top: 0; z-index: 1;
    background: var(--mud-palette-background);
    color: var(--mud-palette-text-primary);
    text-align: right; padding: 9px 11px;
    font-weight: 700; font-size: 11px;
    border-bottom: 2px solid var(--mud-palette-lines-default);
    white-space: nowrap;
}

.kfw-att-table td {
    padding: 8px 11px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.kfw-att-table tbody tr:hover { background: var(--mud-palette-primary-hover); }
.kfw-att-absent { background: rgba(220, 38, 38, .07); }
.kfw-att-offday { background: rgba(245, 158, 11, .09); }
.kfw-att-avg { background: var(--mud-palette-background); font-weight: 700; }
.kfw-att-avg td { border-top: 2px solid var(--mud-palette-text-secondary); }

.kfw-personrow { cursor: pointer; transition: background .12s; border-radius: 10px; }
.kfw-personrow:hover { background: var(--mud-palette-primary-hover); }

/* ── Right side panel (person breakdown) ── */
.kfw-scrim {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1299;
}

.kfw-sidepanel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(480px, 96vw);
    background: var(--mud-palette-surface);
    border-left: 1px solid var(--mud-palette-lines-default);
    box-shadow: -12px 0 40px rgba(15, 23, 42, .18);
    z-index: 1300;
    overflow-y: auto;
    padding: 22px;
    animation: kfw-slidein .18s ease-out;
}

@keyframes kfw-slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ── Screenshot lightbox ── */
.kfw-lightbox {
    position: fixed; inset: 4vh 4vw; z-index: 1301;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: zoom-out;
}

.kfw-lightbox img {
    max-width: 100%; max-height: calc(100% - 40px);
    border-radius: 10px; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
    background: #000;
}

.kfw-lightbox-meta { color: #fff; font-size: 13px; margin-top: 10px; text-shadow: 0 1px 4px rgba(0,0,0,.8); }

/* ── Rules save bar (sticky bottom) ── */
.kfw-savebar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px -8px -8px;
    padding: 12px 20px;
    background: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .06);
    border-radius: 0 0 8px 8px;
    flex-wrap: wrap;
}

/* ── Super-admin console ── */
.kfw-super-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, #7f1d1d, #b91c1c);
    color: #fff;
    padding: 12px 22px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.kfw-super-title { font-weight: 800; font-size: 16px; letter-spacing: .01em; }
.kfw-super-signout { background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
.kfw-super-signout:hover { background: rgba(255,255,255,.28); }
.kfw-super-body { max-width: 1180px; margin: 0 auto; padding: 24px 22px; }

.kfw-super-signin { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.kfw-super-card { width: 100%; max-width: 420px; background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); border-radius: 16px; padding: 34px; box-shadow: 0 10px 40px rgba(15,23,42,.1); text-align: center; }
.kfw-super-lock { font-size: 40px; }
.kfw-super-heading { font-size: 22px; font-weight: 800; margin-top: 8px; color: var(--mud-palette-text-primary); }
.kfw-super-sub { font-size: 13px; color: var(--mud-palette-text-secondary); margin: 6px 0 18px; }

.kfw-super-switch { background: #b91c1c; color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.kfw-super-switch:hover { background: #991b1b; }

.kfw-super-pill { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 700; text-decoration: none; }
.kfw-super-pill:hover { background: #fecaca; }

/* ── Validation / framework ── */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

#blazor-error-ui {
    background: #FFFBEB;
    border-top: 1px solid #FDE68A;
    color: #92400E;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    font-size: 14px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 8px;
}

.blazor-error-boundary::after { content: "An error has occurred."; }
