:root {
    --bg: #f6f3ed;
    --surface: #fffdf8;
    --surface-2: #f0ece3;
    --ink: #161615;
    --muted: #777166;
    --line: rgba(25, 24, 21, .11);
    --dark: #171717;
    --lavender: #d8d0ff;
    --yellow: #f6df7f;
    --peach: #ffcfb7;
    --green: #cfecc9;
    --blue: #cce6ff;
    --shadow: 0 24px 70px rgba(47, 42, 34, .12);
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
}

[data-theme="dark"] {
    --bg: #121211;
    --surface: #1c1b19;
    --surface-2: #262420;
    --ink: #f9f5ec;
    --muted: #b7aea0;
    --line: rgba(255,255,255,.11);
    --shadow: 0 24px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at 10% 0%, rgba(216,208,255,.7), transparent 26%), radial-gradient(circle at 90% 5%, rgba(246,223,127,.55), transparent 24%), var(--bg);
    color: var(--ink);
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.page-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 20px 0 90px; }

.brand-row { display: inline-flex; align-items: center; gap: 12px; }
.brand-row.compact { color: var(--ink); }
.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    background: var(--dark);
    box-shadow: 0 12px 24px rgba(0,0,0,.16);
}
.brand-row strong { display: block; font-size: 17px; letter-spacing: -.03em; }
.brand-row span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn, .icon-btn {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    padding: 13px 18px;
    font-weight: 800;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
    color: var(--ink);
}
.btn:hover, .icon-btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--ink); color: var(--surface); box-shadow: 0 14px 26px rgba(0,0,0,.14); }
.btn.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn.dark { background: var(--dark); color: white; }
.btn.small { padding: 9px 13px; font-size: 13px; }
.btn.full { width: 100%; }
.icon-btn { width: 44px; height: 44px; padding: 0; background: var(--surface); border: 1px solid var(--line); }

.mini-pill, .date-pill {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--lavender);
    color: #211d34;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.mini-pill.peach { background: var(--peach); color: #422014; }
.mini-pill.green { background: var(--green); color: #193915; }
.date-pill { background: var(--surface-2); color: var(--muted); text-transform: none; }
.muted, .helper-text { color: var(--muted); }
.helper-text { line-height: 1.7; }

.auth-layout {
    min-height: calc(100vh - 40px);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
    gap: 24px;
    align-items: stretch;
}
.auth-hero, .auth-panel, .card, .hero-main-card, .hero-stat-card, .reminder-banner, .app-header {
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.auth-hero {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 720px;
    overflow: hidden;
    position: relative;
}
.auth-hero::after {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: var(--yellow);
    filter: blur(25px);
    opacity: .32;
    right: -150px;
    top: -150px;
}
.hero-copy { position: relative; z-index: 1; max-width: 720px; padding: 70px 0 30px; }
h1 { margin: 14px 0; font-size: clamp(38px, 7vw, 76px); line-height: .92; letter-spacing: -.07em; }
.hero-copy p, .hero-main-card p { color: var(--muted); line-height: 1.8; font-size: 17px; max-width: 650px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.phone-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; position: relative; z-index: 1; }
.phone-card {
    min-height: 180px;
    border-radius: 30px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #181818;
}
.phone-card.lavender { background: var(--lavender); }
.phone-card.yellow { background: var(--yellow); }
.phone-card.dark { background: var(--dark); color: white; }
.phone-card span { opacity: .75; font-weight: 800; }
.phone-card h3 { margin: 0; font-size: 28px; letter-spacing: -.05em; }
.bubble-row { display: flex; gap: 8px; }
.bubble-row i { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.55); }
.progress-line { height: 10px; border-radius: 99px; background: rgba(255,255,255,.45); overflow: hidden; }
.progress-line b { display: block; height: 100%; background: #181818; border-radius: inherit; }
.auth-panel { background: var(--surface); border-radius: var(--radius-xl); padding: 18px; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: var(--radius-xl); padding: 28px; border: 1px solid var(--line); }
.auth-card.narrow { max-width: 520px; }
.auth-card h1, .auth-card h2 { margin: 12px 0 8px; line-height: 1; letter-spacing: -.05em; }
.auth-card h2 { font-size: 34px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 5px; margin-bottom: 20px; }
.tab { text-align: center; padding: 11px; border-radius: 999px; color: var(--muted); font-weight: 900; }
.tab.active { background: var(--ink); color: var(--surface); }

.form-stack, .profile-form, .progress-form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label { display: grid; gap: 8px; font-size: 13px; font-weight: 900; color: var(--ink); }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--ink);
    padding: 14px 15px;
    outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(0,0,0,.35); box-shadow: 0 0 0 4px rgba(216,208,255,.45); }

