/**
 * 百炼模型Key管理系统 - 现代化后台样式表
 */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-border: #c7d2fe;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #ffffff;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

code, kbd, samp {
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-badge {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 19px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

.logo-title {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.nav-menu {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-group-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    padding: 14px 12px 6px;
    letter-spacing: 0.8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: #94a3b8;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-item svg {
    width: 19px;
    height: 19px;
    stroke-width: 2;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 14px;
}

/* 主内容区域 */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.top-navbar {
    height: 68px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title-box h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-container {
    padding: 28px;
    flex: 1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

pre,
.code-block {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
    white-space: pre-wrap;
    box-sizing: border-box;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-light); color: var(--danger); }

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
    user-select: none;
    position: relative;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    cursor: not-allowed !important;
    pointer-events: none;
    box-shadow: none !important;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
    background: #64748b;
    border-color: #64748b;
    color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    border-color: #475569;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(100, 116, 139, 0.25);
}

.btn-light {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-light:hover:not(:disabled) {
    background: #f1f5f9;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* 按钮 Loading 状态与旋转图标 */
.btn-loading {
    pointer-events: none !important;
    opacity: 0.85 !important;
    cursor: wait !important;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btnSpinner 0.65s linear infinite;
    vertical-align: middle;
    flex-shrink: 0;
}

.spinner-sm {
    width: 12px;
    height: 12px;
    border-width: 2px;
}

@keyframes btnSpinner {
    to { transform: rotate(360deg); }
}

/* 表格样式 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}

/* 自定义现代平滑横向滚动条 */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    background: #f8fafc;
    padding: 13px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
    font-size: 14px;
    line-height: 1.5;
    white-space: nowrap;
}

.table code,
.table .code-inline {
    white-space: nowrap !important;
    word-break: keep-all !important;
}

.table .badge {
    white-space: nowrap;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* 移动端横向滑动提示 */
.mobile-scroll-tip {
    display: none;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
    padding: 4px 10px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    align-items: center;
    justify-content: space-between;
}

/* 分页容器标准样式 */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 13px;
    width: 100%;
}

.pagination-info {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px;
    max-width: 100%;
}

.pagination-controls::-webkit-scrollbar {
    height: 4px;
}
.pagination-controls::-webkit-scrollbar-track {
    background: transparent;
}
.pagination-controls::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.pagination-controls .btn,
.pagination-controls .btn-page {
    white-space: nowrap !important;
    word-break: keep-all !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
}

.pagination-controls .btn-page-num {
    min-width: 32px !important;
    padding: 0 8px !important;
    font-weight: 500;
}

.pagination-controls .pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-width: 20px;
    padding: 0 4px;
    color: #94a3b8;
    font-size: 13px;
    flex-shrink: 0;
    user-select: none;
}

/* 状态药丸标签 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-info {
    background: var(--primary-light);
    color: #3730a3;
}

/* 表单与输入框 */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

textarea.form-control {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.input-group {
    display: flex;
    gap: 8px;
}

.grid-2col,
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 弹窗 Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

/* 下拉菜单组件 (Dropdown) */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 0 !important;
    left: auto !important;
    z-index: 1050 !important;
    display: none;
    min-width: 220px !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    color: var(--text-main) !important;
    text-align: left !important;
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1) !important;
    animation: dropdownFadeIn 0.15s ease-out;
}

.dropdown-menu.show {
    display: block !important;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item,
button.dropdown-item,
a.dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 9px 16px !important;
    margin: 0 !important;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 14px !important;
    font-family: inherit !important;
    font-weight: 500 !important;
    color: #334155 !important;
    text-align: left !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
}

.dropdown-item:hover,
button.dropdown-item:hover,
a.dropdown-item:hover {
    color: var(--primary) !important;
    background-color: #f1f5f9 !important;
}

.dropdown-item.text-danger,
button.dropdown-item.text-danger,
a.dropdown-item.text-danger {
    color: #b91c1c !important;
}

.dropdown-item.text-danger:hover,
button.dropdown-item.text-danger:hover,
a.dropdown-item.text-danger:hover {
    color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

.dropdown-divider {
    height: 1px !important;
    margin: 5px 0 !important;
    overflow: hidden !important;
    background-color: #e2e8f0 !important;
    border: none !important;
}

.modal-backdrop.show {
    display: flex;
}

.modal-card,
.modal {
    background: #ffffff !important;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.modal-close:hover {
    color: #1e293b;
    background: #f1f5f9;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* 提示 Toast 系统 */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: #1e293b;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    max-width: 420px;
    word-break: break-word;
}

.toast.success {
    background: linear-gradient(135deg, #065f46, #047857);
    color: #ffffff;
    border-color: #059669;
}

.toast.error {
    background: linear-gradient(135deg, #991b1b, #b91c1c);
    color: #ffffff;
    border-color: #dc2626;
}

.toast.warning {
    background: linear-gradient(135deg, #92400e, #b45309);
    color: #ffffff;
    border-color: #d97706;
}

.toast.info {
    background: linear-gradient(135deg, #3730a3, #4338ca);
    color: #ffffff;
    border-color: #6366f1;
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 代码与复制块 */
.code-block {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    position: relative;
    overflow-x: auto;
    line-height: 1.6;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* 移动端汉堡菜单按钮与抽屉遮罩 */
.menu-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.menu-toggle-btn:hover {
    background: #e2e8f0;
}

.menu-toggle-btn svg {
    width: 22px;
    height: 22px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* 登录单页独立布局 */
.login-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 440px;
    padding: 38px 34px;
    animation: modalIn 0.3s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header .logo-badge {
    margin: 0 auto 16px;
    width: 52px;
    height: 52px;
    font-size: 24px;
}

.login-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

/* ==========================================================================
   📱 移动端与手机浏览器深度响应式适配 (@media 媒体查询)
   ========================================================================== */

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* 1. 抽屉式侧边栏 */
    .menu-toggle-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 270px;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* 2. 顶部导航栏与主体区域适配 */
    .top-navbar {
        height: auto;
        min-height: 60px;
        padding: 10px 14px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .page-title-box {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }

    .page-title-box h1 {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .top-actions {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    .top-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .content-container {
        padding: 14px 10px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .card {
        padding: 16px 12px;
        margin-bottom: 16px;
        border-radius: var(--radius-md);
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
        max-width: 100%;
    }

    .card-header > div:first-child {
        width: 100%;
        max-width: 100%;
    }

    .card-header > div:last-child {
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 3. 统计卡片与网格单列化 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        width: 100%;
        max-width: 100%;
    }

    .grid-2col,
    .form-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100%;
        max-width: 100%;
    }

    .stat-card {
        padding: 16px;
    }

    /* 4. 弹窗 Modal 手机全屏适配 */
    .modal-backdrop {
        padding: 10px;
        align-items: flex-end;
    }

    .modal-card,
    .modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 92vh !important;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        margin: 0;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
        font-size: 14px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 110px;
        padding: 10px 14px;
    }

    /* 5. 表单输入与触控优化 (防 iOS 放大跳动) */
    .form-control,
    input.form-control,
    select.form-control,
    textarea.form-control {
        font-size: 16px !important;
        padding: 9px 12px;
    }

    .input-group {
        flex-direction: column;
        gap: 6px;
    }

    .input-group .btn {
        width: 100%;
    }

    /* 6. Toast 移动端居中 */
    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        align-items: center;
    }

    .toast {
        width: 100%;
        max-width: 100%;
        font-size: 13px;
        padding: 10px 14px;
    }

    /* 7. 登录卡片移动端适配 */
    .login-card {
        padding: 26px 18px;
        border-radius: 12px;
    }

    .login-header h2 {
        font-size: 19px;
    }

    /* 8. 移动端表格横向顺畅滚动优化 (防止单字折行竖排，保持完整字段) */
    .mobile-scroll-tip {
        display: flex;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        width: calc(100% + 32px);
        padding: 0 16px;
        overflow-x: auto !important;
        overflow-y: hidden;
    }

    .table-responsive .table {
        width: max-content !important;
        min-width: 100%;
    }

    .table th,
    .table td {
        padding: 12px 14px;
        font-size: 13px;
        white-space: nowrap !important;
        word-break: keep-all !important;
    }

    .table td code {
        white-space: nowrap !important;
        word-break: keep-all !important;
        display: inline-block;
    }

    /* 移动端分页栏优化 */
    .pagination-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 14px;
    }

    .pagination-info {
        text-align: left;
        font-size: 13px;
    }

    .pagination-controls {
        width: 100%;
        overflow-x: auto;
        padding: 4px 0 6px 0;
        -webkit-overflow-scrolling: touch;
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .pagination-controls .btn,
    .pagination-controls .btn-page {
        height: 32px !important;
        min-width: 32px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width: 480px) {
    .btn {
        font-size: 13px;
    }

    .card-title {
        font-size: 15px;
    }
}
