:root {
  --y: #F5B700; --k: #111111; --w: #FFFFFF; --g: #8A8A8A; --c: #C9184A;
  --line: #E7E7E5; --soft: #F6F6F4; --ink2: #444; --ok: #1b7f3b;
  --head: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font: 15px/1.5 var(--body); color: var(--k); background: var(--soft); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--head); letter-spacing: -0.02em; line-height: 1.15; }
button { font: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; border-radius: 10px; padding: 10px 16px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--y); outline-offset: 2px; }
.btn-dark { background: var(--k); color: var(--w); }
.btn-dark:hover { background: #2a2a2a; }
.btn-yellow { background: var(--y); color: var(--k); }
.btn-yellow:hover { background: #ffc61a; }
.btn-outline { border-color: #cfcfcf; background: var(--w); color: var(--k); }
.btn-outline:hover { border-color: var(--k); }
.btn-danger { background: var(--w); color: var(--c); border-color: #f0c2cf; }
.btn-danger:hover { background: #fdf0f4; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-wa { background: #25D366; color: #fff; }
.link-btn { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: 13px; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 20px; width: 38px; height: 38px; border-radius: 8px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--k); }
.login-card { background: var(--w); border-radius: 20px; padding: 36px; width: min(400px, 100%); }
.login-logo { height: 64px; margin: 0 auto 18px; display: block; }
.login h1 { font-size: 26px; text-align: center; margin-bottom: 20px; }
.login .btn { margin-top: 8px; padding: 13px; }
.err { color: var(--c); font-size: 14px; margin-top: 10px; min-height: 20px; }
.demo-note { background: #fff8e0; border: 1px solid #f3dc8a; padding: 12px; border-radius: 10px; font-size: 13.5px; margin-bottom: 8px; }
.back { display: block; text-align: center; margin-top: 18px; font-size: 14px; color: var(--g); }
body.live .demo-only { display: none !important; }
body.demo .live-only { display: none !important; }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 12px; }
input, select, textarea { width: 100%; margin-top: 5px; font: 400 15px var(--body); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--w); color: var(--k); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--k); box-shadow: 0 0 0 3px rgba(245,183,0,.35); }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; vertical-align: -2px; accent-color: var(--k); }
input:disabled { background: var(--soft); color: var(--g); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.hint { font-size: 12.5px; color: var(--g); font-weight: 400; }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--k); color: #ddd; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.side-brand img { height: 32px; }
.side-brand span { font-family: var(--head); font-weight: 800; color: var(--w); font-size: 18px; }
#sideNav { flex: 1; overflow-y: auto; padding: 6px 10px; }
#sideNav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #777; padding: 14px 10px 6px; }
#sideNav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-weight: 500; color: #cfcfcf; }
#sideNav a:hover { background: #1e1e1e; color: #fff; }
#sideNav a.active { background: var(--y); color: var(--k); font-weight: 700; }
#sideNav .ico { width: 18px; text-align: center; }
#sideNav .count { margin-left: auto; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.side-foot { padding: 14px 18px; border-top: 1px solid #222; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; gap: 10px; align-items: center; }
.me b { display: block; color: #fff; font-size: 14px; }
.me small { color: var(--y); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--y); color: var(--k); display: grid; place-items: center; font-weight: 800; }
.side-foot .link-btn { color: #999; text-align: left; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 28px; background: var(--w); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 22px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }
.demo-banner { background: #fff8e0; border-bottom: 1px solid #f3dc8a; font-size: 13px; padding: 7px 28px; }
.view { padding: 24px 28px 60px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--w); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat small { color: var(--g); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat b { display: block; font-family: var(--head); font-size: 28px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.hl { background: var(--k); color: var(--w); border-color: var(--k); }
.stat.hl b { color: var(--y); }
.stat.warn b { color: var(--c); }
.panel { background: var(--w); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.panel h2 .right { margin-left: auto; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 16px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 46px; background: var(--k); border-radius: 6px 6px 2px 2px; min-height: 2px; position: relative; }
.bar.cur i { background: var(--y); }
.bar span { font-size: 12px; color: var(--g); }
.bar em { font-style: normal; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13.5px; }
.hbar .track { background: var(--soft); height: 10px; border-radius: 99px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--k); border-radius: 99px; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }

/* toolbar + table */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.toolbar input, .toolbar select { margin: 0; width: auto; min-width: 160px; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar label { margin: 0; }
.tbl-wrap { background: var(--w); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--g); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fcfcfb; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.who { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.who b { display: block; }
.who small { color: var(--g); font-size: 12.5px; }
.ph { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--soft); flex: none; display: grid; place-items: center; font-weight: 700; color: var(--g); font-size: 13px; border: 1px solid var(--line); }
.empty { text-align: center; color: var(--g); padding: 40px 20px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 9px; background: var(--soft); color: var(--ink2); white-space: nowrap; }
.pill.paid { background: #e6f4ea; color: var(--ok); }
.pill.due { background: #fde8ee; color: var(--c); }
.pill.new { background: var(--y); color: var(--k); }
.pill.dark { background: var(--k); color: var(--w); }
.due-amt { color: var(--c); font-weight: 700; }

/* attendance */
.att-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.att-row:last-child { border: 0; }
.att-row .who { flex: 1; cursor: default; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--w); padding: 7px 14px; font-weight: 700; cursor: pointer; color: var(--g); }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button.on[data-v=P] { background: var(--ok); color: #fff; }
.seg button.on[data-v=A] { background: var(--c); color: #fff; }
.seg button.on[data-v=L] { background: var(--y); color: var(--k); }

/* enquiries */
.enq { background: var(--w); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin-bottom: 10px; }
.enq h3 { font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.enq p { color: var(--ink2); font-size: 14px; }
.enq .meta { font-size: 12.5px; color: var(--g); }
.enq .acts { display: flex; gap: 6px; align-items: start; flex-wrap: wrap; justify-content: flex-end; }
.enq select { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }

/* website editor */
.batch-ed { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: #fcfcfb; }
.gal-ed { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gal-ed figure { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--w); }
.gal-ed img { width: 100%; height: 100px; object-fit: cover; }
.gal-ed figcaption { padding: 6px; display: flex; gap: 4px; }
.gal-ed figcaption input { margin: 0; padding: 5px 7px; font-size: 12.5px; }
.save-bar { position: sticky; bottom: 0; background: var(--w); border-top: 1px solid var(--line); padding: 12px 0; display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(17,17,17,.55); z-index: 100; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal-box { background: var(--w); border-radius: 18px; width: min(640px, 100%); padding: 26px; position: relative; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-box.wide { width: min(820px, 100%); }
.modal-box h2 { font-size: 22px; margin-bottom: 16px; padding-right: 30px; }
.modal-x { position: absolute; top: 12px; right: 14px; border: 0; background: var(--soft); width: 34px; height: 34px; border-radius: 50%; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.photo-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.photo-pick .ph { width: 72px; height: 72px; font-size: 22px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin-bottom: 16px; }
.kv dt { color: var(--g); }
.prof { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.prof .ph { width: 76px; height: 76px; font-size: 24px; }
.mini-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mini-cards div { background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.mini-cards small { color: var(--g); font-size: 12px; }
.mini-cards b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 120px); background: var(--k); color: var(--w); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 200; transition: transform .25s; max-width: 90vw; }
.toast.show { transform: translate(-50%, 0); }
.toast.bad { background: var(--c); }

/* receipt */
.receipt { font-family: var(--body); color: #111; border: 2px solid #111; border-radius: 12px; padding: 22px; max-width: 560px; margin: 0 auto; }
.receipt .rh { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--y); padding-bottom: 12px; margin-bottom: 14px; gap: 10px; }
.receipt .rh img { height: 54px; }
.receipt .rh div { text-align: right; font-size: 12.5px; }
.receipt h3 { text-align: center; letter-spacing: .2em; font-size: 14px; margin-bottom: 12px; }
.receipt table td { padding: 6px 4px; border: 0; border-bottom: 1px dashed #ccc; }
.receipt .amt { font-size: 22px; font-weight: 800; font-family: var(--head); }
.receipt .sign { display: flex; justify-content: space-between; margin-top: 36px; font-size: 12.5px; color: #555; }
.receipt .sign span { border-top: 1px solid #999; padding-top: 4px; min-width: 140px; text-align: center; }
#printArea { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }
  #printArea { display: block !important; position: absolute; inset: 0; padding: 20px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 90; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .two { grid-template-columns: 1fr; }
  .view { padding: 16px 14px 60px; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; }
  .topbar h1 { font-size: 19px; }
  .demo-banner { padding: 7px 14px; }
}
@media (max-width: 560px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 100px 1fr 70px; }
  .mini-cards { grid-template-columns: 1fr 1fr 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .enq { grid-template-columns: 1fr; }
  .enq .acts { justify-content: flex-start; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1; }
}
