:root {
    color-scheme: light dark;
    --primary-color: light-dark(#22ac65, #22B469);
    --secondary-color: light-dark(#4B5563, #A1A1AA);
    --bg-color: light-dark(#F1F5F9, #0A0A0A);
    --bg-container-color: light-dark(#fff, #141414);
    --highlight-color: light-dark(#dc2626, #ef4444);
    --p-color: light-dark(#4B5563, #A1A1AA);
    --card-color: light-dark(#727586, #727586);
    --btn-color: light-dark(#fff, #0A0A0A);
    --autofill-color: light-dark(#E2E8F0, #262626);
    --shadow-color: light-dark(rgba(0,0,0,.25), rgba(0,0,0,0.4));
}
body {
    font-family: Arial, sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    margin: 0;
    background-color: var(--bg-color);
    height: 100%;
    color-scheme: light;
}
.content {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.simple-container {
    color: var(--secondary-color);
    padding: 10px;
    border-radius: 16px;
    text-align: center;
    max-width: 410px;
    min-width: 300px;
}
.container {
    background-color: var(--bg-container-color);
    color: var(--secondary-color);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    min-width: 300px;
}
.container.wide, .simple-container.wide {
    width: 500px;
}
.container .status-code, .simple-container .status-code {
    color: var(--p-color);
    font-weight: bold;
    font-size: 32px;
    margin: 20px 0;
}
.container .error-text, .simple-container .error-text {
    margin-top: 10px;
    color: var(--highlight-color);
    font-weight: bold;
    font-size: 16px;
}
.footer {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
}
.apps-label {
    font-style: italic;
    color: var(--p-color);
}
.apps-grid {
    margin: 5px auto 20px auto;
    box-sizing: border-box;
    width: 100%;
    max-width: 800px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, max-content));
    gap: 18px;
    justify-content: center;
}
.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 16px;
    text-decoration: none;
    max-width: 250px;
    color: var(--card-color);
    background: var(--bg-container-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px var(--shadow-color);
    outline: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.app-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--shadow-color);
    border-color: var(--card-color);
}
.app-card:focus-visible {
    box-shadow: 0 0 0 3px var(--card-color), 0 10px 28px var(--shadow-color);
}
.app-card .icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 3px 8px var(--shadow-color));
}
.app-card .name { font-size: 1.05rem; font-weight: 700; letter-spacing: .2px; color: var(--primary-color); }
.app-card .url { font-size: .85rem; color: var(--card-color); word-break: break-all; text-align: center; }
.logo {
    width: 200px;
    margin-bottom: 10px;
}
h1 {
    font-size: 24px;
    margin: 10px 0 20px 0;
    color: var(--primary-color);
    text-transform: uppercase;
}
p {
    font-size: 14px;
    color: var(--p-color);
    margin: 0 0 20px;
}
a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
span.email {
    font-size: 16px;
    font-weight: bold;
}
input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
input:-webkit-autofill {
    box-shadow: 0 0 0 1000px var(--autofill-color) inset !important;
}
input:-webkit-autofill:focus {
    box-shadow: 0 0 0 1000px var(--autofill-color) inset !important;
}
input:focus {
    outline: var(--primary-color) auto 2px;
}
button {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 20px;
    color: var(--btn-color);
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
}
button:hover {
    opacity: 0.9;
}
.scopes-list {
    text-align: left;
    margin-bottom: 20px;
}
.scopes-list ul {
    list-style-type: none;
    padding: 0;
}
.scopes-list li {
    font-size: 14px;
    color: var(--p-color);
    margin: 10px 0;
    padding-left: 20px;
    position: relative;
}
.scopes-list li::before {
    content: "✓";
    color: var(--primary-color);
    position: absolute;
    left: 0;
}
.form-group {
    margin-bottom: 15px;
}
.form-group-captcha {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
    flex-direction: row;
    margin-bottom: 15px;
}
.form-group-captcha label {
    margin-bottom: 0;
}
.form-group-captcha input[type="number"] {
    width: 60px;
}
.cap-row {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}
/* Cap CAPTCHA widget (login.html). It renders in a shadow DOM, so regular
   selectors can't reach its internals — it is themed through its --cap-*
   custom properties, which inherit across the shadow boundary. Full width
   like the input fields. Deliberately pinned to the LIGHT palette (literal
   values, no light-dark()) — the login UI renders light-only. */
cap-widget {
    display: block;
    width: 100%;
    color-scheme: light;
    --cap-widget-width: 100%;
    --cap-font: Arial, sans-serif;
    --cap-background: #F1F5F9;
    --cap-color: #4B5563;
    --cap-border-color: #4B5563;
    --cap-border-radius: 4px;
    --cap-checkbox-background: #ffffff;
    --cap-checkbox-border: 1px solid #4B5563;
    --cap-checkbox-border-radius: 4px;
    --cap-spinner-color: #22ac65;
    --cap-spinner-background-color: #E2E8F0;
    --cap-focus-ring: #22ac65;
    --cap-troubleshoot-color: #22ac65;
    /* Default checkmark recolored to the brand green (stroke=%2322ac65) */
    --cap-checkmark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cstyle%3E%40keyframes%20anim%7B0%25%7Bstroke-dashoffset%3A23.21320343017578px%7Dto%7Bstroke-dashoffset%3A0%7D%7D%3C%2Fstyle%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%2322ac65%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20d%3D%22m5%2012%205%205L20%207%22%20style%3D%22stroke-dashoffset%3A0%3Bstroke-dasharray%3A23.21320343017578px%3Banimation%3Aanim%20.5s%20ease%22%2F%3E%3C%2Fsvg%3E");
}
/* Two-factor pages (mfa.html / mfa-setup.html) */
.mfa-subtitle {
    color: var(--p-color);
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
}
.mfa-help {
    color: var(--p-color);
    font-size: 12px;
    text-align: center;
    margin-top: 12px;
}
.mfa-qr {
    text-align: center;
    margin-bottom: 20px;
}
.mfa-qr img {
    border-radius: 8px;
    background: #fff;
    padding: 6px;
}
.mfa-secret {
    color: var(--p-color);
    font-size: 12px;
    margin-top: 8px;
}
.mfa-secret code {
    font-size: 12.5px;
    user-select: all;
}
.recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 14px 0;
    font-family: ui-monospace, monospace;
    font-size: 14px;
    text-align: center;
}
.login-btn-wrapper {
    margin-top: 40px;
}
.logout-btn {
    color: var(--highlight-color);
    background: transparent;
    border-radius: unset;
    display: inline-block;
    padding: 0;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 12px;
    width: auto;
}
/* Logged-in header row: name + icon actions (two-factor, sign out) */
.user-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.user-name {
    color: var(--p-color);
    font-weight: bold;
    margin-right: 4px;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--p-color);
    cursor: pointer;
}
.icon-btn svg {
    width: 18px;
    height: 18px;
}
.icon-btn:hover {
    background: var(--autofill-color);
    color: var(--primary-color);
}
.icon-btn-exit:hover {
    color: var(--highlight-color);
}
.hidden {
    display: none;
}
.field {
    position: relative;
    font-family: system-ui, sans-serif;
    margin: 1.5rem 0;
    height: 40px;

    --field-bg: var(--bg-color);
}
.field:focus-within {
    --field-bg: var(--bg-container-color);
}
.field::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    pointer-events: none;
    box-sizing: border-box;
}
.field:focus-within::before {
    border: 2px solid var(--primary-color);
}
.field input {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
    background-color: var(--field-bg);
}
.field input:focus {
    outline: none;
}
.field label {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 6px;
    color: var(--p-color);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
    background: transparent;
    transition:
            top 0.18s ease,
            transform 0.18s ease,
            font-size 0.18s ease,
            color 0.18s ease;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
}
.field input:focus + label {
    color: var(--primary-color);
}
.field input:not(:focus) + label {
    color: var(--secondary-color);
}
.field input:focus + label::before,
.field input:not(:placeholder-shown) + label::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: calc(50% + 1px);
    transform: translateY(-50%);
    height: 2px;
    background: var(--field-bg);
    z-index: -1;
}
