/* ============================================================
   KESEHATANKU v7 — Mobile-First Design System
   Dark Glassmorphism · Touch-Optimized · Safe Area Ready
   ============================================================ */

/* ---- GOOGLE FONTS ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS VARIABLES ---- */
:root {
    --bg-primary:   #080d16;
    --bg-secondary: #0c1221;
    --bg-card:      #101828;
    --bg-card2:     #141f33;
    --glass-bg:     rgba(16, 24, 40, 0.92);
    --glass-border: rgba(255,255,255,0.08);
    --glass-border-hover: rgba(255,255,255,0.16);

    --green:   #10b981; --green-d: #059669; --green-bg: rgba(16,185,129,0.12);
    --blue:    #3b82f6; --blue-d:  #2563eb; --blue-bg:  rgba(59,130,246,0.12);
    --purple:  #8b5cf6; --purple-d:#7c3aed; --purple-bg:rgba(139,92,246,0.12);
    --amber:   #f59e0b; --amber-d: #d97706; --amber-bg: rgba(245,158,11,0.12);
    --red:     #ef4444; --red-d:   #dc2626; --red-bg:   rgba(239,68,68,0.12);
    --cyan:    #06b6d4; --cyan-d:  #0891b2; --cyan-bg:  rgba(6,182,212,0.12);
    --rose:    #f43f5e; --rose-bg: rgba(244,63,94,0.12);
    --orange:  #f97316; --orange-bg:rgba(249,115,22,0.12);

    --text-1: #f1f5f9;
    --text-2: #cbd5e1;
    --text-3: #94a3b8;
    --text-4: #64748b;

    --radius-sm: 10px;
    --radius:    14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 100px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow:    0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --shadow-green: 0 4px 20px rgba(16,185,129,0.3);

    --nav-h: 68px; /* bottom nav height */
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top:    env(safe-area-inset-top, 0px);
    --topbar-h: 56px;

    --trans: all 0.22s cubic-bezier(0.4,0,0.2,1);
    --trans-fast: all 0.12s ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-1);
    line-height: 1.5;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; font-size: 16px; /* prevent iOS zoom */ }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* ============================================================
   LAYOUT — Mobile-First (no sidebar by default)
   ============================================================ */
.main-content {
    margin-left: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Page body — safe area bottom for nav */
.page-body {
    padding: 12px 16px calc(var(--nav-h) + var(--safe-bottom) + 16px);
    flex: 1;
}

/* ============================================================
   TOPBAR — Mobile Sticky
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-top: var(--safe-top);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}
.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.topbar-logo .logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--green), var(--green-d));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(16,185,129,0.35);
}
.topbar-logo h1 {
    font-size: 1rem; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text-1);
}
.topbar-logo p {
    font-size: 0.7rem; color: var(--text-4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.topbar-badge {
    background: var(--green-bg);
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: var(--radius-full);
    padding: 5px 10px;
    font-size: 0.72rem; font-weight: 700; color: var(--green);
    white-space: nowrap;
}
.hamburger-btn {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 5px; padding: 10px;
    transition: var(--trans);
    flex-shrink: 0;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.1); }
.hamburger-btn span {
    display: block; width: 18px; height: 2px;
    background: var(--text-1); border-radius: 2px;
    transition: var(--trans);
}

/* ============================================================
   BOTTOM NAVIGATION — Mobile Primary Nav
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: flex-start;
    z-index: 200;
}
.bnav-items {
    display: flex;
    width: 100%;
    height: var(--nav-h);
}
.bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--text-4);
    font-size: 0.62rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: var(--trans-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.bnav-item:active { transform: scale(0.92); }
.bnav-item.active { color: var(--green); }
.bnav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--green);
}
.bnav-icon {
    font-size: 22px;
    line-height: 1;
    display: block;
}
.bnav-item.active .bnav-icon { transform: scale(1.05); }
.bnav-dot {
    position: absolute;
    top: 7px; right: calc(50% - 14px);
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

/* ============================================================
   SIDEBAR — Desktop Only (shown on ≥900px)
   ============================================================ */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,0.5); }
