/* ==========================================================================
   Posyandu Kalijaga Timur — Design System
   ========================================================================== */

:root {
    --brand-950: #071f3a;
    --brand-900: #0a2f55;
    --brand-800: #0d3f72;
    --brand-700: #0f4c81;
    --brand-600: #1565a8;
    --brand-500: #1d7bc7;
    --brand-100: #e3effa;
    --brand-50:  #f1f7fd;

    --teal-600:  #0f9b8e;
    --teal-100:  #dcf5f2;
    --rose-600:  #d6456b;
    --rose-100:  #fde7ed;
    --amber-600: #d98a0b;
    --amber-100: #fdf2d9;
    --green-600: #1f9d63;
    --green-100: #dff5ea;

    --bg:        #f4f6fa;
    --surface:   #ffffff;
    --border:    #e3e8f0;
    --text:      #1a2a3d;
    --muted:     #64748b;

    --radius:    14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 35, 66, .05), 0 1px 3px rgba(15, 35, 66, .04);
    --shadow-md: 0 8px 24px rgba(15, 35, 66, .08);
    --sidebar-w: 268px;

    --bs-primary: var(--brand-600);
    --bs-primary-rgb: 21, 101, 168;
    --bs-body-font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
    --bs-link-color: var(--brand-600);
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--bs-body-font-family);
    background: var(--bg);
    color: var(--text);
    font-size: .94rem;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { letter-spacing: -.015em; }
.text-muted { color: var(--muted) !important; }

