/* ============================================================
   60 Hari Mengubah Diri — App Stylesheet
   Plain CSS port of the Next.js design (emerald + gold, glass).
   ============================================================ */

:root {
    /* Radius */
    --radius: 0.875rem;
    --radius-sm: calc(var(--radius) - 4px);
    --radius-md: calc(var(--radius) - 2px);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) + 4px);

    /* Light theme — warm cream background, emerald primary, gold accent */
    --bg: #fbfaf5;
    --bg-2: #f3f1e8;
    --fg: #1a2b26;
    --fg-muted: #5d6b63;
    --card: #ffffff;
    --card-fg: #1a2b26;
    --border: #e8e4d6;
    --border-soft: rgba(232, 228, 214, 0.6);
    --primary: #0f6b4e;
    --primary-fg: #fbfaf5;
    --primary-soft: rgba(15, 107, 78, 0.1);
    --primary-softer: rgba(15, 107, 78, 0.05);
    --accent: #e8c87a;
    --accent-fg: #4a3a1a;
    --accent-soft: rgba(232, 200, 122, 0.18);
    --amber: #d97706;
    --amber-soft: rgba(217, 119, 6, 0.12);
    --rose: #be123c;
    --rose-soft: rgba(190, 18, 60, 0.12);
    --shadow-sm: 0 1px 3px rgba(15, 107, 78, 0.06), 0 1px 2px rgba(15, 107, 78, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 107, 78, 0.08), 0 2px 6px rgba(15, 107, 78, 0.05);
    --shadow-lg: 0 12px 32px rgba(15, 107, 78, 0.12), 0 4px 12px rgba(15, 107, 78, 0.08);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-arabic: "Amiri", "Scheherazade New", serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #122824;
        --bg-2: #0d1f1c;
        --fg: #f0ede4;
        --fg-muted: #9aa8a0;
        --card: #1a2e2a;
        --card-fg: #f0ede4;
        --border: rgba(255, 255, 255, 0.1);
        --border-soft: rgba(255, 255, 255, 0.06);
        --primary: #34a87a;
        --primary-fg: #122824;
        --primary-soft: rgba(52, 168, 122, 0.18);
        --primary-softer: rgba(52, 168, 122, 0.08);
        --accent: #d4a85a;
        --accent-fg: #1a2b26;
        --accent-soft: rgba(212, 168, 90, 0.15);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
    }
}

/* Theme override when .hmdi-dark is applied (manual toggle) */
.hmdi-dark {
    --bg: #122824;
    --bg-2: #0d1f1c;
    --fg: #f0ede4;
    --fg-muted: #9aa8a0;
    --card: #1a2e2a;
    --card-fg: #f0ede4;
    --border: rgba(255, 255, 255, 0.1);
    --border-soft: rgba(255, 255, 255, 0.06);
    --primary: #34a87a;
    --primary-fg: #122824;
    --primary-soft: rgba(52, 168, 122, 0.18);
    --primary-softer: rgba(52, 168, 122, 0.08);
    --accent: #d4a85a;
    --accent-fg: #1a2b26;
    --accent-soft: rgba(212, 168, 90, 0.15);
}

/* ============================================================
   Base + layout
   ============================================================ */

.hmdi-body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hmdi-root {
    min-height: 100vh;
    min-height: 100dvh;
}

* { box-sizing: border-box; }

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* Scrollbar */
.hmdi-root ::-webkit-scrollbar { width: 6px; height: 6px; }
.hmdi-root ::-webkit-scrollbar-track { background: transparent; }
.hmdi-root ::-webkit-scrollbar-thumb { background: var(--primary-soft); border-radius: 999px; }

/* Loading placeholder */
.hmdi-loading {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}
.hmdi-loading__icon {
    width: 56px; height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg);
    animation: hmdi-pulse 1.6s ease-in-out infinite;
}
.hmdi-loading__icon svg { width: 28px; height: 28px; }
.hmdi-loading__text { color: var(--fg-muted); font-size: 0.875rem; }

@keyframes hmdi-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.94); }
}

/* ============================================================
   Utilities
   ============================================================ */

