/* Rep App: phone-first styles, no build step. */
:root {
    --brand: #0f766e;
    --brand-dark: #115e59;
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --warning: #92400e;
    --warning-bg: #fef3c7;
    --success: #166534;
    --success-bg: #dcfce7;
    --info: #1e40af;
    --info-bg: #dbeafe;
    --gray-bg: #f3f4f6;
    --radius: 12px;
    --nav-height: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
}

body.has-nav { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }

a { color: var(--brand); }

h1, h2 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.05rem; }

.container { max-width: 640px; margin: 0 auto; padding: 16px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--brand);
    color: #fff;
}
.topbar-title { font-weight: 600; font-size: 1.1rem; }
.topbar-sub { font-size: .8rem; opacity: .85; }

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.link-button {
    display: inline-block;
    text-decoration: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, .5);
    color: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: .85rem;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--card);
    border-top: 1px solid var(--border);
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    text-decoration: none;
    font-size: .75rem;
}
.bottom-nav svg { width: 24px; height: 24px; fill: currentColor; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }

.offline-banner {
    background: var(--warning-bg);
    color: var(--warning);
    text-align: center;
    font-size: .85rem;
    padding: 6px 12px;
}

.card {
    display: block;
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    color: inherit;
}
.card-link { text-decoration: none; }
.card-link:active { background: #f9fafb; }
.card-muted { background: transparent; box-shadow: none; border: 1px dashed var(--border); }
.card-done { opacity: .7; }
.card-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.card-value { font-size: 1.35rem; font-weight: 600; margin: 2px 0 6px; }
.card-title { font-weight: 600; font-size: 1rem; margin: 0; }

.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.text-danger { color: var(--danger); font-weight: 600; }
.greeting { font-size: 1.3rem; font-weight: 600; margin: 4px 0 0; }
.time { color: var(--brand); margin-right: 4px; }

.badge {
    display: inline-block;
    white-space: nowrap;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: .75rem;
    font-weight: 600;
    margin: 2px 4px 2px 0;
}
.badge-info, .badge-primary { background: var(--info-bg); color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--gray-bg); color: var(--muted); }

.progress { height: 8px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.progress span { display: block; height: 100%; background: var(--brand); }

.tabs { display: flex; background: var(--card); border-radius: var(--radius); padding: 4px; margin-bottom: 12px; }
.tabs a {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
}
.tabs a.active { background: var(--brand); color: #fff; }
.count { display: inline-block; min-width: 1.4em; font-size: .8rem; opacity: .85; }

.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; text-align: center; }
.date-nav a {
    font-size: 1.6rem;
    text-decoration: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border-radius: 50%;
}

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 500; }

.details { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; font-size: .92rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

.note { background: var(--gray-bg); border-radius: 8px; padding: 10px 12px; margin-top: 8px; white-space: normal; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .button { flex: 1; }

.alert { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }

.form label { display: block; font-weight: 500; margin: 12px 0 4px; }
.form input[type=text], .form input[type=password], .form input[type=search], .form textarea {
    width: 100%;
    font: inherit;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.form input[type=file] { width: 100%; font-size: .9rem; }
.error { color: var(--danger); font-size: .85rem; margin: 6px 0 0; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { margin: 0 !important; }
.choice input { position: absolute; opacity: 0; }
.choice span {
    display: block;
    text-align: center;
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 500;
    font-size: .92rem;
}
.choice input:checked + span { border-color: var(--brand); background: var(--brand); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--brand); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 0;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.button-block { width: 100%; margin-top: 16px; }
.button-primary { background: var(--brand); color: #fff; }
.button-primary:active { background: var(--brand-dark); }
.button-secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
form > .button-block:first-of-type { margin-top: 0; margin-bottom: 12px; }
.button[disabled] { opacity: .6; }

.photo, .photo-preview { display: block; max-width: 100%; border-radius: 8px; margin-top: 10px; }

.login { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login .form { text-align: left; margin-top: 20px; }
.login-logo { border-radius: 16px; }

.achievement { margin-top: 10px; }
.achievement .progress { margin: 4px 0 2px; }
.progress span.progress-good { background: #16a34a; }
.progress span.progress-low { background: #d97706; }
/* Reptor's Beranda: one ring per rep, filled to their month's achievement (--p, 0-100). */
.pie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 10px; }
.pie-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pie-item { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 6px; border-radius: 12px; color: inherit; text-decoration: none; }
.pie-item:active { background: var(--gray-bg); }
.pie { --c: var(--brand); width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
    background: repeating-conic-gradient(from -1.5deg, var(--card) 0 3deg, transparent 3deg 90deg),
        conic-gradient(var(--c) calc(var(--p) * 1%), var(--gray-bg) 0); } /* ticks mark every 25% */
.pie span { width: 64px; height: 64px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 700; }
.pie-good { --c: #16a34a; }
.pie-low { --c: #d97706; }
.pie-name { font-weight: 600; font-size: .9rem; }
.ring-row { display: flex; align-items: center; gap: 16px; margin: 8px 0 4px; }
.ring-row .pie { margin-bottom: 0; }
.pie-sub { font-size: .75rem; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.date-nav-spacer { width: 44px; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list-link { display: block; flex: 1; color: inherit; text-decoration: none; }
.bottom-nav a { position: relative; }
.nav-badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.toast { position: fixed; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 20; max-width: 616px; margin: 0 auto; display: block; padding: 12px 14px; border-radius: var(--radius); background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.toast[hidden] { display: none; }
