:root {
    --primary: #1e3a8a;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    --secondary: #0f172a;
    --accent: #0d9488;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-w: 265px;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
}

/* Badges & Buttons */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    font-size: 12px; font-weight: 600; border-radius: 999px;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-gray { background: #f1f5f9; color: #475569; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--primary); color: #fff; border: none;
    padding: 9px 16px; border-radius: 7px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: all 0.15s ease;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-green { background: #059669; }
.btn-green:hover { background: #047857; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: #f8fafc; }

/* Cards & Forms */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 18px;
}
.card-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--secondary); }

label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], select, textarea {
    width: 100%; padding: 9px 12px; margin-bottom: 14px;
    border: 1px solid #cbd5e1; border-radius: 7px; font-size: 14px;
    font-family: inherit; background: #fff; color: var(--text-main);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,138,0.12);
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    background: #f8fafc; color: #475569; font-weight: 600; text-transform: uppercase;
    font-size: 11px; letter-spacing: 0.04em; padding: 12px 14px; text-align: left;
    border-bottom: 2px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f8fafc; }

/* Alerts */
.alert {
    padding: 13px 16px; border-radius: 8px; margin-bottom: 20px;
    font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px;
}
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Grid Helpers */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }

/* Admin Layout with Sidebar */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: #0f172a; color: #cbd5e1;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    transition: transform 0.25s ease;
}
.sidebar-brand {
    padding: 20px 22px; font-size: 18px; font-weight: 800; color: #fff;
    border-bottom: 1px solid #1e293b; display: flex; align-items: center; gap: 10px;
}
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-section {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b; font-weight: 700; padding: 12px 12px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    color: #cbd5e1; text-decoration: none; border-radius: 7px; font-size: 14px;
    font-weight: 500; margin-bottom: 3px; transition: all 0.15s;
}
.nav-link:hover { background: #1e293b; color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 15px; border-top: 1px solid #1e293b; font-size: 12px; color: #94a3b8; }

.admin-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 64px; background: #fff; border-bottom: 1px solid var(--border);
    padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30;
}
.admin-content { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; flex: 1; }
.admin-footer {
    background: #fff; border-top: 1px solid var(--border); padding: 16px 28px;
    font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between;
}

/* Public Frontend Layout */
.pub-topbar { background: #0f172a; color: #94a3b8; font-size: 12px; padding: 6px 0; }
.pub-container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.pub-header {
    background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.pub-nav-wrap {
    display: flex; justify-content: space-between; align-items: center; height: 72px;
}
.pub-logo { font-size: 21px; font-weight: 800; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.pub-menu { display: flex; align-items: center; gap: 22px; }
.pub-menu a { text-decoration: none; color: #334155; font-weight: 600; font-size: 14px; }
.pub-menu a:hover, .pub-menu a.active { color: var(--primary); }

.hero-banner {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #fff; padding: 54px 20px; margin-bottom: 32px;
}
.pub-footer {
    background: #0f172a; color: #cbd5e1; padding: 48px 0 24px; margin-top: 60px;
}
.pub-footer a { color: #94a3b8; text-decoration: none; font-size: 14px; }
.pub-footer a:hover { color: #fff; }

/* Stat Cards */
.stat-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow);
}
.stat-val { font-size: 28px; font-weight: 800; color: var(--secondary); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* Mobile Responsive */
.mobile-toggle { display: none; background: none; border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px; font-size: 18px; cursor: pointer; }
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .mobile-toggle { display: inline-block; }
}