.hmdi-gradient-emerald {
    background: linear-gradient(135deg, #0f6b4e, #1a8a66);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hmdi-gradient-gold {
    background: linear-gradient(135deg, #d4a85a, #e8c87a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hmdi-arabic { font-family: var(--font-arabic); }

.hmdi-glass {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.hmdi-dark .hmdi-glass {
    background: rgba(26, 46, 42, 0.6);
}

.hmdi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--fg);
    text-decoration: none;
}
.hmdi-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.hmdi-btn--primary {
    background: var(--primary);
    color: var(--primary-fg);
    box-shadow: var(--shadow-md);
}
.hmdi-btn--primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}
.hmdi-btn--ghost { color: var(--fg); }
.hmdi-btn--ghost:hover { background: var(--primary-softer); }
.hmdi-btn--lg { padding: 0.875rem 1.75rem; font-size: 1rem; height: 3.25rem; border-radius: var(--radius-lg); }
.hmdi-btn--lg.hmdi-btn--pill { border-radius: 999px; }
.hmdi-btn--pill { border-radius: 999px; }
.hmdi-btn--icon { padding: 0; width: 2.25rem; height: 2.25rem; }

.hmdi-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    padding-left: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--fg);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.hmdi-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.hmdi-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.375rem; color: var(--fg); }

/* Spinner */
.hmdi-spinner {
    width: 1.1rem; height: 1.1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: hmdi-spin 0.7s linear infinite;
}
@keyframes hmdi-spin { to { transform: rotate(360deg); } }

/* Animations: entrance */
@keyframes hmdi-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes hmdi-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes hmdi-scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.hmdi-anim-fade-up { animation: hmdi-fade-up 0.5s ease-out both; }
.hmdi-anim-fade-in { animation: hmdi-fade-in 0.4s ease-out both; }
.hmdi-anim-scale-in { animation: hmdi-scale-in 0.4s ease-out both; }

/* Floating orbs */
@keyframes hmdi-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}
.hmdi-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    pointer-events: none;
    animation: hmdi-float 8s ease-in-out infinite;
}

/* Ping dot */
@keyframes hmdi-ping {
    75%, 100% { transform: scale(2); opacity: 0; }
}
.hmdi-ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--primary);
    animation: hmdi-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ============================================================
   Landing view
   ============================================================ */

.hmdi-landing {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.hmdi-landing__bg {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
}
.hmdi-landing__bg::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(251, 250, 245, 0.4) 0%, rgba(251, 250, 245, 0.6) 50%, var(--bg) 100%);
}
.hmdi-dark .hmdi-landing__bg::after {
    background: linear-gradient(to bottom, rgba(18, 40, 36, 0.4) 0%, rgba(18, 40, 36, 0.6) 50%, var(--bg) 100%);
}
.hmdi-landing__header {
    position: relative; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
}
@media (min-width: 640px) { .hmdi-landing__header { padding: 1.25rem 2.5rem; } }
.hmdi-landing__brand {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 600; letter-spacing: -0.01em;
}
.hmdi-landing__logo {
    width: 2.25rem; height: 2.25rem;
    border-radius: 0.75rem;
    background: var(--primary); color: var(--primary-fg);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
}
.hmdi-landing__logo svg { width: 1.25rem; height: 1.25rem; }
.hmdi-landing__tagline {
    display: none;
    align-items: center; gap: 0.5rem;
    font-size: 0.875rem; color: var(--fg-muted);
}
@media (min-width: 640px) { .hmdi-landing__tagline { display: flex; } }
.hmdi-landing__main {
    position: relative; z-index: 2;
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem 1.5rem 2rem;
    text-align: center;
}
.hmdi-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.375rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--primary-soft);
    background: var(--primary-softer);
    color: var(--primary);
    font-size: 0.85rem; font-weight: 500;
    margin-bottom: 1.5rem;
}
.hmdi-badge__dot { position: relative; width: 0.5rem; height: 0.5rem; }
.hmdi-badge__dot span:first-child { position: absolute; inset: 0; border-radius: 50%; background: var(--primary); }
.hmdi-badge__dot span:last-child { position: absolute; inset: 0; border-radius: 50%; background: var(--primary); opacity: 0.6; animation: hmdi-ping 1.5s cubic-bezier(0,0,0.2,1) infinite; }

.hmdi-landing__arabic {
    font-family: var(--font-arabic);
    font-size: 2rem;
    color: var(--primary);
    margin: 0 0 1rem;
    direction: rtl;
}
@media (min-width: 640px) { .hmdi-landing__arabic { font-size: 2.5rem; } }

.hmdi-landing__title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin: 0;
    max-width: 48rem;
}
@media (min-width: 640px) { .hmdi-landing__title { font-size: 3.75rem; } }