.sidebar-close {
    display: flex;
    position: absolute; top: 14px; right: 14px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
    border-radius: 8px; color: var(--text-3); font-size: 1rem;
    width: 30px; height: 30px; align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-logo {
    padding: 20px 18px; border-bottom: 1px solid var(--glass-border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-logo .logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--green), var(--green-d));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
    box-shadow: var(--shadow-green); flex-shrink: 0;
}
.sidebar-logo h2 { font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.sidebar-logo small { font-size: 0.68rem; color: var(--text-4); }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-title {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 1.5px;
    color: var(--text-4); text-transform: uppercase;
    padding: 12px 8px 6px; margin-top: 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text-3); font-size: 0.85rem; font-weight: 500;
    transition: var(--trans); margin-bottom: 2px; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text-1); }
.nav-item.active { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.nav-item .nav-icon { font-size: 17px; width: 22px; text-align: center; }
.nav-item .nav-badge {
    margin-left: auto; background: var(--red); color: white;
    font-size: 0.62rem; font-weight: 700; padding: 2px 6px; border-radius: var(--radius-full);
}
.sidebar-footer { padding: 14px 10px; border-top: 1px solid var(--glass-border); }
.sidebar-stat-box {
    background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2);
    border-radius: 10px; padding: 12px; margin-bottom: 10px;
}
.sidebar-stat-box .lbl { font-size: 0.68rem; color: var(--text-4); margin-bottom: 3px; }
.sidebar-stat-box .val { font-size: 1.3rem; font-weight: 800; color: var(--amber); }
.sidebar-stat-box .sub { font-size: 0.65rem; color: var(--text-4); }
.btn-logout {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 12px;
    background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px; color: #f87171; font-size: 0.82rem; font-weight: 500;
    text-decoration: none; transition: var(--trans);
}
.btn-logout:hover { background: rgba(239,68,68,0.15); }
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); z-index: 149;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px;
}
.page-header-text h2 {
    font-size: 1.15rem; font-weight: 800; color: var(--text-1); line-height: 1.2;
}
.page-header-text p { font-size: 0.78rem; color: var(--text-4); margin-top: 2px; }

/* ============================================================
   CARD COMPONENT
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 16px; }
.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 0.9rem; font-weight: 700; }
.card-title { font-size: 0.82rem; font-weight: 700; color: var(--text-1); margin-bottom: 12px; }

/* ============================================================
   FEATURE GRID — Dashboard shortcuts
   ============================================================ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.feature-btn {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 12px 8px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    text-decoration: none; transition: var(--trans);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.feature-btn:active { transform: scale(0.95); }
.feature-btn .ficon { font-size: 26px; line-height: 1; }
.feature-btn .flabel { font-size: 0.62rem; font-weight: 700; color: var(--text-3); text-align: center; line-height: 1.3; }
.feature-btn.done { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.06); }
.feature-btn.done .flabel { color: var(--green); }
.feature-btn .fdot {
    position: absolute; top: 7px; right: 7px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--red);
}
.feature-btn.done .fdot { background: var(--green); }

/* ============================================================
   STAT CARDS — Quick numbers
   ============================================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex; align-items: center; gap: 12px;
}
.stat-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.stat-val { font-size: 1.3rem; font-weight: 800; color: var(--text-1); line-height: 1; }
.stat-val small { font-size: 0.7rem; font-weight: 400; color: var(--text-4); }
.stat-lbl { font-size: 0.7rem; color: var(--text-4); margin-top: 2px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-wrap {
    background: rgba(255,255,255,0.07);
    border-radius: var(--radius-full);
    height: 10px;
    overflow: hidden;
    margin: 6px 0;
}
.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
    position: relative;
}
.progress-fill::after {
    content: '';
    position: absolute; right: 0; top: 0;
    width: 8px; height: 100%;
    background: rgba(255,255,255,0.4);
    border-radius: var(--radius-full);
}

/* Water progress */
.progress-water { background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.progress-sleep  { background: linear-gradient(90deg, var(--purple), var(--blue)); }
.progress-journey{ background: linear-gradient(90deg, var(--green), var(--purple)); }

/* ============================================================
   QUICK-TAP BUTTONS — Drink & Supplement
   ============================================================ */
.qtap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.qtap-btn {
    background: var(--bg-card2);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--trans-fast);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    -webkit-tap-highlight-color: transparent;
}
.qtap-btn:active { transform: scale(0.93); background: var(--green-bg); border-color: var(--green); }
.qtap-btn .q-icon { font-size: 28px; line-height: 1; }
.qtap-btn .q-label { font-size: 0.68rem; font-weight: 700; color: var(--text-2); }
.qtap-btn .q-ml { font-size: 0.62rem; color: var(--text-4); }
.qtap-btn.tapped { background: var(--green-bg); border-color: rgba(16,185,129,0.4); }

