/* Shared intrinsic sizing. The image ratio decides its width at the row height. */
:root {
    --system-captcha-surface: #f8faff;
    --system-captcha-line: #d7e3f5;
    --system-captcha-primary: #2563eb;
    --system-captcha-muted: #667085;
    --system-captcha-focus: rgba(37, 99, 235, .3);
}

.system-captcha-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--system-captcha-gap, 12px);
}

.system-captcha-row > :first-child {
    flex: 1 1 140px;
    min-width: 0;
}

.system-captcha-row > button.system-captcha-image {
    flex: 0 1 auto;
    max-width: 100%;
}

button.system-captcha-image {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: var(--system-captcha-height, 44px);
    min-width: 44px;
    min-height: var(--system-captcha-height, 44px);
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--system-captcha-line);
    border-radius: 6px;
    background: var(--system-captcha-surface);
    color: var(--system-captcha-muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color .16s ease, box-shadow .16s ease;
}

button.system-captcha-image:hover:not(:disabled) {
    border-color: var(--system-captcha-primary);
}

button.system-captcha-image:focus-visible {
    outline: 3px solid var(--system-captcha-focus);
    outline-offset: 2px;
}

button.system-captcha-image:disabled {
    opacity: .65;
    cursor: wait;
}

button.system-captcha-image > img {
    display: block;
    width: auto;
    max-width: 100%;
    height: calc(var(--system-captcha-height, 44px) - 2px);
    object-fit: contain;
}

button.system-captcha-image > [hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    button.system-captcha-image {
        transition: none;
    }
}

/* One provider widget layout shared by login, mail dialogs and domain search. */
.captcha-plugin-host {
    width: 100%;
    min-width: 0;
    text-align: left;
}

.captcha-plugin-host[hidden], .system-captcha-row[hidden] { display: none !important; }

.captcha-plugin-widget {
    width: 100%;
    min-height: 50px;
}

.captcha-plugin-footer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 8px;
    line-height: 1.5;
}

.captcha-plugin-status {
    flex: 1 1 160px;
    font-size: 13px;
    color: var(--system-captcha-muted);
    overflow-wrap: anywhere;
}

.captcha-plugin-host[data-captcha-state="error"] .captcha-plugin-status {
    color: #b42318;
}

.captcha-plugin-host[data-captcha-state="success"] .captcha-plugin-status {
    color: #067647;
}

.captcha-plugin-retry {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 2px 4px;
    border: 0;
    background: transparent;
    color: var(--system-captcha-primary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.captcha-plugin-retry:disabled { opacity: .55; cursor: wait; }
.captcha-plugin-retry:focus-visible { outline: 3px solid var(--system-captcha-focus); outline-offset: 2px; }