.hmdi-landing__desc {
    margin: 1.5rem 0 0;
    max-width: 36rem;
    font-size: 1rem;
    color: var(--fg-muted);
}
@media (min-width: 640px) { .hmdi-landing__desc { font-size: 1.125rem; } }

.hmdi-landing__cta { margin-top: 2.5rem; }

.hmdi-pillars {
    margin-top: 4rem;
    width: 100%;
    max-width: 42rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 640px) { .hmdi-pillars { grid-template-columns: repeat(3, 1fr); } }
.hmdi-pillar {
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    text-align: left;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    transition: transform 0.2s;
}
.hmdi-dark .hmdi-pillar { background: rgba(26, 46, 42, 0.6); }
.hmdi-pillar:hover { transform: translateY(-4px); }
.hmdi-pillar__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem;
    border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    font-size: 0.75rem; font-weight: 700;
    margin-right: 0.5rem;
}
.hmdi-pillar__title { font-weight: 600; font-size: 0.875rem; }
.hmdi-pillar__desc { font-size: 0.75rem; color: var(--fg-muted); margin-top: 0.25rem; }

.hmdi-landing__footer {
    position: relative; z-index: 2;
    padding: 1.25rem 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--fg-muted);
}

/* ============================================================
   Auth view
   ============================================================ */

.hmdi-auth {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
}
.hmdi-auth__card {
    width: 100%;
    max-width: 28rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.hmdi-dark .hmdi-auth__card { background: rgba(26, 46, 42, 0.6); }

.hmdi-auth__header { display: flex; flex-direction: column; align-items: center; padding: 2rem 2rem 0; text-align: center; }
.hmdi-auth__logo {
    width: 3.5rem; height: 3.5rem;
    border-radius: 1rem;
    background: var(--primary); color: var(--primary-fg);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}
.hmdi-auth__logo svg { width: 1.75rem; height: 1.75rem; }
.hmdi-auth__title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.hmdi-auth__subtitle { font-size: 0.875rem; color: var(--fg-muted); margin: 0.25rem 0 0; }

.hmdi-auth__tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    margin: 1.5rem 2rem 0;
    padding: 0.25rem;
    background: var(--bg-2);
    border-radius: var(--radius-md);
}
.hmdi-auth__tab {
    position: relative;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--fg-muted);
    transition: color 0.2s;
}
.hmdi-auth__tab.is-active { color: var(--fg); }
.hmdi-auth__tab__pill {
    position: absolute; inset: 0;
    border-radius: var(--radius-sm);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    z-index: -1;
}

.hmdi-auth__form { padding: 1.5rem 2rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.hmdi-field { position: relative; }
.hmdi-field__icon { position: absolute; left: 0.75rem; top: 2.1rem; color: var(--fg-muted); width: 1rem; height: 1rem; pointer-events: none; }
.hmdi-auth__switch { padding: 0 2rem 2rem; text-align: center; font-size: 0.875rem; color: var(--fg-muted); }
.hmdi-link { color: var(--primary); font-weight: 500; background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; }
.hmdi-back {
    display: inline-flex; align-items: center; gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--fg-muted);
    font-size: 0.875rem;
    background: none; border: none; cursor: pointer;
    transition: color 0.2s;
}
.hmdi-back:hover { color: var(--fg); }

/* ============================================================
   Setup view
   ============================================================ */

.hmdi-setup {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
}
.hmdi-setup__wrap { width: 100%; max-width: 42rem; }
.hmdi-setup__dots { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 2rem; }
.hmdi-setup__dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--border); transition: all 0.3s; }
.hmdi-setup__dot.is-active { transform: scale(1.2); background: var(--primary); }
.hmdi-setup__bar { width: 2.5rem; height: 2px; background: var(--border); transition: background 0.3s; }
.hmdi-setup__bar.is-done { background: var(--primary); }

.hmdi-setup__head { text-align: center; margin-bottom: 2rem; }
.hmdi-setup__icon { width: 3rem; height: 3rem; border-radius: 1rem; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }
.hmdi-setup__title { font-size: 1.75rem; font-weight: 700; margin: 0; }
@media (min-width: 640px) { .hmdi-setup__title { font-size: 1.875rem; } }
.hmdi-setup__subtitle { color: var(--fg-muted); margin: 0.5rem 0 0; }

.hmdi-choices { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .hmdi-choices { grid-template-columns: 1fr 1fr; } }

