/* 登录页与管理后台沿用的旧样式；其余旧界面样式已裁掉。 */
:root {
    --bg: #f7f7f4;
    --surface: #ffffff;
    --surface-soft: #f2f2ef;
    --text: #1f1f1d;
    --muted: #6f6b64;
    --faint: #a19c94;
    --line: #dedbd4;
    --line-strong: #c8c3ba;
    --primary: #1f1f1d;
    --primary-hover: #3a3833;
    --danger: #b42318;
    --warning-bg: #fff4ed;
    --shadow: 0 18px 50px rgba(31, 31, 29, 0.08);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
    --font-mono: "SF Mono", "JetBrains Mono", Consolas, monospace;
}

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

html, body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
textarea,
input { font: inherit; }

button {
    border: 0;
    background: none;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(460px, 1fr) minmax(520px, 0.92fr);
    gap: 56px;
    padding: 28px 7.5vw;
    background: #fbfaf7;
}

.auth-brand {
    position: fixed;
    top: 28px;
    left: 7.5vw;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0;
}

.auth-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: contain;
}

.auth-copy {
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 56px;
}

.auth-copy h1 {
    margin-bottom: 20px;
    color: #11110f;
    font-family: ui-serif, Georgia, "Times New Roman", "Songti SC", serif;
    font-size: 62px;
    font-weight: 500;
    line-height: 1.06;
    letter-spacing: 0;
    text-align: center;
}

.auth-copy p {
    width: min(520px, 100%);
    margin-bottom: 28px;
    color: #2d2b27;
    font-family: ui-serif, Georgia, "Times New Roman", "Songti SC", serif;
    font-size: 20px;
    line-height: 1.32;
    text-align: center;
}

.auth-card {
    width: min(520px, 100%);
    border: 1px solid #e4e0d8;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 28px 80px rgba(45, 43, 39, 0.12);
    overflow: hidden;
}

.auth-card-banner {
    height: 42px;
    display: grid;
    place-items: center;
    border-bottom: 1px solid #e6e2da;
    background: #eef4ff;
    color: #4c647f;
    font-size: 13px;
    font-weight: 650;
}

.auth-visual {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-visual-frame {
    position: relative;
    width: min(760px, 100%);
    aspect-ratio: 0.92;
    border-radius: 8px;
    overflow: hidden;
    background: #eee6da;
    box-shadow: 0 20px 70px rgba(45, 43, 39, 0.14);
}

.auth-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: authSlide 18s infinite;
}

.slide-one { animation-delay: 0s; }

.slide-two { animation-delay: 6s; }

.slide-three { animation-delay: 12s; }

@keyframes authSlide {
    0% { opacity: 0; transform: scale(1.035); }
    8% { opacity: 1; }
    31% { opacity: 1; }
    39% { opacity: 0; transform: scale(1); }
    100% { opacity: 0; }
}

body.is-authenticated .auth-page {
    display: none;
}

.auth-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-loading {
    color: var(--faint);
    font-size: 12px;
    padding: 0 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes progressGlint {
    0% { transform: translateX(-46px); }
    100% { transform: translateX(220px); }
}

@keyframes cursorBlink {
    50% { opacity: 0; }
}

.followup-btn,
.followup-send,
.history-refresh,
.history-back,
.history-detail-btn {
    height: 36px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.followup-btn:hover,
.history-refresh:hover,
.history-back:hover,
.history-detail-btn:hover {
    background: var(--surface-soft);
}

.history-overlay,
.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(31, 31, 29, 0.38);
    backdrop-filter: blur(8px);
}

.auth-overlay.show { display: grid; place-items: center; }

.history-header,
.auth-header {
    min-height: 64px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.auth-header {
    min-height: 86px;
    align-items: flex-start;
    padding-top: 18px;
}

.history-header h2,
.auth-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.panel-close {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.panel-close:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.history-toolbar {
    min-height: 44px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.history-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.auth-tabs {
    margin: 18px 28px 0;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.auth-tabs button {
    height: 38px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 650;
}

.auth-tabs button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(31, 31, 29, 0.08);
}

.auth-form {
    padding: 18px 28px 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    position: relative;
    display: flex;
    flex-direction: column;
}

.auth-field span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.auth-field input {
    height: 56px;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    padding: 0 16px;
    font-size: 16px;
}

.auth-field input:focus,
.followup-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 31, 29, 0.12);
}

.auth-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 118px;
    gap: 10px;
}

.auth-code-btn {
    height: 56px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 650;
    white-space: nowrap;
}

.auth-code-btn:hover {
    background: var(--surface-soft);
}

.auth-code-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.auth-message {
    min-height: 18px;
    color: var(--danger);
    font-size: 12px;
    line-height: 1.5;
}

.auth-message.ok { color: var(--text); }

.auth-submit {
    height: 56px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
}

.auth-submit:hover { background: var(--primary-hover); }

.auth-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.admin-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(31, 31, 29, 0.28);
}

.admin-overlay.show {
    display: grid;
}

.admin-panel {
    width: min(760px, 100%);
    max-height: min(720px, 88vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(31, 31, 29, 0.22);
}

.admin-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--line);
}

.admin-panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 720;
}

.admin-panel-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.admin-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
}

.admin-filter {
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    padding: 0 12px;
    cursor: pointer;
}

.admin-filter.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.admin-list {
    min-height: 220px;
    overflow: auto;
    padding: 10px 16px 18px;
}

