/* ============================================================
   HEPI-D Pasien Panel — mobile-first app shell
   ============================================================ */

/* Render materi edukasi (HTML tersanitasi dari admin) */
.materi-body { font-size: 15px; line-height: 1.7; }
.materi-body p { margin: 0 0 12px; }
.materi-body p:last-child { margin-bottom: 0; }
.materi-body h3 { font-size: 17px; margin: 16px 0 8px; }
.materi-body h4 { font-size: 15px; margin: 12px 0 6px; }
.materi-body ul, .materi-body ol { margin: 0 0 12px; padding-left: 22px; }
.materi-body li { margin-bottom: 4px; }
.materi-body a { color: var(--hijau-gelap); font-weight: 600; }

:root {
    --hijau-utama: #16A34A;
    --hijau-gelap: #15803D;
    --hijau-muda: #DCFCE7;
    --teks-utama: #1F2937;
    --teks-sekunder: #6B7280;
    --putih: #FFFFFF;
    --border: #E5E7EB;

    /* status klinis 4 warna */
    --st-hijau: #22C55E;
    --st-kuning: #FACC15;
    --st-merah: #EF4444;
    --st-oranye: #F97316;

    --bar-h: 56px;
    --nav-h: 60px;
    --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--hijau-muda);
    color: var(--teks-utama);
    font-size: 16px;
    line-height: 1.5;
}

body {
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
}

/* Matikan seleksi teks pada chrome UI (bar & nav & tombol) — biar tak terasa web */
.app-bar, .bottom-nav, .btn, .card-action, .chip {
    -webkit-user-select: none;
    user-select: none;
}

a { color: inherit; text-decoration: none; }

/* ---------- Top bar ---------- */
.app-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(var(--bar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: var(--hijau-utama);
    color: #fff;
    display: flex;
    align-items: center;
    z-index: 50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.app-bar__title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}
.app-bar__back {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    line-height: 1;
    color: #fff;
    flex-shrink: 0;
}
.app-bar__back--placeholder { visibility: hidden; }

/* Logo kecil di kanan top bar */
.app-bar__logo-wrap {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-bar__logo {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 8px;
    background: #fff;
}

/* ---------- Content area ---------- */
.app-content {
    padding: 16px;
    padding-top: calc(var(--bar-h) + env(safe-area-inset-top) + 16px);
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: flex;
    background: var(--putih);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}
.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: var(--nav-h);
    color: var(--teks-sekunder);
    font-size: 11px;
}
.bottom-nav__icon { font-size: 22px; line-height: 1; }
.bottom-nav__item.is-active { color: var(--hijau-utama); font-weight: 600; }

/* ---------- Cards ---------- */
.card {
    background: var(--putih);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.card--flat { box-shadow: none; border: 1px solid var(--border); }
.card__title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.card__sub { font-size: 13px; color: var(--teks-sekunder); margin: 0; }

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--teks-sekunder);
    margin: 20px 4px 10px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.section-title:first-child { margin-top: 4px; }

/* ---------- Quick access grid ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.tile {
    background: var(--putih);
    border-radius: var(--radius);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    min-height: 100px;
    justify-content: center;
    transition: transform .08s ease;
}
.tile:active { transform: scale(.97); }
.tile__icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--hijau-muda);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.tile__label { font-size: 14px; font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    background: var(--hijau-utama);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.btn:active { background: var(--hijau-gelap); }
.btn--outline {
    background: transparent;
    color: var(--hijau-gelap);
    border: 1.5px solid var(--hijau-utama);
}
.btn--muted { background: #E5E7EB; color: var(--teks-utama); }
.btn--muted:active { background: #D1D5DB; }
.btn--danger { background: var(--st-merah); }
.btn--sm { min-height: 40px; padding: 8px 14px; font-size: 14px; width: auto; }
.btn--block { width: 100%; }

/* ---------- Badges & status ---------- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}
.big-status {
    text-align: center;
    padding: 8px 0;
}
.big-status__value {
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
}
.big-status__unit { font-size: 15px; color: var(--teks-sekunder); }
.big-status__badge { margin-top: 10px; }

/* ---------- Rows / list items ---------- */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item__main { min-width: 0; }
.list-item__title { font-weight: 600; font-size: 15px; }
.list-item__sub { font-size: 13px; color: var(--teks-sekunder); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}
.control {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: var(--teks-utama);
}
.control:focus {
    outline: none;
    border-color: var(--hijau-utama);
}
textarea.control { min-height: 90px; resize: vertical; }
.field__hint { font-size: 12px; color: var(--teks-sekunder); margin-top: 4px; }

/* checklist besar (perawatan kaki) */
.check-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--putih);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
}
.check-item input { width: 24px; height: 24px; accent-color: var(--hijau-utama); flex-shrink: 0; }
.check-item.is-checked { border-color: var(--hijau-utama); background: var(--hijau-muda); }
.check-item__label { font-size: 15px; font-weight: 500; }

/* ---------- Toast / alert ---------- */
.toast {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 14px;
    font-weight: 500;
}
.toast--success { background: var(--hijau-muda); color: var(--hijau-gelap); }
.toast--danger  { background: #FEE2E2; color: #991B1B; }
.toast--warning { background: #FEF9C3; color: #854D0E; }

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 14px;
}
.alert-error ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Empty state ---------- */
.empty {
    text-align: center;
    color: var(--teks-sekunder);
    padding: 40px 16px;
    font-size: 14px;
}
.empty__icon { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- Misc ---------- */
.muted { color: var(--teks-sekunder); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 10px; }

.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.metric {
    background: var(--hijau-muda);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}
.metric__value { font-size: 20px; font-weight: 700; }
.metric__label { font-size: 12px; color: var(--teks-sekunder); }

/* ---------- Login ---------- */
.login-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(160deg, var(--hijau-utama), var(--hijau-gelap));
}
.login-brand { text-align: center; color: #fff; margin-bottom: 28px; }
.login-brand__logo {
    display: block;
    width: 96px; height: 96px;
    border-radius: 20px;
    object-fit: cover;
    background: #fff;
    margin: 0 auto 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}
.login-brand__name { font-size: 26px; font-weight: 700; }
.login-brand__tag { font-size: 14px; opacity: .9; }
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
}
