/* ============================================================
   微软邮箱批量管理系统 — 视觉规范
   设计基调：浅色、克制、留白充足；主色为深靛蓝，强调色为青绿
   布局基调：整页锁定视口，主页面不出现滚动条，滚动只发生在各面板内部
   ============================================================ */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-sunken: #fafbfd;
    --border: #e6e9f0;
    --border-strong: #d7dce6;

    --text: #1a2233;
    --text-muted: #6b7690;
    --text-faint: #9aa3b8;

    --primary: #3554d1;
    --primary-hover: #2a44b4;
    --primary-soft: #eef1fd;

    --success: #0f9d6e;
    --success-soft: #e8f7f1;
    --warning: #c9860c;
    --warning-soft: #fdf4e3;
    --danger: #d64545;
    --danger-soft: #fdeeee;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(20, 28, 50, 0.04);
    --shadow-md: 0 6px 24px rgba(20, 28, 50, 0.07);
    --shadow-lg: 0 24px 60px rgba(20, 28, 50, 0.18);
    --header-h: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
        'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* 主页面锁定滚动：滚动条只出现在面板内部 */
body.page-admin {
    overflow: hidden;
}

/* ============ 应用外壳 ============ */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: 18px 22px;
    gap: 16px;
}

.app-header {
    flex: 0 0 auto;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, #3554d1, #5b7bf0);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.5px;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.1px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #dde3fb;
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ============ 工作区（两栏面板） ============ */
.workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 16px;
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.panel-title h2 {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.pill {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px 10px;
    white-space: nowrap;
}

.panel-tools {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
}

.panel-body {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: var(--surface);
}

/* 滚动只在这里发生 */
.table-wrap {
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
}

.panel-foot {
    flex: 0 0 auto;
    border-top: 1px solid var(--border);
    background: var(--surface-sunken);
    padding: 10px 18px;
    min-height: 48px;
}

.panel-foot:empty {
    display: none;
}

/* ============ 数据表格 ============ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-sunken);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-faint);
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

/* 可排序表头 */
.data-table thead th.is-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.data-table thead th.is-sortable:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.data-table thead th.is-sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: 1px;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-bottom: 4.5px solid currentColor;
    opacity: 0.28;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.data-table thead th.sort-asc::after {
    opacity: 1;
    color: var(--primary);
}

.data-table thead th.sort-desc::after {
    opacity: 1;
    color: var(--primary);
    transform: rotate(180deg);
}

.data-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #f1f3f8;
    font-size: 13px;
    color: var(--text);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background-color 0.14s ease;
}

.data-table tbody tr:hover td {
    background: #f8faff;
}

.cell-empty {
    text-align: center;
    padding: 48px 16px !important;
    color: var(--text-faint) !important;
    font-size: 13px !important;
}

.cell-email {
    font-weight: 500;
    color: var(--text);
}

.cell-mono {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.cell-time {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 12.5px;
}

.cell-muted {
    color: var(--text-faint);
    font-size: 12.5px;
}

.col-actions {
    text-align: right;
}

.cell-actions {
    text-align: right;
}

/* 状态徽标 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 5px;
}

.badge-valid {
    color: var(--success);
    background: var(--success-soft);
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge-expired {
    color: var(--danger);
    background: var(--danger-soft);
}

.badge-unknown {
    color: var(--text-muted);
    background: #f0f2f7;
}

/* 行内操作按钮 */
.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.btn-icon {
    padding: 5px 8px;
    font-size: 11.5px;
    line-height: 1;
}

/* ============ 按钮 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease,
        color 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(53, 84, 209, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-plus {
    font-size: 14px;
    line-height: 1;
    margin-top: -1px;
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--primary);
    border-color: #c3cdf5;
    background: var(--primary-soft);
}

.btn-ghost-danger {
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border-strong);
}

.btn-ghost-danger:hover:not(:disabled) {
    color: var(--danger);
    border-color: #f3c9c9;
    background: var(--danger-soft);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* 兼容旧类名 */
.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #0c8560;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #bd3a3a;
}

.btn-info {
    background: var(--primary);
    color: #fff;
}

.btn-info:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-group {
    display: inline-flex;
    gap: 5px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

/* ============ 加载态 ============ */
.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(1.5px);
    color: var(--text-muted);
    font-size: 12.5px;
}

.loading-overlay[hidden] {
    display: none;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid #e8ecf5;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============ 分页 ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pg-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.14s ease;
}

.pg-btn:hover:not(.is-disabled):not(.is-active) {
    color: var(--primary);
    border-color: #c3cdf5;
    background: var(--primary-soft);
}

.pg-btn.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    cursor: default;
}

