:root {
    --primary: #d4a373;
    /* 品牌主色：金木色 */
    --primary-hover: #b88a5d;
    /* 悬停色 */
    --accent-pink: #e29578;
    /* 辅助色：嫩裸粉 */
    --bg-color: #0f172a;
    /* 深空大背景 */
    --card-bg: rgba(30, 41, 59, 0.5);
    /* 毛玻璃底层 */
    --card-border: rgba(255, 255, 255, 0.08);
    /* 极细边框线 */
    --text-main: #f8fafc;
    /* 主文本色 */
    --text-dim: #94a3b8;
    /* 辅助/暗淡文本 */
    --glass-blur: blur(20px);
    /* 标准模糊半径 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Global Floating Background */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    /* 略微减小模糊半径以增强色彩感 */
    opacity: 0.35;
    animation: float 20s ease-in-out infinite;
    mix-blend-mode: color-dodge;
    /* 切换为更高级的混合模式 */
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 163, 115, 0.4) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(148, 163, 184, 0.2) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(226, 149, 120, 0.25) 0%, transparent 70%);
    top: 30%;
    left: 20%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
    /* 确保卡片内文字默认为主白色 */
}

h1,
h2,
h3 {
    color: var(--text-main);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #d4a373);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 300;
}

.logo-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(212, 163, 115, 0.4));
}

.form-group {
    margin-bottom: 32px;
    position: relative;
}

.form-group input {
    width: 100%;
    height: 50px;
    /* 统一高度 */
    padding: 0 16px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.form-group label {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-dim);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    padding: 0 4px;
}

.form-group .focus-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.4s ease;
    box-shadow: 0 4px 10px rgba(212, 163, 115, 0.3);
}

/* 核心逻辑：Focus 或有值时，Label 浮起并在底部显示发光条 */
.form-group input:focus~label,
.form-group input:not(:placeholder-shown)~label,
.form-group select:focus~label,
.form-group select:valid~label,
.form-group select:not([value=""])~label {
    top: 0;
    transform: translateY(-50%) scale(0.85);
    left: 10px;
    background: #1e293b;
    /* 遮挡边框 */
    color: var(--primary);
    padding: 0 8px;
    z-index: 10;
}

.form-group input:focus~.focus-border,
.form-group .glass-select:focus~.focus-border {
    width: 100%;
}

.form-group input:focus {
    border-bottom-color: transparent;
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background-color: var(--primary);
    color: var(--bg-color);
    /* 改为背景深色以提升对比度和高级感 */
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.btn-submit:hover {
    background-color: var(--primary-hover);
    transform: scale(1.02);
}

.btn-submit:active {
    transform: scale(0.98);
}

/* Error message */
.error-msg {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
    margin-top: 15px;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.error-msg.show {
    opacity: 1;
}

/* Loading spinner */
/* Unified Custom UI Components */

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    /* Controlled by JS */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #1e293b;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    max-width: 650px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 30px;
    transform: scale(0.95);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary);
}