/* Supplement quick-tap */
.supp-qtap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.supp-qtap {
    background: var(--bg-card2);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: var(--trans-fast);
    display: flex; align-items: center; gap: 10px;
    -webkit-tap-highlight-color: transparent;
}
.supp-qtap:active { transform: scale(0.95); }
.supp-qtap.taken { background: var(--green-bg); border-color: rgba(16,185,129,0.35); }
.supp-qtap .sq-icon { font-size: 22px; flex-shrink: 0; }
.supp-qtap .sq-name { font-size: 0.78rem; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.supp-qtap .sq-dose { font-size: 0.66rem; color: var(--text-4); }

/* ============================================================
   ACCORDION SECTIONS
   ============================================================ */
.acc-section {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}
.acc-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; cursor: pointer;
    background: transparent; border: none;
    width: 100%; text-align: left;
    color: var(--text-1); font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.acc-head:active { background: rgba(255,255,255,0.03); }
.acc-icon { font-size: 1.2rem; flex-shrink: 0; }
.acc-title { flex: 1; font-size: 0.9rem; font-weight: 700; }
.acc-badge {
    font-size: 0.68rem; font-weight: 700; padding: 3px 9px;
    border-radius: var(--radius-full);
    background: var(--green-bg); color: var(--green); flex-shrink: 0;
}
.acc-badge.warn { background: var(--red-bg); color: #f87171; }
.acc-badge.info { background: var(--blue-bg); color: #60a5fa; }
.acc-chevron { font-size: 0.8rem; color: var(--text-4); transition: transform 0.3s; flex-shrink: 0; }
.acc-section.open .acc-chevron { transform: rotate(180deg); }
.acc-body { display: none; border-top: 1px solid var(--glass-border); }
.acc-section.open .acc-body { display: block; }
.acc-inner { padding: 14px 16px; }

/* ============================================================
   FORM ELEMENTS — Mobile Optimized (no zoom)
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.form-input, .form-select, .form-textarea {
    background: rgba(255,255,255,0.05);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-1);
    font-size: 16px; /* CRITICAL: prevents iOS zoom */
    font-family: inherit;
    padding: 13px 14px;
    transition: var(--trans);
    width: 100%;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--green);
    background: rgba(16,185,129,0.06);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}
.form-select option { background: #1e293b; color: var(--text-1); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.form-full { grid-column: 1/-1; }
.form-hint { font-size: 0.72rem; color: var(--text-4); margin-top: 4px; }

/* Rating Buttons */
.rating-row { display: flex; gap: 4px; }
.rating-btn {
    flex: 1; padding: 10px 4px; border-radius: 8px;
    border: 1.5px solid var(--glass-border);
    background: rgba(255,255,255,0.04);
    color: var(--text-4); font-size: 0.8rem; font-weight: 700;
    text-align: center; transition: var(--trans-fast); cursor: pointer;
    min-height: 44px; /* touch target */
}
.rating-btn:active { transform: scale(0.92); }
.rating-btn.selected { background: var(--green-bg); border-color: rgba(16,185,129,0.5); color: var(--green); }

/* Emoji Rating */
.emoji-rating { display: flex; gap: 6px; }
.emoji-btn {
    flex: 1; padding: 10px; border-radius: 10px;
    border: 1.5px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    text-align: center; cursor: pointer;
    transition: var(--trans-fast); min-height: 60px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.emoji-btn:active { transform: scale(0.9); }
.emoji-btn .em { font-size: 26px; line-height: 1; }
.emoji-btn .em-lbl { font-size: 0.6rem; color: var(--text-4); font-weight: 600; }
.emoji-btn.selected { background: var(--green-bg); border-color: rgba(16,185,129,0.4); }

/* Counter Input */
.counter-wrap {
    display: flex; align-items: center;
    border: 1.5px solid var(--glass-border); border-radius: var(--radius-sm); overflow: hidden;
}
.counter-btn {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.05); border: none;
    color: var(--text-1); font-size: 1.4rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: var(--trans-fast);
}
.counter-btn:active { background: rgba(255,255,255,0.12); }
.counter-val {
    flex: 1; text-align: center; padding: 12px;
    background: transparent; border: none;
    border-left: 1px solid var(--glass-border); border-right: 1px solid var(--glass-border);
    color: var(--text-1); font-size: 18px; font-weight: 700; font-family: inherit;
}
.counter-val:focus { outline: none; }

/* Checkbox Items */
.check-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.check-item {
    display: flex; align-items: center; gap: 8px;
    padding: 12px; border: 1.5px solid var(--glass-border);
    border-radius: 10px; cursor: pointer;
    background: rgba(255,255,255,0.03); transition: var(--trans-fast);
    font-size: 0.82rem; color: var(--text-2); min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}
.check-item:active { transform: scale(0.97); }
.check-item input[type="checkbox"] { display: none; }
.check-box {
    width: 22px; height: 22px; border-radius: 6px;
    border: 2px solid var(--glass-border-hover);
    background: rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 12px; color: transparent; transition: var(--trans-fast);
}
.check-item.checked { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.3); color: #f87171; }
.check-item.checked .check-box { background: var(--red); border-color: var(--red); color: white; }

/* Time calc display */
.time-result {
    background: var(--green-bg); border: 1px solid rgba(16,185,129,0.25);
    border-radius: var(--radius-sm); padding: 10px 14px;
    font-size: 1.1rem; font-weight: 800; color: var(--green); text-align: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, var(--green), var(--green-d));
    border: none; border-radius: var(--radius);
    color: white; font-size: 1rem; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: var(--trans);
    box-shadow: var(--shadow-green);
    min-height: 54px;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
    border-radius: var(--radius); color: var(--text-2);
    font-size: 0.9rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: var(--trans); min-height: 48px;
}
.btn-secondary:active { background: rgba(255,255,255,0.1); }
.btn-danger {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
    border-radius: 8px; color: #f87171;
    font-size: 0.78rem; font-weight: 600; font-family: inherit;
    cursor: pointer; min-height: 36px;
}
.btn-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer; flex-shrink: 0; transition: var(--trans-fast);
}