.pg-btn.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.pg-ellipsis {
    padding: 0 4px;
    color: var(--text-faint);
    font-size: 12px;
    user-select: none;
}

/* ============ 提示条 ============ */
.toast-stack {
    position: fixed;
    top: 92px;
    right: 26px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 250px;
    max-width: 400px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    color: var(--text);
    pointer-events: auto;
    animation: toastIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.toast.is-leaving {
    opacity: 0;
    transform: translateX(14px);
    transition: all 0.2s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(14px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 7px;
}

.toast-success .toast-dot {
    background: var(--success);
}

.toast-danger .toast-dot {
    background: var(--danger);
}

.toast-msg {
    flex: 1;
    line-height: 1.45;
}

.toast-close {
    border: none;
    background: none;
    color: var(--text-faint);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.toast-close:hover {
    color: var(--text);
}

/* 兼容旧 alert 类（js 通知复用） */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 13px;
}

/* ============ 弹窗 ============ */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(18, 24, 42, 0.42);
    backdrop-filter: blur(3px);
    animation: maskIn 0.18s ease;
}

.modal-mask[hidden] {
    display: none;
}

@keyframes maskIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    border: none;
    background: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-faint);
    cursor: pointer;
    padding: 0 3px;
    border-radius: 5px;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-foot {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-sunken);
}

/* 确认对话框（小尺寸） */
.modal-sm {
    max-width: 400px;
}

.modal-sm .modal-body {
    padding: 18px 20px;
    gap: 14px;
}

.confirm-text {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-muted);
    word-break: break-word;
}

.confirm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.confirm-field[hidden] {
    display: none;
}

.confirm-field label {
    font-size: 12px;
    color: var(--text-faint);
}

.confirm-field .form-control {
    width: 100%;
    padding: 9px 11px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.confirm-field .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(53, 84, 209, 0.12);
}

/* 拖拽上传区 */
.dropzone {
    position: relative;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-sunken);
    padding: 26px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: #a9b8ee;
    background: var(--primary-soft);
}

