/* ============ skooldee — Admin design tokens ============ */
:root{
  /* neutrals (cream/grey per brand) */
  --bg:        #FAFAF9;
  --surface:   #ffffff;
  --surface-2: #FAFAF9;
  --surface-3: #F2F0ED;
  --border:    #EDEAE6;
  --border-2:  #C8C5C0;

  --text:   #111111;
  --text-2: #444444;
  --text-3: #888888;

  /* brand blue primary */
  --primary:      #0D9488;
  --primary-ink:  #0F766E;
  --primary-soft: #F0FDFA;
  --primary-soft2:#CCFBF1;
  --sky:          #5EEAD4;

  /* class category hues (same L/C, varied hue) */
  --c-sing:   oklch(0.63 0.155 25);
  --c-piano:  oklch(0.55 0.20 264);
  --c-dance:  oklch(0.62 0.15 340);
  --c-drums:  oklch(0.66 0.125 70);
  --c-guitar: oklch(0.60 0.105 158);
  --c-art:    oklch(0.58 0.15 300);

  --c-sing-soft:   oklch(0.955 0.03 25);
  --c-piano-soft:  #F0FDFA;
  --c-dance-soft:  oklch(0.955 0.03 340);
  --c-drums-soft:  oklch(0.96 0.035 75);
  --c-guitar-soft: oklch(0.955 0.028 158);
  --c-art-soft:    oklch(0.955 0.035 300);

  --ok:   #16A34A;
  --ok-soft: #F0FDF4;
  --warn: #CA8A04;
  --warn-soft: #FEFCE8;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(17,17,17,0.05), 0 1px 3px rgba(17,17,17,0.04);
  --shadow-md: 0 4px 14px rgba(17,17,17,0.07), 0 2px 6px rgba(17,17,17,0.05);
  --shadow-lg: 0 18px 50px rgba(17,17,17,0.14), 0 8px 20px rgba(17,17,17,0.08);

  --ff-ui: "Work Sans","IBM Plex Sans Thai",system-ui,sans-serif;
  --ff-display: "Work Sans","IBM Plex Sans Thai",system-ui,sans-serif;
  --ff-mono: "DM Mono","IBM Plex Sans Thai",ui-monospace,monospace;
}

*{ box-sizing:border-box; }
html,body{ margin:0; height:100%; }
body{
  font-family:var(--ff-ui);
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  font-size:15px;
  line-height:1.45;
}
#root{ height:100%; }
button{ font-family:inherit; cursor:pointer; }
::selection{ background:var(--primary-soft2); }
/* scrollbars */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{ background:oklch(0.85 0.01 60); border-radius:20px; border:3px solid transparent; background-clip:padding-box; }
*::-webkit-scrollbar-thumb:hover{ background:oklch(0.78 0.01 60); background-clip:padding-box; border:3px solid transparent; }

/* ===================== App shell ===================== */
.app{ display:flex; height:100%; overflow:hidden; }

