.k-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 24px;
    animation: kmodal-fade 160ms ease-out;
}
.k-modal__scrim {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    border: 0;
    padding: 0;
    cursor: pointer;
}
.k-modal__card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: var(--shadow-16);
    width: min(560px, 100%);
    max-height: min(85vh, 800px);
    overflow: auto;
    padding: 32px;
    animation: kmodal-rise 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.k-modal__card--wide { width: min(760px, 100%); }
.k-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    font: inherit;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.k-modal__close:hover, .k-modal__close:focus-visible {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line-strong);
    outline: none;
}
.k-modal__head { margin-bottom: 22px; padding-right: 44px; }
.k-modal__head--center { text-align: center; padding-right: 0; }
.k-modal__icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}
.k-modal__icon--success { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.k-modal__icon--warn    { background: rgba(249, 115, 22, 0.18); color: #fb923c; }
.k-modal__title { font-size: 1.35rem; font-weight: 700; color: var(--text); margin: 0 0 6px; line-height: 1.2; }
.k-modal__title--lg { font-size: 1.6rem; }
.k-modal__subtitle { color: var(--muted); font-size: 0.95rem; margin: 0; }

.k-modal__info {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.k-modal__info--warn {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.32);
}
.k-modal__info--warn p { margin: 0; color: var(--text); font-size: 0.92rem; line-height: 1.5; }
.k-modal__info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    color: var(--text);
}
.k-modal__info-row + .k-modal__info-row { margin-top: 10px; }
.k-modal__info-row > svg { color: var(--soft); flex-shrink: 0; }
.k-modal__info-row .muted { color: var(--muted); font-weight: 400; }
.k-modal__body-text {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 16px;
}
.k-modal__divider { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.k-modal__list-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.98rem;
    margin: 0 0 8px;
}
.k-modal__list {
    margin: 0 0 18px;
    padding-left: 20px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.7;
}
.k-modal__list li { margin: 0; }
body:has(.k-modal) { overflow: hidden; }
@keyframes kmodal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes kmodal-rise {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
@media (prefers-reduced-motion: reduce) {
    .k-modal, .k-modal__card { animation: none; }
}

.k-form { display: grid; gap: 16px; }
/* The grid display above otherwise overrides the [hidden] attribute, so the
   multi-step login would show every step at once. Keep hidden steps hidden. */
.k-form[hidden] { display: none; }
.k-form .k-field { display: grid; gap: 6px; }
.k-form label {
    font-size: 0.9rem; font-weight: 500; color: var(--text);
}
.k-form input, .k-form textarea, .k-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.k-form input:focus, .k-form textarea:focus, .k-form select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
}
.k-form textarea { min-height: 110px; resize: vertical; }
.k-error { color: #ff8a80; font-size: 0.9rem; }
/* Status line for the passkey flows. Neutral by default (progress messages like
   "Follow your device's prompt…" must not look like errors); red only on failure. */
.auth-status { color: var(--muted); font-size: 0.9rem; }
.auth-status.is-error { color: #ff8a80; }
.k-success {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-8);
}
.auth-card__icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    display: grid; place-items: center;
    margin: 0 auto 16px;
}
.auth-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 24px; }

.admin-shell { padding: 32px max(24px, calc((100vw - 1180px) / 2)); }
.admin-shell__head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.admin-shell__head h1 { font-size: 2rem; margin: 0; color: var(--text); }
.admin-tabs {
    display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.admin-tabs button {
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.admin-tabs button:hover,
.admin-tabs button:focus-visible {
    background: var(--panel);
    color: var(--text);
    outline: none;
}
.admin-tabs button.is-active {
    border-color: var(--cyan);
    background: rgba(128, 203, 196, 0.14);
    color: var(--text);
}