.dropzone.is-dragover {
    border-style: solid;
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.dropzone-icon {
    font-size: 22px;
    color: var(--primary);
    opacity: 0.75;
    line-height: 1;
}

.dropzone-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.dropzone-hint {
    font-size: 11.5px;
    color: var(--text-faint);
}

.dz-file {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.dz-file[hidden] {
    display: none;
}

.dz-file-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dz-file-size {
    font-size: 11.5px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.dz-file-clear {
    border: none;
    background: none;
    font-size: 18px;
    line-height: 1;
    color: var(--text-faint);
    cursor: pointer;
    padding: 0 3px;
}

.dz-file-clear:hover {
    color: var(--danger);
}

/* 格式说明卡片 */
.format-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-sunken);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.format-head {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.format-tag {
    flex: 0 0 auto;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 4px;
    padding: 2px 7px;
}

.format-head code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.format-note {
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-faint);
    padding-top: 3px;
    border-top: 1px dashed var(--border);
}

.format-note strong {
    color: var(--text-muted);
    font-weight: 600;
}

/* 进度条 */
.progress {
    position: relative;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    overflow: hidden;
}

.progress[hidden] {
    display: none;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3554d1, #6b8af5);
    transition: width 0.25s ease;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

/* ============ 登录页 ============ */
.page-login {
    min-width: 1040px;
    overflow: hidden;
    background: #f4f4f1;
}

.page-login .app-shell {
    height: 100vh;
    height: 100dvh;
    padding: 0;
    gap: 0;
}

.page-login .app-header { display: none; }

.page-login .app-main {
    min-height: 100vh;
    min-height: 100dvh;
}

.login-layout {
    flex: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(430px, 42%) minmax(610px, 58%);
    background: #f4f4f1;
}

.login-brand-panel {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: 42px 54px 38px;
    overflow: hidden;
    color: #fff;
    background: #191b20;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: 12%;
    right: -31%;
    width: 510px;
    height: 510px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    box-shadow:
        0 0 0 82px rgba(255, 255, 255, 0.018),
        0 0 0 164px rgba(255, 255, 255, 0.012);
}

.login-brand-panel::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: 0.16;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, transparent 4%, #000 35%, transparent 94%);
}

.login-brand-copy {
    width: min(430px, 100%);
    margin: auto 0;
    padding: 42px 0;
}

.login-eyebrow {
    margin: 0 0 21px;
    color: #ff9a24;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.19em;
}

.login-brand-copy h1 {
    margin: 0;
    max-width: none;
    color: #f7f7f4;
    font-size: clamp(34px, 3.1vw, 49px);
    font-weight: 550;
    letter-spacing: -0.045em;
    line-height: 1.18;
}

.login-brand-copy h1 span {
    display: block;
    white-space: nowrap;
}

.login-title-offset { margin-left: 2em; }

.login-brand-summary {
    max-width: none;
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.52);
    font-size: 14px;
    line-height: 1.85;
    white-space: nowrap;
}

.login-feature-list {
    display: grid;
    gap: 0;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.login-feature-list li span {
    color: #ff9a24;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
}

.login-stage {
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 0;
    padding: 54px 8vw;
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 138, 0, 0.055), transparent 28%),
        #f4f4f1;
}

.login-card {
    width: min(100%, 440px);
    padding: 44px 42px 34px;
    color: #1d2026;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e3e3df;
    border-radius: 20px;
    box-shadow:
        0 28px 75px rgba(31, 32, 34, 0.08),
        0 2px 6px rgba(31, 32, 34, 0.035);
}

.login-card-head { text-align: left; }

.login-section-mark {
    display: block;
    width: 34px;
    height: 4px;
    margin-bottom: 25px;
    border-radius: 4px;
    background: #ff8a00;
}

.login-card h2 {
    margin: 0;
    color: #1c1f24;
    font-size: 30px;
    font-weight: 620;
    letter-spacing: -0.035em;
    line-height: 1.2;
}

.login-subtitle {
    margin: 10px 0 0;
    color: #818388;
    font-size: 13.5px;
    line-height: 1.7;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
    margin-top: 31px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-field label {
    color: #4e5157;
    font-size: 12px;
    font-weight: 600;
}

.login-input-shell { position: relative; }

.login-input-shell > svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 15px;
    width: 18px;
    height: 18px;
    color: #a1a3a7;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: translateY(-50%);
    pointer-events: none;
}

