/* ========================================
   普标链 - 登录页 / 超管控制台补充样式 (auth.css)
   复用 app.css / admin.css 的变量与组件，只写差异部分
   ======================================== */

/* =========================================================
   1. 页头身份（admin / cp 共用）
   ========================================================= */
.header-identity {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
}
.header-identity strong {
    color: #ffffff;
    font-weight: 700;
}
.header-identity .identity-role {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(139, 92, 246, 0.35) 100%);
    color: #dbeafe;
    letter-spacing: 0.02em;
}

/* =========================================================
   2. 登录页
   ========================================================= */
.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 70% 50% at 15% -10%, rgba(59, 130, 246, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 60% 45% at 90% 20%, rgba(139, 92, 246, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 50% 110%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
        linear-gradient(135deg, #020617 0%, #0B1120 45%, #0F172A 75%, #1E1B4B 100%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

.auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem 4rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-2xl);
    padding: 2.5rem 2.25rem 2rem;
    box-shadow:
        0 30px 60px -20px rgba(2, 6, 23, 0.65),
        0 0 0 1px rgba(59, 130, 246, 0.08);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand) 0%, #8B5CF6 50%, #06B6D4 100%);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
}
.auth-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--brand) 0%, #8B5CF6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    flex-shrink: 0;
}
.auth-brand-mark svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}
.auth-brand-text {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--brand-dark) 0%, #8B5CF6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--gray-900);
    margin-bottom: 0.4rem;
}
.auth-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.auth-alert {
    display: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    border: 1.5px solid var(--danger);
    background: var(--danger-bg);
    color: var(--status-untrusted-text);
    word-break: break-word;
}
.auth-alert.show {
    display: block;
    animation: authShake 0.28s var(--ease);
}
@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.auth-field {
    margin-bottom: 1rem;
}
.auth-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}
.auth-field input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.9375rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    color: var(--gray-900);
    transition: all 0.2s var(--ease);
    font-family: inherit;
}
.auth-field input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--white);
    box-shadow: 0 0 0 4px var(--brand-glow);
}
.auth-field input::placeholder {
    color: var(--gray-400);
}
.auth-field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--gray-500);
    line-height: 1.5;
}

.auth-submit {
    width: 100%;
    padding: 0.95rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
}
.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-notice {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.8rem;
    line-height: 1.65;
    margin-bottom: 1rem;
}
.auth-account-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.auth-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8rem;
    color: var(--gray-500);
}
.auth-switch a {
    color: var(--brand-dark);
    font-weight: 700;
    text-decoration: none;
}
.auth-switch a:hover {
    text-decoration: underline;
}

.auth-foot {
    margin-top: 1.5rem;
    font-size: 0.78rem;
    color: rgba(148, 163, 184, 0.85);
    text-align: center;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.5rem 1.5rem;
        border-radius: var(--radius-xl);
    }
    .auth-title { font-size: 1.4rem; }
}

/* =========================================================
   3. 租户后台：用量徽标 + 改密提示
   ========================================================= */
.admin-meta-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 0;
    margin-bottom: 0.75rem;
}
.usage-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.usage-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--gray-600);
    white-space: nowrap;
}
.usage-pill strong {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gray-900);
}
.usage-pill.warn {
    border-color: var(--warning);
    background: var(--warning-bg);
    color: #92400e;
}
.usage-pill.warn strong { color: #92400e; }
.usage-pill.over {
    border-color: var(--danger);
    background: var(--danger-bg);
    color: var(--status-untrusted-text);
}
.usage-pill.over strong { color: var(--status-untrusted-text); }
.usage-level {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--brand-glow);
    color: var(--brand-dark);
    border: 1px solid rgba(59, 130, 246, 0.25);
    white-space: nowrap;
}

.pwd-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1.5px solid var(--warning);
    color: #92400e;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.pwd-notice:hover {
    box-shadow: 0 6px 18px -6px rgba(245, 158, 11, 0.45);
    transform: translateY(-1px);
}
.pwd-notice-action {
    font-weight: 700;
    white-space: nowrap;
}

/* =========================================================
   4. 超管控制台
   ========================================================= */
.cp-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin: 0.25rem 0 1.5rem;
    flex-wrap: wrap;
}
.cp-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--gray-900);
    line-height: 1.2;
}
.cp-subtitle {
    margin-top: 0.35rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}
