/* TOTP 页只包含密钥输入、倒计时和验证码结果样式。 */
.totp-form input[type="password"],
.totp-form input[type="text"] {
    display: block;
    width: 100%;
    min-height: 54px;
    padding: 15px 16px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 5px;
    font: 600 15px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
    letter-spacing: 0;
}

.totp-form input[type="password"]:focus,
.totp-form input[type="text"]:focus {
    border-color: var(--forest);
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.secret-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
}

.secret-visibility {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

.secret-visibility input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--orange-dark);
}

.inline-command {
    padding: 4px 0;
    color: var(--orange-dark);
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
}

.inline-command:hover,
.inline-command:focus-visible {
    color: var(--forest);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.provisioning-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.provisioning-field {
    min-width: 0;
}

.provisioning-field label,
.uri-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 750;
}

.provisioning-field input {
    min-height: 48px;
    font-family: inherit;
    font-weight: 500;
}

.totp-result {
    margin-top: 38px;
    padding-top: 34px;
    border-top: 1px solid var(--line);
}

.totp-code {
    min-width: 0;
    color: var(--forest);
    font: 800 58px/1 ui-monospace, "Cascadia Code", Consolas, monospace;
    letter-spacing: 6px;
}

.countdown-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 14px;
    text-align: right;
}

.countdown-line progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    appearance: none;
    background: var(--line);
    border: 0;
    border-radius: 0;
}

.countdown-line progress::-webkit-progress-bar {
    background: var(--line);
}

.countdown-line progress::-webkit-progress-value {
    background: var(--orange);
}

.countdown-line progress::-moz-progress-bar {
    background: var(--orange);
}

.totp-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 30px 0 0;
}

.totp-details div {
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.totp-details dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.totp-details dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

/* 原生 dialog 保留系统级焦点管理，只覆盖与站点一致的视觉样式。 */
.qr-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 24px;
    overflow: auto;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.qr-dialog::backdrop {
    background: rgba(24, 31, 28, 0.62);
}

.qr-dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.qr-dialog-heading h2 {
    margin: 0;
    font-family: Georgia, "Microsoft YaHei", serif;
    font-size: 26px;
    letter-spacing: 0;
}

.dialog-close {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
    font: 400 28px/1 Arial, sans-serif;
}

.dialog-close:hover,
.dialog-close:focus-visible {
    border-color: var(--forest);
    outline: 3px solid var(--eye);
    outline-offset: 2px;
}

.qr-image {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 18px auto;
    background: #ffffff;
    image-rendering: pixelated;
}

.uri-field textarea {
    display: block;
    width: 100%;
    padding: 11px 12px;
    resize: none;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    font: 500 12px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.qr-dialog > .secondary-command {
    margin-top: 14px;
}

@media (max-width: 640px) {
    .provisioning-fields {
        grid-template-columns: 1fr;
    }

    .totp-code {
        font-size: 42px;
        letter-spacing: 4px;
    }

    .totp-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .qr-dialog {
        padding: 20px;
    }
}