.admin-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 8px;
    border-bottom: 1px solid var(--line);
}

.admin-user-main {
    min-width: 0;
}

.admin-user-title {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    color: var(--text);
    font-weight: 680;
}

.admin-user-email {
    overflow-wrap: anywhere;
}

.admin-user-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.admin-status {
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 2px 8px;
    font-size: 12px;
}

.admin-status.pending {
    background: #fff4df;
    color: #8b5a00;
}

.admin-status.approved {
    background: #e9f7ef;
    color: #17633a;
}

.admin-status.rejected {
    background: #fbe9e9;
    color: #9b2424;
}

.admin-status.unreviewed {
    background: #eef1f4;
    color: #4d5963;
}

.admin-status.bad_case {
    background: #fbe9e9;
    color: #9b2424;
}

.admin-status.fixed {
    background: #e9f7ef;
    color: #17633a;
}

.admin-status.not_issue {
    background: #ecebe6;
    color: var(--muted);
}

.admin-status.watch {
    background: #fff4df;
    color: #8b5a00;
}

.admin-user-actions {
    display: flex;
    gap: 8px;
}

.admin-action-btn {
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    padding: 0 12px;
    cursor: pointer;
    font-weight: 650;
}

.admin-action-btn.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.admin-action-btn.danger {
    color: #9b2424;
}

.diagnostic-panel {
    width: min(1180px, 96vw);
    max-height: min(820px, 92vh);
}

.diagnostic-toolbar {
    flex-wrap: wrap;
}

.diagnostic-layout {
    min-height: 0;
    flex: 1;
    display: grid;
    grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.4fr);
}

.diagnostic-list {
    min-height: 0;
    border-right: 1px solid var(--line);
}

.diagnostic-detail {
    min-height: 0;
    overflow: auto;
    padding: 18px 22px 24px;
}

.diagnostic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
}

.diagnostic-row-main {
    min-width: 0;
    display: block;
    text-align: left;
    color: var(--text);
    cursor: pointer;
}

.diagnostic-row-main:hover .diagnostic-row-title {
    text-decoration: underline;
}

.diagnostic-row-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 650;
}

.diagnostic-row-meta,
.diagnostic-source-meta {
    display: block;
    margin-top: 4px;
    color: var(--faint);
    font-size: 11px;
    font-family: var(--font-mono);
}

.diagnostic-row-actions,
.diagnostic-detail-actions,
.diagnostic-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.diagnostic-detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.diagnostic-detail-head h3 {
    margin: 4px 0 0;
    font-size: 18px;
    line-height: 1.45;
}

.diagnostic-counts {
    margin: 12px 0;
    color: var(--muted);
    font-size: 12px;
}

.diagnostic-counts span {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
}

.diagnostic-section {
    margin-top: 16px;
}

.diagnostic-section h3 {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 720;
}

.diagnostic-section pre {
    max-height: 260px;
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8f8f5;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
}

.diagnostic-textarea {
    width: 100%;
    min-height: 86px;
    resize: vertical;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.65;
}

.diagnostic-source-item {
    margin: 8px 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.diagnostic-source-title {
    color: var(--text);
    font-weight: 680;
    line-height: 1.45;
}

.diagnostic-source-body,
.diagnostic-result {
    margin-top: 6px;
    color: var(--muted);
    font-family: var(--font-serif);
    font-size: 13px;
    line-height: 1.72;
    white-space: pre-wrap;
}

.diagnostic-result {
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-soft);
}

.diagnostic-empty {
    color: var(--faint);
    font-size: 13px;
}

@media (max-width: 1180px) {
.auth-page {
        grid-template-columns: minmax(420px, 1fr) minmax(420px, 0.88fr);
        gap: 34px;
        padding-left: 4vw;
        padding-right: 4vw;
    }
.auth-brand {
        left: 4vw;
    }
.auth-copy h1 {
        font-size: 54px;
    }
}

@media (max-width: 720px) {
.auth-page {
        min-height: 100vh;
        display: block;
        padding: 24px 18px 36px;
    }
body.is-authenticated .auth-page {
        display: none;
    }
.auth-brand {
        position: static;
        margin-bottom: 40px;
    }
.auth-copy {
        min-height: auto;
        padding-top: 0;
        justify-content: flex-start;
    }
.auth-copy h1 {
        font-size: 42px;
    }
.auth-copy p {
        font-size: 17px;
        margin-bottom: 22px;
    }
.auth-card {
        width: 100%;
    }
.auth-code-row {
        grid-template-columns: 1fr;
    }
.auth-code-btn {
        width: 100%;
    }
.auth-visual {
        min-height: auto;
        margin-top: 24px;
    }
.auth-visual-frame {
        width: 100%;
        aspect-ratio: 1.2;
    }
.admin-overlay {
        padding: 10px;
    }
.admin-user-row {
        grid-template-columns: 1fr;
    }
.admin-user-actions {
        justify-content: flex-start;
    }
.diagnostic-panel {
        width: 100%;
        max-height: 94vh;
    }
.diagnostic-layout {
        grid-template-columns: 1fr;
        overflow: auto;
    }
.diagnostic-list {
        max-height: 34vh;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
.diagnostic-detail {
        overflow: visible;
        padding: 14px;
    }
.diagnostic-detail-head {
        grid-template-columns: 1fr;
    }
}
