/* ============================================================
   HR System —简洁专业风格/ 深色侧边栏+ 浅色内容区
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
    --sidebar-bg: #1a1d23;
    --sidebar-hover: #262a33;
    --sidebar-active: #2c313a;
    --sidebar-text: #9ca3af;
    --sidebar-text-active: #e5e7eb;
    --accent: #4f8ef7;
    --accent-light: #e8f0fe;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --card-bg: var(--surface);
    --border: #e5e7eb;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #e5e7eb;
    letter-spacing: 0.02em;
}

.brand-icon { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s ease;
}

.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }

.nav-sm { font-size: 13px; padding: 7px 12px; }

.nav-divider {
    height: 1px;
    background: #2c313a;
    margin: 8px 12px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 12px 4px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #2c313a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user {
    font-size: 13px; color: var(--sidebar-text);
}

.logout-btn {
    font-size: 12px; color: #ef4444; text-decoration: none;
    padding: 4px 10px; border-radius: 4px; transition: background 0.15s;
}
.logout-btn:hover { background: rgba(239,68,68,0.15); }

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 32px 40px;
    max-width: 1200px;
}

.main-content.full-width {
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Flash */
.flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash-msg {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.3s;
    max-width: 360px;
}

/* Page Header */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px; font-weight: 700; color: var(--text);
}

.page-header p {
    font-size: 14px; color: var(--text-secondary); margin-top: 4px;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px; font-weight: 600;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 28px; font-weight: 700; color: var(--text);
}

.stat-label {
    font-size: 13px; color: var(--text-secondary); margin-top: 4px;
}

.stat-card.warn .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }

/* Table */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: top;
}

tr:hover { background: #f9fafb; }

/* Table column widths */
.col-name { min-width: 140px; }
.col-id { min-width: 170px; }
.col-phone { min-width: 120px; }
.col-duration { min-width: 90px; }
.col-status { min-width: 90px; }
.col-date { min-width: 100px; }
.col-actions { min-width: 110px; width: 110px; }

/* Sortable column headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

th.sortable:hover {
    color: var(--accent);
}

th.sortable.sorted {
    color: var(--accent);
}

.sort-arrow {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.5;
}

th.sortable.sorted .sort-arrow {
    opacity: 1;
}

/* Dashboard toolbar */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.result-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* Search box with icon */
.search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
    min-width: 180px;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font);
    background: #f9fafb;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.search-box input:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79,142,247,0.1);
}

.select-sm {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    cursor: pointer;
    outline: none;
}

.select-sm:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,142,247,0.1);
}

/* Table card —reduced padding */
.table-card { padding: 0; }

.table-card .table-wrap { padding: 0; }

.table-card th { padding: 14px 18px; }
.table-card td { padding: 14px 18px; }

/* Employee name cell */
.emp-name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.emp-name-cell strong {
    font-size: 14px;
    color: var(--text);
}

.emp-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ID code style */
.id-code {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: none;
    padding: 0;
    border-radius: 0;
    letter-spacing: 0.02em;
}

/* Text muted */
.text-muted {
    font-size: 13px;
    color: var(--text-muted);
}

/* Resign date under status */
.resign-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Row action buttons (icon style) */
.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.15s;
    text-decoration: none;
}

.action-link:hover {
    background: #f0f4ff;
    color: var(--accent);
}

.action-link.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.delete-form {
    display: inline-flex;
    margin: 0;
}

.delete-form button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid.col-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.col-1 { grid-template-columns: 1fr; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }
.form-group.half { grid-column: span 1; }


/* ???? Tooltip */


.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="email"],
input[type="password"],
select,
textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,142,247,0.15);
}

textarea { resize: vertical; min-height: 60px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3b7de6; }