/* Float save button */
.float-save {
    position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
    left: 50%; transform: translateX(-50%);
    z-index: 90;
    background: linear-gradient(135deg, var(--green), var(--green-d));
    color: white; border: none; border-radius: var(--radius-full);
    padding: 14px 28px; font-size: 0.95rem; font-weight: 700;
    font-family: inherit; cursor: pointer;
    box-shadow: 0 6px 24px rgba(16,185,129,0.45);
    display: flex; align-items: center; gap: 8px;
    white-space: nowrap; transition: var(--trans);
}
.float-save:active { transform: translateX(-50%) scale(0.96); }

/* ============================================================
   ALERT / FLASH MESSAGES
   ============================================================ */
.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: var(--radius);
    margin-bottom: 14px; font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.alert-success { background: var(--green-bg); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.alert-error   { background: var(--red-bg);   border: 1px solid rgba(239,68,68,0.3);   color: #f87171; }
.alert-warning { background: var(--amber-bg); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
.alert-info    { background: var(--blue-bg);  border: 1px solid rgba(59,130,246,0.3);  color: #60a5fa; }
.alert-icon { font-size: 20px; flex-shrink: 0; }
.alert strong { color: var(--text-1); }
/* flash alias */
.flash-msg { }
.flash-success { background: var(--green-bg); border: 1px solid rgba(16,185,129,0.3); color: #34d399; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 0.85rem; }
.flash-error { background: var(--red-bg); border: 1px solid rgba(239,68,68,0.3); color: #f87171; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 0.85rem; }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; padding: 3px 8px;
    border-radius: var(--radius-full); font-size: 0.68rem; font-weight: 700;
}
.badge-green  { background: var(--green-bg);  color: #34d399; }
.badge-red    { background: var(--red-bg);    color: #f87171; }
.badge-amber  { background: var(--amber-bg);  color: #fbbf24; }
.badge-blue   { background: var(--blue-bg);   color: #60a5fa; }
.badge-purple { background: var(--purple-bg); color: #c4b5fd; }
.badge-cyan   { background: var(--cyan-bg);   color: #67e8f9; }

/* Status badges */
.status-normal     { background: var(--green-bg);  color: #34d399; }
.status-borderline { background: var(--amber-bg);  color: #fbbf24; }
.status-warning    { background: var(--red-bg);    color: #f87171; }
.status-danger     { background: rgba(239,68,68,0.25); color: #fca5a5; }
.status-low        { background: var(--blue-bg);   color: #60a5fa; }

/* ============================================================
   LOG ITEMS — List layout
   ============================================================ */
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
}
.log-item .li-icon { font-size: 18px; flex-shrink: 0; }
.log-item .li-time { font-size: 0.75rem; font-weight: 700; color: var(--text-4); min-width: 38px; }
.log-item .li-main { flex: 1; font-size: 0.82rem; color: var(--text-2); min-width: 0; }
.log-item .li-sub  { font-size: 0.7rem; color: var(--text-4); margin-top: 1px; }
.log-item .li-val  { font-size: 0.85rem; font-weight: 700; color: var(--text-1); white-space: nowrap; }
.log-item .li-del  {
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
    border-radius: 6px; padding: 5px 8px; color: #f87171; font-size: 0.72rem;
    cursor: pointer; flex-shrink: 0; font-family: inherit;
}

/* ============================================================
   BLOOD PRESSURE STATUS
   ============================================================ */
.bp-normal   { color: var(--green); }
.bp-elevated { color: var(--amber); }
.bp-stage1   { color: var(--orange); }
.bp-stage2   { color: var(--red); }
.bp-crisis   { color: #ff0000; font-weight: 900; }

/* ============================================================
   SUPPLEMENT SCHEDULE CARD
   ============================================================ */
.schedule-timeline { display: flex; flex-direction: column; gap: 0; }
.sched-block {
    display: flex; gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}
.sched-block:last-child { border-bottom: none; }
.sched-time {
    font-size: 0.68rem; font-weight: 800; color: var(--text-4);
    text-transform: uppercase; letter-spacing: 0.5px;
    min-width: 48px; text-align: right; padding-top: 2px; flex-shrink: 0;
}
.sched-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px;
    border: 2px solid transparent;
}
.sched-items { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sched-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 20px;
    font-size: 0.73rem; font-weight: 600; width: fit-content;
}
.sched-note { font-size: 0.7rem; color: var(--text-4); margin-top: 2px; line-height: 1.4; }

/* ============================================================
   JOURNEY BANNER
   ============================================================ */
.journey-banner {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(99,102,241,0.08));
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
}
.journey-banner h2 { font-size: 0.95rem; font-weight: 800; margin-bottom: 2px; }
.journey-banner p { font-size: 0.72rem; color: var(--text-4); margin-bottom: 10px; }
.journey-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.journey-nums { display: flex; gap: 12px; }
.journey-num { text-align: center; }
.journey-num .n { font-size: 1.2rem; font-weight: 900; color: var(--text-1); }
.journey-num .l { font-size: 0.6rem; color: var(--text-4); }

/* ============================================================
   TODAY SUMMARY ROW
   ============================================================ */
.today-row {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.today-metric {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
}
.today-metric .tm-icon { font-size: 18px; margin-bottom: 3px; }
.today-metric .tm-val { font-size: 0.95rem; font-weight: 800; color: var(--text-1); line-height: 1; }
.today-metric .tm-lbl { font-size: 0.6rem; color: var(--text-4); margin-top: 2px; }
.today-metric.tm-ok { border-color: rgba(16,185,129,0.25); }
.today-metric.tm-warn { border-color: rgba(245,158,11,0.25); }
.today-metric.tm-bad { border-color: rgba(239,68,68,0.25); }

/* ============================================================
   URINE TRACKER
   ============================================================ */
.urine-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 12px 0; }
.uc-btn {
    border: 2px solid transparent; border-radius: 10px;
    padding: 10px 4px; cursor: pointer; text-align: center;
    background: rgba(255,255,255,0.04); font-family: inherit;
    transition: var(--trans-fast); width: 100%; min-height: 72px;
    -webkit-tap-highlight-color: transparent;
}
.uc-btn:active { transform: scale(0.92); }
.uc-btn.selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }
.uc-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 5px; border: 2px solid rgba(0,0,0,0.15); }
.uc-label { font-size: 0.6rem; font-weight: 700; color: var(--text-3); line-height: 1.3; }

/* ============================================================
   LAB RESULTS
   ============================================================ */
.lab-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}
.lab-category-header {
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-4);
    border-bottom: 1px solid var(--glass-border);
}
.lab-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.lab-row:last-child { border-bottom: none; }
.lab-name { flex: 1; font-size: 0.82rem; color: var(--text-2); line-height: 1.3; }
.lab-val  { font-size: 0.9rem; font-weight: 800; color: var(--text-1); white-space: nowrap; }
.lab-val small { font-size: 0.68rem; font-weight: 400; color: var(--text-4); }
.lab-status {
    font-size: 0.63rem; font-weight: 800; padding: 3px 7px;
    border-radius: var(--radius-full); text-transform: uppercase;
    letter-spacing: 0.4px; white-space: nowrap; flex-shrink: 0;
}

/* ============================================================
   CHART CARDS
   ============================================================ */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 14px;
}
.chart-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.chart-header h3 { font-size: 0.88rem; font-weight: 700; }
.chart-badge {
    background: var(--purple-bg); border: 1px solid rgba(139,92,246,0.25);
    color: #c4b5fd; font-size: 0.65rem; font-weight: 700;
    padding: 3px 8px; border-radius: var(--radius-full);
}

/* ============================================================
   PILLAR CARDS
   ============================================================ */
.pillars-grid { display: flex; flex-direction: column; gap: 10px; }
.pillar-card {
    background: var(--bg-card); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.pillar-baseline { border-left: 4px solid var(--purple); }
.pillar-habits   { border-left: 4px solid var(--green); }
.pillar-final    { border-left: 4px solid var(--amber); }
.pillar-header   { display: flex; align-items: center; gap: 10px; }
.pillar-num      { font-size: 1.8rem; font-weight: 900; color: rgba(255,255,255,0.07); line-height: 1; flex-shrink: 0; }
.pillar-header h3 { font-size: 0.9rem; font-weight: 700; }
.pillar-header p  { font-size: 0.72rem; color: var(--text-4); }
.pillar-icon      { font-size: 24px; margin-left: auto; }
.pillar-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.78rem; font-weight: 700; color: var(--green);
    text-decoration: none; padding-top: 10px;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

/* ============================================================
   MEAL TYPE TAGS
   ============================================================ */
.meal-tag { font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.meal-sarapan    { background: rgba(245,158,11,0.15); color: #fbbf24; }
.meal-makan_siang{ background: rgba(16,185,129,0.15); color: #34d399; }
.meal-makan_malam{ background: rgba(99,102,241,0.15); color: #a5b4fc; }
.meal-snack      { background: rgba(249,115,22,0.15); color: #fb923c; }
.meal-sahur      { background: rgba(6,182,212,0.15);  color: #67e8f9; }
.meal-buka       { background: rgba(236,72,153,0.15); color: #f9a8d4; }

/* ============================================================
   MOBILE BOTTOM MODAL (sheet-style add forms)
   ============================================================ */
.bottom-sheet-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); z-index: 300;
}
.bottom-sheet-overlay.active { display: block; }
.bottom-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #131c2e;
    border-top: 1px solid var(--glass-border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 16px 16px calc(var(--safe-bottom) + 24px);
    z-index: 301;
    max-height: 90vh; overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.bottom-sheet.active { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin: 0 auto 16px; }
.sheet-title { font-size: 1rem; font-weight: 800; margin-bottom: 16px; }

/* ============================================================
   TABLE (riwayat)
   ============================================================ */
.data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; min-width: 400px; }
.data-table th {
    font-size: 0.68rem; font-weight: 700; color: var(--text-4);
    text-transform: uppercase; letter-spacing: 0.8px;
    padding: 10px 12px; text-align: left;
    background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--glass-border);
}
.data-table td {
    padding: 11px 12px; font-size: 0.82rem; color: var(--text-2);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:active td { background: rgba(255,255,255,0.03); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
    background: radial-gradient(ellipse at 60% 0%, rgba(16,185,129,0.12) 0%, transparent 60%),
                radial-gradient(ellipse at 0% 100%, rgba(99,102,241,0.1) 0%, transparent 60%),
                var(--bg-primary);
}
.login-box {
    background: var(--glass-bg); backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-xl);
    padding: 36px 24px; width: 100%; max-width: 380px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.04) inset;
    animation: slideDown 0.4s ease;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .heart-icon {
    width: 64px; height: 64px; background: linear-gradient(135deg, var(--green), var(--green-d));
    border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 30px; margin-bottom: 14px; box-shadow: var(--shadow-green);
    animation: heartbeat 2s ease-in-out infinite;
}
@keyframes heartbeat {
    0%,100% { transform: scale(1); } 15% { transform: scale(1.07); }
    30% { transform: scale(1); } 45% { transform: scale(1.04); }
}
.login-logo h1 { font-size: 1.5rem; font-weight: 900; }
.login-logo p  { font-size: 0.78rem; color: var(--text-4); margin-top: 4px; }

/* ============================================================
   SUPPLEMENT LINE COLORS (collab)
   ============================================================ */
.time-pagi_sebelum { border-color: var(--cyan) !important; }
.time-pagi_makan   { border-color: var(--amber) !important; }
.time-siang_makan  { border-color: var(--green) !important; }
.time-malam_makan  { border-color: var(--purple) !important; }
.time-tidur        { border-color: var(--blue) !important; }
.time-kapan_saja   { border-color: var(--text-4) !important; }

/* ============================================================
   DESKTOP LAYOUT (≥900px) — Sidebar Enabled
   ============================================================ */
@media (min-width: 900px) {
    .sidebar { transform: translateX(0); }
    .sidebar-close { display: none; }
    .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 260px; }
    .bottom-nav { display: none; }
    .hamburger-btn { display: none; }
    .page-body { padding: 24px 28px 32px; }
    .float-save { bottom: 24px; }

    /* Desktop grids */
    .feature-grid { grid-template-columns: repeat(5,1fr); }
    .stats-row    { grid-template-columns: repeat(4,1fr); }
    .qtap-grid    { grid-template-columns: repeat(4,1fr); }
    .form-grid    { grid-template-columns: repeat(2,1fr); }
    .check-grid   { grid-template-columns: repeat(3,1fr); }
    .supp-qtap-grid { grid-template-columns: repeat(3,1fr); }
    .today-row    { grid-template-columns: repeat(6,1fr); }

    /* Topbar desktop */
    .topbar { padding: 0 24px; height: 60px; }
    .topbar-logo h1 { font-size: 1.1rem; }
    .topbar-date { display: flex !important; }

    /* Pillar grid side by side */
    .pillars-grid { flex-direction: row; }
}

/* ============================================================
   SMALL SCREENS EXTRA TWEAKS
   ============================================================ */
@media (max-width: 360px) {
    .feature-grid { grid-template-columns: repeat(4,1fr); gap: 6px; }
    .qtap-grid { grid-template-columns: repeat(2,1fr); }
    .rating-row { gap: 3px; }
    .emoji-rating { gap: 4px; }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse-green {
    0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}
.pulse-green { animation: pulse-green 2s ease infinite; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

/* ============================================================
   TOPBAR (compat alias)
   ============================================================ */
.topbar-left h1 { font-size: 0.95rem; font-weight: 700; }
.topbar-left p  { font-size: 0.7rem; color: var(--text-4); }
.topbar-date {
    display: none;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px; padding: 5px 10px;
    font-size: 0.75rem; color: var(--text-4);
}

/* ============================================================
   v7 EXTRAS — Additional utility classes
   ============================================================ */

/* Card border color variants */
.border-green  { border-color: rgba(16,185,129,0.35) !important; }
.border-red    { border-color: rgba(239,68,68,0.35)  !important; }
.border-amber  { border-color: rgba(245,158,11,0.35) !important; }
.border-purple { border-color: rgba(139,92,246,0.35) !important; }
.border-cyan   { border-color: rgba(6,182,212,0.35)  !important; }
.border-blue   { border-color: rgba(59,130,246,0.35) !important; }

/* btn-danger full width */
a.btn-danger, button.btn-danger {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 20px; min-height: 48px;
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius); color: #f87171;
    font-size: 0.9rem; font-weight: 700; font-family: inherit;
    cursor: pointer; text-decoration: none; transition: var(--trans); width: 100%;
}
a.btn-danger:active, button.btn-danger:active { background: rgba(239,68,68,0.2); }

/* flash-info */
.flash-info { background: var(--blue-bg); border: 1px solid rgba(59,130,246,0.3); color: #60a5fa; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 0.85rem; }

/* li-main block for multi-line */
.log-item .li-main { display: block; font-weight: 600; }

/* page-header-text */
.page-header-text { margin-bottom: 12px; }
.page-header-text h2 { font-size: 1rem; font-weight: 800; color: var(--text-1); }
.page-header-text p  { font-size: 0.75rem; color: var(--text-4); margin-top: 3px; }

/* form-select arrow */
.form-select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px; }

/* Collab note card */
.collab-note-card { background: rgba(99,102,241,0.07); border: 1px solid rgba(99,102,241,0.18); border-radius: 10px; padding: 10px 12px; font-size: 0.75rem; color: var(--text-3); line-height: 1.6; margin-top: 6px; }

/* Param hint */
.param-hint { font-size: 0.65rem; color: var(--text-4); margin-top: 2px; }

/* Habit grade */
.habit-grade { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; font-weight: 900; flex-shrink: 0; }

/* Compare aliases */
.c-name { font-size: 0.78rem; color: var(--text-2); font-weight: 600; min-width: 0; word-break: break-word; }
.c-val  { font-size: 0.88rem; font-weight: 800; color: var(--text-1); }
.c-diff { text-align: right; font-size: 0.75rem; }

/* Schedule strip */
.schedule-strip { background: rgba(255,255,255,0.03); border-radius: 10px; padding: 10px 12px; font-size: 0.75rem; line-height: 1.7; border: 1px solid var(--glass-border); margin-top: 8px; }

/* badge links */
a.badge:active { transform: scale(0.95); }

/* Desktop radar */
@media (min-width: 900px) { .radar-container { height: 300px; } }

/* Very small screens */
@media (max-width: 380px) {
    .rating-row { gap: 2px; }
    .rating-btn { font-size: 0.72rem; padding: 8px 2px; }
    .form-grid { grid-template-columns: 1fr; }
}
