:root {
    --sidebar-width: 260px;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --border: #e2e8f0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'Sarabun', sans-serif; background: var(--bg-light); color: var(--text-main); display: flex; min-height: 100vh; overflow-x: hidden; }

/* Sidebar Layout */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-brand {
    padding: 30px 25px;
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 15px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 15px;
}

.nav-link i { width: 20px; text-align: center; font-size: 18px; }
.nav-link:hover { background: #f1f5f9; color: var(--primary); }
.nav-link.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }

/* User Profile Section in Sidebar */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: #fdfdfd;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 40px;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.admin-header h1 { font-size: 28px; font-weight: 800; color: #0f172a; }

/* Dashboard Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.metric-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.metric-card span { font-size: 13px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.metric-card strong { display: block; font-size: 32px; margin-top: 8px; font-weight: 800; color: #0f172a; }

/* Content Cards */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.04);
    margin-bottom: 30px;
}

.card h2 { font-size: 18px; font-weight: 700; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; }

/* Modern Table */
.table-responsive { overflow-x: auto; margin: 0 -15px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 20px; background: #f8fafc; font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; border-bottom: 1px solid var(--border); }
td { padding: 18px 20px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }

/* Status Badges */
.pill { padding: 5px 12px; border-radius: 30px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.pill.pending { background: #fef9c3; color: #854d0e; }
.pill.created { background: #dcfce7; color: #15803d; }
.pill.failed { background: #fee2e2; color: #b91c1c; }

/* Buttons */
button { padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
button.primary { background: var(--primary); color: white; }
button.primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }

.error-msg { background: #fff1f2; color: #be123c; padding: 12px; border-radius: 10px; font-size: 13px; margin-top: 10px; border-left: 4px solid var(--error); }

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .sidebar { width: 80px; }
    .sidebar-brand span, .nav-link span, .sidebar-footer span { display: none; }
    .sidebar-brand, .nav-link { justify-content: center; padding: 15px; }
    .main-content { margin-left: 80px; width: calc(100% - 80px); }
}