/* ---------- Buttons & forms ---------- */
.btn { font-weight: 600; border-radius: var(--radius-sm); padding: .5rem 1.1rem; }
.btn-sm { padding: .32rem .75rem; border-radius: 8px; font-size: .82rem; }
.btn-lg { padding: .75rem 1.6rem; border-radius: 12px; }
.btn-primary {
    --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg: var(--brand-800); --bs-btn-active-border-color: var(--brand-800);
    --bs-btn-disabled-bg: var(--brand-600); --bs-btn-disabled-border-color: var(--brand-600);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand-600); --bs-btn-border-color: #b9d3ea;
    --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
}
.btn-light-soft { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-light-soft:hover { background: var(--brand-50); border-color: #b9d3ea; color: var(--brand-700); }

.form-label { font-weight: 600; font-size: .8rem; color: #3b4b61; margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: var(--radius-sm); border-color: #d5dde8; padding: .55rem .85rem; font-size: .92rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500); box-shadow: 0 0 0 .22rem rgba(29, 123, 199, .15);
}
.form-control::placeholder { color: #a3afbf; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: #8a98ab; pointer-events: none; }
.input-icon .form-control { padding-left: 2.6rem; }
.input-icon .toggle-pass {
    position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: #8a98ab; padding: .4rem .6rem; border-radius: 8px;
}
.input-icon .toggle-pass:hover { color: var(--brand-600); background: var(--brand-50); }

/* ---------- Layout aplikasi (sidebar + konten) ---------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-950) 100%);
    color: #fff; display: flex; flex-direction: column;
    transform: translateX(-100%); transition: transform .25s ease;
}
.app-sidebar .brand {
    display: flex; align-items: center; gap: .75rem; padding: 1.35rem 1.4rem;
    text-decoration: none; color: #fff;
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, #2f9bea, var(--teal-600));
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff;
}
.brand-name { font-weight: 800; line-height: 1.1; font-size: 1.02rem; }
.brand-sub { font-size: .72rem; color: rgba(255,255,255,.6); letter-spacing: .02em; }

.nav-caption {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
    color: rgba(255,255,255,.4); padding: 1.1rem 1.6rem .4rem; font-weight: 700;
}
.app-sidebar .nav-link {
    color: rgba(255,255,255,.74); display: flex; align-items: center; gap: .8rem;
    padding: .68rem 1rem; margin: .12rem .9rem; border-radius: 10px; font-weight: 500;
    transition: background .15s, color .15s;
}
.app-sidebar .nav-link i { font-size: 1.05rem; opacity: .9; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar .nav-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 #5cc2ff; }

.sidebar-user {
    margin-top: auto; padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: .75rem;
}
.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; font-weight: 700;
    background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-user .name { font-weight: 700; font-size: .88rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .role { font-size: .74rem; color: rgba(255,255,255,.55); }
.sidebar-user .logout { margin-left: auto; color: rgba(255,255,255,.6); font-size: 1.15rem; padding: .35rem; border-radius: 8px; }
.sidebar-user .logout:hover { color: #fff; background: rgba(255,255,255,.1); }

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(7, 31, 58, .5); z-index: 1035;
    opacity: 0; visibility: hidden; transition: opacity .25s;
}
body.sidebar-open .app-sidebar { transform: none; }
body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }

.app-main { min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1020; background: rgba(255,255,255,.86); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); padding: .7rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
}
.app-topbar .menu-btn { border: 1px solid var(--border); background: #fff; border-radius: 10px; width: 40px; height: 40px; font-size: 1.2rem; }
.app-topbar .crumb { font-weight: 700; color: var(--text); }
.app-topbar .crumb small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; }
.topbar-date {
    margin-left: auto; display: none; align-items: center; gap: .45rem; color: var(--muted); font-size: .84rem;
    background: var(--bg); padding: .45rem .85rem; border-radius: 999px; font-weight: 500;
}
.app-content { padding: 1.6rem; flex: 1; }
.app-footer { padding: 1rem 1.6rem 1.4rem; color: var(--muted); font-size: .78rem; text-align: center; }

@media (min-width: 992px) {
    .app-sidebar { transform: none; }
    .sidebar-backdrop { display: none; }
    .app-main { margin-left: var(--sidebar-w); }
    .app-topbar .menu-btn { display: none; }
    .topbar-date { display: inline-flex; }
    .app-content { padding: 2rem 2.2rem; }
    .app-topbar { padding: .8rem 2.2rem; }
}

/* ---------- Komponen konten ---------- */
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 .2rem; }
.page-header p { margin: 0; color: var(--muted); }

.panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.panel-body { padding: 1.4rem 1.5rem; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }

.stat-card { padding: 1.2rem 1.3rem; display: flex; align-items: center; gap: 1rem; height: 100%; }
.stat-icon {
    width: 50px; height: 50px; border-radius: 14px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.stat-value small { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: .2rem; }

.tint-blue  { background: var(--brand-100); color: var(--brand-600); }
.tint-teal  { background: var(--teal-100);  color: var(--teal-600); }
.tint-rose  { background: var(--rose-100);  color: var(--rose-600); }
.tint-amber { background: var(--amber-100); color: var(--amber-600); }
.tint-green { background: var(--green-100); color: var(--green-600); }

.welcome-banner {
    background: linear-gradient(120deg, var(--brand-800), var(--brand-600) 60%, #2a8fd6);
    color: #fff; border-radius: var(--radius); padding: 1.8rem 2rem; position: relative; overflow: hidden;
}
.welcome-banner::after {
    content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
}
.welcome-banner h2 { font-weight: 800; font-size: 1.45rem; margin-bottom: .3rem; }
.welcome-banner p { margin: 0; opacity: .85; }
.welcome-banner .chip {
    display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.16);
    padding: .3rem .8rem; border-radius: 999px; font-size: .78rem; font-weight: 600; margin-top: .9rem;
}

.schedule-date {
    width: 62px; flex-shrink: 0; text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
}
.schedule-date .m { background: var(--brand-600); color: #fff; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: .2rem 0; }
.schedule-date .d { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }

/* ---------- Tabel ---------- */
.table-modern { margin: 0; --bs-table-bg: transparent; }
.table-modern thead th {
    background: #f7f9fc; color: #52627a; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    font-weight: 700; border-bottom: 1px solid var(--border); padding: .85rem 1rem; white-space: nowrap;
}
.table-modern tbody td { padding: .9rem 1rem; border-color: #eef1f6; vertical-align: middle; }
.table-modern tbody tr:hover { background: #fafcff; }
.table-modern .num { font-variant-numeric: tabular-nums; }

.badge-soft { font-weight: 700; padding: .38rem .7rem; border-radius: 999px; font-size: .74rem; }
.badge-soft-success { background: var(--green-100); color: #167a4b; }
.badge-soft-muted   { background: #eceff4; color: #5b6b80; }
.badge-soft-blue    { background: var(--brand-100); color: var(--brand-700); }
.badge-soft-rose    { background: var(--rose-100); color: #b0325a; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.4rem; color: #b8c4d4; display: block; margin-bottom: .6rem; }

.alert { border: 0; border-radius: var(--radius-sm); font-weight: 500; }
.alert-success { background: var(--green-100); color: #145c3b; }
.alert-danger  { background: var(--rose-100); color: #8f2346; }
.alert-warning { background: var(--amber-100); color: #7a4d05; }

.modal-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-md); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.2rem 1.5rem; }
.modal-title { font-weight: 800; font-size: 1.1rem; }
.modal-body { padding: 1.4rem 1.5rem; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }

.form-section-title {
    font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-600);
    margin: .4rem 0 .8rem; display: flex; align-items: center; gap: .6rem;
}
.form-section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Kartu pilihan pencatatan */
.record-card {
    display: flex; flex-direction: column; height: 100%; padding: 1.6rem; text-align: left; width: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s; color: inherit;
}
.record-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: #b9d3ea; }
.record-card .stat-icon { width: 58px; height: 58px; font-size: 1.7rem; margin-bottom: 1.1rem; }
.record-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: .35rem; }
.record-card p { color: var(--muted); margin-bottom: 1.2rem; }
.record-card .go { margin-top: auto; font-weight: 700; display: inline-flex; align-items: center; gap: .4rem; }

/* ---------- Halaman publik ---------- */
.site-nav { background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1030; }
.site-nav .brand-name, .site-nav .brand-sub { color: var(--brand-900); }
.site-nav .brand-sub { color: var(--muted); }
.site-nav .nav-link { font-weight: 600; color: #3b4b61; padding: .5rem .9rem; border-radius: 8px; }
.site-nav .nav-link:hover { color: var(--brand-600); background: var(--brand-50); }

.hero {
    background:
        radial-gradient(900px 400px at 85% -10%, rgba(47,155,234,.35), transparent 60%),
        radial-gradient(600px 300px at 0% 100%, rgba(15,155,142,.25), transparent 60%),
        linear-gradient(135deg, var(--brand-950), var(--brand-800));
    color: #fff; padding: 5rem 0 6.5rem; position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0; opacity: .07;
    background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 26px 26px;
}
.hero .container { position: relative; }
.hero .eyebrow {
    display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18); padding: .4rem 1rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
}
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 800; line-height: 1.12; margin: 1.2rem 0 1rem; }
.hero h1 span { color: #7fd3ff; }
.hero .lead { color: rgba(255,255,255,.8); font-size: 1.08rem; max-width: 34rem; }
.btn-hero { background: #fff; color: var(--brand-800); border: 0; }
.btn-hero:hover { background: var(--brand-100); color: var(--brand-900); }
.btn-ghost { border: 1px solid rgba(255,255,255,.35); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }

.hero-card {
    background: rgba(255,255,255,.97); color: var(--text); border-radius: 20px; padding: 1.6rem;
    box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.hero-card .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-600); font-weight: 800; }

.stats-strip { margin-top: -3.2rem; position: relative; z-index: 2; }
.stats-strip .panel { box-shadow: var(--shadow-md); }
.stats-strip .item { padding: 1.4rem 1.2rem; text-align: center; }
.stats-strip .item + .item { border-left: 1px solid var(--border); }
.stats-strip .n { font-size: 1.9rem; font-weight: 800; color: var(--brand-700); letter-spacing: -.03em; line-height: 1.1; }
.stats-strip .t { color: var(--muted); font-size: .82rem; font-weight: 600; }
@media (max-width: 767px) { .stats-strip .item:nth-child(3) { border-left: 0; } .stats-strip .item:nth-child(n+3) { border-top: 1px solid var(--border); } }

.section { padding: 4.5rem 0; }
.section-title { text-align: center; max-width: 40rem; margin: 0 auto 2.6rem; }
.section-title .kicker { color: var(--brand-600); font-weight: 800; font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; }
.section-title h2 { font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .4rem 0 .6rem; }
.section-title p { color: var(--muted); }

.service-card { padding: 1.8rem; height: 100%; transition: transform .18s, box-shadow .18s; }
.service-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.service-card .stat-icon { width: 56px; height: 56px; font-size: 1.6rem; margin-bottom: 1.1rem; }
.service-card h3 { font-size: 1.1rem; font-weight: 800; }
.service-card ul { list-style: none; padding: 0; margin: 1rem 0 0; color: var(--muted); }
.service-card li { padding: .28rem 0; display: flex; gap: .55rem; align-items: baseline; }
.service-card li i { color: var(--teal-600); }

.dusun-tile {
    display: flex; align-items: center; gap: .9rem; padding: 1rem 1.2rem;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); transition: .18s;
}
.dusun-tile:hover { border-color: #b9d3ea; box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.dusun-tile .no {
    width: 36px; height: 36px; border-radius: 10px; background: var(--brand-100); color: var(--brand-700);
    font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dusun-tile .nm { font-weight: 700; line-height: 1.25; }
.dusun-tile small { color: var(--muted); }

.site-footer { background: var(--brand-950); color: rgba(255,255,255,.7); padding: 2.6rem 0 1.4rem; }
.site-footer a { color: rgba(255,255,255,.7); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .copy { border-top: 1px solid rgba(255,255,255,.1); margin-top: 1.8rem; padding-top: 1.2rem; font-size: .82rem; }

/* ---------- Halaman login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-side {
    display: none; color: #fff; padding: 3rem 3.5rem; position: relative; overflow: hidden;
    background:
        radial-gradient(700px 380px at 90% 0%, rgba(47,155,234,.4), transparent 60%),
        radial-gradient(500px 300px at 0% 100%, rgba(15,155,142,.3), transparent 60%),
        linear-gradient(150deg, var(--brand-950), var(--brand-800));
}
.auth-side::before {
    content: ''; position: absolute; inset: 0; opacity: .06;
    background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 26px 26px;
}
.auth-side > * { position: relative; }
.auth-side h2 { font-size: 2.1rem; font-weight: 800; line-height: 1.2; }
.auth-feature { display: flex; gap: .9rem; margin-top: 1.4rem; }
.auth-feature .ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.12); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-feature strong { display: block; }
.auth-feature span { color: rgba(255,255,255,.7); font-size: .88rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
@media (min-width: 992px) {
    .auth-wrap { grid-template-columns: 1.05fr 1fr; }
    .auth-side { display: flex; flex-direction: column; justify-content: space-between; }
}

/* ---------- Cetak ---------- */
.print-only { display: none; }
@media print {
    body { background: #fff; font-size: 12px; }
    .app-sidebar, .app-topbar, .sidebar-backdrop, .no-print, .app-footer { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; }
    .panel { box-shadow: none !important; border: 0; }
    .print-only { display: block !important; }
    .print-kop { text-align: center; border-bottom: 3px double #000; padding-bottom: .6rem; margin-bottom: 1rem; }
    .print-kop h2 { font-size: 16px; font-weight: 800; margin: 0; text-transform: uppercase; }
    .print-kop p { margin: 0; font-size: 12px; }
    .table-modern thead th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
