:root{
  --bg:#FBF7F2; --surface:#FFFFFF; --beige:#E9DACD; --beige-2:#F4ECE3; --line:#EADFD3;
  --cocoa:#4F3B2D; --brand:#7A5C48; --brand-d:#634A39; --muted:#7D6858;
  --ok:#4F7A57; --ok-bg:#E4EEE3; --warn:#9A6414; --warn-bg:#FBEBCB; --bad:#A93F34; --bad-bg:#F7DDD9;
  --r:18px; --r-s:12px;
  --head:'Fredoka',system-ui,sans-serif; --body:'Nunito',system-ui,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--cocoa);font:16px/1.5 var(--body);min-height:100vh}
h1,h2,h3{font-family:var(--head);font-weight:500;margin:0;line-height:1.2;letter-spacing:.1px}
h1{font-size:1.7rem} h2{font-size:1.25rem} h3{font-size:1.05rem}
p{margin:0}
a{color:var(--brand)}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid #C49A78;outline-offset:2px}
.sr{position:absolute;left:-9999px}

/* layout */
.app{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh}
.side{position:sticky;top:0;height:100vh;padding:22px 16px;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:18px}
.side .brand{display:flex;flex-direction:column;align-items:center;padding:6px 8px 14px;border-bottom:1px solid var(--line)}
.side .brand img{width:132px;height:auto}
.nav{display:flex;flex-direction:column;gap:4px}
.nav a{display:flex;align-items:center;gap:12px;padding:11px 14px;border-radius:var(--r-s);text-decoration:none;color:var(--muted);font-weight:700}
.nav a:hover{background:var(--beige-2)}
.nav a[aria-current=page]{background:var(--beige);color:var(--cocoa)}
.nav svg{width:20px;height:20px;flex:none}
.sync{margin-top:auto;font-size:.82rem;color:var(--muted);display:flex;gap:8px;align-items:center;padding:0 8px}
.dot{width:9px;height:9px;border-radius:50%;background:var(--ok);flex:none}
.dot.saving{background:#C49A3C}.dot.err,.dot.local{background:var(--bad)}
main{padding:28px clamp(16px,3vw,40px) 60px;max-width:1120px;width:100%}
.top{display:none}
.bottom{display:none}

.page-h{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:20px}
.page-h p{color:var(--muted)}

/* components */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:18px}
.grid{display:grid;gap:14px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.stat{display:flex;flex-direction:column;gap:2px}
.stat b{font:500 1.7rem/1.1 var(--head)}
.stat span{color:var(--muted);font-size:.9rem}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:999px;border:1.5px solid var(--brand);background:var(--brand);color:#fff;font-weight:800;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn:hover{background:var(--brand-d)}
.btn.ghost{background:transparent;color:var(--brand)}
.btn.ghost:hover{background:var(--beige-2)}
.btn.danger{border-color:var(--bad);color:var(--bad);background:transparent}
.btn.danger:hover{background:var(--bad-bg)}
.btn.wa{background:#2F7D57;border-color:#2F7D57}
.btn.wa:hover{background:#266a49}
.btn.sm{min-height:36px;padding:0 14px;font-size:.9rem}
.btn svg{width:18px;height:18px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.sp{flex:1}
.badge{display:inline-flex;align-items:center;padding:2px 10px;border-radius:999px;font-size:.8rem;font-weight:800;background:var(--beige-2);color:var(--muted)}
.badge.ok{background:var(--ok-bg);color:var(--ok)}
.badge.warn{background:var(--warn-bg);color:var(--warn)}
.badge.bad{background:var(--bad-bg);color:var(--bad)}
.muted{color:var(--muted)}
.small{font-size:.88rem}
.list{display:flex;flex-direction:column;gap:10px}
.item{display:flex;align-items:center;gap:14px;padding:14px 16px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);width:100%;text-align:left}
button.item{cursor:pointer}
button.item:hover{border-color:#D3BFAE;background:#FFFCF9}
.av{width:44px;height:44px;border-radius:50%;background:var(--beige);display:grid;place-items:center;font:500 1.1rem var(--head);color:var(--brand);flex:none}
.item .meta{min-width:0;flex:1}
.item .meta b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.empty{text-align:center;padding:34px 16px;color:var(--muted)}
.empty img{width:84px;opacity:.9;margin-bottom:8px}
.empty h3{color:var(--cocoa);margin-bottom:4px}
.tabs{display:flex;gap:6px;background:var(--beige-2);padding:4px;border-radius:999px;width:max-content;max-width:100%;overflow:auto}
.tabs button{border:0;background:transparent;padding:8px 16px;border-radius:999px;font-weight:800;color:var(--muted);cursor:pointer;min-height:38px}
.tabs button[aria-pressed=true]{background:var(--surface);color:var(--cocoa);box-shadow:0 1px 2px #0001}

/* forms */
.field{display:flex;flex-direction:column;gap:5px;margin-bottom:14px}
.field>label,.lbl{font-weight:800;font-size:.9rem}
.field small{color:var(--muted)}
input[type=text],input[type=number],input[type=date],input[type=month],input[type=time],input[type=tel],select,textarea{width:100%;min-height:46px;padding:9px 13px;border:1.5px solid #DCCDBE;border-radius:var(--r-s);background:#fff}
textarea{min-height:110px;resize:vertical}
input:focus,select:focus,textarea:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px #E9DACD}
.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.days{display:grid;gap:8px}
.dayrow{display:grid;grid-template-columns:110px 1fr;gap:10px;align-items:center}
.dayrow label{display:flex;gap:8px;align-items:center;font-weight:700}
.dayrow input[type=checkbox]{width:20px;height:20px;accent-color:var(--brand)}
.search{position:relative;margin-bottom:14px}

/* attendance */
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg button{min-height:40px;padding:0 14px;border-radius:999px;border:1.5px solid #DCCDBE;background:#fff;font-weight:800;color:var(--muted);cursor:pointer}
.seg button[aria-pressed=true].h{background:var(--ok);border-color:var(--ok);color:#fff}
.seg button[aria-pressed=true].i{background:#C49A3C;border-color:#C49A3C;color:#fff}
.seg button[aria-pressed=true].p{background:#5E7FA3;border-color:#5E7FA3;color:#fff}
.seg button[aria-pressed=true].l{background:var(--brand);border-color:var(--brand);color:#fff}
.seg button[aria-pressed=true].a{background:var(--bad);border-color:var(--bad);color:#fff}

/* hero */
.hero{display:grid;grid-template-columns:1fr auto;gap:18px;align-items:center;background:var(--beige);border-radius:24px;padding:26px 28px;margin-bottom:18px;overflow:hidden}
.hero p{color:#6B5545;margin:6px 0 16px}
.hero img{width:112px;height:auto;transform-origin:50% 90%;animation:wave 1.4s ease-out .3s 1 both}
@keyframes wave{0%{transform:rotate(0)}25%{transform:rotate(-7deg)}55%{transform:rotate(5deg)}100%{transform:rotate(0)}}

/* schedule */
.week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px}
.col{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:12px;min-height:120px}
.col.today{border-color:var(--brand);box-shadow:0 0 0 2px var(--beige)}
.col h3{font-size:1rem;margin-bottom:8px}
.slot{background:var(--beige-2);border-radius:10px;padding:8px 10px;margin-bottom:6px;font-size:.88rem}
.slot b{display:block}

table{width:100%;border-collapse:collapse}
th,td{text-align:left;padding:10px 8px;border-bottom:1px solid var(--line);font-size:.95rem}
th{font-weight:800;color:var(--muted);font-size:.85rem}
td.r,th.r{text-align:right}
.big{font:500 2rem var(--head)}
.pos{color:var(--ok)}.neg{color:var(--bad)}

/* modal + toast */
.ov{position:fixed;inset:0;background:#3a2b2066;display:flex;align-items:flex-end;justify-content:center;z-index:50;padding:0}
.modal{background:var(--bg);width:min(620px,100%);max-height:92vh;overflow:auto;border-radius:24px 24px 0 0;padding:22px 20px 26px}
.modal header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}
.x{border:0;background:var(--beige-2);width:40px;height:40px;border-radius:50%;cursor:pointer;font-size:1.3rem;line-height:1;color:var(--muted)}
@media(min-width:700px){.ov{align-items:center;padding:20px}.modal{border-radius:24px}}
#toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%) translateY(20px);background:var(--cocoa);color:#fff;padding:11px 18px;border-radius:999px;font-weight:700;opacity:0;pointer-events:none;transition:.25s;z-index:60;max-width:90vw;text-align:center}
#toast.on{opacity:1;transform:translateX(-50%) translateY(0)}

@media(max-width:960px){
  .app{grid-template-columns:1fr}
  .side{display:none}
  .top{display:flex;align-items:center;gap:10px;position:sticky;top:0;z-index:20;background:#FBF7F2ee;backdrop-filter:blur(6px);padding:10px 16px;border-bottom:1px solid var(--line)}
  .top img{width:34px;height:auto}
  .top b{font:500 1.05rem var(--head)}
  main{padding-bottom:110px}
  .bottom{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;left:0;right:0;bottom:0;z-index:30;background:var(--surface);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
  .bottom a,.bottom button{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 2px;border:0;background:none;text-decoration:none;color:var(--muted);font-size:.74rem;font-weight:800;border-radius:12px;cursor:pointer}
  .bottom svg{width:22px;height:22px}
  .bottom [aria-current=page]{color:var(--cocoa);background:var(--beige-2)}
  .g4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .g3{grid-template-columns:1fr}
  .week{grid-template-columns:1fr}
  .hero{grid-template-columns:1fr auto;padding:20px}
  .hero img{width:76px}
  h1{font-size:1.45rem}
}
@media(max-width:520px){.two{grid-template-columns:1fr}.g2{grid-template-columns:1fr}.dayrow{grid-template-columns:96px 1fr}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
