:root {
    --primary: #009688; /* Medical Teal */
    --primary-dark: #00796b;
    --secondary: #455a64;
    --bg-body: #f4f7f6;
    --white: #ffffff;
    --text-dark: #263238;
    --text-grey: #78909c;
    --danger: #e53935;
    --success: #43a047;
    --warning: #fdd835; /* Yellow for logo */
    --sidebar-width: 260px;
}

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

body {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-dark);
}

/* --- LAYOUT --- */
.app-wrapper { display: flex; min-height: 100vh; }

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

/* BRAND LOGO */
.sidebar-header {
    padding: 30px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-logo { display: flex; align-items: center; gap: 15px; }

.brand-logo i {
    font-size: 28px;
    color: var(--warning);
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 20px; font-weight: 800; color: var(--white); text-transform: uppercase; letter-spacing: 0.5px; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,0.6); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }

/* NAV LINKS */
.sidebar-nav { flex: 1; padding: 20px 0; }
.nav-link {
    display: flex; align-items: center; padding: 15px 25px;
    color: rgba(255,255,255,0.7); text-decoration: none;
    transition: 0.2s; font-size: 15px;
}
.nav-link i { width: 30px; }
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1); color: white;
    border-right: 4px solid var(--warning);
}

.sidebar-footer { padding: 20px; font-size: 12px; text-align: center; opacity: 0.5; }

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    display: flex; flex-direction: column;
    transition: margin 0.3s ease;
}

/* TOPBAR */
.topbar {
    background: white; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#menu-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-dark); display: none; }
.user-profile { display: flex; align-items: center; gap: 10px; font-weight: bold; }
.avatar { width: 35px; height: 35px; background: var(--bg-body); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); }

/* --- VIEWS --- */
.content-body { padding: 25px; }
.view-section { display: none; animation: fadeIn 0.3s; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- DASHBOARD WIDGETS --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 25px; }
.kpi-card { background: white; padding: 20px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.02); display: flex; align-items: center; gap: 20px; border-top: 3px solid transparent; }
.kpi-card.blue { border-color: #1e88e5; }
.kpi-card.green { border-color: #43a047; }
.kpi-card.red { border-color: #e53935; }

.kpi-card .icon { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.kpi-card.blue .icon { background: #e3f2fd; color: #1e88e5; }
.kpi-card.green .icon { background: #e8f5e9; color: #43a047; }
.kpi-card.red .icon { background: #ffebee; color: #e53935; }

.kpi-card h3 { font-size: 14px; color: var(--text-grey); font-weight: normal; margin-bottom: 5px; }
.kpi-card p { font-size: 24px; font-weight: bold; }

.dashboard-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* --- COMPONENTS --- */
.card { background: white; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.02); padding: 20px; margin-bottom: 20px; }
.card-header { margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 10px; }

/* Forms */
.form-grid { display: flex; gap: 20px; flex-wrap: wrap; }
.form-group { flex: 1; margin-bottom: 15px; }
.big-select { flex: 2; }
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: var(--text-grey); }
input, select { width: 100%; padding: 12px; border: 1px solid #cfd8dc; border-radius: 6px; font-size: 16px; transition: 0.3s; }
input:focus, select:focus { border-color: var(--primary); }
.input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input-row input { flex: 1; }

/* Buttons */
.btn { padding: 12px 20px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-lg { width: 100%; font-size: 18px; margin-top: 10px; }

.pos-footer { margin-top: 20px; border-top: 2px dashed #eee; padding-top: 20px; }
.total-box { display: flex; justify-content: space-between; font-size: 24px; font-weight: bold; margin-bottom: 15px; color: var(--primary-dark); }

/* Tables */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { text-align: left; padding: 15px; background: #f9fafb; color: var(--text-grey); font-weight: 600; font-size: 14px; }
td { padding: 15px; border-bottom: 1px solid #eee; font-size: 15px; }
tr:hover { background: #f1f8e9; }

/* Charts & Lists */
.alert-list { list-style: none; }
.alert-list li { padding: 10px; border-bottom: 1px solid #eee; color: var(--text-dark); display: flex; align-items: center; gap: 10px; }
.alert-list li i { color: var(--danger); }

.bar-row { display: flex; align-items: center; gap: 15px; margin-bottom: 12px; }
.bar-label { width: 100px; text-align: right; font-size: 14px; font-weight: 600; }
.bar-wrapper { flex: 1; background: #eee; height: 12px; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); display: block; border-radius: 6px; }
.bar-value { width: 40px; font-size: 12px; color: #666; }

/* Reports */
.report-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.filter-btn { padding: 8px 15px; background: #eee; border: none; border-radius: 20px; cursor: pointer; }
.filter-btn.active { background: var(--text-dark); color: white; }
.report-summary span { margin-left: 15px; font-size: 16px; color: var(--primary-dark); }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.active { transform: translateX(0); box-shadow: 5px 0 15px rgba(0,0,0,0.2); }
    .main-content { margin-left: 0; }
    #menu-toggle { display: block; }
    .kpi-grid, .dashboard-widgets { grid-template-columns: 1fr; }
    .input-row { flex-direction: column; }
}