.login-input-shell input {
    width: 100%;
    height: 50px;
    padding: 0 15px 0 44px;
    color: #21242a;
    font: inherit;
    font-size: 13.5px;
    background: #fafaf8;
    border: 1px solid #dededa;
    border-radius: 10px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.login-input-shell input::placeholder { color: #afb0b2; }
.login-input-shell input:hover { border-color: #c8c8c3; }

.login-input-shell input:focus-visible {
    background: #fff;
    border-color: #f08a14;
    box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.13);
}

.login-input-shell:focus-within > svg { color: #dc7805; }

.login-input-shell input[aria-invalid="true"] {
    border-color: #d85b55;
    background: #fffafa;
}

.login-submit {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-top: 3px;
    padding: 0 18px;
    color: #20170d;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 650;
    background: #ff8a00;
    border: 1px solid #ed8000;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(255, 138, 0, 0.18);
    cursor: pointer;
    transition: transform 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.login-submit svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-submit:hover {
    background: #ff971f;
    box-shadow: 0 10px 24px rgba(255, 138, 0, 0.24);
    transform: translateY(-1px);
}

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

.login-submit:focus-visible {
    outline: 3px solid rgba(255, 138, 0, 0.26);
    outline-offset: 3px;
}

.login-error {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: -4px 0 0;
    padding: 10px 12px;
    color: #a93431;
    font-size: 12.5px;
    line-height: 1.55;
    background: #fff4f3;
    border: 1px solid #f0cfcc;
    border-radius: 9px;
}

.login-error svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* 桌面侧栏或分屏窗口过窄时，保留完整表单并避免横向裁切。 */
@media (max-width: 900px) {
    .page-login {
        min-width: 0;
        overflow: auto;
    }

    .login-layout { grid-template-columns: minmax(0, 1fr); }
    .login-brand-panel { display: none; }

    .login-stage {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-submit,
    .login-input-shell input { transition: none; }
}

/* ---------- 登录页：玻璃扫描舱 ---------- */
.page-login {
    min-width: 0;
    background: #f6f3ed;
}

.login-layout {
    position: relative;
    grid-template-columns: minmax(650px, 59%) minmax(520px, 41%);
    overflow: hidden;
    background:
        radial-gradient(circle at 91% 7%, rgba(255, 157, 52, 0.08), transparent 24%),
        #f6f3ed;
}

.login-brand-panel {
    position: relative;
    z-index: 1;
    isolation: isolate;
    justify-content: flex-start;
    padding: clamp(42px, 4.1vw, 78px);
    padding-right: 13vw;
    overflow: visible;
    background: transparent;
}

.login-brand-panel::before {
    z-index: 0;
    top: 0;
    left: 0;
    width: 67vw;
    height: 120vh;
    border: 0;
    border-right: 1px solid rgba(255, 151, 34, 0.12);
    border-bottom: 1px solid rgba(255, 151, 34, 0.08);
    border-radius: 0 0 100% 0;
    background:
        radial-gradient(circle at 76% 46%, rgba(255, 142, 16, 0.075), transparent 24%),
        radial-gradient(circle at 72% 46%, transparent 0 40%, rgba(255, 255, 255, 0.026) 40.2% 40.45%, transparent 40.7%),
        radial-gradient(circle at 72% 46%, transparent 0 53%, rgba(255, 255, 255, 0.016) 53.2% 53.4%, transparent 53.6%),
        #17191e;
    box-shadow: 20px 14px 65px rgba(25, 22, 18, 0.1);
    transform: none;
}

.login-brand-panel::after {
    z-index: 1;
    inset: auto;
    top: 0;
    left: 0;
    width: 67vw;
    height: 120vh;
    border-radius: 0 0 100% 0;
    opacity: 0.2;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 70% 44%, #000 5%, rgba(0, 0, 0, 0.68) 36%, transparent 76%);
}

.login-brand-copy {
    position: relative;
    z-index: 4;
    width: min(640px, 49vw);
    margin: 0;
    padding: clamp(70px, 10.5vh, 108px) 0 0;
}

.login-eyebrow {
    margin-bottom: 32px;
    color: #ff981d;
    font-size: 11px;
    letter-spacing: 0.22em;
}

.login-brand-copy h1 {
    max-width: 590px;
    font-size: clamp(40px, 3vw, 60px);
    font-weight: 640;
    letter-spacing: -0.055em;
    line-height: 1.05;
    text-shadow: 0 10px 35px rgba(0, 0, 0, 0.24);
}

.login-title-offset { margin-left: 1.28em; }

.login-brand-summary {
    max-width: 520px;
    margin-top: 27px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    letter-spacing: 0.01em;
    white-space: normal;
}

.login-feature-list {
    width: min(650px, 53vw);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-top: 64px;
    border-top: 0;
}

.login-feature-list li {
    position: relative;
    display: grid;
    justify-items: start;
    gap: 17px;
    min-height: 82px;
    padding: 0;
    color: rgba(255, 255, 255, 0.82);
    border-top: 0;
    border-bottom: 0;
}

.login-feature-list li img {
    display: block;
    width: 36px;
    height: 36px;
}

.login-feature-list .login-feature-label {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.4;
}

.login-brand-foot {
    position: absolute;
    z-index: 4;
    left: clamp(42px, 4.1vw, 78px);
    bottom: 46px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0;
    color: rgba(255, 255, 255, 0.38);
    font-size: 9px;
    letter-spacing: 0.22em;
}

.login-brand-foot > span {
    width: 30px;
    height: 1px;
    background: #ff9418;
}

.login-scan-scene {
    position: absolute;
    z-index: 3;
    top: 10%;
    right: 44px;
    bottom: 10%;
    width: min(85vw, 1400px);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 36px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 36px), transparent 100%);
    pointer-events: none;
}

.login-scan-gate {
    position: absolute;
    right: -4vw;
    bottom: 7%;
    width: 100%;
    margin: 0;
    filter: drop-shadow(0 30px 42px rgba(0, 0, 0, 0.36));
    transform-origin: 0 70%;
    animation: login-scene-float 8s ease-in-out infinite;
}

.login-scan-gate img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0.96;
}

.login-mail-stream {
    position: absolute;
    z-index: -1;
    right: 9%;
    bottom: 27%;
    width: 82%;
    height: 28%;
    opacity: 0.48;
    background:
        repeating-linear-gradient(0deg, transparent 0 16px, rgba(255, 139, 10, 0.19) 17px 18px),
        linear-gradient(90deg, transparent, rgba(255, 143, 18, 0.74) 46%, transparent 84%);
    filter: blur(0.2px);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 76%, transparent);
    animation: login-mail-flow 6.8s linear infinite;
}

.login-scan-beam {
    position: absolute;
    z-index: 2;
    top: 16%;
    bottom: 16%;
    left: 58%;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, transparent, rgba(255, 169, 70, 0.95) 32%, #fff4dc 50%, rgba(255, 133, 0, 0.9) 68%, transparent);
    box-shadow: 0 0 18px 5px rgba(255, 139, 15, 0.17);
    opacity: 0;
    animation: login-scan-sweep 7.2s cubic-bezier(0.55, 0.05, 0.45, 0.95) infinite;
}

.login-scan-status {
    position: absolute;
    z-index: 4;
    top: 24%;
    right: 26%;
    display: grid;
    gap: 5px;
    padding-left: 12px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 8px;
    letter-spacing: 0.18em;
    border-left: 1px solid rgba(255, 151, 32, 0.55);
    animation: login-status-pulse 3.6s ease-in-out infinite;
}

.login-scan-status strong {
    color: #ff9a28;
    font-size: 9px;
    font-weight: 650;
}

.login-stage {
    position: relative;
    z-index: 4;
    place-items: center start;
    align-content: center;
    padding: 54px clamp(34px, 4vw, 76px) 54px 0;
    background: transparent;
}

.login-stage::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background:
        radial-gradient(circle at 92% 12%, rgba(255, 146, 18, 0.08), transparent 26%),
        radial-gradient(circle at 5% 100%, rgba(255, 255, 255, 0.72), transparent 36%);
}

