* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #07c160;
    --primary-dark: #06ad56;
    --danger: #e84040;
    --warning: #e6a23c;
    --info: #4a90d9;
    --border: #e8e8e8;
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --text: #333333;
    --text-secondary: #888888;
    --radius: 8px;
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
    --sidebar-width: 340px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* Common */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    user-select: none;
    gap: 4px;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d03535; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-text { background: transparent; border: none; color: var(--info); cursor: pointer; padding: 2px 6px; font-size: 13px; }
.btn-text:hover { color: var(--primary); }
.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { color: #d03535; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    font-size: 11px;
    line-height: 20px;
    background: #e8f8ee;
    color: var(--primary-dark);
}
.tag-blue { background: #e8f0fe; color: var(--info); }
.tag-orange { background: #fef6e8; color: var(--warning); }
.tag-red { background: #fef0f0; color: var(--danger); }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s;
}
.modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent;
    font-size: 20px; color: var(--text-secondary);
    cursor: pointer; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 2000;
    animation: fadeIn 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-success { background: #07c160; color: #fff; }
.toast-error { background: #e84040; color: #fff; }
.toast-info { background: #4a90d9; color: #fff; }

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}
.pagination button {
    min-width: 32px; height: 32px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar specific */
.sidebar-only { display: none; }

/* Responsive */
@media (max-width: 480px) {
    .modal { width: 95%; max-width: 100%; }
}
