/* Shared text-entry labels for H5 and the management console. */
.floating-field {
    --floating-surface: #fff;
    --floating-muted: #526071;
    --floating-focus: #365984;
    --floating-error: #b52e44;
    position: relative;
    min-inline-size: 0;
}

.energy-auth .floating-field,
.energy-h5 .floating-field {
    --floating-surface: #142329;
    --floating-muted: #b0c2c7;
    --floating-focus: #a2dbbd;
    --floating-error: #f2b3b7;
}

[data-floating-theme=dark]:not(.energy-h5) .floating-field {
    --floating-surface: #202438;
    --floating-muted: #c6d0e0;
    --floating-focus: #c4e6f9;
    --floating-error: #ffbfc8;
}

.energy-auth .floating-field { --floating-surface: var(--auth-bg, #0d191f); }
.login-container .floating-field {
    --floating-surface: #3b3a58;
    --floating-muted: #e1e0ec;
    --floating-focus: #d5e6ff;
    --floating-error: #ffc4cc;
}

.floating-field > label.floating-label {
    position: absolute;
    z-index: 4;
    margin: 0 !important;
    padding-inline: 3px;
    inset-inline-start: calc(var(--floating-inline-offset, 0px) + .65rem);
    top: calc(var(--floating-edge, 0px) + var(--floating-center, 1.45rem));
    transform: translateY(-50%);
    max-inline-size: calc(var(--floating-width, 100%) - 1.35rem);
    color: var(--floating-muted);
    background: transparent;
    font-size: .82rem;
    font-weight: 500;
    line-height: 1.25;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: top .15s ease, font-size .15s ease, color .15s ease;
}

.floating-field--group > label.floating-label {
    max-inline-size: calc(var(--floating-width, 100%) - 2.6rem);
}

.floating-field[data-floating-active] > label.floating-label,
.floating-field[data-floating-filled] > label.floating-label,
.floating-field[data-floating-raised] > label.floating-label {
    top: var(--floating-edge, 0px);
    color: var(--floating-focus);
    background: var(--floating-surface);
    font-size: .72rem;
}

/* Keep native focus as a fallback without gating the shared state selectors. */
.floating-field:focus-within > label.floating-label {
    top: var(--floating-edge, 0px);
    color: var(--floating-focus);
    background: var(--floating-surface);
    font-size: .72rem;
}

.floating-field[data-floating-invalid] > label.floating-label {
    color: var(--floating-error);
}

.floating-field [data-floating-control]::placeholder { color: transparent !important; }

/* Password managers can fill credentials without dispatching an input event. */
@keyframes floating-autofill { from { opacity: 1; } to { opacity: 1; } }
.floating-field [data-floating-control]:-webkit-autofill {
    animation: floating-autofill .01s;
}

.energy-auth .floating-field input { min-height: 54px; }
.energy-auth .floating-field .energy-auth-password > button,
.energy-auth .energy-auth-password.floating-field > button { top: 6px; }

.energy-settings-form > .floating-field,
.energy-funds-form #energy-channel-fields > .floating-field { margin-block: 15px; }
.energy-h5 #energy-chat-form > .floating-field { flex: 1; }

@media (prefers-reduced-motion: reduce) {
    .floating-field > label.floating-label { transition: none; }
}