.login-card {
    position: relative;
    width: min(100%, 520px);
    margin-left: -12px;
    padding: 50px 60px 53px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 26px;
    box-shadow:
        0 34px 88px rgba(28, 27, 23, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(30px) saturate(125%);
    -webkit-backdrop-filter: blur(30px) saturate(125%);
}

.login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.18), transparent 40%);
    pointer-events: none;
}

.login-card-head,
.login-form {
    position: relative;
    z-index: 1;
}

.login-section-mark {
    width: 38px;
    margin-bottom: 34px;
    background: #ff8a00;
}

.login-card h2 {
    font-size: 36px;
    font-weight: 680;
    letter-spacing: -0.045em;
}

.login-subtitle {
    margin-top: 11px;
    color: #797c82;
    font-size: 13.5px;
}

.login-form {
    gap: 27px;
    margin-top: 49px;
}

.login-input-shell input {
    height: 60px;
    padding-left: 46px;
    background: rgba(238, 244, 252, 0.88);
    border-color: rgba(203, 203, 198, 0.78);
    border-radius: 12px;
}

.login-input-shell input:focus-visible {
    background: #fff;
    border-color: #ed850e;
    box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.14), 0 8px 26px rgba(67, 46, 21, 0.06);
}

.login-submit {
    min-height: 60px;
    margin-top: 4px;
    border-radius: 12px;
    background: #ff8a00;
    box-shadow: 0 13px 30px rgba(255, 138, 0, 0.22);
}

