/* Dark surfaces use card brown, not page black. */

:root {
    --term-bg: #F2EDE0;
    --term-window: #FAFAF7;
    --term-border: #e0d8c4;
    --term-text: #0E0C08;
    --term-muted: #5c5850;
    --term-prompt: #B8780E;
    --term-on-prompt: #0E0C08;
    --term-accent: #A84020;
    --term-error: #A84020;
    --term-success: #3A7CA5;
    --term-warn: #B8780E;
    --term-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --term-bg: #1A1008;
        --term-window: #201810;
        --term-border: #4a3818;
        --term-text: #F2EDE0;
        --term-muted: #b8b09a;
        --term-prompt: #E8B030;
        --term-accent: #D4901A;
        --term-error: #D4901A;
        --term-success: #5B8FB9;
        --term-warn: #E8B030;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;
    color-scheme: light dark;
}

body,
.term-page {
    font-family: var(--term-mono);
    font-size: 14px;
    line-height: 1.5;
    color: var(--term-text);
    background: var(--term-bg);
}

.term-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.term-wrap {
    width: 100%;
    max-width: 32rem;
    margin-block: auto;
}

.term-window {
    background: var(--term-window);
    border: 1px solid var(--term-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.term-titlebar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--term-border);
}

.term-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--term-border);
}

.term-titletext {
    margin-left: 0.6rem;
    font-size: 0.68rem;
    color: var(--term-muted);
}

.term-body {
    padding: 1.5rem 1.4rem 1.75rem;
    font-size: 0.82rem;
    line-height: 1.9;
    color: var(--term-text);
}

.term-body p {
    margin: 0 0 0.15rem;
}

.term-prompt {
    color: var(--term-prompt);
}

.term-body p.term-out {
    color: var(--term-muted);
    padding-left: 1.4rem;
    margin-bottom: 1rem;
}

.term-body p.term-links {
    padding-left: 1.4rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.term-links a,
.term-out a,
.term-body a {
    color: var(--term-prompt);
    text-decoration: none;
}

.term-links a:hover,
.term-out a:hover,
.term-body a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.term-link-primary {
    color: var(--term-accent);
    font-weight: 700;
}

.term-cursor {
    display: inline-block;
    width: 0.5em;
    height: 1em;
    background: var(--term-prompt);
    vertical-align: text-bottom;
    margin-left: 0.4em;
    animation: term-blink 1s steps(1) infinite;
}

@keyframes term-blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.term-page-title {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--term-text);
}

.term-page-title::before {
    content: "$ ";
    color: var(--term-prompt);
}

.term-form,
.term-body form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 0.75rem 0 0;
}

.term-field,
.term-field-label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    min-width: 0;
    text-align: start;
}

.term-label,
.term-field-label label {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--term-prompt);
}

.term-label::before {
    content: "$ ";
}

.term-required {
    color: var(--term-error);
}

.term-input-wrap,
.term-input-group {
    width: 100%;
    min-width: 0;
}

.term-control,
.term-input-group,
.pf-v5-c-form-control,
.term-field > input,
.term-field > select,
.term-field > textarea,
.term-body input[type="text"],
.term-body input[type="password"],
.term-body input[type="email"],
.term-body input[type="number"],
.term-body select,
.term-body textarea {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    font-family: var(--term-mono);
    font-size: 1rem;
    color: var(--term-text);
    background: var(--term-bg);
    border: 1px solid var(--term-border);
    border-radius: 0.25rem;
    outline: none;
}

.term-field > input,
.term-field > select,
.term-field > textarea,
.term-body input[type="text"],
.term-body input[type="password"],
.term-body input[type="email"],
.term-body input[type="number"],
.term-body select,
.term-body textarea {
    display: block;
    padding: 0 0.75rem;
}

.term-control::before,
.term-control::after,
.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after {
    display: none !important;
    content: none !important;
}

.term-control input,
.pf-v5-c-form-control input,
.term-input-group input,
span.term-control > input,
span.term-control > select,
span.term-control > textarea {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 0 0.75rem;
    font-family: var(--term-mono);
    font-size: 1rem;
    color: var(--term-text);
    background: transparent;
    border: 0 !important;
    box-shadow: none !important;
    outline: none;
}

@media (min-width: 640px) {
    .term-control,
    .term-input-group,
    .pf-v5-c-form-control,
    .term-field > input,
    .term-field > select,
    .term-field > textarea,
    .term-body input[type="text"],
    .term-body input[type="password"],
    .term-body input[type="email"],
    .term-body input[type="number"] {
        min-height: 36px;
        font-size: 0.875rem;
    }

    .term-control input,
    span.term-control > input {
        min-height: 34px;
        font-size: 0.875rem;
    }
}