.alert {
    padding: 13px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    margin: 12px 0;
    font-weight: 700;
}
.alert.success { background: rgba(207,236,201,.8); color: #183413; }
.alert.error { background: rgba(255,207,183,.85); color: #4d1f11; }
.floating-alert { position: sticky; top: 10px; z-index: 30; }

.app-header {
    position: sticky;
    top: 12px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    padding: 14px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(14px);
    border-radius: 28px;
}
.header-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.dashboard-hero { display: grid; grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(145px, .6fr)); gap: 14px; margin-bottom: 14px; }
.hero-main-card, .hero-stat-card, .card, .reminder-banner { background: var(--surface); border-radius: var(--radius-xl); padding: 24px; }
.hero-main-card h1 { font-size: clamp(32px, 5vw, 56px); }
.hero-stat-card { min-height: 210px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-stat-card.lavender { background: var(--lavender); color: #201a38; }
.hero-stat-card.yellow { background: var(--yellow); color: #3d2b00; }
.hero-stat-card.dark { background: var(--dark); color: #fff; }
.hero-stat-card span { font-weight: 900; opacity: .72; }
.hero-stat-card strong { display: block; font-size: 48px; letter-spacing: -.07em; }
.hero-stat-card p { margin: 0; font-weight: 800; }

.body-status-card {
    margin-top: 18px;
    padding: 16px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.body-status-card span, .today-status span { display: block; color: var(--muted); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: .03em; }
.body-status-card strong { display: block; margin-top: 8px; font-size: 34px; letter-spacing: -.06em; }
.body-status-card p, .today-status p { margin: 8px 0 0; line-height: 1.65; color: var(--muted); }
.body-status-card.under, .status-metric.under, .today-status.under, .status-chip.under { background: var(--blue); color: #12324c; }
.body-status-card.ideal, .status-metric.ideal, .today-status.ideal, .status-chip.ideal { background: var(--green); color: #173514; }
.body-status-card.over, .status-metric.over, .today-status.over, .status-chip.over { background: var(--yellow); color: #3d2b00; }
.body-status-card.obese, .status-metric.obese, .today-status.obese, .status-chip.obese { background: var(--peach); color: #4d2011; }
.status-metric span { color: inherit; opacity: .72; }
.today-status {
    padding: 16px;
    border-radius: 22px;
    border: 1px solid var(--line);
    margin-top: 4px;
}
.today-status strong { display: block; margin-top: 8px; font-size: 22px; letter-spacing: -.04em; }
.status-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 950;
    white-space: nowrap;
}


.reminder-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; background: var(--peach); color: #2e160d; }
.reminder-banner strong, .reminder-banner span { display: block; }
.reminder-banner span { opacity: .72; margin-top: 4px; }
.hidden { display: none !important; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.card { grid-column: span 4; }
.card.wide { grid-column: span 8; }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-head h2 { margin: 10px 0 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.055em; line-height: 1; }
.compact-head { margin-bottom: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 18px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.metric-card span, .meal-list span { color: var(--muted); font-size: 13px; font-weight: 900; }
.metric-card strong { font-size: 23px; letter-spacing: -.04em; }
.meal-list { display: grid; gap: 10px; }
.meal-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.meal-list strong { font-size: 20px; }
.workout-big { font-size: 64px; font-weight: 950; letter-spacing: -.08em; }
.workout-big span { font-size: 20px; color: var(--muted); letter-spacing: -.03em; }
.pretty-list { padding: 0; margin: 16px 0 0; list-style: none; display: grid; gap: 10px; }
.pretty-list li { padding: 12px 14px; border-radius: 18px; background: var(--surface-2); line-height: 1.55; }
.pretty-list li::before { content: "✓"; margin-right: 8px; font-weight: 900; }

.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    cursor: pointer;
}
.check-card input { width: 20px; height: 20px; accent-color: #181818; }
.check-card span { font-weight: 900; }

.inline-form { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; margin-bottom: 16px; }
.habit-list { display: grid; gap: 9px; }
.habit-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 18px; background: var(--surface-2); }
.habit-row span { font-weight: 800; }
.text-danger { background: transparent; border: 0; color: #b33a28; cursor: pointer; font-weight: 900; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row input { width: 22px; height: 22px; }

.table-wrap { overflow-x: auto; border-radius: 24px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 780px; background: var(--surface-2); }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td { font-weight: 700; }

.bottom-dock {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 18px;
    z-index: 40;
    display: flex;
    gap: 6px;
    padding: 7px;
    background: color-mix(in srgb, var(--dark) 92%, transparent);
    border-radius: 999px;
    box-shadow: 0 14px 40px rgba(0,0,0,.28);
}
.bottom-dock a { color: white; padding: 11px 15px; border-radius: 999px; font-size: 13px; font-weight: 900; opacity: .8; }
.bottom-dock a.active, .bottom-dock a:hover { background: white; color: #111; opacity: 1; }

.install-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 8px; }


.premium-plan-badge {
    background: var(--yellow);
    color: #3d2b00;
    border: 1px solid rgba(0,0,0,.08);
    cursor: default;
}
.premium-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    background: var(--dark);
    color: white;
    font-size: 12px;
    font-weight: 950;
    white-space: nowrap;
}
.premium-stat-locked {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--yellow), var(--peach)) !important;
}
.premium-stat-locked::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 26px;
    border: 1px dashed rgba(0,0,0,.25);
    pointer-events: none;
}
.premium-locked-section {
    position: relative;
    overflow: hidden;
    min-height: 320px;
}
.premium-content.locked-blur {
    filter: blur(6px);
    opacity: .33;
    pointer-events: none;
    user-select: none;
    transform: scale(.995);
}
.premium-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    padding: 24px;
    background: color-mix(in srgb, var(--surface) 58%, transparent);
    backdrop-filter: blur(2px);
}
.premium-lock-overlay.compact { padding: 18px; }
.premium-lock-box {
    width: min(430px, 100%);
    padding: 22px;
    border-radius: 28px;
    text-align: center;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border: 1px solid var(--line);
    box-shadow: 0 24px 70px rgba(0,0,0,.14);
}
.premium-lock-box.small-box { padding: 18px; }
.lock-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: var(--dark);
    color: white;
    font-size: 32px;
    box-shadow: 0 18px 36px rgba(0,0,0,.18);
}
.premium-lock-box h3 {
    margin: 0 0 8px;
    font-size: 28px;
    letter-spacing: -.055em;
}
.premium-lock-box p {
    margin: 0 auto 16px;
    color: var(--muted);
    line-height: 1.65;
    max-width: 360px;
}
.premium-page-grid {
    min-height: calc(100vh - 40px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
    gap: 18px;
    align-items: stretch;
}
.premium-hero-card,
.premium-action-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
    padding: 28px;
}
.premium-hero-card h1 { font-size: clamp(40px, 6vw, 72px); }
.premium-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.premium-feature {
    padding: 16px;
    border-radius: 22px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-weight: 900;
}
.price-box {
    padding: 22px;
    border-radius: 28px;
    background: var(--yellow);
    color: #3d2b00;
    margin: 18px 0;
}
.price-box span { font-weight: 900; opacity: .75; }
.price-box strong { display: block; margin-top: 4px; font-size: 38px; letter-spacing: -.06em; }
.admin-note {
    margin-top: 16px;
    padding: 14px;
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--muted);
    line-height: 1.65;
    font-size: 13px;
}

@media (max-width: 980px) {
    .premium-page-grid { grid-template-columns: 1fr; }
    .auth-layout, .dashboard-hero { grid-template-columns: 1fr; }
    .auth-hero { min-height: auto; }
    .phone-grid { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .card, .card.wide { grid-column: span 1; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid.four { grid-template-columns: repeat(2, 1fr); }
    .check-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
    .premium-feature-grid { grid-template-columns: 1fr; }
    .page-shell { width: min(100% - 18px, 1180px); padding-top: 10px; }
    .auth-hero, .auth-panel, .card, .hero-main-card, .hero-stat-card, .reminder-banner { border-radius: 26px; padding: 18px; }
    .auth-layout { gap: 10px; }
    h1 { font-size: 42px; }
    .app-header { align-items: start; flex-direction: column; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1; }
    .dashboard-hero { gap: 10px; }
    .hero-stat-card { min-height: 150px; }
    .hero-stat-card strong { font-size: 40px; }
    .metric-grid, .form-grid, .form-grid.four, .check-grid { grid-template-columns: 1fr; }
    .section-head { flex-direction: column; }
    .reminder-banner { flex-direction: column; align-items: start; }
    .inline-form { grid-template-columns: 52px 1fr; }
    .inline-form button { grid-column: 1 / -1; }
    .bottom-dock { width: calc(100% - 22px); justify-content: space-between; }
    .bottom-dock a { padding: 10px 12px; }
}


/* Modal sukses berbentuk kotak di tengah layar */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(16, 15, 13, .46);
    backdrop-filter: blur(8px);
}
.success-modal-card {
    width: min(420px, 100%);
    padding: 28px;
    border-radius: 30px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 34px 120px rgba(0,0,0,.24);
    animation: modalPop .22s ease-out;
}
.modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: var(--green);
    color: #173914;
    font-size: 36px;
    font-weight: 950;
}
.success-modal-card h2 {
    margin: 0 0 8px;
    font-size: 34px;
    letter-spacing: -.055em;
}
.success-modal-card p {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.65;
}
@keyframes modalPop {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Admin dashboard */
.admin-hero .hero-main-card h1 { max-width: 680px; }
.admin-search {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 10px;
    min-width: min(460px, 100%);
}
.admin-table-wrap table { min-width: 980px; }
.admin-user-cell { display: grid; gap: 4px; }
.admin-user-cell strong { font-size: 15px; }
.admin-user-cell span, .admin-user-cell em, .admin-table small {
    color: var(--muted);
    font-size: 12px;
}
.admin-user-cell em {
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--yellow);
    color: #3d2b00;
    font-style: normal;
    font-weight: 900;
}
.admin-subscription-form {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}
.admin-subscription-form select { min-width: 120px; padding: 10px 12px; border-radius: 999px; }

@media (max-width: 760px) {
    .admin-search, .admin-subscription-form { grid-template-columns: 1fr; }
}