.btn-outline {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: #f9fafb; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active { background: var(--success-bg); color: #059669; }
.badge-resigned { background: var(--danger-bg); color: #dc2626; }
.badge-tag { background: #f0f4ff; color: #2563eb; font-size: 11px; margin-left: 6px; }

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar .search-input {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

/* Login Page */
.login-wrapper {
    width: 420px;
    max-width: 90vw;
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-logo { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.login-card h1 {
    font-size: 22px; font-weight: 700; margin-bottom: 4px; text-align: center;
}

.login-card .login-sub {
    font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; text-align: center;
}

.login-card .form-group { margin-bottom: 18px; }

.login-card .form-group label {
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 6px; display: block;
}

.login-card input {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 15px;
}

.login-card .btn-primary { width: auto; min-width: 200px; padding: 12px 32px; font-size: 15px; margin-top: 8px; justify-content: center; }

.login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 13px; color: var(--text-secondary);
}

.login-link a { color: var(--accent); text-decoration: none; font-weight: 500; }
.login-link a:hover { text-decoration: underline; }

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.info-grid .info-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.info-grid .info-item:nth-child(even) { border-right: none; }
.info-grid .info-item:nth-last-child(-n+2) { border-bottom: none; }

.info-item .info-label {
    font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px;
}

.info-item .info-value {
    font-size: 15px; color: var(--text); font-weight: 500;
}

/* Section Card */
.section-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.section-card-header {
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    font-size: 15px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

.section-card-body { padding: 24px; }

/* Action Bar */
.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-item {
    padding: 10px 20px;
    font-size: 14px; font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--accent); border-color: var(--accent); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; }



/* ============================================================
   Enhanced Table & Filter Components
   ============================================================ */

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px;
    flex: 1;
    min-width: 220px;
    color: var(--text-muted);
}

.filter-input {
    border: none;
    background: transparent;
    padding: 9px 0;
    font-size: 13px;
    outline: none;
    flex: 1;
    font-family: var(--font);
}

.filter-select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
    font-family: var(--font);
    cursor: pointer;
    min-width: 110px;
}

/* Data Table */
.data-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 12px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

/* 姓名列给足宽度，避免头像+姓名被挤压换行 */
.data-table td .name-link {
    min-width: 104px;
}

/* 操作列按钮组保持单行，避免被裁切 */
.data-table td .row-actions {
    flex-wrap: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Sortable Header */
.th-sort {
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: color 0.15s;
}

.th-sort:hover {
    color: var(--accent);
}

/* ID Badge */
.id-badge {
    display: inline-block;
    background: #f3f4f6;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    font-family: monospace;
}

/* Name Link & Avatar */
.name-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.name-link:hover {
    color: var(--accent);
}

.avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #7c5cfc);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.tag-green {
    background: #ecfdf5;
    color: #059669;
}

.tag-red {
    background: #fef2f2;
    color: #dc2626;
}

.tag-blue {
    background: #eff6ff;
    color: #2563eb;
}

.tag-gray {
    background: #f3f4f6;
    color: #6b7280;
}

/* Row Actions */
.row-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}

.action-link {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
}

.action-link:hover {
    background: #f3f4f6;
    color: var(--text);
}

.action-delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
    background: var(--surface);
}

.page-btn:hover {
    background: #f3f4f6;
    border-color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Enhanced Stat Card */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-body {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }

    .sidebar {
        width: 100%; min-width: 100%; height: auto; position: relative;
        padding-bottom: 12px;
    }

    .sidebar-brand { padding: 16px 20px 12px; }

    .sidebar-nav {
        flex-direction: row; flex-wrap: wrap; padding: 0 12px; gap: 4px;
    }

    .nav-item { font-size: 12px; padding: 8px 10px; }
    .nav-item svg { display: none; }
    .nav-divider, .nav-label, .nav-sm { display: none; }

    .sidebar-footer { padding: 12px 20px; font-size: 12px; }

    .main-content { padding: 16px; max-width: 100%; }

    .page-header h1 { font-size: 20px; }
    .page-header p { font-size: 13px; }

    /* Stats */
    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }

    /* Toolbar */
    .dashboard-toolbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; }
    .toolbar-left { flex-wrap: wrap; gap: 8px; }
    .toolbar-right { justify-content: space-between; }
    .search-box { max-width: 100%; }
    .search-box input { font-size: 16px; } /* prevent iOS zoom */

    /* Table */
    .table-card th, .table-card td { padding: 10px 12px; font-size: 13px; }
    .data-table th, .data-table td { padding: 10px 10px; }
    .col-id { min-width: 150px; }
    .emp-meta { font-size: 11px; }
    .id-code { font-size: 12px; }
    .row-actions { gap: 2px; }
    .action-link { width: 28px; height: 28px; }
    .action-link svg { width: 13px; height: 13px; }

    /* Forms */
    .form-grid { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .card-header h2 { font-size: 15px; }
    .section-card-body { padding: 16px; }
    .section-card-header { padding: 12px 16px; font-size: 14px; }

    /* Info Grid */
    .info-grid { grid-template-columns: 1fr; }
    .info-grid .info-item { border-right: none; }
    .info-item { padding: 12px 16px; }
    .info-item .info-value { font-size: 14px; }

    /* Login */
    .login-card { padding: 28px 20px; }
    .login-logo { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.login-card h1 { font-size: 20px; }

    /* Buttons */
    .btn { padding: 8px 16px; font-size: 13px; }
    .btn-sm { padding: 6px 12px; font-size: 12px; }

    /* Flash */
    .flash-container { top: 10px; right: 10px; left: 10px; }
    .flash-msg { max-width: 100%; font-size: 13px; padding: 10px 16px; }

    /* Empty state */
    .empty-state { padding: 32px 16px; }
    .empty-state .empty-icon { font-size: 32px; }

    /* Tabs */
    .tabs { overflow-x: auto; }
    .tab-item { padding: 8px 14px; font-size: 13px; white-space: nowrap; }
}

/* Status dot */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active { background: var(--success); }
.status-dot.resigned { background: var(--danger); }


/* ===== 入职类型 Tooltip ===== */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1;
    position: relative;
}
.tooltip-trigger .tooltip-text {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: #1e293b;
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 400;
    padding: 10px 14px;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    line-height: 1.7;
}
.tooltip-trigger .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}
.tooltip-trigger:hover .tooltip-text {
    display: block;
}