.hmdi-choice {
    position: relative;
    text-align: left;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    background: var(--card);
    cursor: pointer;
    transition: all 0.2s;
}
.hmdi-choice:hover { transform: translateY(-4px); border-color: var(--primary-soft); }
.hmdi-choice.is-selected { border-color: var(--primary); background: var(--primary-softer); }
.hmdi-choice__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3rem; height: 3rem; border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}
.hmdi-choice__icon--emerald { background: var(--primary-soft); color: var(--primary); }
.hmdi-choice__icon--amber { background: var(--amber-soft); color: var(--amber); }
.hmdi-choice__title { font-size: 1.125rem; font-weight: 700; margin: 0 0 0.25rem; }
.hmdi-choice__desc { font-size: 0.875rem; color: var(--fg-muted); margin: 0 0 0.75rem; }
.hmdi-choice__badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 999px; background: var(--bg-2); font-size: 0.75rem; font-weight: 500; color: var(--fg-muted); }
.hmdi-choice__check {
    position: absolute; top: 1rem; right: 1rem;
    width: 1.5rem; height: 1.5rem; border-radius: 50%;
    background: var(--primary); color: var(--primary-fg);
    display: none; align-items: center; justify-content: center;
}
.hmdi-choice.is-selected .hmdi-choice__check { display: flex; }
.hmdi-choice__check svg { width: 0.875rem; height: 0.875rem; }

.hmdi-setup__actions { display: flex; align-items: center; justify-content: space-between; margin-top: 2rem; }

/* ============================================================
   App shell (header + nav)
   ============================================================ */

.hmdi-app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.hmdi-header {
    position: sticky; top: 0; z-index: 40;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
}
.hmdi-dark .hmdi-header { background: rgba(26, 46, 42, 0.7); }
.hmdi-header__inner {
    max-width: 64rem; margin: 0 auto;
    height: 4rem; padding: 0 1rem;
    display: flex; align-items: center; justify-content: space-between;
}
@media (min-width: 640px) { .hmdi-header__inner { padding: 0 1.5rem; } }
.hmdi-header__left { display: flex; align-items: center; gap: 0.75rem; }
.hmdi-header__logo { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-fg); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.hmdi-header__title { font-size: 0.875rem; font-weight: 600; line-height: 1.2; }
.hmdi-header__sub { font-size: 0.75rem; color: var(--fg-muted); }
.hmdi-header__nav { display: none; align-items: center; gap: 0.25rem; }
@media (min-width: 640px) { .hmdi-header__nav { display: flex; } }
.hmdi-nav-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.375rem 0.875rem; border-radius: 999px;
    border: none; background: transparent; color: var(--fg-muted);
    font-size: 0.875rem; font-weight: 500; transition: all 0.2s;
}
.hmdi-nav-btn:hover { background: var(--primary-softer); color: var(--fg); }
.hmdi-nav-btn.is-active { background: var(--primary-soft); color: var(--primary); }
.hmdi-header__right { display: flex; align-items: center; gap: 0.375rem; }

.hmdi-main { flex: 1; }
.hmdi-main__inner { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem; }
@media (min-width: 640px) { .hmdi-main__inner { padding: 2rem 1.5rem; } }

/* Mobile bottom nav */
.hmdi-mobile-nav {
    position: sticky; bottom: 0; z-index: 40;
    border-top: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    display: flex;
}
@media (min-width: 640px) { .hmdi-mobile-nav { display: none; } }
.hmdi-mobile-nav__item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
    padding: 0.5rem; padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: none; border: none;
    font-size: 0.75rem; font-weight: 500;
    color: var(--fg-muted);
}
.hmdi-mobile-nav__item.is-active { color: var(--primary); }

/* ============================================================
   Dashboard view
   ============================================================ */

.hmdi-dash-greeting { font-size: 0.875rem; color: var(--fg-muted); margin: 0; }
.hmdi-dash-title { font-size: 1.5rem; font-weight: 700; margin: 0.25rem 0 0; letter-spacing: -0.02em; }
@media (min-width: 640px) { .hmdi-dash-title { font-size: 1.875rem; } }
.hmdi-dash-date { display: flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; color: var(--fg-muted); margin-top: 0.25rem; }

.hmdi-grid-5 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1024px) { .hmdi-grid-5 { grid-template-columns: 2fr 3fr; } }