.login-submit:hover {
    background: #ff981f;
    box-shadow: 0 16px 34px rgba(255, 138, 0, 0.28);
}

.login-stage-note {
    position: absolute;
    top: 57%;
    right: 6.2vw;
    display: grid;
    gap: 4px;
    margin: 0;
    color: rgba(55, 55, 53, 0.31);
    font-size: 10px;
    letter-spacing: 0.24em;
    line-height: 1.7;
    transform: translateY(-50%);
}

.login-stage-footnote {
    position: absolute;
    right: 5.2vw;
    bottom: 96px;
    margin: 0;
    color: rgba(55, 55, 53, 0.31);
    font-size: 9px;
    letter-spacing: 0.18em;
    line-height: 1.62;
}

.login-stage-footnote > span {
    display: block;
    width: 26px;
    height: 1px;
    margin-bottom: 14px;
    background: rgba(255, 148, 24, 0.34);
}

@keyframes login-scan-sweep {
    0%, 16% { opacity: 0; transform: translateX(-220px); }
    25% { opacity: 0.72; }
    62% { opacity: 0.82; }
    76%, 100% { opacity: 0; transform: translateX(250px); }
}

@keyframes login-mail-flow {
    from { background-position: 0 0, -180px 0; }
    to { background-position: 0 0, 240px 0; }
}

@keyframes login-scene-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -9px, 0); }
}

@keyframes login-status-pulse {
    0%, 100% { opacity: 0.42; }
    50% { opacity: 0.9; }
}

@media (max-width: 1500px) {
    .login-layout { grid-template-columns: minmax(590px, 61%) minmax(430px, 39%); }
    .login-brand-panel { padding-right: 11vw; }
    .login-brand-copy { width: min(570px, 48vw); }
    .login-brand-copy h1 { font-size: clamp(38px, 3.3vw, 53px); }
    .login-feature-list { width: min(610px, 53vw); gap: 28px; }
    .login-scan-scene { right: 60px; width: min(84vw, 1200px); opacity: 0.82; }
    .login-card { margin-left: -28px; padding-inline: 52px; }
    .login-stage-note,
    .login-stage-footnote { display: none; }
}

@media (max-width: 1120px) {
    .login-layout { grid-template-columns: minmax(500px, 56%) minmax(430px, 44%); }
    .login-brand-panel { padding-right: 8vw; }
    .login-brand-copy { width: min(500px, 48vw); }
    .login-brand-copy h1 { font-size: clamp(34px, 4vw, 44px); }
    .login-title-offset { margin-left: 0.8em; }
    .login-brand-summary { max-width: 430px; }
    .login-feature-list { width: min(470px, 48vw); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
    .login-feature-list li { min-height: 70px; gap: 10px; }
    .login-feature-list li img { width: 30px; height: 30px; }
    .login-feature-list .login-feature-label { font-size: 12px; }
    .login-scan-scene { right: 64px; bottom: 1%; opacity: 0.48; }
    .login-card { margin-left: -32px; padding: 42px 38px 36px; }
}

@media (max-width: 900px) {
    .page-login { overflow: auto; }
    .login-layout {
        grid-template-columns: minmax(0, 1fr);
        background:
            radial-gradient(circle at 50% 0%, rgba(255, 146, 18, 0.11), transparent 30%),
            #f4f1eb;
    }
    .login-brand-panel { display: none; }
    .login-stage {
        min-height: 100vh;
        min-height: 100dvh;
        place-items: center;
        padding: 40px;
    }
    .login-card { width: min(100%, 470px); margin-left: 0; }
}

@media (max-width: 560px) {
    .login-stage { padding: 20px; }
    .login-card { padding: 34px 26px 28px; border-radius: 22px; }
    .login-card h2 { font-size: 30px; }
    .login-form { margin-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-scan-gate,
    .login-mail-stream,
    .login-scan-beam,
    .login-scan-status {
        animation: none;
    }

    .login-scan-beam { display: none; }
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
    color: var(--primary);
    border-color: #c3cdf5;
    background: var(--primary-soft);
}

/* ============ API 文档页 ============ */
.doc-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 26px 30px 34px;
}

.doc-wrap > h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.doc-intro {
    font-size: 13px;
    color: var(--text-faint);
    margin-bottom: 22px;
}

.doc-group {
    margin-bottom: 26px;
}

.doc-group:last-child {
    margin-bottom: 0;
}

.doc-group-title {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-faint);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

.endpoint {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 17px;
    margin-bottom: 11px;
    background: var(--surface);
    transition: border-color 0.15s ease;
}

.endpoint:hover {
    border-color: var(--border-strong);
}

.endpoint-head {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 9px;
}

.method {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 5px;
}

.method-get {
    color: var(--success);
    background: var(--success-soft);
}

.method-post {
    color: var(--primary);
    background: var(--primary-soft);
}

.endpoint-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 9px;
}