.term-control:focus-within,
.term-input-group:focus-within,
.pf-v5-c-form-control:focus-within,
.term-field > input:focus,
.term-body input:focus,
.term-body select:focus,
.term-body textarea:focus {
    border-color: var(--term-prompt);
    box-shadow: 0 0 0 1px var(--term-prompt);
}

.term-control.term-error,
.term-input-group:has(.term-error) {
    border-color: var(--term-error);
}

.term-control-util,
.term-error-icon,
.pf-v5-c-form-control__utilities,
.pf-v5-c-form-control__icon {
    display: none !important;
}

.term-input-group {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    padding: 0;
}

.term-input-group .term-control,
.term-input-group .pf-v5-c-form-control {
    flex: 1;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.term-input-group-item {
    display: flex;
}

.term-fill {
    flex: 1;
    min-width: 0;
}

.term-icon-btn,
.pf-v5-c-button.pf-m-control {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--term-muted);
    cursor: pointer;
}

@media (min-width: 640px) {
    .term-icon-btn,
    .pf-v5-c-button.pf-m-control {
        min-width: 36px;
        min-height: 36px;
    }
}

.term-btn,
.pf-v5-c-button.pf-m-primary,
.pf-v5-c-button.pf-m-secondary,
.term-body button[type="submit"],
.term-body input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1rem;
    font-family: var(--term-mono);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 0.25rem;
    border: 1px solid var(--term-border);
    cursor: pointer;
    text-decoration: none;
}

@media (min-width: 640px) {
    .term-btn,
    .term-body button[type="submit"],
    .term-body input[type="submit"] {
        min-height: 36px;
    }
}

.term-btn-block,
.pf-m-block {
    width: 100%;
}

.term-btn-primary,
.pf-v5-c-button.pf-m-primary,
.term-body input[type="submit"],
.term-body button[type="submit"] {
    color: var(--term-on-prompt);
    background: var(--term-prompt);
    border-color: var(--term-prompt);
}

@media (hover: hover) {
    .term-btn-primary:hover,
    .term-body button[type="submit"]:hover,
    .term-body input[type="submit"]:hover {
        filter: brightness(1.08);
    }
}

.term-btn-secondary,
.pf-v5-c-button.pf-m-secondary {
    color: var(--term-text);
    background: transparent;
    border-color: var(--term-border);
}

.term-link-btn {
    color: var(--term-prompt);
    font-size: 0.75rem;
    text-decoration: none;
}

.term-helper,
.term-helper-wrap {
    font-size: 0.75rem;
    color: var(--term-muted);
}

.term-helper-wrap,
.term-helper-row {
    text-align: right;
}

.term-helper-wrap:has(.term-error-text),
.term-error-text {
    text-align: left;
    width: 100%;
    color: var(--term-error);
    font-size: 0.75rem;
}

.term-card-footer,
#kc-info-wrapper,
#kc-registration {
    font-size: 0.75rem;
    color: var(--term-muted);
    text-align: center;
}

.term-alert {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.625rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.82rem;
    border: 1px solid var(--term-error);
    background: transparent;
    color: var(--term-error);
    overflow-wrap: anywhere;
}

.term-alert-success {
    border-color: var(--term-success);
    color: var(--term-success);
}

.term-alert-warning,
.term-alert-info {
    border-color: var(--term-warn);
    color: var(--term-warn);
}

.term-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    font-size: 0.75rem;
}

.term-check-input,
.term-body input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    accent-color: var(--term-prompt);
}

.term-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.term-idp-list,
.term-auth-list,
.term-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    margin: 0.75rem 0 0;
    list-style: none;
}

.term-otp-tile {
    border: 1px solid var(--term-border);
    border-radius: 0.25rem;
    padding: 0.75rem;
}

.term-otp-tile.is-selected {
    border-color: var(--term-prompt);
}

.term-clipboard input,
.term-readonly input {
    font-family: var(--term-mono);
}

.term-mt {
    margin-top: 0.75rem;
}

.term-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.term-locale select {
    font-family: var(--term-mono);
    font-size: 0.75rem;
    color: var(--term-text);
    background: var(--term-bg);
    border: 1px solid var(--term-border);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pf-v5-c-login__header,
.pf-v5-c-background-image,
.pf-v5-c-brand {
    display: none;
}

.pf-v5-c-login,
.pf-v5-c-login__container,
.pf-v5-c-login__main {
    max-width: none;
    background: transparent;
    box-shadow: none;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
