:root {
  --bg: #F6F5FA;
  --panel: #FFFFFF;
  --ink: #15151A;
  --muted: #8A8A99;
  --line: #EFEEF5;
  --black: #131316;
  --accent: #131316;
  --link: #7A6408;
  --peri: #C9CCF6; --peri-t: #E7E8FB; --peri-ink: #2E3488;
  --khaki: #DCD38F; --khaki-t: #F3EFCF; --khaki-ink: #55501E;
  --mint: #CFE6DE; --mint-t: #E6F2EE; --mint-ink: #235A48;
  --peach: #F0E2D6; --peach-t: #F8F0E9; --peach-ink: #7A5A3E;
  --pinkc: #F4D9E2; --pink-t: #FAEDF1; --pink-ink: #8A2E4A;
  --yellow: #F6D34A;
  /* legacy names used in views */
  --pink: #F4D9E2; --blue: #C9CCF6; --blue-t: #E7E8FB; --blue-ink: #2E3488; --lav-t: #E7E8FB; --yellow-t: #F3EFCF;
  --shadow: 0 2px 10px rgba(40, 40, 80, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink); background: linear-gradient(180deg, #E8E7F8 0, var(--bg) 340px) no-repeat, var(--bg); min-height: 100vh;
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Frame ---------- */
.frame { display: grid; grid-template-columns: 92px 1fr; max-width: 1360px; margin: 0 auto; min-height: 100vh; }
.sidebar { position: sticky; top: 16px; height: calc(100vh - 32px); max-height: 760px; margin: 16px 0 16px 16px; padding: 14px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; border-radius: 34px; background: var(--black); }
.brand { display: block; width: 48px; height: 48px; border-radius: 14px; overflow: hidden; margin-bottom: 10px; text-decoration: none; box-shadow: 0 4px 12px rgba(5, 57, 44, .25); }
.brand img { width: 48px; height: 48px; display: block; }
.brand span { display: none; }
.nav { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.nav a { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; color: #A3A3B2; }
.nav a span { position: absolute; left: 64px; background: var(--black); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 10px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5; }
.nav a:hover span { opacity: 1; }
.nav a svg { width: 21px; height: 21px; }
.nav a:hover { color: #fff; }
.nav a.active { background: #fff; color: var(--black); }
.nav a .badge { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); }
.tip { display: none; }
.signout-btn { margin-top: auto; width: 52px; height: 52px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; color: #A3A3B2; cursor: pointer; }
.signout-btn span { display: none; }
.signout-btn:hover { color: #fff; }
.content { padding: 22px 26px 24px; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.crumb { font-size: 13px; color: var(--muted); margin-top: 2px; }
.crumb a { color: var(--muted); text-decoration: none; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.chip { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 4px 4px 14px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); }
.chip .avatar { width: 40px; height: 40px; border-radius: 50%; font-size: 13px; background: var(--yellow) !important; color: var(--ink) !important; order: 2; border: 2px solid #fff; }
.chip b { display: block; font-size: 13.5px; }
.chip span { display: block; font-size: 12px; color: var(--muted); }
.sq { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 0; box-shadow: var(--shadow); display: grid; place-items: center; text-decoration: none; cursor: pointer; }
.sq svg { width: 19px; height: 19px; }
#tb-signout { display: none; }
#view { flex: 1; }
.foot-bar { display: none; }

/* ---------- Type ---------- */
h1.page { display: none; }
.pname { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
h2.section { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head > .btn:last-child, .page-head > .tools { margin-left: auto; }
.page-head .sub { margin: 0; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 10px; flex-wrap: wrap; }
.see { color: var(--link); font-weight: 600; font-size: 13px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; background: var(--black); color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; min-height: 42px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: #2B2B31; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px #E6E5EE; }
.btn.ghost:hover { background: #F6F5FA; }
.btn.soft { background: var(--khaki); color: var(--ink); }
.btn.soft:hover { background: #D2C87E; }
.btn.danger { background: #fff; color: #B3324F; box-shadow: inset 0 0 0 1px #F3CBD6; }
.btn.danger:hover { background: #FFF5F7; }
.btn.sm { padding: 7px 14px; min-height: 36px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
/* WhatsApp buttons: WhatsApp green with the logo. Dark text keeps it readable on the bright green. */
.btn.wa, [data-theme="dark"] .btn.wa { background: #25D366; color: #073B1E; box-shadow: none; }
.btn.wa:hover, [data-theme="dark"] .btn.wa:hover { background: #1EBE5A; }
.btn.wa .wa-ic { width: 17px; height: 17px; flex: none; }
.wa-link { color: #128C4A; display: inline-flex; align-items: center; gap: 4px; }
.wa-link .wa-ic { width: 14px; height: 14px; color: #25D366; }
[data-theme="dark"] .wa-link { color: #4ADE80; }
.abar.wa, [data-theme="dark"] .abar.wa { background: #25D366; color: #073B1E; }
.abar.wa .wa-ic { width: 20px; height: 20px; margin-right: 8px; flex: none; }
.link { background: none; border: 0; color: var(--link); font-weight: 600; cursor: pointer; padding: 0; font-size: 13.5px; }

/* Pastel action bar with round black button (from the reference look) */
.abar { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 50px; border-radius: 25px; background: rgba(255, 255, 255, .62); padding: 0 5px 0 18px; font-weight: 600; text-decoration: none; color: var(--ink); border: 0; width: 100%; cursor: pointer; font-size: 14px; }
.abar:hover { background: rgba(255, 255, 255, .85); }
.abar.white { background: #fff; }
.abar.dark { background: var(--black); color: #fff; }
.abar.dark .go { background: #fff; color: var(--black); }
.go { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--black); color: #fff; display: grid; place-items: center; border: 0; cursor: pointer; text-decoration: none; }
.go svg { width: 17px; height: 17px; }
.go.sm { width: 36px; height: 36px; }
.ibtn { width: 44px; height: 44px; flex: none; border-radius: 50%; background: #fff; border: 0; display: grid; place-items: center; color: var(--ink); box-shadow: var(--shadow); text-decoration: none; cursor: pointer; }
.ibtn svg { width: 18px; height: 18px; }

/* ---------- Cards ---------- */
.card { background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); }
.pad { padding: 18px 20px; }
.pc { border-radius: 26px; padding: 18px; position: relative; overflow: hidden; }
.pc.peri, .bg-peri { background: var(--peri); } .pc.khaki, .bg-khaki { background: var(--khaki); } .pc.mint, .bg-mint { background: var(--mint); }
.pc.peach, .bg-peach { background: var(--peach); } .pc.pinkc, .bg-pink { background: var(--pinkc); } .bg-yellow { background: var(--yellow); }
.pc .kick { font-size: 12.5px; font-weight: 600; opacity: .75; }
.pc .big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.pc .small { font-size: 12.5px; opacity: .8; margin-top: 3px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stats.four, .stats.money { display: flex; }
.stat { flex: 1 1 140px; min-width: 0; background: var(--tint, #fff); border-radius: 20px; padding: 12px 16px; position: relative; }
.stat .label { font-size: 12.5px; font-weight: 600; color: var(--tink, #4A4B57); }
.stat .value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; white-space: nowrap; }
.stat .value small { font-size: 12px; font-weight: 600; color: var(--tink, var(--muted)); margin-left: 4px; letter-spacing: 0; opacity: .8; }
.stat .spark { display: none; }
.pink { --tint: var(--pinkc); --tink: var(--pink-ink); }
.blue { --tint: var(--peri); --tink: var(--peri-ink); }
.green { --tint: var(--mint); --tink: var(--mint-ink); }
.lav { --tint: var(--peri-t); --tink: var(--peri-ink); }
.peach { --tint: var(--khaki); --tink: var(--khaki-ink); }

/* ---------- Hero (now a compact pastel card) ---------- */
.hero { position: relative; overflow: hidden; border-radius: 26px; background: var(--peach); padding: 18px 20px; margin-bottom: 14px; min-height: 0; }
.hero .when { color: var(--peach-ink); font-size: 13px; font-weight: 600; position: relative; z-index: 3; }
.hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 0; position: relative; z-index: 3; }
.hero .orb { display: none; }
.hero .wave { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-size: 26px; z-index: 2; }

/* ---------- Lists ---------- */
.list { background: #fff; border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item:hover { background: #FAFAFD; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-size: 14px; font-weight: 700; }
.item .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.item .chev { color: #9a9cab; width: 18px; height: 18px; }
.item .amt { text-align: right; }
.item .amt b { font-size: 14px; display: block; margin-bottom: 4px; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { background: #fff; border-radius: 20px; padding: 10px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; font-size: 14px; }
.row .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.thumb { width: 48px; height: 48px; border-radius: 15px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; border-radius: 20px; }
.avatar.ani { background: #F3EFE2 url(/avatars.webp) no-repeat; background-size: 2000% 100%; background-position: calc(var(--ai, 0) * 100% / 19) 0; border-radius: 50%; font-size: 0; color: transparent; display: inline-block; vertical-align: middle; }
.avatar.ani.lg { width: 72px; height: 72px; border-radius: 50%; }
.avatar.ani.xl { width: 112px; height: 112px; }
button.av-edit { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }
button.av-edit::after { content: '✎'; position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: 13px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel); }
button.av-edit:focus-visible { outline: 3px solid var(--peri-ink); outline-offset: 3px; }
.avpick-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 14px; }
.avpick-hero b { font-size: 16px; }
.avpick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.avpick button { border: 3px solid transparent; border-radius: 50%; padding: 0; background: none; cursor: pointer; aspect-ratio: 1; }
.avpick button .avatar { width: 100%; height: 100%; }
.avpick button.on { border-color: var(--ink); }
.avpick button:focus-visible { outline: 3px solid var(--peri-ink); outline-offset: 2px; }
.av0 { background: var(--yellow); color: var(--ink); } .av1 { background: var(--pinkc); color: var(--pink-ink); } .av2 { background: var(--peri); color: var(--peri-ink); } .av3 { background: var(--mint); color: var(--mint-ink); } .av4 { background: var(--khaki); color: var(--khaki-ink); }
.pill { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill.paid, .pill.present, .pill.done { background: var(--mint); color: var(--mint-ink); }
.pill.unpaid, .pill.scheduled { background: var(--khaki-t); color: var(--khaki-ink); }
.pill.overdue, .pill.absent { background: var(--pinkc); color: var(--pink-ink); }
.pill.checking { background: var(--peri-t); color: var(--peri-ink); }
.pill.cancelled { background: #EDEDF1; color: #6B6D7B; }
.pill.white { background: #fff; color: var(--ink); }

/* ---------- Empty ---------- */
.empty { padding: 36px 20px; text-align: center; }
.empty .icon { width: 64px; height: 64px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; margin: 0 auto 14px; font-size: 28px; }
.empty h3 { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.empty p { color: var(--muted); font-size: 13.5px; margin: 0; }
.empty .next { color: var(--link); font-weight: 600; }

/* ---------- Segmented / chips ---------- */
.seg { display: inline-flex; background: #fff; border-radius: 999px; padding: 4px; gap: 2px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: #55556A; }
.seg button.on { background: var(--black); color: #fff; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; padding: 9px; }
.pchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.pchips::-webkit-scrollbar { display: none; }
.pchip { height: 40px; flex: none; border-radius: 20px; padding: 0 6px 0 16px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; border: 0; color: var(--ink); text-decoration: none; cursor: pointer; }
.pchip b { min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; background: #fff; display: grid; place-items: center; font-size: 12px; }
.pchip.dark { background: var(--black); color: #fff; padding: 0 18px; }
.pchip.plain { background: #fff; padding: 0 18px; box-shadow: var(--shadow); }

/* ---------- Week strip / navbar ---------- */
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
.navbar .title { font-weight: 700; font-size: 15px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #F6F5FA; cursor: pointer; display: grid; place-items: center; }
.iconbtn:hover { background: #EEEDF4; }
.iconbtn svg { width: 17px; height: 17px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 0 10px 12px; }
.day { border: 0; background: none; border-radius: 18px; padding: 8px 0; cursor: pointer; text-align: center; }
.day:hover { background: #F6F5FA; }
.day .dn { font-size: 12px; color: var(--muted); font-weight: 600; }
.day .dd { font-size: 17px; font-weight: 700; margin: 2px 0; }
.day .dc { font-size: 11.5px; color: var(--muted); }
.day.today .dd { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.day.on { background: var(--black); color: #fff; }
.day.on .dn, .day.on .dc { color: #C9C9D4; }

/* ---------- Month calendar ---------- */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.month .mh { padding: 8px 6px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.mc { min-height: 92px; padding: 5px 5px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.mc:nth-child(7n) { border-right: 0; }
.mc:hover { background: #FBFBFE; }
.mc.out { background: #FAFAFC; }
.mc.out .n { color: #C0C0CC; }
.mc .n { text-align: right; font-size: 12px; font-weight: 600; color: #4A4B57; padding: 2px 4px; }
.mc.today .n span { background: var(--black); color: #fff; border-radius: 999px; padding: 2px 7px; }
.mc.sel { box-shadow: inset 0 0 0 2px var(--black); border-radius: 6px; }
.ev { display: block; font-size: 11.5px; line-height: 1.3; border-radius: 8px; padding: 4px 6px; margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: var(--peri); color: var(--peri-ink); }
.ev b { font-weight: 700; }
.ev.group { background: var(--khaki); color: var(--khaki-ink); }
.ev.done { background: var(--mint); color: var(--mint-ink); }
.ev.cancelled { text-decoration: line-through; opacity: .55; }
.more { font-size: 11px; color: var(--muted); margin: 3px 0 0 4px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 14px; font-size: 12.5px; color: #4A4B57; border-top: 1px solid var(--line); }
.legend-row i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Class cards ---------- */
.classes { display: flex; flex-direction: column; gap: 8px; }
.class { background: var(--peri); border-radius: 22px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.class.group { background: var(--khaki); }
.class.done { background: var(--mint); }
.class.cancelled { background: #EFEEF4; opacity: .7; }
.class .time { width: 70px; flex: none; }
.class .time b { font-size: 15px; display: block; }
.class .time span { color: rgba(21, 21, 26, .6); font-size: 12px; }
.class .bar { display: none; }
.class .info { flex: 1; min-width: 0; }
.class .info .t { font-size: 14.5px; font-weight: 700; }
.class .info .s { color: rgba(21, 21, 26, .65); font-size: 12.5px; margin-top: 2px; }
.class .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.class .btn.ghost { background: rgba(255, 255, 255, .7); box-shadow: none; }
.class .btn:not(.ghost) { background: var(--black); color: #fff; }

/* ---------- Search ---------- */
.search { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 999px; padding: 0 18px; height: 46px; margin-bottom: 12px; box-shadow: var(--shadow); }
.search input { border: 0; outline: 0; flex: 1; font-size: 14px; background: none; min-width: 0; }
.search svg { width: 18px; height: 18px; color: #8A8A99; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.field input:not([type=file]):not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; border: 1px solid #E6E5EE; background: #fff; border-radius: 14px; padding: 10px 13px; font-size: 14px; outline: 0;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #A9ADEE; box-shadow: 0 0 0 3px var(--peri-t); }
.full { grid-column: 1 / -1; }
.section-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px; }
.section-card h3 { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.section-card .desc { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.upload { display: flex; align-items: center; gap: 16px; }
.upload .preview { width: 88px; height: 88px; border-radius: 18px; background: #F6F5FA; border: 1px dashed #D8DAE6; display: grid; place-items: center; overflow: hidden; flex: none; }
.upload .preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.upload .preview svg { width: 24px; height: 24px; color: #6B6D7B; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
code.tag { background: #F2F1F7; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

/* ---------- Banner ---------- */
.banner { display: flex; align-items: center; gap: 12px; background: var(--khaki); border-radius: 22px; padding: 12px 14px 12px 18px; margin-bottom: 14px; }
.banner svg { width: 22px; height: 22px; color: var(--khaki-ink); flex: none; }
.banner p { margin: 0; flex: 1; font-size: 13.5px; line-height: 1.45; }

/* ---------- Chart ---------- */
.chart { display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; height: 200px; gap: 14px; padding: 16px 10px 0; border-bottom: 1px solid var(--line); }
.chart .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .stack { width: min(100%, 44px); display: flex; flex-direction: column; gap: 3px; }
.chart .seg-o { background: var(--khaki); border-radius: 10px; }
.chart .seg-c { background: var(--peri); border-radius: 10px 10px 4px 4px; }
.chart .tot { font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.chart-x { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 8px 10px 0; text-align: center; color: var(--muted); font-size: 12.5px; }
.legend { display: flex; gap: 16px; color: #4A4B57; margin: 6px 0 0; font-size: 13px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: #FAFAFD; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.n, .tbl th.n { text-align: center; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(25, 25, 40, .3); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(4px); }
.modal { background: #fff; border-radius: 28px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 22px; box-shadow: 0 30px 80px rgba(30, 30, 70, .2); }
.modal.wide { width: min(760px, 100%); }
.modal h3 { font-size: 19px; font-weight: 800; margin: 0 0 14px; letter-spacing: -.01em; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chk { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #E6E5EE; border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 13.5px; }
.chk.on { border-color: var(--black); background: var(--black); color: #fff; font-weight: 600; }
.chk input { display: none; }
.att { background: #F8F7FB; border-radius: 20px; padding: 14px; margin-bottom: 10px; }
.att .top { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.att .avatar { width: 36px; height: 36px; font-size: 12px; }
.stars { display: inline-flex; gap: 0; }
.stars button { border: 0; background: none; font-size: 22px; cursor: pointer; color: #DADCE6; padding: 0 2px; }
.stars button.on { color: #E8B92C; }
.att textarea { width: 100%; margin-top: 10px; border: 1px solid #E6E5EE; border-radius: 14px; padding: 9px 12px; min-height: 54px; resize: vertical; background: #fff; }

/* ---------- Documents ---------- */
.doc { background: #fff; border-radius: 22px; border: 1px solid var(--line); padding: 26px; }
.doc .dh { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 20px; }
.doc .dh img { max-height: 56px; max-width: 150px; }
.doc .dh h4 { font-size: 20px; margin: 0; letter-spacing: .06em; }
.doc .meta { color: #5C5E6C; font-size: 13.5px; line-height: 1.6; }
.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.doc th, .doc td { padding: 8px 6px; border-bottom: 1px solid #EEE; text-align: left; font-size: 13.5px; }
.doc .total { text-align: right; font-size: 20px; font-weight: 800; }
.doc .pay { display: flex; gap: 20px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed #DDD; flex-wrap: wrap; }
.doc .pay img { width: 150px; height: 150px; object-fit: contain; border: 1px solid #EEE; border-radius: 14px; }
.doc pre { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.65; margin: 0; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.sign div { border-top: 1px solid #999; padding-top: 8px; color: #555; font-size: 12.5px; }
.slip { margin-top: 14px; display: flex; gap: 14px; align-items: center; background: var(--peri-t); border-radius: 18px; padding: 10px; }
.slip img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; background: #fff; cursor: zoom-in; }

/* ---------- Detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.profile { display: flex; gap: 16px; align-items: center; padding: 18px 20px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 0 20px 18px; }
.kv div span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.kv div b { font-weight: 600; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--black); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 80; font-weight: 600; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.err { color: #B3324F; font-size: 13.5px; margin-top: 8px; }

/* ---------- Lesson report form ---------- */
.pill.late { background: var(--khaki-t); color: var(--khaki-ink); }
.att .here { margin-top: 6px; }
.att .rates { display: grid; gap: 4px; margin-top: 10px; }
.att .rate { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-radius: 14px; padding: 2px 12px; }
.att .rate > span:first-child { font-size: 13.5px; color: #4A4B57; font-weight: 500; }
.att .lbl, .section-card .lbl { font-size: 12.5px; font-weight: 700; color: #4A4B57; margin: 12px 0 6px; }
.lbl .muted { color: var(--muted); font-weight: 500; }
.att .inp { width: 100%; border: 1px solid #E6E5EE; background: #fff; border-radius: 14px; padding: 9px 12px; font-size: 14px; outline: 0; }
.att .inp:focus, .att textarea:focus { border-color: #A9ADEE; box-shadow: 0 0 0 3px var(--peri-t); outline: 0; }
.att textarea { margin-top: 0; }
.att textarea.report { min-height: 140px; line-height: 1.55; }
.seg.wrap { flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-t { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #E6E5EE; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: #4A4B57; }
.chip-t.on { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); font-weight: 600; }
.chip-t.warm.on { background: var(--khaki); border-color: var(--khaki); color: var(--khaki-ink); }
.chip-t.add { border-style: dashed; color: var(--link); font-weight: 600; }
.chip-t.off { opacity: .45; text-decoration: line-through; background: #F6F5FA; }
.chip-t .x { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 2px; color: #8A8C9B; }
.inline-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.inline-add input { flex: 1; min-width: 150px; border: 1px solid #A9ADEE; border-radius: 999px; padding: 8px 14px; font-size: 14px; outline: 0; background: #fff; }
.inline-add .err { width: 100%; margin: 0; }
.ai-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ai-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; min-height: 0; }
.share { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.share input { width: 18px; height: 18px; accent-color: var(--black); }
.att .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.priv { margin-top: 10px; }
.priv summary { cursor: pointer; font-size: 13px; color: #4A4B57; font-weight: 600; }
.priv textarea { margin-top: 8px !important; }
details.rep { margin-top: 6px; }
details.rep summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: 13px; }
details.rep p { white-space: pre-wrap; font-size: 14px; line-height: 1.55; margin: 8px 0 10px; color: var(--ink); }

/* ---------- Settings: syllabuses ---------- */
.syl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.syl { text-align: left; border: 1px solid #E6E5EE; background: #fff; border-radius: 18px; padding: 10px 13px; cursor: pointer; }
.syl b { display: block; font-size: 14px; }
.syl span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.syl.on { background: var(--peri); border-color: var(--peri); }
.syl.on b { color: var(--peri-ink); }

/* ---------- Parent view ---------- */
.ptop { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ptop .hi { font-size: 16px; font-weight: 700; }
.ptitle { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 12px; }
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.phead .avatar.ani.lg { width: 64px; height: 64px; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pgrid .pc { padding: 14px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.meter { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .7); }
.meter i { display: block; height: 6px; border-radius: 3px; background: var(--mint-ink); }
.reports { display: flex; flex-direction: column; gap: 10px; }
.rcard { padding: 16px 18px; }
.rhead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.rhead b { font-size: 15px; }
.rscores { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: #4A4B57; }
.rscores span { margin-right: 6px; }
.mini-stars { color: #E8B92C; letter-spacing: 1px; }
.mini-stars i { color: #DADCE6; font-style: normal; }
.rline { margin-top: 10px; font-size: 14px; }
.rline span { color: var(--muted); font-weight: 600; font-size: 12.5px; margin-right: 8px; }
.rtext { white-space: pre-wrap; font-size: 14.5px; line-height: 1.6; margin: 10px 0 0; }
.hwbox { margin-top: 12px; background: var(--peri-t); border-radius: 16px; padding: 10px 14px; font-size: 14px; }
.prog { margin-top: 14px; }
.pbars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 120px; }
.pb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.pb i { display: block; width: min(100%, 26px); background: var(--peri); border-radius: 10px 10px 4px 4px; }
.pb span { font-size: 11.5px; color: var(--muted); }
.paybox { display: flex; gap: 12px; align-items: center; background: rgba(255, 255, 255, .6); border-radius: 18px; padding: 10px; margin: 12px 0; }
.paybox img { width: 96px; height: 96px; object-fit: contain; border-radius: 12px; background: #fff; flex: none; cursor: zoom-in; }
.paybox .meta { font-size: 13px; line-height: 1.5; }
.rcpt { background: var(--mint); border-radius: 26px; padding: 18px; }
.rcpt .grid { background: rgba(255, 255, 255, .65); border-radius: 18px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; font-size: 13px; margin: 12px 0; }
.rcpt .grid span { display: block; font-size: 11.5px; color: var(--mint-ink); }
.rcpt .lines { background: #fff; border-radius: 18px; padding: 10px 14px; font-size: 13px; }
.rcpt .lines div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.rcpt .fine { font-size: 11.5px; color: var(--mint-ink); margin-top: 10px; line-height: 1.5; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }
.chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chat-head .t { font-weight: 700; font-size: 15px; }
.chat-head .s { font-size: 12.5px; color: var(--muted); }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 10px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 20px; line-height: 1.45; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg.out { align-self: flex-end; background: var(--black); color: #fff; border-bottom-right-radius: 6px; }
.msg .tm { font-size: 10.5px; opacity: .55; margin-top: 3px; text-align: right; }
.msg img { display: block; max-width: 220px; max-height: 220px; border-radius: 14px; margin: -3px -7px 6px; cursor: zoom-in; }
.msg.sys { align-self: center; max-width: 90%; background: var(--khaki); color: var(--ink); font-size: 13px; border-radius: 16px; text-align: center; }
.msg.sys.k-receipt { background: var(--mint); }
.msg.sys.k-agreement { background: var(--peri); }
.msg.sys img { margin: 4px auto; max-width: 160px; }
.dayline { align-self: center; font-size: 11.5px; font-weight: 700; color: #55556A; padding: 3px 12px; border-radius: 999px; background: #fff; }
.composer { display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.composer .box { flex: 1; display: flex; align-items: center; background: #fff; border-radius: 999px; padding: 0 5px 0 16px; height: 48px; box-shadow: var(--shadow); }
.composer input[type=text] { flex: 1; border: 0; outline: 0; background: none; font-size: 14px; min-width: 0; }
.threads .item .unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--yellow); font-size: 11.5px; font-weight: 800; display: grid; place-items: center; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }

/* ---------- Header logo ---------- */
.tlogo { display: inline-flex; align-items: center; }
.rimby-logo { display: block; height: 34px; width: auto; aspect-ratio: 3680 / 1380; }
.tlogo .rimby-logo { height: 36px; }

/* ---------- Past lessons + comments ---------- */
.lcs { display: flex; flex-direction: column; gap: 8px; }
.lc { background: var(--panel); border-radius: 20px; padding: 12px 14px; box-shadow: var(--shadow); }
.lc-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lc-h b { font-size: 14px; }
.lc-h .s { color: var(--muted); font-size: 12.5px; }
.lc-sc { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.lc-r { font-size: 13.5px; margin-top: 6px; line-height: 1.5; }
.lc-r span { color: var(--muted); font-weight: 600; font-size: 12px; margin-right: 8px; }
.lc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tg { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; }
.tg.good { background: var(--mint); color: var(--mint-ink); }
.tg.work { background: var(--khaki-t); color: var(--khaki-ink); }
.lc-p { white-space: pre-wrap; font-size: 14px; line-height: 1.55; margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; background: var(--peri-t); border-radius: 14px; padding: 0; border: solid transparent; border-width: 9px 12px; }
.lc-p.open { -webkit-line-clamp: unset; display: block; }
.lc-f { font-size: 12px; color: var(--muted); margin-top: 8px; }
.mhead { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 10px 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.mhead:first-child { margin-top: 0; }
details.past { margin: 10px 0 2px; }
details.past summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--link); }
details.past .lcs { margin-top: 8px; }
details.past .lc { box-shadow: none; }

/* ---------- Agreement signing ---------- */
.agr-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); }
.agr-t { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; }
.signbox { margin-top: 12px; }
.sigwrap { position: relative; border-radius: 18px; overflow: hidden; border: 1.5px dashed #C9CBDA; background: #fff; }
.sigwrap canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.sighint { position: absolute; left: 16px; bottom: 12px; font-size: 12.5px; color: #A0A2B2; pointer-events: none; border-top: 1px solid #D8DAE6; padding-top: 4px; width: calc(100% - 32px); }
.sigwrap.has-ink .sighint { opacity: 0; }
.signbox .field { margin-top: 12px; }
.sigimg { display: block; max-width: 220px; max-height: 80px; margin-bottom: 4px; }
.signed-note { background: var(--mint); color: var(--mint-ink); border-radius: 16px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px; }
.signed-note.wait { background: var(--khaki-t); color: var(--khaki-ink); }
#agr .pill { margin-left: 4px; }

/* ---------- Mobile ---------- */
@media (max-width: 1000px) {
  .frame { grid-template-columns: 1fr; }
  .content { padding: 14px 16px 104px; }
  .sidebar { position: fixed; z-index: 40; bottom: 16px; left: 16px; right: 16px; top: auto; height: 64px; margin: 0; flex-direction: row; padding: 0 8px; border-radius: 32px; box-shadow: 0 10px 30px rgba(20, 20, 40, .25); }
  .sidebar .brand, .sidebar .tip, .sidebar .signout-btn { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 0; justify-content: space-between; }
  .nav a { width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; gap: 6px; }
  .nav a span { position: static; opacity: 1; display: none; background: none; color: inherit; padding: 0; font-size: 13px; font-weight: 700; }
  .nav a.active { width: auto; padding: 0 16px; }
  .nav a.active span { display: inline; }
  .nav a.desk { display: none; }
  .nav a .badge { top: 8px; right: 8px; }
  .topbar { margin-bottom: 12px; }
  .topbar h1 { font-size: 20px; }
  .crumb { display: none; }
  .chip { padding: 0; background: none; box-shadow: none; }
  .chip > div:last-child { display: none; }
  #tb-signout { display: grid; }
  .hero { padding: 16px 18px; }
  .hero h1 { font-size: 22px; }
  .hero .wave { width: 46px; height: 46px; font-size: 22px; }
  .stat { flex-basis: 30%; padding: 10px 12px; border-radius: 18px; }
  .stat .label { font-size: 11.5px; }
  .stat .value { font-size: 18px; }
  .stat .value small { display: none; }
  .stats.money .stat { flex-basis: 100%; display: flex; justify-content: space-between; align-items: center; }
  .stats.money .stat .value { margin: 0; }
  .stats.four .stat { flex-basis: 45%; }
  .form-grid { grid-template-columns: 1fr; }
  .section-card { padding: 16px; }
  .class { flex-wrap: wrap; gap: 8px 12px; }
  .class .acts { width: 100%; justify-content: flex-start; }
  .week { padding: 0 6px 10px; gap: 2px; }
  .day .dd { font-size: 16px; }
  .mc { min-height: 52px; padding: 4px 2px; }
  .mc .n { font-size: 11.5px; text-align: center; }
  .ev { display: inline-block; width: 7px; height: 7px; padding: 0; margin: 2px 1px 0; border-radius: 50%; font-size: 0; background: var(--peri-ink); }
  .ev.group { background: #A3962A; } .ev.done { background: var(--mint-ink); }
  .more { display: none; }
  .tbl th, .tbl td { padding: 9px 10px; font-size: 13px; }
  .chart { height: 170px; gap: 8px; } .chart-x { gap: 8px; }
  .modal { padding: 18px 16px; border-radius: 24px; }
  .doc { padding: 18px; }
  .att { padding: 12px 10px; }
  .att .seg button { padding: 7px 11px; }
  .rcard { padding: 14px; }
  .chat { height: calc(100vh - 210px); }
  .split { grid-template-columns: 1fr; }
  .split.has-thread > .threads { display: none; }
  .ptitle { font-size: 24px; }
}

/* =========================================================
   Rewards, goals and Sang the mascot
   ========================================================= */
.sang { display: block; flex: none; width: 60px; aspect-ratio: 160 / 176; background: url(/sang-full.webp?v=2) no-repeat; background-size: 1200% 100%; }
.jar-sang { width: 96px; margin: -10px -6px -12px 0; }
.empty .icon .sang { width: 54px; }
.jar-n { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.jar-n b { font-size: 42px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.jar-n span:last-child { font-weight: 700; }
.star-tw { color: #E8B92C; font-size: 26px; display: inline-block; }
.bubble { background: var(--panel); border-radius: 16px 16px 16px 4px; padding: 9px 13px; font-size: 13px; font-weight: 600; margin-top: 10px; line-height: 1.4; position: relative; }
.tile-n { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.pgrid .pc .small { margin: 0; }
.pgrid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .pgrid.four { grid-template-columns: 1fr 1fr; } }
.dots { display: flex; gap: 4px; margin-top: 4px; }
.dots i { flex: 1; height: 10px; border-radius: 5px; background: rgba(128, 128, 128, .22); }
.dots i.on { background: var(--mint-ink); transform-origin: left; }
.meter { overflow: hidden; }
.meter i { transition: width 1s cubic-bezier(.2, .75, .2, 1); }
.meter.thick, .meter.thick i { height: 10px; border-radius: 5px; }
.pc.peri .meter i { background: var(--ink); }
.pc.khaki .meter i { background: var(--khaki-ink); }
.meter.thin { height: 5px; margin-top: 7px; background: var(--soft, #F0EFF6); }
.meter.thin i { height: 5px; background: var(--peri-ink); }
.bdgs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
@media (min-width: 701px) { .bdgs { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.bdg { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; font-size: 11.5px; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.2; }
.bdg-i { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: end center; overflow: hidden; position: relative; }
.bdg-i .sang { width: 48px; margin-bottom: -2px; }
.bdg.off { color: var(--muted); }
.bdg.off .bdg-i { background: var(--soft, #F0EFF6) !important; box-shadow: inset 0 0 0 2px var(--line); }
.bdg.off .sang { filter: grayscale(1); opacity: .35; }
.rows .row .btn.off, .btn.off { background: var(--soft, #EDEDF1); color: var(--muted); }
.row.ready { box-shadow: 0 0 0 2px var(--mint), var(--shadow); }
.mbars { display: grid; gap: 10px; align-items: end; height: 84px; margin-top: 12px; }
.mbar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-size: 11px; font-weight: 600; white-space: nowrap; }
.mbar i { width: 100%; height: 0; border-radius: 8px 8px 4px 4px; background: rgba(255, 255, 255, .7); display: block; transition: height .8s cubic-bezier(.2, .75, .2, 1) var(--d, 0ms); }
.mbar i.now { background: var(--ink); }
.mbar i:not(.now) { background: color-mix(in srgb, var(--ink) 38%, transparent); }
.task { display: flex; gap: 10px; align-items: center; padding: 8px 0; font-size: 13.5px; border-bottom: 1px solid var(--line); cursor: pointer; }
.task:last-of-type { border-bottom: 0; }
.task input { width: 20px; height: 20px; accent-color: var(--black); margin: 0; flex: none; }
.task span { flex: 1; }
.task input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(128, 128, 128, .5); }
.task em { font-style: normal; font-size: 12px; color: var(--muted); }
.task .x, .rw-row .x, .trow .x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.addrow { display: flex; gap: 8px; margin-top: 8px; }
.addrow input, .addrow select { flex: 1; min-width: 0; height: 38px; border-radius: 12px; border: 1px solid #E6E5EE; background: #fff; padding: 0 12px; }
.pc.reward { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.pc.reward .sang { width: 60px; margin: -10px -4px -14px -6px; }
.pc.reward .t, .teaser .t, .refer .t { font-weight: 700; font-size: 15px; }
.pc.reward.ready { box-shadow: 0 0 0 2px var(--mint-ink); }
.opt { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; margin-top: 9px; }
.opt b { display: block; font-size: 13.5px; }
.opt .dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--panel); color: var(--peri-ink); }
.opt .dot svg { width: 15px; height: 15px; }
.teaser { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); padding: 14px 16px; }
.teaser .sang { width: 66px; margin: -10px -6px -14px 0; }
.teaser .meter { margin-top: 8px; }
.refer { display: flex; gap: 12px; align-items: flex-start; }
.refer .sang { width: 60px; margin: -4px -4px -10px -6px; }
/* Sang pops out over the top edge of these cards */
.pc.jar, .pc.reward, .pc.teaser, .pc.refer { position: relative; overflow: visible; }
.pc.jar .sang, .pc.reward > .sang, .pc.teaser > .sang, .pc.refer > .sang { position: absolute; margin: 0; z-index: 2; filter: drop-shadow(0 6px 8px rgba(40, 30, 80, .16)); }
/* Sang stands on the card floor (feet 6px above the bottom edge) and only his head peeks over the top.
   margin-top = how far he pokes out at the card's minimum height, so he never overlaps the card above. */
.pc.jar .sang, .pc.reward > .sang, .pc.teaser > .sang, .pc.refer > .sang { top: auto; bottom: 6px; }
.pc.jar { margin-top: 48px; }
/* Sang stands on the jar's top row (above the speech bubble), not on the card floor */
.pc.jar > div:first-child { position: relative; padding-right: 144px; min-height: 104px; }
.pc.jar > div:first-child > .jar-sang { bottom: -4px; }
.pc.jar .jar-sang { width: 150px; right: 2px; }
.pc.reward { margin-top: 26px !important; padding-left: 124px; min-height: 104px; }
.pc.reward > .sang { width: 108px; left: 10px; }
.pc.teaser { margin-top: 44px; padding-right: 138px; min-height: 120px; }
.pc.teaser > .sang { width: 140px; right: 2px; }
.pc.refer { margin-top: 44px !important; padding-left: 138px; min-height: 116px; }
.pc.refer > .sang { width: 136px; left: 4px; }
@media (max-width: 380px) {
  .pc.jar > div:first-child { padding-right: 122px; }
  .pc.jar .jar-sang { width: 128px; }
  .pc.teaser { padding-right: 118px; }
  .pc.teaser > .sang { width: 120px; }
  .pc.refer { padding-left: 118px; }
  .pc.refer > .sang { width: 116px; }
}
.pc.teaser:hover > .sang { transform: translateY(-4px); transition: transform .2s; }
.legend-t { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.lg { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 6px 11px; display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 9px; height: 9px; border-radius: 50%; display: block; background: currentColor; }
.h3t { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 2px 8px; }
.tgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 701px) { .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tp { border-radius: 18px; padding: 11px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 76px; }
.tp b { font-size: 13.5px; line-height: 1.25; color: var(--ink); }
.tp span { font-size: 11.5px; font-weight: 700; }
.tp .m { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .6); margin-top: auto; overflow: hidden; }
.tp .m i { display: block; height: 6px; border-radius: 3px; background: currentColor; width: 0; transition: width 1s cubic-bezier(.2, .75, .2, 1); }
.tp.done, .lg.done { background: var(--mint); color: var(--mint-ink); }
.tp.prog, .lg.prog { background: var(--khaki); color: var(--khaki-ink); }
.tp.weak, .lg.weak { background: var(--pinkc); color: var(--pink-ink); }
.tp.todo, .lg.todo { background: var(--panel); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.tp.todo { box-shadow: none; border: 1.5px dashed var(--line); }
.lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.ttl { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.tdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tdot.done { background: var(--mint-ink); } .tdot.prog { background: #C6B84A; } .tdot.weak { background: var(--pink-ink); } .tdot.todo { background: var(--line); box-shadow: inset 0 0 0 1px var(--muted); }
.lv { display: flex; gap: 3px; flex: none; }
.lv button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--soft, #F0EFF6); font-size: 12px; font-weight: 700; cursor: pointer; color: var(--muted); }
.lv button.on { background: var(--black); color: #fff; }
.rw-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rw-row.off b { color: var(--muted); }
.alerts:not(:empty) { margin-top: 22px; }
.alerts-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.alerts-h .sang { width: 52px; margin: -14px 0 -8px; }
/* Sang popping out of tutor cards */
.pc.pop, .card.pop { position: relative; overflow: visible; }
.pop > .sang { position: absolute; z-index: 2; margin: 0; filter: drop-shadow(0 6px 8px rgba(40, 30, 80, .16)); }
.pop.l > .sang, .pop.r > .sang { top: auto; bottom: 6px; }
.pop.r { margin-top: 18px !important; }
.pop.r > .sang { width: 140px; right: 4px; }
.pop.r > .pop-body { padding-right: 128px; min-height: 112px; }
/* Cards with a full-width bar under the text: keep the bar clear of Sang's feet */
.pop.r > .abar { width: calc(100% - 124px); }
.pop.r:has(> .abar) > .pop-body { min-height: 0; }
.pop.l { margin-top: 18px !important; }
.pop.l > .sang { width: 116px; left: 8px; }
.pop.l > .pop-body { padding-left: 116px; min-height: 84px; }
.pop .pop-t { font-weight: 800; font-size: 16px; }
/* (wink is now a pose in the main Sang sprite) */
.alerts > .pop.l { margin-bottom: 10px; }
.alerts > .pop.l > .pop-body { display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 380px) { .pop.r > .sang { width: 120px; } .pop.r > .pop-body { padding-right: 110px; } .pop.r > .abar { width: calc(100% - 106px); } }
.empty .sang-e { width: 112px; margin: 0 auto 8px; }
/* UI pass (Nov 2026): long text, chart, chips, topic rows, week strip */
.kv div { min-width: 0; }
.kv div b { overflow-wrap: anywhere; }
.item .grow, .row .grow, .class .info, .pop-body, .profile > div { min-width: 0; }
.t, .s, .sub, .small, .big, .pname, .msg, .card p { overflow-wrap: break-word; }
.chart .col { min-width: 0; }
.chart .stack { flex: 1; min-height: 0; justify-content: flex-end; }
.chart .stack .tot { text-align: center; white-space: nowrap; }
.pchips { flex-wrap: wrap; overflow: visible; }
.tbl td:first-child { min-width: 150px; }
.dcn { font-weight: 700; }
@media (max-width: 480px) {
  .tbl th, .tbl td { padding: 10px 10px; }
  .trow { flex-wrap: wrap; }
  .trow .grow { flex: 1 1 calc(100% - 60px); }
  .trow .x { order: 2; }
  .trow .lv { order: 3; margin-left: 20px; }
  .dcl { display: none; }
}
.msg.sys.k-reward { background: var(--mint); }
/* certificate: always on white paper */
.cert { background: #fff; color: #15151A; border-radius: 24px; padding: 22px 20px; text-align: center; box-shadow: inset 0 0 0 6px #F6D34A, inset 0 0 0 9px #fff, inset 0 0 0 10px #E3D9A6, var(--shadow); max-width: 560px; margin: 0 auto; }
.cert-k { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: #7A6408; }
.cert-seal { width: 108px; height: 108px; border-radius: 50%; background: #FBF1C6; margin: 12px auto 8px; display: grid; place-items: end center; overflow: hidden; }
.cert-seal .sang { width: 96px; margin-bottom: -4px; }
.cert-s { font-size: 13.5px; color: #55556A; line-height: 1.5; }
.cert-name { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 6px; }
.cert-f { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 12px; border-top: 1px solid #EFEEF5; font-size: 12px; color: #6B6D7B; text-align: left; }
.cert-f b { display: block; color: #15151A; font-size: 13px; }
.wplan p { font-size: 14px; line-height: 1.5; }
.wtbl { width: 100%; border-collapse: collapse; margin-top: 10px; }
.wtbl td { border-bottom: 1px solid #E6E5EE; padding: 12px 6px; font-size: 14px; }
.wtbl td.bx { width: 34px; }
.wtbl .bx span { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid #15151A; border-radius: 4px; font-weight: 800; font-size: 13px; }
.wtbl .due { width: 90px; color: #6B6D7B; text-align: right; }

/* ---------- gentle motion ---------- */
@keyframes mg-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes mg-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-1.5deg); } }
@keyframes mg-wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg) scale(1.06); } 45% { transform: rotate(7deg) scale(1.06); } 70% { transform: rotate(-4deg); } }
@keyframes mg-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 45% { transform: scale(1.25) rotate(18deg); } }
@keyframes mg-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
@keyframes mg-shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }
@keyframes mg-dot { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes mg-tick { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes mg-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(35, 90, 72, .0); } 50% { box-shadow: 0 0 0 6px rgba(35, 90, 72, .18); } }
@keyframes mg-confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 120px)) rotate(var(--r)); opacity: 0; } }
.rise { animation: mg-rise .5s cubic-bezier(.2, .75, .2, 1) both; animation-delay: var(--d, 0ms); }
.sang.bob { animation: mg-bob 3.4s ease-in-out infinite; }
.sang.tap { cursor: pointer; }
.sang.wiggle { animation: mg-wiggle .6s ease-in-out; }
.star-tw { animation: mg-twinkle 2.8s ease-in-out 1s infinite; }
.dots i.on { animation: mg-dot .4s cubic-bezier(.2, .75, .2, 1) both; animation-delay: calc(300ms + var(--d, 0ms)); }
.task input:checked { animation: mg-tick .3s ease-out; }
.btn.glow { animation: mg-glow 2.2s ease-in-out infinite; }
.bdg.new .bdg-i { animation: mg-pop .6s cubic-bezier(.2, .75, .2, 1) both .3s; }
.bdg.new .bdg-i::after, .row.new::after { content: ''; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); animation: mg-shine 1.1s ease-in-out .7s 2 both; pointer-events: none; }
.row.new { position: relative; overflow: hidden; }
/* cards keep overflow visible (Sang pops out), so their shine sweeps a background instead */
@keyframes mg-sweep { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.pc.new { position: relative; }
.pc.new::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .7) 50%, transparent 62%) no-repeat; background-size: 250% 100%; animation: mg-sweep 1.1s ease-in-out .7s 2 both; pointer-events: none; z-index: 1; }
.bdg:hover .bdg-i, .teaser:hover .sang { transform: translateY(-2px); transition: transform .2s; }
.confetti { position: fixed; z-index: 90; pointer-events: none; width: 0; height: 0; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: mg-confetti 1.25s cubic-bezier(.15, .6, .35, 1) forwards; }
@media (prefers-reduced-motion: reduce) {
  .rise, .sang.bob, .sang.wiggle, .star-tw, .dots i.on, .btn.glow, .bdg.new .bdg-i, .task input:checked { animation: none !important; }
  .bdg.new .bdg-i::after, .row.new::after, .pc.new::after { display: none; }
  .meter i, .mbar i, .tp .m i { transition: none !important; }
}

/* =========================================================
   Dark mode: deep, muted versions of the same pastels with
   light text; primary buttons flip to light-on-dark.
   Documents (agreement, invoice) stay white like paper.
   ========================================================= */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121218; --panel: #1D1D26; --ink: #ECEBF3; --muted: #9C9CB0; --line: #2C2C38;
  --link: #EBCB55; --soft: #262632; --field: #24242E; --fline: #34343F;
  --peri: #343769; --peri-t: #262849; --peri-ink: #CDD0FA;
  --khaki: #48432A; --khaki-t: #34311F; --khaki-ink: #E9DF9F;
  --mint: #24463C; --mint-t: #1B332C; --mint-ink: #AFE0CC;
  --peach: #4C3B2E; --peach-t: #382C23; --peach-ink: #F2D5BC;
  --pinkc: #502C3B; --pink-t: #3B212C; --pink-ink: #F6C6D6;
  --pink: #502C3B; --blue: #343769; --blue-t: #262849; --blue-ink: #CDD0FA; --lav-t: #262849; --yellow-t: #34311F;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 4px 14px rgba(0, 0, 0, .25);
}
[data-theme="dark"] body { background: linear-gradient(180deg, #1D1C30 0, var(--bg) 340px) no-repeat, var(--bg); }
/* white surfaces -> panel */
[data-theme="dark"] .chip, [data-theme="dark"] .sq, [data-theme="dark"] .ibtn, [data-theme="dark"] .list, [data-theme="dark"] .row,
[data-theme="dark"] .seg, [data-theme="dark"] .pchip.plain, [data-theme="dark"] .search, [data-theme="dark"] .section-card,
[data-theme="dark"] .modal, [data-theme="dark"] .msg.in, [data-theme="dark"] .dayline, [data-theme="dark"] .composer .box,
[data-theme="dark"] .abar.white, [data-theme="dark"] .rcpt .lines, [data-theme="dark"] .pill.white, [data-theme="dark"] .syl,
[data-theme="dark"] .btn.ghost, [data-theme="dark"] .btn.danger, [data-theme="dark"] .chk { background: var(--panel); color: var(--ink); }
[data-theme="dark"] .btn.ghost { box-shadow: inset 0 0 0 1px var(--fline); }
[data-theme="dark"] .btn.ghost:hover, [data-theme="dark"] .item:hover, [data-theme="dark"] .mc:hover, [data-theme="dark"] .day:hover { background: var(--soft); }
[data-theme="dark"] .btn.danger { color: #F49AB1; box-shadow: inset 0 0 0 1px #5A2E3C; }
[data-theme="dark"] .pchip b { background: rgba(255, 255, 255, .12); }
[data-theme="dark"] .pchip.dark b { background: rgba(0, 0, 0, .1); }
/* inputs */
[data-theme="dark"] .field input:not([type=file]):not([type=checkbox]):not([type=radio]), [data-theme="dark"] .field select, [data-theme="dark"] .field textarea,
[data-theme="dark"] .att textarea, [data-theme="dark"] .att .inp, [data-theme="dark"] .inline-add input, [data-theme="dark"] .att .rate,
[data-theme="dark"] .chip-t { background: var(--field); border-color: var(--fline); color: var(--ink); }
[data-theme="dark"] .field input:focus, [data-theme="dark"] .field textarea:focus, [data-theme="dark"] .att .inp:focus, [data-theme="dark"] .att textarea:focus { border-color: #7C80D8; }
[data-theme="dark"] ::placeholder { color: #727286; }
/* light-grey fills */
[data-theme="dark"] .att, [data-theme="dark"] .iconbtn, [data-theme="dark"] .upload .preview, [data-theme="dark"] .mc.out, [data-theme="dark"] .tbl th,
[data-theme="dark"] code.tag, [data-theme="dark"] .chip-t.off, [data-theme="dark"] .class.cancelled { background: var(--soft); }
[data-theme="dark"] .iconbtn:hover { background: #30303D; }
[data-theme="dark"] .upload .preview { border-color: var(--fline); }
[data-theme="dark"] .pill.cancelled { background: #2E2E3A; color: #A9A9BB; }
[data-theme="dark"] .mc.out .n { color: #5A5A6C; }
/* hard-coded dark greys -> light greys */
[data-theme="dark"] .seg button, [data-theme="dark"] .legend, [data-theme="dark"] .legend-row, [data-theme="dark"] .mc .n, [data-theme="dark"] .att .rate > span:first-child,
[data-theme="dark"] .att .lbl, [data-theme="dark"] .section-card .lbl, [data-theme="dark"] .priv summary, [data-theme="dark"] .rscores, [data-theme="dark"] .dayline,
[data-theme="dark"] .stat .label, [data-theme="dark"] .chip-t { color: #BDBDCE; }
[data-theme="dark"] .stat { background: var(--tint, var(--panel)); }
[data-theme="dark"] .stat .label { color: var(--tink, #BDBDCE); }
[data-theme="dark"] .class .time span, [data-theme="dark"] .class .info .s { color: rgba(236, 235, 243, .68); }
[data-theme="dark"] .class .btn.ghost { background: rgba(255, 255, 255, .1); color: var(--ink); }
[data-theme="dark"] .stars button, [data-theme="dark"] .mini-stars i { color: #3C3C4C; }
[data-theme="dark"] .chip-t.on { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); }
[data-theme="dark"] .chip-t.warm.on { background: var(--khaki); border-color: var(--khaki); color: var(--khaki-ink); }
[data-theme="dark"] .syl.on { background: var(--peri); border-color: var(--peri); }
/* translucent white on pastel cards */
[data-theme="dark"] .abar { background: rgba(255, 255, 255, .1); color: var(--ink); }
[data-theme="dark"] .abar:hover { background: rgba(255, 255, 255, .16); }
[data-theme="dark"] .paybox, [data-theme="dark"] .rcpt .grid { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .meter { background: rgba(255, 255, 255, .14); }
/* primary (black) controls flip to light */
[data-theme="dark"] .btn, [data-theme="dark"] .go, [data-theme="dark"] .seg button.on, [data-theme="dark"] .pchip.dark, [data-theme="dark"] .abar.dark,
[data-theme="dark"] .day.on, [data-theme="dark"] .chk.on, [data-theme="dark"] .msg.out, [data-theme="dark"] .mc.today .n span, [data-theme="dark"] .toast,
[data-theme="dark"] .class .btn:not(.ghost) { background: #ECEBF3; color: #15151A; }
[data-theme="dark"] .btn:hover { background: #D6D5E0; }
[data-theme="dark"] .btn.soft { background: var(--khaki); color: var(--khaki-ink); }
[data-theme="dark"] .abar.dark .go { background: #15151A; color: #fff; }
[data-theme="dark"] .day.on .dn, [data-theme="dark"] .day.on .dc { color: #55556A; }
[data-theme="dark"] .mc.sel { box-shadow: inset 0 0 0 2px #ECEBF3; }
[data-theme="dark"] .share input { accent-color: #ECEBF3; }
/* sidebar / floating tab bar stays dark but lifts off the page */
[data-theme="dark"] .sidebar { background: #1F1F29; box-shadow: inset 0 0 0 1px #2E2E3B, 0 10px 30px rgba(0, 0, 0, .45); }
[data-theme="dark"] .nav a.active { background: #ECEBF3; color: #15151A; }
@media (min-width: 1001px) { [data-theme="dark"] .nav a span { background: #2A2A36; } }
/* yellow things keep dark text */
[data-theme="dark"] .av0, [data-theme="dark"] .chip .avatar, [data-theme="dark"] .threads .item .unread { color: #15151A !important; }
[data-theme="dark"] .chip .avatar { border-color: #2A2A36; }
:root { --logo-ink: #034A2B; }
:root[data-theme="dark"] { --logo-ink: #FFFFFF; }
@media print { :root[data-theme="dark"] { --logo-ink: #034A2B; } }
/* chat */
[data-theme="dark"] .msg.sys { background: var(--khaki); color: var(--ink); }
[data-theme="dark"] .msg.sys.k-receipt { background: var(--mint); }
[data-theme="dark"] .msg.sys.k-agreement { background: var(--peri); }
[data-theme="dark"] .overlay { background: rgba(0, 0, 0, .55); }
/* documents stay on white paper */
[data-theme="dark"] .doc { background: #fff; color: #15151A; border-color: #fff; }
[data-theme="dark"] .doc .meta { color: #5C5E6C; }
[data-theme="dark"] .rcpt { color: var(--ink); }
[data-theme="dark"] .sigwrap { border-color: #4A4A5A; }
[data-theme="dark"] .item { border-color: var(--line); }
/* rewards */
[data-theme="dark"] .mbar i { background: rgba(255, 255, 255, .42); }
[data-theme="dark"] .mbar i.now { background: var(--ink); }
[data-theme="dark"] .tp .m { background: rgba(255, 255, 255, .14); }
[data-theme="dark"] .addrow input, [data-theme="dark"] .addrow select { background: var(--field); border-color: var(--fline); }
[data-theme="dark"] .lv button.on { background: #ECEBF3; color: #15151A; }
[data-theme="dark"] .task input { accent-color: #ECEBF3; }
[data-theme="dark"] .pc.khaki .meter i { background: var(--khaki-ink); }
[data-theme="dark"] .cert-seal { background: #FBF1C6; }

/* ---------- Settings tabs + sticky save ---------- */
.stabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 4px 0 14px; padding: 4px; background: var(--panel); border-radius: 999px; box-shadow: var(--shadow); }
.stabs::-webkit-scrollbar { display: none; }
.stabs button { flex: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 700; padding: 9px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.stabs button.on { background: var(--black); color: #fff; }
.stabs button:focus-visible { outline: 3px solid var(--peri-ink); outline-offset: -3px; }
.spanel[hidden] { display: none; }
.stabs .tdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #E5484D; margin-left: 6px; vertical-align: middle; }
.bk-pick select { width: 100%; }
.savebar { position: sticky; bottom: 56px; z-index: 30; display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 4px; padding: 10px 10px 10px 18px; background: var(--panel); border-radius: 999px; box-shadow: 0 10px 30px rgba(20, 20, 40, .16); }
.savebar[hidden] { display: none; }
.savebar .sb-note { flex: 1; font-size: 12.5px; color: var(--muted); }
.savebar .err:empty { display: none; }
.savebar .err:not(:empty) + .sb-note { display: none; }
@media (max-width: 1000px) { .savebar { bottom: 92px; } }
@media (max-width: 560px) { .savebar .sb-note { display: none; } .savebar .btn { flex: 1; } .savebar { padding: 8px; } .savebar .err { flex: 1; padding-left: 10px; } }
.modal .foot:last-child { position: sticky; bottom: -22px; margin: 18px -22px -22px; padding: 12px 22px 16px; background: var(--panel); border-top: 1px solid var(--line, #EFEEF5); z-index: 2; }
@media (max-width: 1000px) { .modal .foot:last-child { bottom: -18px; margin: 16px -16px -18px; padding: 12px 16px 14px; } }

/* passkeys */
.pk-h { display: flex; gap: 12px; align-items: center; }
.pk-sang { width: 52px; }
.pk-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.pk-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: 14px; background: var(--bg); }
.pk-row em { font-style: normal; font-weight: 500; color: var(--muted); }
a.pk-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); }

/* parent visits */
.vtag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--peri-t); color: var(--peri-ink); vertical-align: 1px; }
.vmute { color: var(--muted); font-weight: 600; }
.vtime { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; padding-right: 6px; }
.row.flat { box-shadow: none; background: var(--bg); }
.mhead { font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 4px 8px; }

/* get started */
.gs-h { display: flex; gap: 12px; align-items: center; }
.gs-sang { width: 58px; margin: -6px 0 -8px -4px; }
.gs-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.gs-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 16px; background: rgba(255, 255, 255, .62); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px; }
.gs-row.ok { opacity: .7; font-weight: 600; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .3); }
.gs-row .grow { flex: 1; min-width: 0; }
.gs-dot { width: 24px; height: 24px; border-radius: 50%; flex: none; border: 2px solid var(--mint-ink); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; }
.gs-row.ok .gs-dot { background: var(--mint-ink); }
.go.sm { width: 32px; height: 32px; }
.go.sm svg { width: 16px; height: 16px; }
.gs-foot { display: flex; justify-content: space-between; margin-top: 10px; padding: 0 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[data-theme="dark"] .gs-row { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .gs-row.ok { text-decoration-color: rgba(255, 255, 255, .3); }

/* guided tour */
.tour { position: fixed; inset: 0; z-index: 70; }
.tour-hole { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(20, 18, 40, .55); transition: all .3s cubic-bezier(.2, .75, .2, 1); pointer-events: none; }
.tour-card { position: fixed; width: 340px; max-width: calc(100vw - 32px); background: var(--panel); color: var(--ink); border-radius: 24px; padding: 16px 18px 14px; box-shadow: 0 24px 60px rgba(20, 20, 50, .3); transition: top .3s, left .3s; }
.tour-card.sheet { left: 16px; right: 16px; bottom: 96px; width: auto; max-width: none; }
.tour-top { display: flex; gap: 12px; align-items: center; }
.tour-sang { width: 56px; margin: -4px 0 -6px -4px; }
.tour-card h3 { margin: 2px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.tour-card .kick { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tour-card p { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; }
.tour-dots { display: flex; gap: 5px; margin: 12px 0 0; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line, #E2E1EC); }
.tour-dots i.on { background: var(--ink); width: 18px; border-radius: 4px; }
.tour-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } }
.welcome { text-align: center; padding-top: 6px; }
.welcome-sang { width: 120px; margin: 0 auto 6px; }
.welcome h3 { font-size: 22px; margin: 0 0 6px; }
.welcome p { font-size: 15px; line-height: 1.55; margin: 0; color: var(--muted); }

@media print {
  :root[data-theme="dark"] {
    color-scheme: light; --bg: #fff; --panel: #fff; --ink: #15151A; --muted: #8A8A99; --line: #EFEEF5;
    --mint: #CFE6DE; --mint-ink: #235A48; --peri-t: #E7E8FB; --khaki-t: #F3EFCF; --khaki-ink: #55501E;
  }
  [data-theme="dark"] .rcpt .grid { background: rgba(255, 255, 255, .65); }
  [data-theme="dark"] .rcpt .lines { background: #fff; }
}
@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute; left: 0; top: 0; width: 100%; }
  .overlay { background: none; backdrop-filter: none; }
  .no-print { display: none !important; }
  .rcpt, .rcpt * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .topbar { display: none; }
  .scene, .fx { display: none !important; }
}

/* =========================================================
   Jungle scene (Nov 2026): background pictures, frosted cards,
   fireflies (dark) and butterflies (light). Tall picture for phones,
   wide picture for computers and tablets lying down.
   ========================================================= */
:root { --muted: #6B6B7D; }
:root[data-theme="dark"] { --muted: #A8B2C0; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: none;
}
.scene{position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden}.scene svg{display:block;width:100%;height:100%}
@media (min-aspect-ratio: 7/10) {
  body::before { background: none; }
  .scene { z-index: -1; }
}
/* Cards sit on a frosted, slightly see-through layer so text stays readable on the picture */
.card, .list, .section-card, .stabs { background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.row, .chip, .sq, .ibtn, .seg, .search, .lc, .msg.in, .composer .box, .pchip.plain { background: rgba(255, 255, 255, .86); }
[data-theme="dark"] .card, [data-theme="dark"] .list, [data-theme="dark"] .section-card, [data-theme="dark"] .stabs { background: rgba(20, 36, 46, .80); }
[data-theme="dark"] .row, [data-theme="dark"] .chip, [data-theme="dark"] .sq, [data-theme="dark"] .ibtn, [data-theme="dark"] .seg,
[data-theme="dark"] .search, [data-theme="dark"] .lc, [data-theme="dark"] .msg.in, [data-theme="dark"] .composer .box,
[data-theme="dark"] .pchip.plain { background: rgba(20, 36, 46, .80); }
/* Headings that sit straight on the picture get a soft glow behind them */
.topbar h1, .crumb, .ptitle, .pname, h2.section, .row-between h2, .h3t, .lbl, .page-head .sub, .page-head h2 { text-shadow: 0 0 10px rgba(255, 255, 255, .95), 0 0 3px rgba(255, 255, 255, .7); }
[data-theme="dark"] .topbar h1, [data-theme="dark"] .crumb, [data-theme="dark"] .ptitle, [data-theme="dark"] .pname,
[data-theme="dark"] h2.section, [data-theme="dark"] .row-between h2, [data-theme="dark"] .h3t, [data-theme="dark"] .lbl,
[data-theme="dark"] .page-head .sub, [data-theme="dark"] .page-head h2 { text-shadow: 0 1px 10px rgba(0, 0, 0, .7); }

/* Sang never covers text: text padding now clears the full width of each picture */
.pop.r > .pop-body { padding-right: 146px; }
.pop.l > .pop-body { padding-left: 126px; }
.pc.teaser { padding-right: 144px; }
.pc.refer { padding-left: 142px; }
.pc.reward { padding-left: 126px; }
.pc.jar > div:first-child { padding-right: 154px; }
.pop.r > .abar { width: calc(100% - 146px); white-space: nowrap; font-size: 13.5px; }
@media (max-width: 380px) {
  .pop.r > .abar { width: calc(100% - 126px); white-space: normal; }
  .pop.r > .pop-body { padding-right: 124px; }
  .pc.teaser { padding-right: 122px; }
  .pc.refer { padding-left: 120px; }
  .pc.jar > div:first-child { padding-right: 130px; }
}

/* Yellow chips keep dark text in dark mode (white on yellow was hard to read) */
[data-theme="dark"] .pchip.bg-yellow, [data-theme="dark"] .bg-yellow { color: #1B1B1F; }

/* Fireflies and butterflies (js in /fx.js). Small, slow, behind the cards, off for "reduce motion". */
.fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; contain: strict; }
.fx.paused * { animation-play-state: paused !important; }
.ff { position: absolute; border-radius: 50%; background: #FFE98A; opacity: 0;
  box-shadow: 0 0 8px 3px rgba(255, 226, 120, .5), 0 0 18px 7px rgba(255, 214, 90, .2);
  animation: ff-m var(--d) ease-in-out infinite, ff-g var(--g) ease-in-out infinite; animation-delay: var(--s), var(--s); will-change: transform, opacity; }
@keyframes ff-m { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(var(--x1), var(--y1)); } 50% { transform: translate(var(--x2), var(--y2)); } 75% { transform: translate(var(--x3), var(--y3)); } }
@keyframes ff-g { 0%, 100% { opacity: 0; } 30% { opacity: .9; } 55% { opacity: .25; } 75% { opacity: .85; } }
.bf { position: absolute; left: 0; top: 0; width: 24px; height: 18px; opacity: .9; animation: bf-m var(--d) linear infinite; animation-delay: var(--s); will-change: transform; }
.bf svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bf .w { transform-origin: 50% 50%; animation: bf-f .45s ease-in-out infinite alternate; }
@keyframes bf-f { from { transform: scaleX(1); } to { transform: scaleX(.25); } }
@keyframes bf-m {
  0% { transform: translate(var(--x0), var(--y0)) rotate(8deg); } 22% { transform: translate(var(--x1), var(--y1)) rotate(-12deg); }
  48% { transform: translate(var(--x2), var(--y2)) rotate(14deg); } 74% { transform: translate(var(--x3), var(--y3)) rotate(-8deg); }
  100% { transform: translate(var(--x0), var(--y0)) rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) { .fx { display: none; } }

/* =========================================================
   Rimby new look (Nov 2026): green hero header with Sang, green controls,
   plain backgrounds (the jungle ambience now lives only inside the hero).
   ========================================================= */
:root { --black: #0C4A33; --accent: #0C4A33; --link: #0C4A33; --navg: #0C4A33; --cream: #FFF8EA; --h1: #0F6B44; --h2: #0A3D2B; }
:root[data-theme="dark"] { --bg: #0B1411; --panel: #18221E; --soft: #212B27; --field: #1E2824; --fline: #2D3A35; --line: #26312C; --link: #2BD487; --navg: #0A3A29; --h1: #0E5A3A; --h2: #06261B; }
[data-theme="dark"] body { background: var(--bg); }
/* undo the frosted cards and heading glow from the full-page picture */
:root[data-theme] .card, :root[data-theme] .list, :root[data-theme] .section-card, :root[data-theme] .stabs { background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-theme] .row, :root[data-theme] .sq, :root[data-theme] .ibtn, :root[data-theme] .seg, :root[data-theme] .search, :root[data-theme] .lc,
:root[data-theme] .msg.in, :root[data-theme] .composer .box, :root[data-theme] .pchip.plain { background: var(--panel); }
@media (max-width: 1000px) { :root[data-theme] .chip { background: none; } }
:root[data-theme] .topbar h1, :root[data-theme] .crumb, :root[data-theme] .ptitle, :root[data-theme] .pname, :root[data-theme] h2.section,
:root[data-theme] .row-between h2, :root[data-theme] .h3t, :root[data-theme] .lbl, :root[data-theme] .page-head .sub, :root[data-theme] .page-head h2 { text-shadow: none; }
/* primary controls are green in dark mode too */
[data-theme="dark"] .btn, [data-theme="dark"] .go, [data-theme="dark"] .seg button.on, [data-theme="dark"] .pchip.dark, [data-theme="dark"] .abar.dark,
[data-theme="dark"] .day.on, [data-theme="dark"] .chk.on, [data-theme="dark"] .msg.out, [data-theme="dark"] .mc.today .n span, [data-theme="dark"] .toast,
[data-theme="dark"] .class .btn:not(.ghost), [data-theme="dark"] .stabs button.on, [data-theme="dark"] .lv button.on { background: #1DB26F; color: #fff; }
[data-theme="dark"] .btn:hover { background: #17995F; }
[data-theme="dark"] .abar.dark .go { background: #fff; color: #0A3A29; }
[data-theme="dark"] .day.on .dn, [data-theme="dark"] .day.on .dc { color: rgba(255, 255, 255, .85); }
[data-theme="dark"] .mc.sel { box-shadow: inset 0 0 0 2px #1DB26F; }
[data-theme="dark"] .share input, [data-theme="dark"] .task input { accent-color: #1DB26F; }
/* tab bar */
.sidebar, [data-theme="dark"] .sidebar { background: var(--navg); }
[data-theme="dark"] .sidebar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .45); }
.nav a { color: #CFE6DC; }
.nav a:hover { color: #fff; }
.nav a.active, [data-theme="dark"] .nav a.active { background: var(--cream); color: #0C4A33; }
.nav a .badge { background: #FF3B30; }
@media (min-width: 1001px) { [data-theme="dark"] .nav a span, .nav a span { background: #07281C; } }
@media (max-width: 1000px) {
  .nav a { flex-direction: column; gap: 1px; flex: 1; width: auto; height: 54px; border-radius: 27px; }
  .nav a span { display: block; font-size: 10.5px; font-weight: 600; }
  .nav a.active { width: auto; padding: 0; }
  .nav a.active span { font-weight: 800; }
  .nav a svg { width: 20px; height: 20px; }
}
/* hero */
.rhero { position: relative; isolation: isolate; overflow: hidden; border-radius: 30px; margin: 0 0 14px; padding: 18px 20px 22px; min-height: 300px; color: #fff;
  background: radial-gradient(120% 90% at 18% 0, var(--h1), var(--h2)); --logo-ink: #fff; }
.rh-fx { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.rh-leaves { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.rh-bar, .rh-txt { position: relative; z-index: 2; }
.rh-bar { display: flex; align-items: center; justify-content: space-between; }
.rh-logo { display: block; text-decoration: none; }
.rh-logo .rimby-logo { height: 40px; }
.rh-btns { display: flex; gap: 10px; }
.rh-ic { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .2); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.rh-ic svg { width: 21px; height: 21px; }
.rh-dot { display: none; position: absolute; top: 8px; right: 9px; width: 11px; height: 11px; border-radius: 50%; background: #FF3B30; border: 2px solid #0B5A3A; }
.has-new .rh-dot { display: block; }
.sq.bell-btn { position: relative; }
.sq.bell-btn svg { width: 20px; height: 20px; }
.sq.bell-btn .rh-dot { top: 9px; right: 10px; border-color: var(--panel); }
.rh-txt { margin-top: 20px; max-width: calc(100% - 172px); }
.rh-hi { font-size: 15px; opacity: .95; overflow-wrap: break-word; }
.rh-t { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 2px 0 0; color: #fff; overflow-wrap: break-word; }
.rh-l { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 15px; }
.rh-l svg { width: 20px; height: 20px; flex: none; }
.rh-cta { display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; background: var(--cream); color: #0C4A33; font-weight: 800; font-size: 14px; padding: 12px 18px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.rh-cta svg { width: 16px; height: 16px; }
.rh-sang { position: absolute; z-index: 1; right: 8px; bottom: 0; width: 176px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .25)); }
.rtiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 6px; }
.rt { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 18px; text-decoration: none; min-width: 0; }
.rt svg { width: 22px; height: 22px; flex: none; }
.rt span { display: flex; flex-direction: column; font-size: 13px; line-height: 1.15; min-width: 0; }
.rt b { font-size: 24px; font-weight: 800; line-height: 1; }
.rt.t1 { background: var(--peri-t); color: var(--peri-ink); }
.rt.t2 { background: var(--khaki-t); color: var(--khaki-ink); }
.rt.t3 { background: var(--mint-t); color: var(--mint-ink); }
.nxc { display: flex; align-items: center; gap: 12px; background: var(--peach); border-radius: 20px; padding: 14px 16px; text-decoration: none; color: var(--ink); margin-bottom: 6px; }
[data-theme="dark"] .nxc { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.nxi { align-self: flex-start; color: var(--peach-ink); display: block; }
.nxi svg { width: 22px; height: 22px; }
.nxb { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nxb small { font-size: 12.5px; color: var(--muted); }
.nxb b { font-size: 19px; margin: 2px 0; overflow-wrap: break-word; }
.nxc .go { width: 46px; height: 46px; }
.phead { margin-bottom: 12px; align-items: center; }
.phead .kick { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pname-s { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.content:has(.rhero) > .topbar { margin-bottom: 14px; }
@media (min-width: 1001px) {
  .rhero { min-height: 250px; padding: 30px 36px; }
  .rh-bar { display: none; }
  .rh-txt { margin-top: 0; max-width: 520px; }
  .rh-t { font-size: 34px; }
  .rh-sang { width: 196px; right: 48px; }
  .rtiles { max-width: 640px; }
}
@media (max-width: 1000px) {
  .content:has(.rhero) { padding-top: 0; }
  .content:has(.rhero) > .topbar { display: none; }
  .rhero { margin: 0 -16px 14px; border-radius: 0 0 34px 34px; padding-top: max(18px, env(safe-area-inset-top)); }
}
@media (max-width: 380px) {
  .rh-sang { width: 138px; }
  .rh-txt { max-width: calc(100% - 118px); }
  .rh-t { font-size: 24px; }
  .rh-cta { padding: 11px 14px; font-size: 13px; }
}
/* bell + account panels */
.npanel { position: fixed; z-index: 90; right: var(--r, 12px); width: min(360px, calc(100vw - 20px)); max-height: min(72vh, 560px); overflow: auto; background: var(--panel); color: var(--ink);
  border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 18px 44px rgba(0, 0, 0, .28); }
.np-h { padding: 14px 16px 10px; display: flex; flex-direction: column; }
.np-h b { font-size: 16px; }
.np-h small { color: var(--muted); font-size: 12px; }
.nt { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; background: none; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.nt:hover { background: var(--soft, rgba(0, 0, 0, .04)); }
.nt.un { background: rgba(29, 178, 111, .1); }
.nt-i { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--mint-t); color: var(--mint-ink); display: grid; place-items: center; font-size: 18px; }
.nt-i svg { width: 19px; height: 19px; }
.nt-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nt-b b { font-size: 14px; }
.nt-b small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt em { font-style: normal; font-size: 11.5px; color: var(--muted); flex: none; }
.np-empty { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 22px 16px; color: var(--muted); border-top: 1px solid var(--line); }
.np-empty .sang { width: 48px; }
.np-f { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 13px; border-top: 1px solid var(--line); font-weight: 700; color: var(--link); text-decoration: none; }
.np-f svg { width: 16px; height: 16px; }
html.fx-paused .rh-fx * { animation-play-state: paused !important; }
@media (max-width: 520px) { .npanel { left: 10px; right: 10px; width: auto; } .rt { padding: 11px 10px; gap: 6px; } .rt span { font-size: 12.5px; } }
@media print { .rhero, .npanel, .rh-top { display: none !important; } }

/* ---- Hero with stats inside (tutor home). Layout follows the hero's own width, not the screen:
   narrow = Sang top-right, tiles full width below; medium = tiles under the text, Sang bottom-right;
   wide = text, tiles and Sang in one row. ---- */
.rhero.has-stats { padding: 0; display: flex; }
.has-stats .rh-main { flex: 1; min-width: 0; position: relative; z-index: 1; container: rh / inline-size; padding: 18px; display: flex; flex-direction: column; justify-content: center; }
.has-stats .rh-txt { max-width: none; }
.rh-stats { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.rh-st { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; min-height: 44px; padding: 10px 12px; border-radius: 16px; color: #fff; text-decoration: none;
  background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .15s, transform .15s; }
.rh-st:hover { background: rgba(255, 255, 255, .2); }
.rh-st:active { transform: scale(.97); }
.rh-st:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rh-st svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.rh-st span { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12.5px; line-height: 1.15; color: rgba(255, 255, 255, .85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-st b { font-size: 22px; font-weight: 800; line-height: 1; color: #fff; }
@media (min-width: 1001px) { .has-stats .rh-main { padding: 28px 36px; } }
@container rh (max-width: 559px) {
  .has-stats .rh-sang { top: 10px; right: 4px; bottom: auto; width: 118px; }
  .has-stats .rh-txt { max-width: calc(100% - 118px); min-height: 136px; }
}
@container rh (min-width: 560px) {
  .has-stats .rh-sang { top: auto; bottom: 0; right: 16px; width: 176px; }
  .has-stats .rh-in { padding-right: 186px; }
  .has-stats .rh-stats { max-width: 540px; gap: 10px; }
  .has-stats .rh-st { padding: 14px 16px; gap: 8px; border-radius: 18px; }
  .has-stats .rh-st svg { width: 20px; height: 20px; }
  .has-stats .rh-st b { font-size: 28px; }
  .has-stats .rh-st span { font-size: 13.5px; gap: 4px; }
}
@container rh (min-width: 1040px) {
  .has-stats .rh-in { display: flex; align-items: center; gap: 36px; padding-right: 226px; }
  .has-stats .rh-txt { flex: 0 1 320px; }
  .has-stats .rh-stats { flex: 1 1 0; max-width: 620px; margin-top: 0; gap: 12px; }
  .has-stats .rh-st { min-height: 120px; padding: 18px 20px; gap: 12px; border-radius: 20px; justify-content: space-between; }
  .has-stats .rh-st svg { width: 22px; height: 22px; }
  .has-stats .rh-st b { font-size: 36px; }
  .has-stats .rh-st span { font-size: 14.5px; gap: 6px; }
  .has-stats .rh-sang { width: 196px; right: 20px; }
}

/* Solid hero. Only the decorations are clipped to the card, so Sang can break out over the top edge.
   The space above the hero leaves room for Sang's head. */
.rhero.has-stats { overflow: visible; margin-top: 38px; }
.rh-clip { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.has-stats .rh-sang { z-index: 3; }
@container rh (max-width: 559px) {
  .has-stats .rh-sang { top: -34px; right: 0; bottom: auto; width: 126px; }
  .has-stats .rh-txt { max-width: calc(100% - 122px); min-height: 104px; }
}
@container rh (min-width: 560px) {
  .has-stats .rh-sang { top: -38px; bottom: auto; right: 12px; width: clamp(190px, 30cqw, 250px); }
  .has-stats .rh-in { padding-right: calc(clamp(190px, 30cqw, 250px) + 10px); }
}
@container rh (min-width: 1040px) {
  .has-stats .rh-sang { top: auto; bottom: 0; right: 22px; width: 248px; }
  .has-stats .rh-in { padding-right: 272px; }
}
@media (prefers-reduced-motion: reduce) { .rh-st { transition: none; } .rh-st:active { transform: none; } }

/* ---- Reference style (Nov 21): header above the hero, rounded hero card, stacked pastel class cards, flush tab bar ---- */
.rh-top { position: relative; z-index: 2; margin: 2px 0 12px; }
.rh-top .rh-ic { background: rgba(120, 110, 150, .14); color: var(--ink); }
[data-theme="dark"] .rh-top .rh-ic { background: rgba(255, 255, 255, .12); }
.rh-top .rh-dot { border-color: var(--bg); }
.rh-top .rimby-logo { height: 44px; }
.rhero { min-height: 232px; padding: 18px 18px 20px; margin: 0 0 12px; border-radius: 28px; }
.rh-txt { margin-top: 0; }
[data-theme="dark"] .class .time { border-color: rgba(255, 255, 255, .15); }
@media (min-width: 1001px) { .rh-top { display: none; } .rhero { padding: 30px 36px; } }
@media (max-width: 1000px) {
  .content:has(.rhero) { padding-top: 14px; }
  .rhero { margin: 0 0 12px; border-radius: 28px; padding: 18px 18px 20px; }
  .sidebar { left: 0; right: 0; bottom: 0; height: 78px; border-radius: 30px 30px 0 0; padding: 0 6px env(safe-area-inset-bottom); }
  .class { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "time info" "acts acts"; gap: 10px 14px; align-items: start; }
  .class .time { grid-area: time; width: auto; padding-right: 14px; border-right: 1px solid rgba(21, 21, 26, .14); }
  .class .info { grid-area: info; }
  .class .acts { grid-area: acts; justify-content: flex-start; }
  .class .btn.ghost { background: #fff; }
}

/* ---- Fold cards: long lists start closed, showing a title, a count and a one-line preview ---- */
.fold { background: var(--panel); border-radius: 22px; box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line) inset; margin: 0 0 12px; }
.fold > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; min-height: 56px; border-radius: 22px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.fold-h { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fold-h b { font-size: 16px; font-weight: 800; }
.fold-h small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-n { flex: none; min-width: 28px; height: 28px; padding: 0 9px; border-radius: 999px; background: var(--mint-t); color: var(--mint-ink); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.fold-c { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
details[open] > summary .fold-c { transform: rotate(225deg) translate(-2px, -2px); }
.fold-b { padding: 0 14px 16px; }
.fold-b > .rows, .fold-b > .list { margin-top: 0; }
.fold-alerts > summary { background: var(--peach, #F0E2D6); }
[data-theme="dark"] .fold-alerts > summary { background: transparent; }

/* One lesson per line; opens to the full comments */
.lrow { border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow > summary { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 6px; cursor: pointer; min-height: 52px; }
.lrow > summary::-webkit-details-marker { display: none; }
.lrow > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 12px; }
.lr-d { display: flex; flex-direction: column; min-width: 92px; }
.lr-d b { font-size: 14px; }
.lr-d small { font-size: 12px; color: var(--muted); }
.lr-s { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow[open] > summary .lr-s { visibility: hidden; }
.lrow > .lc, .lrow > .rcard { margin: 0 0 12px; }
.lc.bare { box-shadow: none; background: var(--soft, rgba(0, 0, 0, .03)); }
.lcs.compact { background: var(--panel); border-radius: 22px; padding: 4px 14px; box-shadow: 0 0 0 1px var(--line) inset; }
@media (max-width: 520px) {
  .lrow > summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
  .lr-s { grid-column: 1 / -1; grid-row: 2; margin-top: -6px; }
}
.more-btn { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 0; border-radius: 14px; background: var(--soft, rgba(0, 0, 0, .04)); color: var(--link); font: inherit; font-weight: 700; cursor: pointer; }

/* ---- Countdowns ---- */
.cdowns { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 0 0 12px; }
.cdown { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; background: var(--peri-t, #E6E6FA); color: var(--peri-ink, #2E2B6B); }
.cdown.first { background: var(--khaki-t, #F3EFC8); color: var(--khaki-ink, #4D4614); }
.cdown.past { opacity: .55; }
.cd-n { flex: none; width: 58px; height: 58px; border-radius: 16px; background: rgba(255, 255, 255, .7); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
[data-theme="dark"] .cd-n { background: rgba(0, 0, 0, .25); }
.cd-n b { font-size: 22px; font-weight: 800; }
.cd-n span { font-size: 11px; font-weight: 700; margin-top: 3px; }
.cd-b { min-width: 0; flex: 1; }
.cd-t { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-b small { font-size: 12.5px; opacity: .85; }
.cdown .x { position: static; flex: none; }
.cprog { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cprog .sang { width: 70px; flex: none; }

/* ---- Join an online lesson ---- */
.btn.join { background: #2563EB; color: #fff; gap: 6px; }
.btn.join:hover { background: #1D4ED8; }
.btn.join svg { width: 16px; height: 16px; }
.rh-cta svg:first-child { width: 17px; height: 17px; }
.mode-seg { margin-bottom: 0; }
.nxc-wrap { margin-bottom: 6px; }
.nxc-wrap .nxc { margin-bottom: 0; }
.btn.nx-join { width: 100%; justify-content: center; margin-top: 8px; min-height: 48px; font-size: 15px; }
.btn.tile-join { margin-top: 8px; align-self: flex-start; }
.msg.sys.k-cert { background: var(--peri-t, #E6E6FA); color: var(--peri-ink, #2E2B6B); }
/* ---- Admin page and account gate ---- */
.adm-row { align-items: flex-start; }
.adm-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.gate-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; width: 100%; }
.gate-card { width: min(460px, 100%); text-align: center; padding: 32px 28px !important; }
.gate-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 10px; }
.gate-sang { width: 120px; margin: 0 auto; }

/* ---- Admin ---- */
.adm-kpi { margin-bottom: 14px; }
.adm-kpi .pc .small a, a.pc { color: inherit; }
.adm-bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 18px 4px 0; }
.adm-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.adm-bar i { display: block; width: 100%; max-width: 54px; border-radius: 10px 10px 4px 4px; background: var(--green, #1F7A4D); opacity: .85; }
.adm-bar .v { font-size: 11px; font-weight: 700; white-space: nowrap; }
.adm-bar .l { font-size: 11.5px; opacity: .7; }
.adm-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.adm-filter .search { display: flex; align-items: center; gap: 8px; background: var(--card, #fff); border-radius: 999px; padding: 8px 14px; flex: 1; min-width: 200px; }
.adm-filter .search svg { width: 18px; height: 18px; opacity: .6; }
.adm-filter .search input { border: 0; outline: 0; background: transparent; width: 100%; font: inherit; color: inherit; }
.seg.wrap { flex-wrap: wrap; }
.adm-name { font-size: 22px; font-weight: 800; margin: 0 0 2px; }
.adm-year { flex: none; gap: 8px; }
.adm-date { width: 46px; text-align: center; flex: none; }
.adm-date b { display: block; font-size: 20px; line-height: 1; }
.adm-date span { font-size: 11.5px; opacity: .7; }
.adm-hols { padding: 4px 10px; margin-bottom: 8px; }
.adm-pre { background: rgba(0,0,0,.05); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; overflow-x: auto; margin: 10px 0; }
.adm-table { margin-top: 14px; font-size: 13.5px; }
.adm-table > div { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr .8fr; gap: 8px; padding: 8px 4px; border-top: 1px solid rgba(0,0,0,.06); }
.adm-table .h { font-weight: 700; opacity: .7; border-top: 0; }
.adm-row { align-items: flex-start; }
.adm-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
@media (min-width: 1001px) { .adm-more { display: none; } }
/* ---- Announcements banner ---- */
#ann:empty { display: none; }
.ann { display: flex; gap: 10px; align-items: flex-start; background: var(--mint); color: var(--mint-ink, #134e33); border-radius: 18px; padding: 12px 14px; margin: 0 0 12px; }
.ann.warn { background: var(--khaki-t); color: var(--khaki-ink); }
.ann p { margin: 2px 0 0; font-size: 14px; }
.ann-x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
/* ---- Public holidays in the tutor calendar ---- */
.hol-note { background: var(--peach); border-radius: 16px; padding: 10px 14px; margin: 0 0 12px; font-size: 14.5px; }
.day.hol { box-shadow: inset 0 -4px 0 #F2994A; }
.day.hol .dn::after { content: ' 🎉'; }
.mc.hol { background: #FFF1E3; }
.hol-tag { display: block; font-size: 10.5px; font-weight: 700; color: #B4561B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 1px 0 2px; }
.hol-key { background: #FFF1E3 !important; box-shadow: inset 0 0 0 1px #F2994A; }
[data-theme="dark"] .mc.hol { background: rgba(242,153,74,.16); }
[data-theme="dark"] .hol-tag { color: #F5B47A; }
.adm-back { display: inline-flex; align-items: center; gap: 6px; }
.adm-back svg { width: 18px; height: 18px; }

/* ---- Language switch and first-login consent ---- */
.sq.lang-btn { font: inherit; font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.consent-card { text-align: left; }
.consent-card .gate-title, .consent-card .sub, .consent-card .small { text-align: center; }
.consent-top { display: flex; justify-content: flex-end; margin: -8px -6px 0 0; }
.lang-pill { min-height: 40px; font-weight: 800; }
.consent-list { display: grid; gap: 10px; margin: 18px 0 8px; }
.consent-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--bg-soft, rgba(120, 110, 180, .08)); cursor: pointer; font-size: 15px; line-height: 1.5; }
.consent-row input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--ink); }
.consent-row a { color: inherit; font-weight: 700; text-decoration: underline; }
.foot-bar a { color: inherit; }