.endpoint-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 11px;
}

.kv {
    display: flex;
    gap: 10px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.kv-key {
    flex: 0 0 74px;
    color: var(--text-faint);
    font-size: 11.5px;
    padding-top: 2px;
}

.kv-val code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 4px;
    padding: 2px 6px;
}

.code-block {
    background: #1d2436;
    color: #d7e0f5;
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.65;
    margin-top: 9px;
}

.note-card {
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    padding: 14px 17px;
    margin-top: 11px;
}

.note-card h4 {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

.note-card ul {
    margin-left: 17px;
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--text-muted);
}

.note-card code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1.25fr) minmax(0, 1fr);
    }

    .panel-emails .panel-tools {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .app-shell {
        padding: 12px;
        gap: 12px;
    }

    .app-header {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px 16px;
    }

    .brand-text h1 {
        font-size: 15px;
    }

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .panel-tools {
        width: 100%;
        flex-wrap: wrap;
    }

    .data-table tbody td,
    .data-table thead th {
        padding: 9px 11px;
        font-size: 12px;
    }

    .toast-stack {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }

    .modal-mask {
        padding: 14px;
    }
}

/* 滚动条精修（Webkit） */
.table-wrap::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.doc-wrap::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.table-wrap::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.doc-wrap::-webkit-scrollbar-thumb {
    background: #d3d9e6;
    border-radius: 9px;
    border: 2.5px solid transparent;
    background-clip: content-box;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.doc-wrap::-webkit-scrollbar-thumb:hover {
    background: #b9c2d6;
    background-clip: content-box;
}

.table-wrap::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.doc-wrap::-webkit-scrollbar-track {
    background: transparent;
}

/* 通用工具类 */
.small-text {
    font-size: 11.5px;
    color: var(--text-faint);
}

.subject-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-faint);
    font-size: 13px;
}

/* ==================== 表单控件（新增 / 编辑弹窗） ==================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-label .req {
    color: var(--danger);
    margin-left: 2px;
}

.form-group .form-control {
    width: 100%;
    padding: 9px 11px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group textarea.form-control {
    resize: vertical;
    min-height: 66px;
    line-height: 1.5;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.form-group .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(53, 84, 209, 0.12);
}

.form-group .form-control::placeholder {
    color: var(--text-faint);
}

.field-hint {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-faint);
}

.field-hint.is-ok {
    color: var(--success);
}

/* 弹窗内的提示条 */
.notice {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    line-height: 1.55;
    border: 1px solid transparent;
}

.notice[hidden] {
    display: none;
}

.notice-info {
    background: var(--primary-soft);
    border-color: rgba(53, 84, 209, 0.22);
    color: var(--primary-hover);
}

.notice-warning {
    background: var(--warning-soft);
    border-color: rgba(201, 134, 12, 0.28);
    color: #8a5d08;
}

.notice-danger {
    background: var(--danger-soft);
    border-color: rgba(214, 69, 69, 0.28);
    color: var(--danger);
}