.modal-body {
    color: #cbd5e1;
    font-size: 15px;
    line-height: 1.6;
    overflow-y: auto;
    padding: 20px 10px 10px 0;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-footer {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(212, 163, 115, 0.5);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 163, 115, 0.8);
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 14px;
    min-width: 280px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.success {
    border-left-color: #22c55e;
}

/* Standardized Form Overwrites */
.form-group input,
.form-input,
input[type="number"],
input[type="date"],
input[type="month"],
input[type="text"] {
    background: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff !important;
    padding: 0 16px;
    height: 50px;
    line-height: 50px;
    border-radius: 12px;
    width: 100%;
    outline: none;
    transition: all 0.3s;
    font-size: 15px;
    color-scheme: dark;
}

/* 移除数字输入框的箭头以保持极简 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input:hover,
.form-input:hover,
input:focus {
    border-color: rgba(212, 163, 115, 0.3);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Loading spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -10px;
}

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

.btn-text {
    transition: opacity 0.2s;
}

.loading .btn-text {
    opacity: 0;
}

.loading .spinner {
    display: block;
}

/* Layout Container */
.layout-container {
    display: none;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

.layout-container.active {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 20px;
    margin-bottom: 40px;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.nav-item {
    padding: 14px 20px;
    margin-bottom: 10px;
    border-radius: 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
    display: block;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-item.active {
    background: var(--primary);
    color: var(--bg-color);
    /* 统一使用深蓝色文字 */
    box-shadow: 0 4px 15px rgba(212, 163, 115, 0.3);
}

.sidebar-footer {
    margin-top: auto;
}

/* Main Content Area */
.main-content {
    flex: 1;
    height: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    overflow-y: auto;
    position: relative;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.role-badge {
    background: var(--primary);
    color: var(--bg-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 10px;
}

/* Data Table / List Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: #94a3b8;
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background: rgba(234, 179, 8, 0.2);
    color: #fef08a;
}

.status-certified {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* Action Buttons */
.btn-action {
    height: 50px;
    padding: 0 24px;
    background: var(--primary);
    color: var(--bg-color);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(212, 163, 115, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: rgba(212, 163, 115, 0.1);
}

.btn-small {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    border-radius: 8px;
}

/* Picker & Action Row Alignment */
.date-picker-wrapper,
.search-box-standard {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0 15px;
    height: 50px;
    gap: 10px;
}

.date-picker-wrapper input,
.date-picker-wrapper select {
    background: transparent !important;
    border: none !important;
    height: 100% !important;
    padding: 0 !important;
    color: #fff !important;
    outline: none !important;
    color-scheme: dark;
    /* 修复深色背景下日期图标不可见的问题 */
}

.date-picker-wrapper input[type="date"] {
    width: 145px;
    /* 增加宽度确保日期能看全 */
}

.date-picker-wrapper input[type="month"] {
    width: 110px;
}

.entry-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Glass Select Implementation */
.glass-select {
    width: 100%;
    height: 50px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    padding: 0 40px 0 16px;
    font-size: 15px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23d4a373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.glass-select:focus {
    border-bottom-color: var(--primary);
    background: #1e293b; /* 使用完全不透明的深色背景 */
    box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.1);
}

.glass-select option {
    background-color: #1e293b !important; /* 强制背景色 */
    color: #ffffff !important;        /* 强制文字颜色 */
    padding: 12px;
}

.glass-select option:disabled {
    color: #64748b;
}

/* 兼容某些浏览器的悬停状态 */
.glass-select option:hover,
.glass-select option:focus,
.glass-select option:active {
    background-color: var(--primary);
    color: var(--bg-color);
}

/* --- Mobile Responsiveness --- */

@media (max-width: 1024px) {
    .layout-container {
        padding: 10px;
        gap: 10px;
    }

    .sidebar {
        width: 80px;
        padding: 30px 10px;
    }

    .sidebar h2,
    .sidebar .nav-item span {
        display: none;
    }

    .sidebar .nav-item {
        padding: 15px;
        text-align: center;
    }

    .sidebar .nav-item i {
        margin-right: 0 !important;
        width: 24px !important;
        height: 24px !important;
    }
}

@media (max-width: 768px) {
    body {
        display: block;
        padding-top: 70px;
        /* 为固定顶栏留出空间 */
    }

    .layout-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 0;
        gap: 0;
    }

    .sidebar {
        width: 100%;
        height: 70px;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        border-radius: 0;
        padding: 0 20px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* 隐藏页脚信息和默认导航，仅在激活时显示 */
    .sidebar .sidebar-header {
        margin-bottom: 0 !important;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar .sidebar-header h2 {
        display: block;
        margin: 0;
        font-size: 18px;
    }

    .sidebar nav,
    .sidebar .sidebar-footer {
        display: none;
    }

    .mobile-toggle {
        display: flex !important;
        align-items: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--primary);
        padding: 8px 15px;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .mobile-toggle:active {
        transform: scale(0.95);
        background: rgba(212, 163, 115, 0.1);
    }

    /* 侧边抽屉模式 */
    .sidebar.mobile-active {
        height: 100vh !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        padding: 20px;
        background: var(--bg-color);
        overflow-y: auto;
    }

    .sidebar.mobile-active .sidebar-header {
        margin-bottom: 30px !important;
        justify-content: space-between;
    }

    .sidebar.mobile-active nav {
        display: block;
        margin-bottom: 40px;
    }

    .sidebar.mobile-active .sidebar-footer {
        display: block;
        margin-top: auto;
        padding-bottom: 40px;
    }

    .sidebar.mobile-active .nav-item {
        display: flex;
        align-items: center;
        padding: 18px 20px;
        background: rgba(255, 255, 255, 0.03);
        margin-bottom: 10px;
        border-radius: 16px;
    }

    .sidebar.mobile-active .nav-item span {
        display: inline-block !important;
        font-size: 16px;
    }

    .main-content {
        border-radius: 0;
        padding: 20px;
        padding-bottom: 100px;
        border: none;
        background: transparent;
        overflow-x: hidden;
        min-height: calc(100vh - 70px);
    }

    /* 横屏优化 */
    @media (orientation: landscape) and (max-height: 500px) {
        .sidebar.mobile-active {
            padding: 15px;
        }

        .sidebar.mobile-active nav {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .sidebar.mobile-active .nav-item {
            margin-bottom: 0;
            padding: 12px 15px;
        }

        .sidebar.mobile-active .sidebar-header {
            margin-bottom: 15px !important;
        }
    }

    .page-header {
        flex-direction: column;
        /* 手机端标题和按钮纵向排列 */
        align-items: flex-start;
        gap: 15px;
    }

    .dashboard-grid,
    .stats-row,
    .entry-form-grid {
        grid-template-columns: 1fr !important;
    }

    .modal-content {
        padding: 20px !important;
        border-radius: 20px;
    }

    .modal-form-grid {
        grid-template-columns: 1fr !important;
    }

    .glass-card {
        padding: 20px !important;
    }

    /* 移动端列表转卡片布局：重点修复管理员看数据看不全的问题 */
    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table th,
    .data-table td,
    .data-table tr {
        display: block;
    }

    .data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .data-table tr {
        background: rgba(30, 41, 59, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 16px;
        margin-bottom: 15px;
        padding: 10px;
    }

    .data-table td {
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        position: relative;
        padding-left: 50% !important;
        text-align: right !important;
        min-height: 40px;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        text-align: left;
        font-weight: 600;
        color: var(--text-dim);
    }

    /* 专门优化操作栏：让按钮平铺 */
    .data-table td[data-label="操作"] {
        padding-left: 15px !important;
        text-align: center !important;
        display: flex;
        justify-content: flex-end;
        gap: 5px;
        border-bottom: none;
        padding-top: 20px;
    }

    .data-table td[data-label="操作"]::before {
        position: static;
        width: auto;
        margin-right: auto;
    }

    .data-table td[data-label="操作"] .btn-action {
        padding: 6px 8px !important;
        font-size: 12px !important;
        white-space: nowrap;
        flex: 0 0 auto;
    }
}

/* 兼容横屏观感：不再隐藏侧边栏，而是沿用移动端顶部条模式 */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        display: flex !important;
        padding: 10px 15px;
    }

    .sidebar h2 {
        font-size: 16px;
    }

    .main-content {
        padding: 15px;
        margin-top: 60px;
    }
}