* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e8edf5 0%, #d0d9e8 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow: hidden;
}

.login-container {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 20px 28px;
    width: 400px;
    max-width: 100%;
    height: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ===== 面板槽：账号 / 扫码 共用，flex 撑满使两模式严格同高 ===== */
.panel-slot {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#accountPanel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 28px;
}

/* ===== 标题行：图标 + 标题 同一行 ===== */
.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2px;
}

.header-row .icon-emoji {
    font-size: 28px;
    line-height: 1;
}

.header-row h1 {
    font-size: 22px;
    color: #1a237e;
    font-weight: 600;
    line-height: 1.2;
}

/* ===== Logo 区域（标题下方） ===== */
.logo-area {
    text-align: center;
    margin-bottom: 12px;
}

.logo-area img {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ===== 账号 / 密码：仅占位提示，无左侧标签，输入框撑满整行 ===== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: none;
}

.form-group input,
.form-group .password-wrapper {
    width: 100%;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d0d7e2;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
    background: #f8f9fb;
}

.form-group input:focus {
    outline: none;
    border-color: #1a237e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

/* ===== 密码框 + 显示/隐藏眼睛 ===== */
.password-wrapper {
    position: relative;
}

.form-group .password-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    color: #8892a6;
    transition: color 0.2s, background 0.2s;
}

.password-toggle:hover {
    color: #1a237e;
    background: rgba(26, 35, 126, 0.06);
}

.password-toggle:active {
    background: rgba(26, 35, 126, 0.12);
}