/* 导出弹窗里的两个选项按钮 */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.export-options .btn {
    width: 100%;
    justify-content: center;
}

/* ==================== 控制台看板（概览卡片 + 单页） ====================

   与旧版「两栏锁视口」的区别：
   内容从 4 个区块（概览 / 机器人 / 邮箱 / 记录）纵向排布，
   整页允许滚动，各表格在自身的 max-height 内滚动。
   这样在 1366×768 这类小屏上也不会把内容压成一条缝。
*/

body.page-dashboard {
    overflow: auto;
}

.page-dashboard .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

.dashboard {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 面板改为内容自适应，滚动交给 .table-wrap */
.page-dashboard .panel-body {
    overflow: visible;
    min-height: 120px;
}

.page-dashboard .table-wrap {
    height: auto;
    max-height: 46vh;
    min-height: 160px;
}

.page-dashboard .panel-emails .table-wrap {
    max-height: 52vh;
}

.page-dashboard .panel-records .table-wrap {
    max-height: 40vh;
}

/* ---------- 概览卡片 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px 18px 15px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* 左侧色条：一眼区分四张卡片 */
.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.stat-card.stat-usable::before {
    background: var(--success);
}

.stat-card.stat-pending::before {
    background: var(--warning);
}

.stat-card.stat-bots::before {
    background: #6b4fd0;
}

/* 运行时状态覆盖（放在后面才能盖住上面的默认色） */
.stat-card.is-warn::before {
    background: var(--warning);
}

.stat-card.is-ok::before {
    background: var(--success);
}

.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.stat-usable .stat-icon {
    background: var(--success-soft);
    color: var(--success);
}

.stat-pending .stat-icon {
    background: var(--warning-soft);
    color: var(--warning);
}

.stat-bots .stat-icon {
    background: #f0ecfd;
    color: #6b4fd0;
}

.stat-value {
    font-size: 27px;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-foot {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-faint);
}

/* ---------- 机器人列表 ---------- */
.panel-hint {
    font-size: 11.5px;
    color: var(--text-faint);
    white-space: nowrap;
    margin-right: 4px;
}

.panel-bots .panel-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.panel-body-flat {
    padding: 0;
    overflow: visible;
}

.bot-list {
    display: flex;
    flex-direction: column;
}

/* 一个机器人一行：横向排布，不换行。
   备注 / 错误信息用省略号截断（悬停看完整内容），
   避免一条长错误把整个面板撑高。 */
.bot-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 18px;
    border-bottom: 1px solid #f1f3f8;
    transition: background-color 0.14s ease;
}

.bot-item:last-child {
    border-bottom: none;
}

.bot-item:hover {
    background: #f8faff;
}

.bot-item.is-off {
    opacity: 0.62;
}

.bot-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.bot-name {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.bot-main .badge {
    flex: 0 0 auto;
}

.bot-id {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--text-muted);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
}

.bot-meta-item {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: var(--text-faint);
}

.bot-sep {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--border-strong);
    user-select: none;
}

.bot-note {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11.5px;
    color: var(--text-muted);
}

.bot-error {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11.5px;
    color: var(--danger);
}

.bot-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 5px;
}

.bot-empty {
    padding: 22px 20px;
    text-align: center;
}

.bot-empty-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.bot-empty-hint {
    max-width: 620px;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-faint);
}

/* ---------- 机器人弹窗内的布局 ---------- */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.check-line input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
}

.modal-foot-right {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
}

/* 提示条与确认框里的换行按原样显示（后端拼的多行排查指引要用） */
.notice,
.confirm-text {
    white-space: pre-line;
}

/* ---------- 看板响应式 ---------- */
@media (max-width: 1180px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .panel-hint {
        display: none;
    }
}

@media (max-width: 760px) {
    .stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .stat-value {
        font-size: 24px;
    }

    .bot-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* 窄屏才允许机器人那一行折行，否则横向内容会被压得看不清 */
    .bot-main {
        flex-wrap: wrap;
        white-space: normal;
    }

    .bot-name {
        max-width: none;
    }

    .bot-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .form-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-dashboard .table-wrap {
        max-height: none;
    }
}
