/* =============================================
   SISTEM POSYANDU — Premium Admin Style
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-w: 228px;
    --topbar-h: 56px;
    /* Primary pink-white theme */
    --navy: #ffffff;
    /* sidebar background -> white */
    --navy-2: #fffafc;
    --navy-3: #fff3f3;
    --blue: #F4C2C2;
    /* primary accent (pink) */
    --blue-light: #fff5f5;
    --green: #F4C2C2;
    /* alias for other accent usage */
    --green-light: #fff5f5;
    --green-dark: #E89B9B;
    --purple: #a855f7;
    --purple-light: #fdf4ff;
    --orange: #f97316;
    --orange-light: #fff7ed;
    --red: #ef4444;
    --red-light: #fef2f2;
    --amber: #f59e0b;
    --amber-light: #fffbeb;
    --white: #ffffff;
    --bg: #fffafa;
    /* page background - very light pink/white */
    --border: #f3e6e6;
    /* soft border */
    --text: #1f2937;
    /* dark text for contrast */
    --muted: #6b7280;
    --muted-2: #94a3b8;
    --font: 'Inter', -apple-system, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}


/* ── SIDEBAR ── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: -0.2px;
}

.brand-sub {
    font-size: 10px;
    color: #475569;
    margin-top: 1px;
}

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

.nav-section-label {
    font-size: 9px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 10px 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    margin-bottom: 2px;
    position: relative;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.nav-item.active {
    background: rgba(244, 194, 194, 0.35);
    color: var(--text);
    border-left-color: var(--blue);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 980px;
    line-height: 1.4;
}

.nav-badge.blue {
    background: var(--blue);
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-username {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
}

.sidebar-role {
    font-size: 10px;
    color: #475569;
}

.btn-logout {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: #64748b;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}


/* ── TOPBAR ── */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 99;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-page {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.topbar-breadcrumb {
    font-size: 12px;
    color: var(--muted);
}

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

.topbar-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
}

.topbar-btn:hover {
    background: var(--border);
}

.topbar-btn i {
    font-size: 16px;
    color: var(--muted);
}

.notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: var(--red);
    border-radius: 50%;
    border: 1.5px solid white;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.topbar-user:hover {
    background: var(--bg);
}

.topbar-av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    font-weight: 600;
}


/* ── MAIN ── */

.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-h));
}


/* ── PAGE HEADER ── */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.page-header p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px;
}


/* ── KPI CARDS ── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.kpi-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon i {
    font-size: 16px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
    color: var(--text);
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    margin-top: 6px;
    color: var(--muted);
}

.kpi-trend.up {
    color: var(--green-dark);
}

.kpi-trend.down {
    color: var(--red);
}

.kpi-trend i {
    font-size: 12px;
}


/* ── CARDS ── */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.card-sub {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 18px;
}

.card-link {
    font-size: 12px;
    font-weight: 500;
    color: var(--blue);
    text-decoration: none;
}

.card-link:hover {
    text-decoration: underline;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}


/* ── ACTIVITY LIST ── */

.act-list {
    display: flex;
    flex-direction: column;
}

.act-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.act-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.act-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.act-body {
    flex: 1;
    min-width: 0;
}

.act-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.act-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 980px;
    white-space: nowrap;
    flex-shrink: 0;
}


/* ── PROGRESS BARS ── */

.prog-item {
    margin-bottom: 14px;
}

.prog-item:last-child {
    margin-bottom: 0;
}

.prog-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
}

.prog-lbl {
    font-weight: 500;
    color: var(--text);
}

.prog-val {
    color: var(--muted);
}

.prog-bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 980px;
    overflow: hidden;
}

.prog-fill {
    height: 100%;
    border-radius: 980px;
    transition: width 0.6s ease;
}


/* ── TABLES ── */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fafbfc;
}

.td-name {
    font-weight: 500;
}

.td-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 1px;
}


/* ── BADGES ── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 980px;
    font-size: 11px;
    font-weight: 600;
}

.badge-balita {
    background: var(--green-light);
    color: #166534;
}

.badge-ibuhamil {
    background: var(--purple-light);
    color: #6b21a8;
}

.badge-lansia {
    background: var(--orange-light);
    color: #9a3412;
}

.badge-hadir {
    background: var(--green-light);
    color: #166534;
}

.badge-tidak {
    background: var(--red-light);
    color: #991b1b;
}

.badge-izin {
    background: var(--amber-light);
    color: #92400e;
}

.badge-segera {
    background: var(--green-light);
    color: #166534;
}

.badge-jadwal {
    background: var(--blue-light);
    color: #1e40af;
}


/* ── FORMS ── */

.btn-primary {
    background: var(--blue);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 155, 155, 0.35);
}

.btn-primary.green {
    background: var(--green-dark);
}

.btn-primary.green:hover {
    background: #15803d;
}

.btn-cancel {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
}

.btn-cancel:hover {
    background: var(--border);
}

.btn-sm {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: var(--blue-light);
    color: #1e40af;
}

.btn-edit:hover {
    background: var(--blue);
    color: white;
}

.btn-delete {
    background: var(--red-light);
    color: #991b1b;
}

.btn-delete:hover {
    background: var(--red);
    color: white;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    color: var(--text);
    background: #fafafa;
    outline: none;
    transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(244, 194, 194, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}


/* ── MODAL ── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

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

.modal-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


/* ── ALERTS ── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert.success {
    background: var(--green-light);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert.error {
    background: var(--red-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}


/* ── SEARCH + FILTER ── */

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    background: white;
    outline: none;
    transition: border-color 0.15s;
}

.toolbar input {
    flex: 1;
    min-width: 160px;
}

.toolbar input:focus,
.toolbar select:focus {
    border-color: var(--blue);
}


/* ── PAGINATION ── */

.pagination {
    display: flex;
    gap: 5px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.pagination a {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}

.pagination span.current {
    background: var(--blue);
    color: white;
}

.table-info {
    font-size: 12px;
    color: var(--muted);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    flex-wrap: wrap;
    gap: 10px;
}


/* ── CHART CANVAS ── */

.chart-container {
    position: relative;
}


/* ── ABSENSI KHUSUS ── */

.absensi-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.absensi-stat {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 16px;
    text-align: center;
}

.absensi-stat-num {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

.absensi-stat-lbl {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 500;
}


/* ── SCROLLBAR ── */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-2);
}