.password-toggle:focus {
    outline: none;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.password-toggle .eye-on {
    display: none;
}

.password-toggle.showing .eye-on {
    display: block;
}

.password-toggle.showing .eye-off {
    display: none;
}

/* ===== 租户信息卡片 - 独立在用户名和密码之间 ===== */
#tenantCard {
    height: 36px;
    margin: 4px 0 8px 0;
    display: flex;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tenant-info {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tenant-info .tenant-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.tenant-info .tenant-type {
    font-weight: 500;
    color: #555;
    flex-shrink: 0;
}

.tenant-info .tenant-divider {
    color: #999;
    flex-shrink: 0;
}

.tenant-info .tenant-name {
    font-weight: 600;
    color: #1a237e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 占位提示样式（灰色虚线框） ===== */
.tenant-placeholder {
    background: #f5f7fa !important;
    border: 1px dashed #d0d7e2;
}

.tenant-placeholder .tenant-icon {
    color: #bbb;
}

.tenant-placeholder .tenant-type {
    color: #bbb;
}

.tenant-placeholder .tenant-divider {
    color: #ccc;
}

.tenant-placeholder .tenant-name {
    color: #bbb;
    font-weight: 400;
}

/* 不同用户类型的背景色（无边框） */
.tenant-admin {
    background: #e8f5e9;
}

.tenant-admin .tenant-name {
    color: #2e7d32;
}

.tenant-brand {
    background: #e3f2fd;
}

.tenant-brand .tenant-name {
    color: #0d47a1;
}

.tenant-tenant {
    background: #fff3e0;
}

.tenant-tenant .tenant-name {
    color: #e65100;
}

.tenant-error {
    background: #ffebee;
}

.tenant-error .tenant-name {
    color: #c62828;
}

/* 记住密码 + 忘记密码 行 */
.row-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    margin-top: 2px;
}

.remember-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.remember-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a237e;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.remember-wrapper label {
    font-size: 14px;
    color: #444;
    cursor: pointer;
    line-height: 1.4;
}

.forgot-link {
    font-size: 14px;
    color: #1a237e;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.15s;
}

.forgot-link:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(26, 35, 126, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.error-msg {
    background: #ffebee;
    color: #c62828;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 16px;
    min-height: 40px;
    display: block;
    visibility: hidden;
}

.error-msg.show {
    visibility: visible;
}

.security-hint {
    margin: 2px 0 6px 0;
    padding: 6px 10px;
    background: #f0f4fa;
    border-radius: 8px;
    font-size: 12px;
    color: #667;
    line-height: 1.6;
    text-align: center;
}

.demo-hint {
    margin-top: 6px;
    padding: 8px 10px;
    background: #f5f7fa;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    text-align: center;
}

.demo-hint a {
    color: #1a237e;
    text-decoration: none;
}

.demo-hint a:hover {
    text-decoration: underline;
}

.demo-hint strong {
    color: #1a237e;
}

/* ---------- 自定义弹窗 (modal) ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 20px;
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFade 0.25s ease;
}

@keyframes modalFade {
    0% {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-box .modal-title {
    position: relative;
    font-size: 20px;
    font-weight: 600;
    color: #1a237e;
    margin-bottom: 16px;
    text-align: center;
}

.modal-box .modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 30px;
    height: 30px;
    line-height: 28px;
    text-align: center;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    background: #f0f2f5;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}

.modal-box .modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.modal-box .modal-body {
    font-size: 15px;
    color: #333;
    line-height: 1.8;
    padding: 4px 0 8px;
}

.modal-box .modal-body .contact-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 2px 0;
}

.modal-box .modal-body .contact-item .label {
    font-weight: 600;
    color: #1a237e;
    min-width: 48px;
}

.modal-box .modal-body .contact-item .value {
    color: #222;
    word-break: break-all;
}

.modal-box .modal-footer {
    margin-top: 24px;
    text-align: center;
}

.modal-box .modal-footer .btn-close {
    padding: 10px 36px;
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.modal-box .modal-footer .btn-close:hover {
    background: #0d47a1;
    transform: scale(1.02);
}

.modal-box .modal-footer .btn-close:active {
    transform: scale(0.98);
}

/* ===== 加载动画 ===== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #1a237e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== 右上角折角切换 ===== */
.corner-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 90px;
    height: 90px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%);
    outline: none;
}

.corner-toggle .corner-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.corner-toggle .corner-fold path {
    transition: fill 0.2s ease;
}

.corner-toggle:hover .corner-fold path {
    fill: #0d47a1;
}

.corner-toggle:active .corner-fold {
    transform: scale(0.96);
}

.corner-toggle .corner-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 56px;
    height: 56px;
    color: #fff;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 扫码模式：折角显示电脑图标（小图标，靠右上） */
.corner-toggle .corner-icon.pc-mode {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
}

.corner-toggle .corner-icon svg {
    width: 100%;
    height: 100%;
}

/* ===== 扫码登录面板 ===== */
#qrPanel {
    flex: 1;
    min-height: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qr-tip {
    font-size: 14px;
    color: #333;
    line-height: 1.7;
    margin-bottom: 14px;
}

.qr-tip .qr-sub {
    font-size: 12px;
    color: #888;
}

.qr-box {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 12px;
    border: 1px solid #e3e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-box img {
    width: 180px;
    height: 180px;
    object-fit: contain;
}

/* ===== 二维码中央温湿度图标 ===== */
.qr-center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.qr-center-icon {
    font-size: 26px;
    line-height: 1;
}

.qr-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 12px;
}

.qr-overlay-text {
    font-size: 14px;
    color: #c62828;
    line-height: 1.5;
}

.qr-refresh {
    padding: 9px 22px;
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.qr-refresh:hover {
    background: #0d47a1;
}

.qr-status {
    font-size: 13px;
    color: #667;
    min-height: 18px;
}

@media (max-width: 480px) {
    .login-container {
        padding: 24px 20px;
    }

    .header-row .icon-emoji {
        font-size: 22px;
    }

    .header-row h1 {
        font-size: 18px;
    }

    .logo-area img {
        max-width: 140px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .form-group input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .modal-box {
        padding: 28px 20px 24px;
    }

    .row-actions {
        flex-wrap: wrap;
        gap: 6px 0;
    }

    #tenantCard {
        height: 36px;
        margin: 4px 0 8px 0;
    }

    .tenant-info {
        padding: 8px 12px;
        font-size: 13px;
    }

    .tenant-info .tenant-icon {
        font-size: 13px;
    }
}
