:root {
  --green: #1f3b2d; --green-2: #2f5641; --green-soft: #e4ece5;
  --sand: #b8925a; --sand-soft: #f1e7d6;
  --paper: #f6f2ea; --card: #fffdf9; --ink: #23272a; --muted: #6b7068; --line: #e3dccd;
  --ok: #2f7d4f; --wait: #a87526; --bad: #b4432f;
  --r: 14px;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.25; color: var(--green); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.hidden { display: none !important; }

/* ---- kerangka ---- */
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 110px; }
.topbar { padding: 22px 0 12px; }
.topbar .hello { font-family: var(--serif); font-size: 1.5rem; color: var(--green); }
.topbar .date { color: var(--muted); font-size: .95rem; }
.brand { font-family: var(--serif); font-weight: 700; color: var(--green); letter-spacing: .2px; }
.brand span { color: var(--sand); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.card.soft { background: var(--sand-soft); border-color: #e6d6bb; }
.card.green { background: var(--green); border-color: var(--green); color: #f2efe6; }
.card.green h2, .card.green h3 { color: #fff; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.label { font-size: .78rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--sand); }

/* ---- tombol ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer; min-height: 48px; text-decoration: none; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sand { background: var(--sand); border-color: var(--sand); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: .92rem; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: none; color: var(--green-2); font-weight: 600; cursor: pointer; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---- form ---- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #d6cdb9; background: #fff; border-radius: 11px; padding: 12px 13px; font-size: 16px; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--sand); outline-offset: 1px; border-color: var(--sand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pin { letter-spacing: 8px; text-align: center; font-size: 1.4rem; }

/* ---- login ---- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 28px 20px; max-width: 420px; margin: 0 auto; }
.login h1 { margin: 6px 0 6px; }
.login .intro { color: var(--muted); margin-bottom: 22px; }
.login-art { height: 70px; margin-bottom: 18px; }

/* ---- strip minggu ---- */
.week { display: flex; align-items: center; gap: 6px; margin: 4px 0 16px; }
.week .nav { border: none; background: none; width: 30px; height: 56px; cursor: pointer; color: var(--muted); font-size: 1.3rem; }
.days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 6px 0 7px; text-align: center; cursor: pointer; }
.day .dn { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.day .dd { display: block; font-weight: 700; font-size: 1.05rem; }
.day .dot { display: block; width: 7px; height: 7px; border-radius: 50%; margin: 2px auto 0; background: transparent; }
.day.plan .dot { background: var(--sand); }
.day.done .dot { background: var(--ok); }
.day.today { border-color: var(--sand); }
.day.sel { background: var(--green); border-color: var(--green); color: #fff; }
.day.sel .dn { color: #d7dccf; }

/* ---- menu harian ---- */
.session-type { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--green-soft); color: var(--green); }
.session-type.rest { background: #ece9e2; color: var(--muted); }
.session-type.strength { background: var(--sand-soft); color: #7d5a26; }
.session h2 { margin: 8px 0 4px; font-size: 1.45rem; }
.target { font-weight: 600; color: var(--green-2); }
.details { white-space: pre-line; margin-top: 10px; }
.ex { border-top: 1px dashed var(--line); padding: 12px 0; }
.ex:last-child { padding-bottom: 2px; }
.ex-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ex-name { font-weight: 700; }
.ex-dose { font-weight: 700; color: var(--green-2); white-space: nowrap; }
.ex-note { color: var(--muted); font-size: .93rem; margin-top: 2px; }
.video { margin-top: 10px; }
.video .frame { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #1c1f1d; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.countdown { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.countdown b { font-family: var(--serif); font-size: 1.9rem; line-height: 1; }

/* ---- latihan ---- */
.status { display: inline-block; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.status.wait { background: #f6ead3; color: var(--wait); }
.status.done { background: #e1efe6; color: var(--ok); }
.wo { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.wo:last-child { border-bottom: none; }
.wo .t { font-weight: 700; }
.drop { border: 2px dashed #d3c6ab; border-radius: var(--r); padding: 22px 16px; text-align: center; background: #fbf7ef; cursor: pointer; }
.drop b { display: block; font-size: 1.05rem; color: var(--green); }
.confirm { background: var(--green-soft); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: #fbf8f1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: .8rem; color: var(--muted); }
.stat .v { font-weight: 700; font-size: 1.15rem; }
.zbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 8px 0 6px; background: #eee; }
.zbar span { display: block; height: 100%; }
.zlegend { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: .78rem; text-align: center; }
.z1 { background: #9fb8c9; } .z2 { background: #5f9a6e; } .z3 { background: #d4b04c; } .z4 { background: #d98b3f; } .z5 { background: #c0533a; } .z0 { background: #d9d4c8; }
.chart { width: 100%; height: 120px; display: block; }
.chart-axis { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 2px; }
table.laps { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.laps th, table.laps td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.laps th:first-child, table.laps td:first-child { text-align: left; }
.review { border-left: 4px solid var(--sand); background: #fffaf0; }
.review .from { font-size: .88rem; color: var(--muted); margin-top: 8px; }
.verdict { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--green); }

/* ---- profil ---- */
.range { position: relative; height: 10px; background: #ece6d9; border-radius: 5px; margin: 14px 0 22px; }
.range .ok { position: absolute; top: 0; bottom: 0; background: #bcd6c3; border-radius: 5px; }
.range .me { position: absolute; top: -5px; width: 4px; height: 20px; background: var(--green); border-radius: 2px; }
.range .me::after { content: attr(data-l); position: absolute; top: 21px; left: 50%; transform: translateX(-50%); font-size: .78rem; white-space: nowrap; color: var(--green); font-weight: 700; }
.zlist div { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 10px; }
.zlist div + div { margin-top: 4px; }
.zlist .main { background: var(--green-soft); font-weight: 700; }
.zlist i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }

/* ---- navigasi bawah ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabbar .in { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 560px; }
.tab { border: none; background: none; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .8rem; color: var(--muted); cursor: pointer; font-weight: 600; }
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--green); }
.tab .badge { position: absolute; margin-left: 22px; background: var(--sand); color: #fff; font-size: .68rem; border-radius: 9px; padding: 0 5px; }

/* ---- lembar (sheet) ---- */
.sheet-bg { position: fixed; inset: 0; background: rgba(25, 30, 27, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px 28px; -webkit-overflow-scrolling: touch; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.close { border: none; background: #e9e3d6; width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }

#toast { pointer-events: none; position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--green); color: #fff; padding: 11px 16px; border-radius: 12px; opacity: 0; transition: .25s; z-index: 60; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- panel mentor (layar lebar) ---- */
.m-layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.m-side { background: var(--green); color: #e9eee6; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.m-side .brand { color: #fff; font-size: 1.15rem; margin-bottom: 22px; display: block; }
.m-nav { display: block; width: 100%; text-align: left; border: none; background: none; color: #dfe6dc; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.m-nav.on { background: rgba(255,255,255,.12); color: #fff; }
.m-nav .count { float: right; background: var(--sand); color: #fff; border-radius: 9px; padding: 0 7px; font-size: .8rem; }
.m-main { padding: 26px 28px 60px; max-width: 1100px; }
.m-main h1 { margin-bottom: 4px; }
.m-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.m-table { width: 100%; border-collapse: collapse; }
.m-table th, .m-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.m-table th { font-size: .82rem; color: var(--muted); font-weight: 600; }
.m-table tr.click { cursor: pointer; }
.m-table tr.click:hover td { background: #fbf6ec; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.weekgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.wcell { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 130px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.wcell:hover { border-color: var(--sand); }
.wcell .h { font-size: .8rem; color: var(--muted); }
.wcell .tt { font-weight: 700; line-height: 1.25; }
.wcell .add { margin-top: auto; color: var(--muted); font-size: .85rem; }
.wcell.today { border-color: var(--sand); box-shadow: inset 0 0 0 1px var(--sand); }
.ex-row { display: grid; grid-template-columns: 1.6fr .7fr .7fr 1.4fr 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.ex-row .x { border: none; background: #eee6d6; border-radius: 8px; height: 40px; cursor: pointer; }
.side-note { font-size: .85rem; color: #c9d3c6; margin-top: 26px; line-height: 1.45; }
.mobile-top { display: none; }

@media (max-width: 860px) {
  .m-layout { grid-template-columns: 1fr; }
  .m-side { position: static; height: auto; padding: 12px 14px; display: flex; gap: 6px; overflow-x: auto; }
  .m-side .brand, .side-note { display: none; }
  .m-nav { width: auto; white-space: nowrap; }
  .m-main { padding: 18px 14px 60px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .weekgrid { grid-template-columns: 1fr; }
  .wcell { min-height: 0; }
  .ex-row { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 520px) { .stats { grid-template-columns: repeat(3, 1fr); } }
