:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --topbar-height: 56px;
    --main-bg: #f1f5f9;
    --card-radius: 8px;
}

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

body {
    font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--main-bg);
    font-size: 14px;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-header i {
    font-size: 24px;
}

.sidebar-nav {
    padding: 8px 0;
}

.nav-group {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 14px;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-group.active > .nav-group-toggle,
.nav-group.active > .nav-link {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

.nav-link i {
    font-size: 18px;
    min-width: 20px;
}

.toggle-icon {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
}

.nav-group.expanded .toggle-icon {
    transform: rotate(180deg);
}

.nav-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.expanded .nav-sub {
    max-height: 500px;
}

.nav-sub-item {
    padding-left: 50px !important;
    font-size: 13px;
}

.nav-sub-item i {
    font-size: 14px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    transition: margin 0.3s ease;
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.btn-toggle {
    background: none;
    border: none;
    font-size: 22px;
    color: #475569;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-toggle:hover {
    color: #1e293b;
}

.topbar-right {
    display: flex;
    align-items: center;
}

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

.user-info i {
    font-size: 20px;
    margin-right: 4px;
}

/* Page Content */
.page-content {
    padding: 20px;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 16px;
    font-weight: 600;
}

/* Stats Cards */
.stat-card {
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: rgba(255,255,255,0.2);
}

.stat-card .stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-card .stat-info p {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
}

.bg-gradient-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-gradient-green { background: linear-gradient(135deg, #10b981, #059669); }
.bg-gradient-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-gradient-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.bg-gradient-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-gradient-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.table tbody td {
    font-size: 14px;
    vertical-align: middle;
}

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

/* Buttons */
.btn {
    font-size: 14px;
    border-radius: 6px;
}

.btn-sm {
    font-size: 13px;
}

/* Badges */
.badge {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #d1fae5; color: #065f46; }

/* Forms */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

/* Filters */
.filter-bar {
    background: #fff;
    padding: 16px;
    border-radius: var(--card-radius);
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Pagination */
.pagination {
    margin: 16px 0 0;
    justify-content: center;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-box {
    width: 400px;
    max-width: 90%;
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 8px;
    color: #1e293b;
}

.login-box .subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 30px;
    font-size: 14px;
}

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

.login-box .btn-login {
    width: 100%;
    padding: 10px;
    font-size: 16px;
}

.login-box .logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-box .logo i {
    font-size: 48px;
    color: #3b82f6;
}

/* Print styles */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    body { background: #fff; }
    .print-area { display: block !important; }
}

.print-area { display: none; }

/* Status badge */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

/* Modal */
.modal-header {
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-weight: 600;
}

/* Item table in forms */
.item-table th {
    background: #f1f5f9 !important;
}

.item-table input, .item-table select {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
    width: 100%;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
}