/* sidebar — dark per brand */
.sidebar{
  width:248px; flex:0 0 248px; background:#111111;
  border-right:1px solid #1f1f1f; display:flex; flex-direction:column;
  padding:18px 14px; gap:6px;
}
.brand{ display:flex; align-items:center; gap:11px; padding:6px 8px 16px; }
.brand-mark{
  width:40px; height:40px; border-radius:12px; flex:0 0 40px;
  background:#fff; display:grid; place-items:center; color:#111; font-size:21px;
  box-shadow:0 6px 16px rgba(0,0,0,0.3); overflow:hidden;
}
.brand-name{ font-family:var(--ff-display); font-weight:700; font-size:18px; letter-spacing:-0.01em; line-height:1.1; color:#fff; }
.brand-sub{ font-size:11.5px; color:rgba(255,255,255,0.45); letter-spacing:0.02em; }

.nav-section{ font-size:11px; font-weight:600; letter-spacing:0.06em; color:rgba(255,255,255,0.4); text-transform:uppercase; padding:14px 10px 6px; }
.nav-item{
  display:flex; align-items:center; gap:12px; width:100%; border:0; background:transparent;
  padding:10px 12px; border-radius:8px; color:rgba(255,255,255,0.55); font-size:13px; font-weight:500;
  text-align:left; transition:background .14s, color .14s; position:relative;
}
.nav-item .ic{ width:20px; height:20px; flex:0 0 20px; opacity:.85; }
.nav-item span{ flex:1 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-item:hover{ background:rgba(255,255,255,0.07); color:#fff; }
.nav-item.active{ background:var(--primary); color:#fff; font-weight:600; }
.nav-item.active .ic{ opacity:1; }
.nav-badge{ margin-left:auto; font-size:11px; font-weight:700; background:var(--primary); color:#fff; border-radius:20px; padding:1px 7px; min-width:20px; text-align:center; }
.nav-item.active .nav-badge{ background:rgba(255,255,255,0.25); }

.side-foot{ margin-top:auto; }
.side-card{ background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1); border-radius:var(--radius); padding:12px; }
.user-chip{ display:flex; align-items:center; gap:10px; padding:7px; border-radius:8px; }
.user-chip:hover{ background:rgba(255,255,255,0.07); }
.user-chip .un{ color:#fff; }
.user-chip .ur{ color:rgba(255,255,255,0.45); }
.side-foot .icon-btn{ background:transparent; border-color:rgba(255,255,255,0.15); color:rgba(255,255,255,0.6); }
.side-foot .icon-btn:hover{ background:rgba(255,255,255,0.1); color:#fff; }

/* main */
.main{ flex:1; min-width:0; display:flex; flex-direction:column; overflow:hidden; }
.topbar{
  height:66px; flex:0 0 66px; display:flex; align-items:center; gap:16px;
  padding:0 26px; background:var(--surface); border-bottom:1px solid var(--border); z-index:5;
}
.page-title{ font-family:var(--ff-display); font-weight:700; font-size:20px; letter-spacing:-0.01em; }
.page-sub{ font-size:12.5px; color:var(--text-3); }
.search{
  display:flex; align-items:center; gap:9px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:11px; padding:8px 13px; width:300px; color:var(--text-3);
}
.search input{ border:0; background:transparent; outline:none; font-family:inherit; font-size:14px; color:var(--text); width:100%; }
.icon-btn{
  width:40px; height:40px; border-radius:11px; border:1px solid var(--border); background:var(--surface);
  display:grid; place-items:center; color:var(--text-2); position:relative; transition:.14s;
}
.icon-btn:hover{ background:var(--surface-3); color:var(--text); }
.dot{ position:absolute; top:9px; right:9px; width:8px; height:8px; border-radius:50%; background:var(--primary); border:2px solid var(--surface); }

.content{ flex:1; overflow:auto; padding:26px; }
.content-inner{ max-width:1240px; margin:0 auto; }

/* ===================== primitives ===================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px; border-radius:11px;
  padding:9px 16px; font-size:14px; font-weight:600; border:1px solid transparent; transition:.14s;
  white-space:nowrap;
}
.btn-primary{ background:var(--primary); color:#fff; box-shadow:0 4px 12px rgba(13,148,136,0.28); }
.btn-primary:hover{ background:var(--primary-ink); }
.btn-ghost{ background:var(--surface); border-color:var(--border-2); color:var(--text); }
.btn-ghost:hover{ background:var(--surface-3); }
.btn-soft{ background:var(--primary-soft); color:var(--primary-ink); }
.btn-soft:hover{ background:var(--primary-soft2); }
.btn-sm{ padding:6px 11px; font-size:13px; border-radius:8px; }

.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); }
.card-pad{ padding:20px; }

.badge{ display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; border-radius:20px; padding:3px 10px; }
.dotmark{ width:8px; height:8px; border-radius:50%; flex:0 0 8px; }

.avatar{ border-radius:50%; display:grid; place-items:center; color:#fff; font-weight:600; flex:0 0 auto; font-family:var(--ff-display); }

.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.stat{ padding:18px; }
.stat-label{ font-size:13px; color:var(--text-2); font-weight:500; }
.stat-val{ font-family:var(--ff-display); font-size:30px; font-weight:700; letter-spacing:-0.02em; margin-top:6px; line-height:1; }
.stat-meta{ font-size:12.5px; margin-top:9px; display:flex; align-items:center; gap:5px; }
.trend-up{ color:var(--ok); } .trend-down{ color:var(--danger); }

table{ width:100%; border-collapse:collapse; }
th{ text-align:left; font-size:12px; font-weight:600; color:var(--text-3); text-transform:uppercase; letter-spacing:0.04em; padding:11px 14px; border-bottom:1px solid var(--border); }
td{ padding:13px 14px; border-bottom:1px solid var(--border); font-size:14px; vertical-align:middle; }
tr:last-child td{ border-bottom:0; }
tbody tr{ transition:background .12s; }
tbody tr:hover{ background:var(--surface-2); }

.tag-filter{ display:flex; gap:8px; flex-wrap:wrap; }
.chip{ border:1px solid var(--border); background:var(--surface); border-radius:20px; padding:6px 13px; font-size:13.5px; font-weight:500; color:var(--text-2); display:inline-flex; align-items:center; gap:7px; transition:.14s; }
.chip:hover{ background:var(--surface-3); }
.chip.active{ background:var(--text); color:var(--surface); border-color:var(--text); }

.section-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:14px; flex-wrap:wrap; }
.section-title{ font-family:var(--ff-display); font-weight:700; font-size:17px; letter-spacing:-0.01em; }

.progress{ height:7px; border-radius:20px; background:var(--surface-3); overflow:hidden; }
.progress > i{ display:block; height:100%; border-radius:20px; }

/* ===================== schedule (time-based) ===================== */
.sc-wrap{ overflow-x:auto; }
.sc-grid{ display:grid; }
.sc-corner{ border-bottom:1px solid var(--border); }
.sc-dayhead{ text-align:center; padding:10px 6px; border-left:1px solid var(--border); border-bottom:1px solid var(--border); }
.sc-dayhead .cal-day{ font-weight:700; font-size:14.5px; font-family:var(--ff-display); }
.sc-dayhead .cal-date{ font-size:11.5px; color:var(--text-3); }
.sc-gutter{ position:relative; border-bottom:1px solid var(--border); }
.sc-hourlabel{ position:absolute; right:8px; transform:translateY(-50%); font-size:11.5px; color:var(--text-3); }
.sc-col{ position:relative; border-left:1px solid var(--border); border-bottom:1px solid var(--border); cursor:copy; }
.sc-hour{ position:absolute; left:0; right:0; border-top:1px solid var(--border); }
.sc-ev{
  position:absolute; border-radius:8px; border-left:3px solid; padding:4px 7px; overflow:hidden;
  cursor:pointer; transition:filter .12s, box-shadow .12s; box-sizing:border-box;
}
.sc-ev:hover{ filter:brightness(0.97); box-shadow:var(--shadow-sm); z-index:4; }
.sc-ev-name{ font-size:12.5px; font-weight:700; line-height:1.15; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sc-ev-time{ font-size:10.5px; opacity:.82; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ===================== drawer / modal ===================== */
.scrim{ position:fixed; inset:0; background:oklch(0.3 0.02 60 / 0.4); backdrop-filter:blur(2px); z-index:40; animation:fade .16s ease; }
@keyframes fade{ from{opacity:0} to{opacity:1} }
.drawer{
  position:fixed; top:0; right:0; height:100%; width:440px; max-width:92vw; background:var(--surface);
  box-shadow:var(--shadow-lg); z-index:41; display:flex; flex-direction:column; animation:slidein .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes slidein{ from{transform:translateX(100%)} to{transform:translateX(0)} }
.drawer-head{ padding:20px 22px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:14px; }
.drawer-body{ flex:1; overflow:auto; padding:22px; }
.drawer-foot{ padding:16px 22px; border-top:1px solid var(--border); display:flex; gap:10px; }

.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13px; font-weight:600; color:var(--text-2); margin-bottom:6px; }
.field input,.field select,.field textarea{
  width:100%; border:1px solid var(--border); border-radius:10px; padding:10px 12px; font-family:inherit;
  font-size:14px; background:var(--surface); color:var(--text); outline:none; transition:.14s;
}
.field input:focus,.field select:focus,.field textarea:focus{ border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }

.kv{ display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--border); font-size:14px; }
.kv:last-child{ border-bottom:0; }
.kv .k{ color:var(--text-2); }
.kv .v{ font-weight:600; }

.empty{ text-align:center; padding:48px 20px; color:var(--text-3); }

/* segmented control (เช็คชื่อ) */
.seg{ display:flex; gap:4px; background:var(--surface-2); border:1px solid var(--border); border-radius:11px; padding:3px; flex:0 0 auto; }
.seg-btn{ border:1px solid transparent; background:transparent; border-radius:8px; padding:6px 12px; font-size:13px; font-weight:600; color:var(--text-2); transition:.12s; white-space:nowrap; }
.seg-btn:hover{ background:var(--surface-3); }
.seg-btn.on{ box-shadow:var(--shadow-sm); }

/* center modal (LINE notify) */
.modal{
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); width:440px; max-width:92vw; max-height:88vh;
  background:var(--surface); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); z-index:50;
  display:flex; flex-direction:column; animation:pop .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes pop{ from{opacity:0; transform:translate(-50%,-46%) scale(.97)} to{opacity:1; transform:translate(-50%,-50%) scale(1)} }
.modal-head{ padding:18px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:13px; }
.modal-body{ flex:1; overflow:auto; padding:18px 20px; background:var(--surface-2); }
.modal-foot{ padding:14px 20px; border-top:1px solid var(--border); display:flex; gap:10px; }
.line-logo{ width:42px; height:42px; flex:0 0 42px; border-radius:12px; background:#06c755; color:#fff; display:grid; place-items:center; font-weight:800; font-size:13px; letter-spacing:0.02em; }
.line-preview{ display:flex; flex-direction:column; gap:10px; }
.line-bubble{ background:#fff; border:1px solid var(--border); border-radius:4px 16px 16px 16px; padding:12px 14px; font-size:13.5px; line-height:1.5; white-space:pre-wrap; box-shadow:var(--shadow-sm); }
.line-card{ background:#fff; border:1px solid var(--border); border-radius:14px; padding:14px; box-shadow:var(--shadow-sm); }
.rep-month{ border:1px solid var(--border); border-radius:11px; padding:9px 13px; font-family:inherit; font-size:14px; background:var(--surface); color:var(--text); outline:none; }

/* homework actions */
.hw-actions{ display:flex; gap:8px; flex:0 0 auto; }

/* group booking */
.grp-toggle{ display:flex; align-items:flex-start; gap:10px; font-size:13.5px; padding:11px 13px; background:var(--surface-2); border:1px solid var(--border); border-radius:11px; margin-bottom:16px; cursor:pointer; }
.grp-toggle span{ line-height:1.4; }
.grp-list{ display:flex; flex-direction:column; gap:4px; max-height:220px; overflow:auto; border:1px solid var(--border); border-radius:11px; padding:6px; }
.grp-item{ display:flex; align-items:center; gap:9px; padding:6px 9px; border-radius:9px; font-size:14px; cursor:pointer; }
.grp-item:hover{ background:var(--surface-2); }
.grp-item.on{ background:var(--primary-soft); color:var(--primary-ink); font-weight:600; }
.grp-item input{ width:16px; height:16px; accent-color:var(--primary); }

/* mobile bottom nav (hidden on desktop) */
.mobnav{ display:none; }
.only-mobile{ display:none; }

/* ===================== responsive ===================== */
@media (max-width:880px){
  .sidebar{ display:none; }
  .main{ padding-bottom:64px; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
  .topbar{ padding:0 16px; height:60px; flex:0 0 60px; }
  .search{ display:none; }
  .content{ padding:16px; }
  .hide-mobile{ display:none !important; }
  .only-mobile{ display:grid !important; }
  .sc-wrap{ overflow-x:auto; }
  .dash-cols{ grid-template-columns:1fr !important; }
  .mobnav{
    display:flex; position:fixed; bottom:0; left:0; right:0; height:62px; background:var(--surface);
    border-top:1px solid var(--border); z-index:30; padding:6px 4px; overflow-x:auto; -webkit-overflow-scrolling:touch;
  }
  .mobnav button{ border:0; background:transparent; display:flex; flex-direction:column; align-items:center; gap:2px; flex:1 0 auto; min-width:50px; color:var(--text-3); font-size:9.5px; font-weight:600; border-radius:9px; padding:3px 4px; }
  .mobnav button.active{ color:var(--primary-ink); }
  .drawer{ width:100%; max-width:100%; }
  /* data tables: let cards scroll sideways instead of clipping columns (overrides inline overflow:hidden) */
  .card:has(> table){ overflow-x:auto !important; -webkit-overflow-scrolling:touch; }
  .card > table{ min-width:480px; }
}
@media (max-width:560px){
  .stat-grid{ grid-template-columns:1fr 1fr; gap:10px; }
}