/* ===== Inline Edit ===== */
.inline-edit {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px dashed transparent;
    min-width: 40px;
}

.inline-edit:hover {
    background: #f0f4ff;
    border-color: var(--accent);
}

.inline-edit:focus {
    background: #f0f4ff;
    border-color: var(--accent);
    outline: none;
}

.inline-edit-saved {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
    animation: saveFlash 1s ease;
}

@keyframes saveFlash {
    0% { background: #d1fae5; }
    100% { background: var(--success-bg); }
}

/* ============================================================
   调休加班系统 — 扩展样式
   ============================================================ */

.main-content { max-width: 1440px; }

.sidebar-role { font-size: 11px; color: #6b7280; margin-top: 2px; }
.nav-count {
    margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: #ef4444; color: #fff;
    font-size: 11px; font-weight: 700; display: inline-flex;
    align-items: center; justify-content: center;
}

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header .btn-group { padding-top: 4px; }

.tag-yellow { background: #fffbeb; color: #b45309; }
.tag-purple { background: #f5f3ff; color: #7c3aed; }
.tag-orange { background: #fff7ed; color: #c2410c; }

.text-muted { color: var(--text-muted); }
.mono { font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', 'Consolas', monospace; }
.td-wrap { white-space: normal; min-width: 150px; max-width: 260px; line-height: 1.5; }
.hours-ok { color: #059669; }
.hours-warn { color: #b45309; font-weight: 600; }
.hours-danger { color: #dc2626; font-weight: 600; }
.muted { color: var(--text-muted); }
.warn { color: var(--warning); }
.ok { color: var(--success); }

.grid-2 {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 20px; align-items: stretch;
}
.grid-2 > .card { margin-bottom: 20px; display: flex; flex-direction: column; }
.grid-2 > .card > .card-tip { margin-top: auto; }

.stats-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-unit { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.days-pill {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    background: #f3f4f6; color: var(--text-secondary);
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.days-pill.warn { background: #fffbeb; color: #b45309; }
.days-pill.danger { background: #fef2f2; color: #dc2626; }

.notice {
    background: #eff6ff; border-left: 3px solid var(--accent);
    padding: 12px 16px; border-radius: 6px; font-size: 13px;
    color: #1e40af; line-height: 1.6; margin-bottom: 18px;
}
.notice strong { margin-right: 6px; }
.notice a { color: var(--accent); text-decoration: none; font-weight: 600; }
.notice-warn { background: #fffbeb; border-left-color: var(--warning); color: #92400e; }

/* 超管切换账号提示条 */
.impersonate-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.impersonate-bar form { margin: 0; }

.expiry-list { display: flex; flex-direction: column; }
.expiry-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 0; border-bottom: 1px solid #f3f4f6;
}
.expiry-item:last-child { border-bottom: none; }
.expiry-main { flex: 1; min-width: 0; }
.expiry-title { font-size: 14px; font-weight: 600; }
.expiry-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.card-tip {
    margin-top: 14px; padding-top: 12px; border-top: 1px solid #f3f4f6;
    font-size: 12px; color: var(--text-muted);
}
.card-tip a { color: var(--accent); text-decoration: none; font-weight: 600; }

.chart-bars {
    display: flex; align-items: flex-end; gap: 18px;
    padding: 8px 4px 0; overflow-x: auto;
}
.chart-col { flex: 1; min-width: 76px; display: flex; flex-direction: column; align-items: center; }
.chart-bar-group { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.chart-bar { width: 18px; border-radius: 4px 4px 0 0; transition: opacity .15s; }
.chart-bar:hover { opacity: .75; }
.chart-bar.ot { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.chart-bar.leave { background: linear-gradient(180deg, #34d399, #059669); }
.chart-month { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.chart-val { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.chart-legend { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.legend-dot.ot { background: #2563eb; }
.legend-dot.leave { background: #059669; }

.dept-bars { display: flex; flex-direction: column; gap: 12px; }
.dept-row { display: grid; grid-template-columns: 180px 1fr 64px; align-items: center; gap: 12px; }
.dept-name { font-size: 13px; color: var(--text); }
.dept-track { height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.dept-fill { height: 100%; background: linear-gradient(90deg, #93c5fd, #2563eb); border-radius: 4px; }
.dept-val { font-size: 13px; font-weight: 600; text-align: right; }

.quick-list { display: flex; flex-direction: column; }
.quick-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid #f3f4f6;
}
.quick-item:last-child { border-bottom: none; }
.quick-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.quick-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.quick-actions { display: flex; gap: 6px; flex-shrink: 0; }
.quick-actions form { margin: 0; }

.filter-bar .result-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.filter-bar .filter-select[type="month"] { min-width: 150px; }

.action-link {
    width: auto; height: 28px; padding: 0 8px;
    font-size: 12px; font-weight: 600; border-radius: 5px;
}
.action-link.action-delete { color: var(--danger); }
.action-link.action-delete:hover { background: var(--danger-bg); color: var(--danger); }
.row-actions form { display: inline-flex; margin: 0; }

.approve-form { display: flex; align-items: center; gap: 6px; }
.approve-form input[type="text"] {
    width: 150px; padding: 6px 10px; font-size: 12px; min-width: 0;
}

.form-actions {
    display: flex; gap: 10px; margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border);
}
.calc-box {
    padding: 10px 14px; background: #f9fafb; border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px; color: var(--text-secondary);
}
.calc-box strong { color: var(--accent); font-size: 16px; }
.section-title { font-size: 14px; font-weight: 600; margin: 22px 0 12px; }

.mode-switch { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 8px; }
.mode-switch label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text); cursor: pointer;
}

.leave-row {
    display: flex; gap: 10px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; margin-bottom: 10px; background: #fcfcfd;
}
.leave-row .leave-date { flex: 0 0 190px; }
.leave-row .leave-period { flex: 1; }
.leave-row .row-hours {
    min-width: 52px; text-align: center; font-size: 13px;
    font-weight: 600; color: var(--accent);
}
.leave-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.leave-total { font-size: 13px; color: var(--text-secondary); }
.leave-total strong { color: var(--accent); font-size: 17px; }

.manual-panel {
    margin-top: 16px; padding: 16px; background: #f9fafb;
    border: 1px solid var(--border); border-radius: 8px;
}
.manual-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.manual-head .btn { margin-left: auto; }
.manual-list { max-height: 320px; overflow: auto; }
.manual-list .data-table { min-width: 0; background: #fff; }
.manual-list .data-table th, .manual-list .data-table td { padding: 9px 12px; }

.table-compact { min-width: 0; }
.table-compact th { padding: 10px 12px; }
.table-compact td { padding: 10px 12px; }

.log-diff {
    font-size: 11px; color: var(--text-secondary); white-space: normal;
    max-width: 240px; word-break: break-all; line-height: 1.5;
}

.import-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.error-list {
    margin: 0; padding: 12px 16px 12px 32px; background: var(--danger-bg);
    border-radius: 6px; font-size: 12px; color: #b91c1c;
    max-height: 260px; overflow: auto; line-height: 1.7;
}
.import-form { display: flex; flex-direction: column; gap: 18px; }
.import-form .btn { align-self: flex-start; }
.import-form input[type="file"] {
    padding: 16px; border: 1px dashed var(--border); border-radius: 8px;
    background: #f9fafb; font-size: 13px; width: 100%;
}
.import-form + .notice { margin: 22px 0 0; }

/* 登录 / 注册 */
body.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1200px 600px at 10% 0%, #e8f0fe 0%, transparent 60%),
                radial-gradient(900px 500px at 100% 100%, #ede9fe 0%, transparent 55%),
                var(--bg);
    padding: 40px 16px;
}
body.auth-body .login-wrapper { width: 420px; }
body.auth-body .login-wrapper-wide { width: 620px; max-width: 100%; }
.auth-body .login-card { padding: 36px 40px; }
.login-card select {
    width: 100%; padding: 12px 14px; font-size: 15px;
    border: 1px solid var(--border); border-radius: 6px;
}
.login-card form .btn-primary { width: 100%; margin-top: 6px; }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.login-grid .form-group.full { grid-column: 1 / -1; }
.auth-error {
    background: var(--danger-bg); color: #b91c1c; font-size: 13px;
    padding: 10px 14px; border-radius: 6px; margin-bottom: 18px;
    border-left: 3px solid var(--danger);
}
.auth-foot { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 20px; line-height: 1.6; }
.role-hint { font-size: 12px; color: var(--text-secondary); background: #f9fafb; border-radius: 6px; padding: 9px 12px; margin: 4px 0 6px; }

/* 账号管理 */
.account-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.account-form .filter-select { min-width: 104px; }
.account-pwd { width: 124px; padding: 6px 10px; font-size: 12px; }

/* 新增账号表单 */
.account-create {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 16px; padding: 4px 0 0;
}
.account-create .form-group { margin: 0; }
.account-create .form-group label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.account-create .form-group input,
.account-create .form-group select { width: 100%; }
.account-create-btn { display: flex; align-items: flex-end; justify-content: flex-end; align-self: start; }
.account-create .form-hint { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }

/* 员工模糊搜索选择 */
.emp-picker { position: relative; }
.emp-picker input[type="text"] { width: 100%; }
.emp-picker-list {
    position: absolute; z-index: 30; left: 0; top: calc(100% + 4px);
    width: max-content; min-width: 288px; max-width: min(440px, 90vw);
    max-height: 266px; overflow-y: auto; scrollbar-gutter: stable; padding: 4px;
    background: #fff; border: 1px solid #dfe4ee; border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
}
.emp-item {
    display: grid; grid-template-columns: 78px 64px 88px minmax(0, 1fr);
    align-items: center; column-gap: 12px; white-space: nowrap;
    height: 32px; padding: 0 8px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.emp-item:hover, .emp-item.active { background: #eef4ff; }
.emp-item.disabled { background: #fafbfd; cursor: not-allowed; }
.emp-item.disabled .emp-name, .emp-item.disabled .emp-no { color: #9aa3b2; }
.emp-no {
    font-size: 12px; color: #8a93a4;
    font-family: Consolas, "Courier New", monospace; letter-spacing: .2px;
}
.emp-name { font-weight: 600; color: var(--text-primary); }
.emp-dept { font-size: 12px; color: #9aa3b2; }
.emp-tag {
    font-size: 11px; color: #b26a00; background: #fff7e6;
    border: 1px solid #ffe0b2; border-radius: 4px; padding: 0 4px;
}
.emp-empty { padding: 10px; font-size: 12px; color: #9aa3b2; text-align: center; }
.form-hint.is-error { color: #d93025; }

/* 数据范围切换（综合部门主管） */
.scope-switch {
    padding: 10px 12px; margin-bottom: 12px;
    background: #f5f7ff; border: 1px solid #e2e8f5; border-radius: 8px;
}
.scope-label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.scope-pills { display: flex; flex-direction: column; gap: 6px; }
.scope-pill {
    display: block; padding: 6px 10px; border-radius: 5px;
    font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--text-secondary);
    text-decoration: none; background: #fff; border: 1px solid #e2e8f5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scope-pill:hover { color: var(--accent); }
.scope-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 1200px) {
    .stats-row-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .stats-row-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-grid { grid-template-columns: 1fr; }
    .dept-row { grid-template-columns: 110px 1fr 56px; }
    .leave-row { flex-wrap: wrap; }
    .leave-row .leave-date { flex: 1 1 100%; }
    .main-content { padding: 16px; }
    .page-header { flex-direction: column; }
}
