* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.5;
}

.layout {
    display: flex;
    min-height: 100vh;
    background: #f5f7fa;
}

.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #2c3e50 0%, #243447 100%);
    color: #fff;
    padding: 20px 0;
    flex-shrink: 0;
    min-height: 100vh;
}

.sidebar-item {
    display: block;
    padding: 14px 20px;
    color: #dce7f3;
    text-decoration: none;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: all 0.2s ease;
    font-size: 14px;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: rgba(255,255,255,0.12);
    border-left-color: #7c9dff;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    background: #fff;
    padding: 16px 24px;
    box-shadow: 0 2px 12px rgba(15,23,42,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eef2f7;
}

.header .title {
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.2px;
}

.header .user-info {
    color: #666;
    font-size: 14px;
}

.header .user-info a {
    color: #667eea;
    text-decoration: none;
    margin-left: 12px;
}

.content {
    flex: 1;
    padding: 24px;
}

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.06);
    padding: 20px;
}

.panel > h2,
.panel > h3 {
    margin: 0 0 16px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 700;
}

.toolbar,
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    background: #f8fafc;
}

.page-toolbar .search-bar {
    margin-bottom: 0;
    flex: 1 1 380px;
    justify-content: flex-start;
}

.panel > .add-btn + .search-bar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    margin-left: 8px;
    vertical-align: middle;
}

.panel > .page-toolbar {
    margin-bottom: 15px;
}

.panel > .page-toolbar .add-btn,
.panel > .page-toolbar .btn {
    margin-bottom: 0;
}

.add-btn,
.btn,
.btn-primary,
.btn-default,
.btn-warning,
.btn-danger {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(15,23,42,0.06);
}

.add-btn,
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #5a6fe0 100%);
    color: #fff;
}

.btn-default {
    background: #f8fafc;
    color: #334155;
    border-color: #e2e8f0;
    box-shadow: none;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.add-btn:hover,
.btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.search-bar input,
.search-bar select,
.form-group input,
.form-group select,
.form-group textarea,
.form-row input,
.form-row select,
.form-row textarea {
    padding: 9px 12px;
    border: 1px solid #dce1e7;
    border-radius: 6px;
    font-size: 14px;
    color: #334155;
    background: #fff;
}

.search-bar input,
.search-bar select {
    background: #f8fafc;
}

.search-bar input:focus,
.search-bar select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    white-space: nowrap;
}

.table th {
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tr {
    transition: background 0.2s ease;
    height: 44px;
}

.table tr:hover {
    background: #f8fafc;
}

.form-group,
.form-row {
    margin-bottom: 16px;
}

.form-group label,
.form-row label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group textarea,
.form-row textarea {
    min-height: 100px;
    resize: vertical;
}

.btn-group,
.btn-row {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    box-shadow: none;
}

.permission-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-top: 8px;
}

.permission-box ul {
    list-style: none;
    padding-left: 18px;
    margin: 8px 0 0;
}

.permission-box > ul {
    padding-left: 0;
}

.permission-box li {
    margin-top: 8px;
}

.permission-box label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
    cursor: pointer;
}

.permission-box .parent-label {
    font-weight: 600;
    color: #0f172a;
}

.badge,
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.badge-success,
.status.available,
.status.on,
.status.enable {
    background: #d4edda;
    color: #155724;
}

.badge-danger,
.status.occupied,
.status.off,
.status.disable {
    background: #f8d7da;
    color: #721c24;
}

.status.maintenance {
    background: #fff3cd;
    color: #856404;
}

.status.completed {
    background: #d4edda;
    color: #155724;
}

.status.normal,
.status.pending {
    background: #d4edda;
    color: #155724;
}

.status.late,
.status.processing {
    background: #fff3cd;
    color: #856404;
}

.status.absent,
.status.done {
    background: #f8d7da;
    color: #721c24;
}

.status.pending {
    background: #fff3cd;
    color: #856404;
}

.status.processing {
    background: #dbeafe;
    color: #1d4ed8;
}

.action a {
    color: #4f46e5;
    text-decoration: none;
    margin-right: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    display: inline-block;
    line-height: 1.2;
    white-space: nowrap;
}

.action .delete {
    color: #dc2626;
    background: #fee2e2;
}

.type-tag,
.read-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.type-tag.type-1,
.read-tag.read-1 {
    background: #e0f2fe;
    color: #0369a1;
}

.type-tag.type-2 {
    background: #ede9fe;
    color: #6d28d9;
}

.type-tag.type-3 {
    background: #dcfce7;
    color: #15803d;
}

.type-tag.type-4 {
    background: #fef3c7;
    color: #b45309;
}

.read-tag.read-0 {
    background: #fee2e2;
    color: #b91c1c;
}

.content-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pagination {
    margin-top: 20px;
    text-align: right;
}

.pagination a {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    margin-left: 5px;
}

.btn-secondary {
    background: #95a5a6;
    color: #fff;
}