.cp-heading-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand) 0%, #8B5CF6 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.cp-tabs {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
}
.cp-tabs .tab {
    flex: 1 1 auto;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.cp-panel {
    display: none;
}
.cp-panel.active {
    display: block;
    animation: cpFadeIn 0.3s var(--ease);
}
@keyframes cpFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 概览统计卡 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.stat-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 1.5rem 1.5rem 1.35rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s var(--ease);
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--brand);
    box-shadow: 0 14px 30px -12px rgba(59, 130, 246, 0.3);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand) 0%, #8B5CF6 60%, #06B6D4 100%);
}
.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.15;
    margin-top: 0.5rem;
}
.stat-hint {
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 0.35rem;
}

/* 工具栏 / 下拉框 */
.cp-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.cp-field-inline {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.cp-field-inline label {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--gray-600);
}
.cp-select {
    min-width: 180px;
    padding: 0.62rem 0.9rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.cp-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}
.form-group select {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.form-group select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.cp-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    line-height: 1.6;
}
.cp-count {
    margin-left: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
}
.cp-inline-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.cp-inline-form input {
    min-width: 200px;
    padding: 0.62rem 0.9rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--gray-900);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease);
}
.cp-inline-form input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}
.cp-inline-form .btn-primary {
    padding: 0.68rem 1.25rem;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
}

/* 数据表格（沿用 admin.css 的 table 基础样式，仅收紧密度） */
.cp-tbl-wrap {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--white);
}
.cp-table {
    min-width: 960px;
}
.cp-table th,
.cp-table td {
    padding: 0.65rem 0.8rem;
    font-size: 0.8rem;
    white-space: nowrap;
    vertical-align: middle;
}
.cp-table th {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}
.cp-table tr:hover {
    background: var(--gray-50);
    cursor: default;
}
.cp-mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--gray-700);
}
.cp-ellipsis {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.cp-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}
.status-pill.active { background: #ecfdf5; color: #065f46; }
.status-pill.disabled { background: #f1f5f9; color: #64748b; }
.status-pill.role { background: #eff6ff; color: #1e40af; }
.status-pill.warn { background: var(--warning-bg); color: #92400e; }

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.btn-mini {
    padding: 0.35rem 0.7rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}
.btn-mini:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: var(--brand-glow);
}
.btn-mini.primary {
    color: #ffffff;
    background: var(--brand);
    border-color: var(--brand);
}
.btn-mini.primary:hover {
    color: #ffffff;
    background: var(--brand-dark);
}
.btn-mini.danger {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}
.btn-mini.danger:hover {
    color: #991b1b;
    background: #fee2e2;
    border-color: var(--danger);
}
.btn-mini:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cp-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* 一次性凭证弹窗 */
.secret-modal {
    max-width: 540px;
}
.secret-warning {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--warning-bg);
    border: 1.5px solid var(--warning);
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.65;
    margin-bottom: 1rem;
}
.secret-box {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}
.secret-value {
    flex: 1;
    display: block;
    padding: 0.9rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    border: 1.5px dashed var(--gray-300);
    border-radius: var(--radius-md);
    word-break: break-all;
}
.secret-tip {
    margin: 1rem 0;
    font-size: 0.8rem;
    color: var(--gray-500);
}
.secret-done {
    width: 100%;
    padding: 0.85rem;
    font-size: 0.95rem;
}
.cp-edit-id {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--brand-dark);
    background: var(--brand-glow);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

/* =========================================================
   5. 响应式
   ========================================================= */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .cp-title { font-size: 1.6rem; }
}
@media (max-width: 768px) {
    .admin-meta-bar { justify-content: flex-start; }
    .cp-heading { align-items: flex-start; }
    .cp-tabs { flex-direction: column; }
    .cp-tabs .tab { width: 100%; }
    .cp-toolbar { align-items: stretch; }
    .cp-field-inline { flex: 1; }
    .cp-select { width: 100%; }
    .cp-inline-form input { flex: 1; min-width: 0; }
    .header-identity { padding-left: 0.5rem; padding-right: 0.5rem; }
}
@media (max-width: 640px) {
    .stat-grid { grid-template-columns: 1fr; }
    .secret-box { flex-direction: column; }
}