/* Progress ring */
.hmdi-ring-card {
    position: relative; overflow: hidden;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    padding: 1.5rem; text-align: center;
}
.hmdi-dark .hmdi-ring-card { background: rgba(26, 46, 42, 0.6); }
.hmdi-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.hmdi-ring svg { transform: rotate(-90deg); }
.hmdi-ring__bg { stroke: var(--primary-soft); }
.hmdi-ring__fg { stroke: url(#hmdi-ring-grad); transition: stroke-dashoffset 1.4s ease; }
.hmdi-ring__content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hmdi-ring__num { font-size: 3rem; font-weight: 700; line-height: 1; }
.hmdi-ring__label { font-size: 0.875rem; font-weight: 500; color: var(--fg-muted); margin-top: 0.125rem; }
.hmdi-ring__pct { font-size: 0.75rem; color: var(--fg-muted); margin-top: 0.25rem; }
.hmdi-ring-stats { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; font-size: 0.875rem; color: var(--fg-muted); }

/* Phase card */
.hmdi-phase-card {
    position: relative; overflow: hidden;
    border-radius: var(--radius-xl);
    border: 1px solid; padding: 1.5rem;
    height: 100%;
}
.hmdi-phase-card--emerald { background: var(--primary-softer); border-color: var(--primary-soft); }
.hmdi-phase-card--amber { background: var(--amber-soft); border-color: rgba(217, 119, 6, 0.2); }
.hmdi-phase-card--rose { background: var(--rose-soft); border-color: rgba(190, 18, 60, 0.2); }
.hmdi-phase-card__badge { display: inline-flex; align-items: center; gap: 0.5rem; }
.hmdi-phase-card__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    font-size: 0.75rem; font-weight: 700;
}
.hmdi-phase-card--emerald .hmdi-phase-card__num { background: rgba(255,255,255,0.7); color: var(--primary); }
.hmdi-phase-card--amber .hmdi-phase-card__num { background: rgba(255,255,255,0.7); color: var(--amber); }
.hmdi-phase-card--rose .hmdi-phase-card__num { background: rgba(255,255,255,0.7); color: var(--rose); }
.hmdi-phase-card--emerald .hmdi-phase-card__tag { color: var(--primary); }
.hmdi-phase-card--amber .hmdi-phase-card__tag { color: var(--amber); }
.hmdi-phase-card--rose .hmdi-phase-card__tag { color: var(--rose); }
.hmdi-phase-card__tag { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.hmdi-phase-card__arabic { font-family: var(--font-arabic); font-size: 1.5rem; margin-top: 0.75rem; direction: rtl; }
.hmdi-phase-card--emerald .hmdi-phase-card__arabic { color: var(--primary); }
.hmdi-phase-card--amber .hmdi-phase-card__arabic { color: var(--amber); }
.hmdi-phase-card--rose .hmdi-phase-card__arabic { color: var(--rose); }
.hmdi-phase-card__name { font-size: 1.25rem; font-weight: 700; margin: 0.25rem 0 0; }
.hmdi-phase-card__subtitle { font-size: 0.875rem; font-weight: 500; margin: 0; }
.hmdi-phase-card--emerald .hmdi-phase-card__subtitle { color: var(--primary); }
.hmdi-phase-card--amber .hmdi-phase-card__subtitle { color: var(--amber); }
.hmdi-phase-card--rose .hmdi-phase-card__subtitle { color: var(--rose); }
.hmdi-phase-card__desc { font-size: 0.875rem; color: var(--fg-muted); margin: 0.75rem 0 0; }
.hmdi-phase-dots { display: flex; gap: 0.375rem; margin-top: 1.25rem; }
.hmdi-phase-dot { height: 0.375rem; flex: 1; border-radius: 999px; background: var(--primary-soft); }
.hmdi-phase-dot.is-done { background: var(--primary); }
.hmdi-phase-dot.is-today { background: var(--primary); opacity: 0.6; box-shadow: 0 0 0 2px var(--primary-soft); }

/* Session cards */
.hmdi-sessions { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.5rem; }
@media (min-width: 640px) { .hmdi-sessions { grid-template-columns: 1fr 1fr; } }
.hmdi-session-card {
    position: relative; overflow: hidden;
    text-align: left;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.hmdi-session-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.hmdi-session-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.hmdi-session-card__icon {
    width: 3rem; height: 3rem; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
}
.hmdi-session-card__icon--amber { background: var(--amber-soft); color: var(--amber); }
.hmdi-session-card__icon--emerald { background: var(--primary-soft); color: var(--primary); }
.hmdi-session-card__check {
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    background: #10b981; color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.hmdi-session-card__title { font-size: 1.125rem; font-weight: 700; margin: 1rem 0 0; }
.hmdi-session-card__subtitle { font-size: 0.875rem; color: var(--fg-muted); margin: 0; }
.hmdi-session-card__footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.hmdi-session-card__time { padding: 0.25rem 0.625rem; border-radius: 999px; background: var(--bg-2); font-size: 0.75rem; font-weight: 500; color: var(--fg-muted); }
.hmdi-session-card__cta { font-size: 0.875rem; font-weight: 500; color: var(--primary); display: inline-flex; align-items: center; gap: 0.25rem; }

.hmdi-pill-active {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.25rem 0.625rem; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary);
    font-size: 0.75rem; font-weight: 500;
}
.hmdi-pill-active__dot { position: relative; width: 0.375rem; height: 0.375rem; }
.hmdi-pill-active__dot span { position: absolute; inset: 0; border-radius: 50%; background: var(--primary); }
.hmdi-pill-active__dot span:last-child { animation: hmdi-ping 1.5s cubic-bezier(0,0,0.2,1) infinite; opacity: 0.6; }

/* Tip card */
.hmdi-tip { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem; border-radius: var(--radius-lg); border: 1px solid var(--border-soft); background: rgba(255,255,255,0.65); backdrop-filter: blur(16px); margin-top: 1.5rem; }
.hmdi-dark .hmdi-tip { background: rgba(26,46,42,0.6); }
.hmdi-tip__icon { width: 2.25rem; height: 2.25rem; flex-shrink: 0; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: flex; align-items: center; justify-content: center; }
.hmdi-tip__title { font-size: 0.875rem; font-weight: 600; margin: 0; }
.hmdi-tip__text { font-size: 0.875rem; color: var(--fg-muted); margin: 0.125rem 0 0; }

/* ============================================================
   Journal view
   ============================================================ */

.hmdi-journal { max-width: 42rem; margin: 0 auto; }
.hmdi-journal__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.hmdi-journal__saved { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.75rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 0.75rem; font-weight: 500; }

.hmdi-journal__hero {
    position: relative; overflow: hidden;
    border-radius: var(--radius-xl); border: 1px solid var(--border-soft);
    margin-bottom: 1.5rem;
}
.hmdi-journal__hero-img { display: block; width: 100%; height: 8rem; object-fit: cover; }
@media (min-width: 640px) { .hmdi-journal__hero-img { height: 10rem; } }
.hmdi-journal__hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0.1), transparent);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 1.25rem;
}
.hmdi-journal__hero-row { display: flex; align-items: center; gap: 0.5rem; }
.hmdi-journal__hero-icon { width: 2rem; height: 2rem; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.hmdi-journal__hero-icon--pagi { background: rgba(251, 191, 36, 0.9); color: #422006; }
.hmdi-journal__hero-icon--malam { background: rgba(15, 107, 78, 0.9); color: #fff; }
.hmdi-journal__hero-meta { font-size: 0.875rem; color: rgba(255,255,255,0.85); margin: 0; }
.hmdi-journal__hero-title { font-size: 1.125rem; font-weight: 700; color: #fff; margin: 0; }

.hmdi-journal__phase { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.hmdi-journal__phase-badge { padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.hmdi-journal__phase-badge--emerald { background: var(--primary-soft); color: var(--primary); }
.hmdi-journal__phase-badge--amber { background: var(--amber-soft); color: var(--amber); }
.hmdi-journal__phase-badge--rose { background: var(--rose-soft); color: var(--rose); }

.hmdi-q-card {
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.hmdi-dark .hmdi-q-card { background: rgba(26,46,42,0.6); }
.hmdi-q-card__head { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; }
.hmdi-q-card__num {
    flex-shrink: 0;
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.875rem; font-weight: 700;
}
.hmdi-q-card__text { font-size: 0.95rem; font-weight: 500; line-height: 1.5; margin: 0; padding-top: 0.125rem; }
.hmdi-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-2);
    color: var(--fg);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: box-shadow 0.2s;
}
.hmdi-textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-soft); }
.hmdi-q-card__count { text-align: right; font-size: 0.75rem; color: var(--fg-muted); margin-top: 0.375rem; }

.hmdi-save-bar {
    position: sticky; bottom: 1rem; z-index: 10;
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 0.75rem;
}
.hmdi-dark .hmdi-save-bar { background: rgba(26,46,42,0.8); }
.hmdi-save-bar__hint { flex: 1; font-size: 0.75rem; color: var(--fg-muted); }
.hmdi-save-bar__hint--ok { color: var(--primary); }

.hmdi-journal__hint {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.75rem; border-radius: var(--radius-md); background: var(--bg-2);
    font-size: 0.75rem; color: var(--fg-muted); margin-top: 1rem;
}
.hmdi-journal__hint svg { flex-shrink: 0; width: 0.875rem; height: 0.875rem; color: var(--amber); margin-top: 0.125rem; }

/* ============================================================
   History view
   ============================================================ */

.hmdi-history { max-width: 48rem; margin: 0 auto; }
.hmdi-history__head { margin-bottom: 1.5rem; }
.hmdi-history__crumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--fg-muted); }
.hmdi-history__title { font-size: 1.5rem; font-weight: 700; margin: 0.25rem 0 0; }
@media (min-width: 640px) { .hmdi-history__title { font-size: 1.875rem; } }
.hmdi-history__subtitle { font-size: 0.875rem; color: var(--fg-muted); margin: 0.25rem 0 0; }

.hmdi-timeline { position: relative; }
.hmdi-timeline__line { position: absolute; left: 1.1875rem; top: 0.5rem; bottom: 0.5rem; width: 1px; background: linear-gradient(to bottom, var(--primary-soft), transparent); }
@media (min-width: 640px) { .hmdi-timeline__line { left: 1.4375rem; } }

.hmdi-day-item { position: relative; padding-left: 3rem; margin-bottom: 0.75rem; }
@media (min-width: 640px) { .hmdi-day-item { padding-left: 3.5rem; } }
.hmdi-day-item__dot {
    position: absolute; left: 0; top: 1.25rem; z-index: 1;
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    border: 4px solid var(--bg);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.75rem; font-weight: 700;
    box-shadow: var(--shadow-sm);
}
@media (min-width: 640px) { .hmdi-day-item__dot { width: 3rem; height: 3rem; } }
.hmdi-day-item__dot--emerald { background: var(--primary); }
.hmdi-day-item__dot--amber { background: var(--amber); }
.hmdi-day-item__dot--rose { background: var(--rose); }

.hmdi-day-card { border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow 0.2s; }
.hmdi-day-card:hover { box-shadow: var(--shadow-md); }
.hmdi-day-card__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem; background: none; border: none; width: 100%; text-align: left; cursor: pointer; transition: background 0.2s; }
.hmdi-day-card__head:hover { background: var(--bg-2); }
.hmdi-day-card__title { font-weight: 600; font-size: 0.95rem; }
.hmdi-day-card__badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 999px; background: var(--bg-2); font-size: 0.75rem; font-weight: 500; color: var(--fg-muted); margin-left: 0.5rem; }
.hmdi-day-card__date { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--fg-muted); margin-top: 0.125rem; }
.hmdi-day-card__icons { display: flex; gap: 0.25rem; }
.hmdi-day-card__icon { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.hmdi-day-card__icon--pagi { background: var(--amber-soft); color: var(--amber); }
.hmdi-day-card__icon--malam { background: var(--primary-soft); color: var(--primary); }
.hmdi-day-card__chev { transition: transform 0.2s; color: var(--fg-muted); }
.hmdi-day-card.is-open .hmdi-day-card__chev { transform: rotate(180deg); }

.hmdi-day-card__body { padding: 1rem; border-top: 1px solid var(--border-soft); display: none; }
.hmdi-day-card.is-open .hmdi-day-card__body { display: block; }
.hmdi-session-group__head { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; margin-bottom: 0.5rem; }
.hmdi-session-group__head--pagi { background: var(--amber-soft); color: var(--amber); }
.hmdi-session-group__head--malam { background: var(--primary-soft); color: var(--primary); }
.hmdi-session-group { margin-bottom: 1rem; }
.hmdi-session-group:last-child { margin-bottom: 0; }
.hmdi-answer { border: 1px solid var(--border-soft); background: var(--bg-2); border-radius: var(--radius-md); padding: 0.75rem; margin-bottom: 0.75rem; }
.hmdi-answer:last-child { margin-bottom: 0; }
.hmdi-answer__q { font-size: 0.75rem; font-weight: 500; color: var(--fg-muted); }
.hmdi-answer__a { font-size: 0.875rem; line-height: 1.55; margin: 0.375rem 0 0; white-space: pre-wrap; }

/* Empty state */
.hmdi-empty { text-align: center; padding: 4rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius-xl); }
.hmdi-empty__icon { width: 4rem; height: 4rem; border-radius: var(--radius-lg); background: var(--bg-2); color: var(--fg-muted); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }
.hmdi-empty__title { font-size: 1.125rem; font-weight: 600; margin: 0; }
.hmdi-empty__text { font-size: 0.875rem; color: var(--fg-muted); margin: 0.25rem auto 1.25rem; max-width: 20rem; }

