:root {
    --bg: #f1f5fb;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #0f766e;
    --accent: #f97316;
    --surface: rgba(255, 255, 255, 0.78);
    --border: rgba(15, 23, 42, 0.1);
    --shadow: 0 20px 45px rgba(15, 23, 42, 0.14);
}

body[data-theme='dark'] {
    --bg: #0b1320;
    --text: #dbe7f6;
    --muted: #99a9bf;
    --primary: #22c55e;
    --accent: #fb923c;
    --surface: rgba(13, 23, 39, 0.78);
    --border: rgba(148, 163, 184, 0.22);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at 20% 10%, #d8efe5 0%, transparent 40%), radial-gradient(circle at 80% 0%, #fce8d6 0%, transparent 30%), var(--bg);
    color: var(--text);
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.auth-bg-shape {
    position: absolute;
    border-radius: 999px;
    filter: blur(6px);
}
.auth-shape-1 {
    width: 380px;
    height: 380px;
    background: linear-gradient(120deg, #0ea5e9, #14b8a6);
    top: -100px;
    left: -100px;
    opacity: 0.35;
}
.auth-shape-2 {
    width: 320px;
    height: 320px;
    background: linear-gradient(120deg, #fb7185, #f97316);
    right: -80px;
    bottom: -100px;
    opacity: 0.3;
}

.auth-card {
    width: min(420px, 92vw);
    padding: 2rem;
    border-radius: 1.25rem;
}
.auth-card h1 { margin: 0 0 0.5rem; font-family: 'Manrope', sans-serif; }
.auth-card p { margin: 0 0 1rem; color: var(--muted); }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    padding: 1.2rem;
    border-right: 1px solid var(--border);
    background: linear-gradient(200deg, rgba(15, 118, 110, 0.2), transparent 45%);
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 86px;
}

.brand-panel { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1rem; }
.brand-badge {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center; color: #fff; font-weight: 700;
    background: linear-gradient(130deg, var(--primary), #14b8a6);
}

.menu { display: grid; gap: 0.45rem; }
.menu-item {
    text-decoration: none;
    color: var(--text);
    padding: 0.75rem 0.8rem;
    border-radius: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease, background 0.2s ease;
}
.menu-item:hover { background: rgba(15, 118, 110, 0.14); transform: translateX(2px); }
.menu-item.active { background: linear-gradient(120deg, rgba(15, 118, 110, 0.22), rgba(34, 197, 94, 0.2)); }
.badge {
    font-size: 0.68rem;
    padding: 0.18rem 0.4rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.content { padding: 1rem 1.25rem; }
.topbar {
    margin-bottom: 1rem;
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-title { margin: 0; font-family: 'Manrope', sans-serif; font-size: 1.15rem; }
.topbar-subtitle { color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 0.8rem; }
.icon-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    cursor: pointer;
}

.profile-dropdown { position: relative; }
.profile-btn {
    width: 38px; height: 38px; border-radius: 50%; border: 0;
    background: linear-gradient(145deg, var(--primary), #14b8a6);
    color: #fff; font-weight: 700; cursor: pointer;
}
.profile-menu {
    position: absolute; right: 0; top: 46px; display: none; width: 210px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem;
}
.profile-dropdown.open .profile-menu { display: block; }

.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.page-transition { animation: fadeInUp 0.45s ease; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-head h2 { margin: 0; font-family: 'Manrope', sans-serif; }
.section-head p { margin: 0.35rem 0 1rem; color: var(--muted); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}
.card {
    border-radius: 1rem;
    padding: 1rem;
}
.card h3 { margin-top: 0; font-size: 1rem; }
.card p { color: var(--muted); margin-bottom: 0; }
.counter { font-size: 1.7rem; font-family: 'Manrope', sans-serif; color: var(--primary); }

.content-grid.two-col {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1rem;
}

.chart-wrap {
    position: relative;
    height: 300px;
    max-height: 300px;
    overflow: hidden;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.activity-list { margin: 0; padding-left: 1rem; display: grid; gap: 0.65rem; }
.activity-list li span { display: block; color: var(--muted); font-size: 0.9rem; }

.table-wrap { overflow-x: auto; }
.table-controls {
    display: flex;
    gap: 0.6rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.55rem;
}
.table-controls input {
    max-width: 220px;
}
.pagination {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.pagination button {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 8px;
    padding: 0.28rem 0.55rem;
    cursor: pointer;
}
.pagination button.active {
    background: var(--primary);
    color: #fff;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
th, td {
    text-align: left;
    padding: 0.65rem;
    border-bottom: 1px solid var(--border);
}

thead th { font-family: 'Manrope', sans-serif; }

.form-grid { display: grid; gap: 0.75rem; }
.form-grid.two-col { grid-template-columns: repeat(2, 1fr); }
label { font-weight: 500; font-size: 0.9rem; display: grid; gap: 0.3rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    background: rgba(255, 255, 255, 0.75);
}
body[data-theme='dark'] input,
body[data-theme='dark'] select,
body[data-theme='dark'] textarea {
    background: rgba(2, 6, 23, 0.5);
    color: var(--text);
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn.primary { background: linear-gradient(120deg, var(--primary), #14b8a6); color: #fff; }
.btn.secondary { background: rgba(100, 116, 139, 0.2); color: var(--text); }
.btn.danger { background: #dc2626; color: #fff; }
.btn.warn { background: #f97316; color: #fff; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    place-items: center;
    z-index: 20;
    padding: 1rem;
}
.modal.open {
    display: grid;
}
.modal-card {
    width: min(640px, 96vw);
    border-radius: 14px;
    padding: 1rem;
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
}

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; gap: 0.5rem; }

.toast {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 999;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    color: #fff;
    animation: slideIn 0.35s ease;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert.error {
    background: rgba(220, 38, 38, 0.14);
    color: #b91c1c;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
}

.muted { color: var(--muted); }
.pill { border-radius: 999px; padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.pill.active { background: rgba(22, 163, 74, 0.18); color: #15803d; }
.pill.inactive { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        width: min(280px, 78vw);
        z-index: 11;
        background: var(--bg);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .content-grid.two-col { grid-template-columns: 1fr; }
    .form-grid.two-col { grid-template-columns: 1fr; }
}