.form-control {
    width: 100%;
    max-width: 520px;
}

.page-title {
    margin-bottom: 20px;
}

.toolbar-right {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #8f8f94;
    font-size: 12px;
}

.text-warning {
    color: #f39c12;
}

.text-success {
    color: #07c160;
}

.text-danger {
    color: #e74c3c;
    font-weight: 600;
}

.text-info {
    color: #3498db;
}

.empty-state {
    text-align: center;
    color: #8f8f94;
    padding: 40px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-6 {
    margin-top: 6px;
}

.d-none {
    display: none !important;
}

.inline-block {
    display: inline-block;
}

.stat-row,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.04);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15,23,42,0.08);
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.04);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 150px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15,23,42,0.08);
}

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: #f8fafc;
}

.card-icon.blue {
    background: #eef2ff;
    color: #4f46e5;
}

.card-icon.green {
    background: #ecfdf3;
    color: #059669;
}

.card-icon.orange {
    background: #fff7ed;
    color: #ea580c;
}

.card-icon.red {
    background: #fef2f2;
    color: #dc2626;
}

.card-title {
    color: #64748b;
    font-size: 14px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin-top: auto;
}

.quick-stats {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.04);
    padding: 20px;
}

.quick-stats h3 {
    margin: 0 0 14px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 700;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #eef2f7;
}

.stats-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.stats-row .label {
    color: #64748b;
    font-size: 14px;
}

.stats-row .value {
    color: #0f172a;
    font-size: 15px;
    font-weight: 600;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.entry-link {
    text-decoration: none;
    color: inherit;
}

.entry-card {
    background: #fff;
    border: 1px solid #eaeef2;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.entry-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.entry-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.entry-desc {
    color: #8f8f94;
    font-size: 13px;
}

.chart-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.chart {
    padding: 8px 0;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    height: 220px;
    gap: 10px;
    margin-top: 16px;
}

.bar {
    flex: 1;
    min-height: 24px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
}

.bar-60 { height: 60%; }
.bar-80 { height: 80%; }
.bar-70 { height: 70%; }
.bar-95 { height: 95%; }
.bar-85 { height: 85%; }
.bar-90 { height: 90%; }
.bar-75 { height: 75%; }

.bar-label {
    font-size: 12px;
    color: #666;
}

.pie-chart {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    margin: 20px auto;
    background: conic-gradient(#667eea 0 40%, #764ba2 40% 70%, #f093fb 70% 90%, #f5576c 90% 100%);
    position: relative;
}

.pie-center {
    position: absolute;
    inset: 50px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.pie-center .total {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.pie-center .label {
    font-size: 12px;
    color: #8f8f94;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: #667eea;
}

.legend-color-primary {
    background: #667eea;
}

.legend-label {
    font-size: 14px;
}

.legend-color-purple {
    background: #764ba2;
}

.legend-color-pink {
    background: #f093fb;
}

.legend-color-red {
    background: #f5576c;
}

.required {
    color: #e74c3c;
}

.hint {
    font-size: 12px;
    color: #8f8f94;
    display: block;
    margin-top: 4px;
}

.image-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.preview img {
    display: block;
    max-width: 100%;
}

.level {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: #333;
    background: #ecf0f1;
}

.level.普通 {
    background: #ecf0f1;
    color: #666;
}

.level.银卡 {
    background: #f0f5ff;
    color: #4a6fe3;
}

.level.金卡 {
    background: #fff6df;
    color: #c97a00;
}

.level.钻石 {
    background: #fdf2f8;
    color: #b42318;
}

.shift-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: #fff;
}

.shift-1 { background: #3498db; }
.shift-2 { background: #2ecc71; }
.shift-3 { background: #f39c12; }
.shift-4 { background: #95a5a6; }

.priority {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.priority.high { background: #f8d7da; color: #721c24; }
.priority.medium { background: #fff3cd; color: #856404; }
.priority.normal { background: #fff3cd; color: #856404; }
.priority.low { background: #d4edda; color: #155724; }

.login-box {
    width: min(420px, calc(100% - 32px));
    margin: 80px auto;
    padding: 36px 32px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15,23,42,0.08);
}

.login-box h2 {
    margin: 0 0 20px;
    text-align: center;
    font-size: 24px;
    color: #0f172a;
}

.login-box .error {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-size: 14px;
}

.login-box .form-group {
    margin-bottom: 16px;
}

.login-box .form-group input {
    width: 100%;
}

.login-box .btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.login-tip {
    text-align: center;
    margin-top: 20px;
    color: #64748b;
    font-size: 12px;
}

.pagination-center {
    margin-top: 20px;
    text-align: center;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .content {
        padding: 15px;
    }

    .stat-row,
    .stats-grid,
    .dashboard-cards,
    .entry-grid,
    .chart-container {
        grid-template-columns: 1fr;
    }
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
}

.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