/* Completed state */
.hmdi-completed { text-align: center; padding: 3rem 1rem; }
.hmdi-completed__icon { width: 5rem; height: 5rem; border-radius: 1.5rem; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; box-shadow: var(--shadow-lg); animation: hmdi-float 4s ease-in-out infinite; }
.hmdi-completed__title { font-size: 1.875rem; font-weight: 700; margin: 0; }
@media (min-width: 640px) { .hmdi-completed__title { font-size: 2.25rem; } }
.hmdi-completed__text { color: var(--fg-muted); margin: 0.75rem auto 0; max-width: 28rem; }

/* Waiting state */
.hmdi-waiting { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; text-align: center; }
.hmdi-waiting__icon { width: 5rem; height: 5rem; border-radius: 1.5rem; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; box-shadow: var(--shadow-lg); animation: hmdi-float 4s ease-in-out infinite; }
.hmdi-waiting__title { font-size: 1.5rem; font-weight: 700; margin: 0; }
@media (min-width: 640px) { .hmdi-waiting__title { font-size: 1.875rem; } }
.hmdi-waiting__date { font-size: 1.125rem; font-weight: 600; color: var(--primary); margin: 0.5rem 0 0; }

/* Toast */
.hmdi-toast-wrap { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.hmdi-toast {
    pointer-events: auto;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fg);
    display: flex; align-items: center; gap: 0.5rem;
    animation: hmdi-toast-in 0.3s ease-out;
    max-width: 90vw;
}
.hmdi-toast--success { border-color: var(--primary); color: var(--primary); }
.hmdi-toast--error { border-color: #ef4444; color: #ef4444; }
@keyframes hmdi-toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hmdi-toast-out { to { opacity: 0; transform: translateY(-12px); } }
.hmdi-toast.is-leaving { animation: hmdi-toast-out 0.25s ease-in forwards; }

/* Shimmer skeleton */
.hmdi-shimmer {
    background: linear-gradient(90deg, var(--bg-2) 0%, var(--card) 50%, var(--bg-2) 100%);
    background-size: 1000px 100%;
    animation: hmdi-shimmer 2s infinite linear;
    border-radius: var(--radius-lg);
}
@keyframes hmdi-shimmer { from { background-position: -1000px 0; } to { background-position: 1000px 0; } }

/* Default page templates (non-app) */
.hmdi-default-header { background: var(--card); border-bottom: 1px solid var(--border-soft); }
.hmdi-default-header__inner { max-width: 64rem; margin: 0 auto; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.hmdi-default-header__brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--fg); font-weight: 600; }
.hmdi-default-header__logo { font-size: 1.25rem; }
.hmdi-default-main { max-width: 64rem; margin: 0 auto; padding: 2rem 1.5rem; }
.hmdi-default-content h1 { font-size: 2rem; margin: 0 0 0.5rem; }
.hmdi-default-postlist { list-style: none; padding: 0; }
.hmdi-default-postlist li { padding: 0.75rem 0; border-bottom: 1px solid var(--border-soft); }
.hmdi-default-postlist a { font-weight: 600; text-decoration: none; color: var(--primary); }
.hmdi-default-footer { background: var(--card); border-top: 1px solid var(--border-soft); padding: 2rem 1.5rem; text-align: center; color: var(--fg-muted); font-size: 0.875rem; }
.hmdi-default-footer__inner { max-width: 64rem; margin: 0 auto; }
.hmdi-default-footer p { margin: 0.25rem 0; }
.hmdi-default-404 { text-align: center; padding: 4rem 1rem; }
.hmdi-default-404 h1 { font-size: 3rem; margin: 0; }
.hmdi-default-single { max-width: 48rem; margin: 0 auto; }
.hmdi-default-single h1 { font-size: 2rem; margin: 0 0 0.5rem; }
.hmdi-default-single time { color: var(--fg-muted); font-size: 0.875rem; }
.hmdi-default-single__content { margin-top: 1.5rem; line-height: 1.7; }
