:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --primary: #166534;
    --primary-hover: #14532d;
    --border: #d1d5db;
    --danger: #991b1b;
    --font-body: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
    --font-display: "Space Grotesk", "Bahnschrift", "Aptos", var(--font-body);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: linear-gradient(135deg, #e5e7eb, #f9fafb);
    color: var(--text);
}

.admin-body {
    font-family: var(--font-display);
    background: radial-gradient(circle at top, rgba(20, 83, 45, 0.18), transparent 55%),
        linear-gradient(135deg, #fef3c7, #ecfdf5 40%, #e0f2fe 100%);
    min-height: 100vh;
}

.shell {
    max-width: 760px;
    margin: 48px auto;
    padding: 0 16px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    max-width: 1600px;
    width: min(1600px, calc(100vw - 48px));
    margin: 32px auto;
    padding: 0 20px 40px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 12px 26px rgba(17, 24, 39, 0.08);
    overflow: hidden;
}

.sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
    background: rgba(17, 24, 39, 0.86);
    color: #f9fafb;
    border-radius: 18px;
    padding: 22px 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.brand-sub {
    font-size: 13px;
    color: rgba(226, 232, 240, 0.8);
    margin-top: 4px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    margin-top: 0;
    width: 100%;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #f1f5f9;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.6);
}

.sidebar-actions button {
    margin-top: 0;
    width: 100%;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.content-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 18px;
}

.status-panel .section-header {
    margin-bottom: 0;
    align-items: flex-start;
}

.status-panel .section-actions {
    margin-left: auto;
    flex-shrink: 0;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: stretch;
    margin-top: 0;
}

.status-card {
    padding: 14px;
    border: 1px solid rgba(20, 83, 45, 0.16);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 253, 245, 0.85));
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-card-label {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.status-card-value {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.section-actions button {
    margin-top: 0;
    width: auto;
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.field-inline input {
    width: 90px;
}

.page-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(148, 163, 184, 0.12);
    padding: 6px 10px;
    border-radius: 999px;
}

.page-controls button {
    margin-top: 0;
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
}

.page-label {
    font-size: 13px;
    color: var(--muted);
}

.grid-two {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 18px;
}

.users-grid {
    grid-template-columns: minmax(240px, 25%) minmax(0, 1fr);
    align-items: start;
}

.create-user-column {
    min-width: 0;
}

#create-user-form {
    width: 100%;
    max-width: 100%;
}

h1,
h2 {
    margin: 0 0 8px;
}

h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.hint {
    margin-top: 0;
    color: var(--muted);
}

label {
    display: block;
    margin: 12px 0 6px;
}

input[type="text"],
input[type="password"],
input[type="file"],
input:not([type]) {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 15px;
}

select.filter-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 15px;
    background: #ffffff;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

button {
    margin-top: 14px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    font-size: 15px;
    cursor: pointer;
}

button:hover {
    background: var(--primary-hover);
}

button.secondary {
    background: #374151;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.actions {
    margin-top: 16px;
}

.message.error {
    color: var(--danger);
}

.message.success {
    color: var(--primary);
}

.result {
    margin-top: 12px;
    background: #111827;
    color: #d1fae5;
    border-radius: 8px;
    padding: 10px;
    min-height: 120px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
    min-width: 760px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 12px 8px;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

th {
    color: var(--muted);
    font-weight: 600;
}

td button {
    margin-top: 0;
    margin-right: 0;
    width: auto;
    padding: 6px 10px;
    font-size: 13px;
}

.text-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

.cell-detail {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-primary {
    min-width: 220px;
}

.cell-actions {
    min-width: 170px;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.table-actions .hint {
    margin: 0;
    white-space: nowrap;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(209, 213, 219, 0.8);
    border-radius: 12px;
    padding: 12px;
}

.filter-grid label {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.filter-input {
    margin-top: 6px;
}

.hidden {
    display: none;
}

@media (max-width: 640px) {
    .shell {
        margin: 20px auto;
    }

    .panel {
        padding: 14px;
    }

    .admin-shell {
        grid-template-columns: 1fr;
        width: calc(100vw - 24px);
        margin: 16px auto;
        padding: 0 12px 24px;
    }

    .sidebar {
        position: static;
    }

    .grid-two {
        grid-template-columns: 1fr;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-controls {
        width: 100%;
        justify-content: space-between;
    }

    .section-actions {
        width: 100%;
    }

    .section-actions button,
    .section-actions .field-inline,
    .section-actions .page-controls {
        width: 100%;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .status-panel .section-actions {
        margin-left: 0;
    }

    table {
        min-width: 640px;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Toast 通知样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out forwards;
    pointer-events: auto;
    font-size: 14px;
    line-height: 1.4;
}

.toast.success {
    border-left: 4px solid #16a34a;
    color: #15803d;
}

.toast.success::before {
    content: "✓";
    font-weight: bold;
    font-size: 18px;
    color: #16a34a;
}

.toast.error {
    border-left: 4px solid #991b1b;
    color: #7f1d1d;
}

.toast.error::before {
    content: "✕";
    font-weight: bold;
    font-size: 18px;
    color: #991b1b;
}

.toast.info {
    border-left: 4px solid #0ea5e9;
    color: #0369a1;
}

.toast.info::before {
    content: "ℹ";
    font-weight: bold;
    font-size: 18px;
    color: #0ea5e9;
}

.toast.hide {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* 文件预览样式 */
.file-preview {
    background: rgba(20, 83, 45, 0.08);
    border: 2px dashed var(--primary);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-name-display {
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--muted);
}

.upload-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.upload-actions button {
    margin-top: 0;
    padding: 10px 14px;
    font-size: 14px;
}

/* 上传进度条样式 */
.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #10b981);
    border-radius: 12px;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.progress-text {
    text-align: right;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

button.primary {
    background: var(--primary);
}

button.primary:hover {
    background: var(--primary-hover);
}

@media (max-width: 640px) {
    .toast-container {
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: none;
    }

    .upload-actions {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

