/* Student-care additions on top of style.css (the ID Plan theme). Same purple and gold. Mobile first. */
.sl-nav{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 14px}
.sl-nav a{display:inline-flex;align-items:center;min-height:40px;padding:6px 16px;border-radius:999px;border:1px solid #e3d5e8;background:#fff;color:#51255e;text-decoration:none;font-size:14px}
.sl-nav a.active{background:#51255e;border-color:#51255e;color:#fff;box-shadow:inset 0 -3px #e2b84f}
.notice.bad{background:#fbeeee;border-color:#ecc9c9;color:#a33a3a}.notice.warn{background:#fdf6e3;border-color:#f0dfa8;color:#6e5413}
.sl-check{display:inline-flex;align-items:center;gap:8px;min-height:40px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.cr-small{font-size:13px}
#toast{display:flex;gap:12px;align-items:center}
#toast.show{opacity:1;transform:translate(-50%,0)}
.cr-toast-btn{background:#e2b84f;color:#2a0832;border:0;border-radius:999px;padding:6px 14px;font:inherit;font-weight:700;cursor:pointer}

/* Save state in the top bar */
.cr-state{font-size:14px;font-weight:600}.cr-state.ok{color:#2f6b45}.cr-state.wait{color:#9a6c12}.cr-state.bad{color:#a33a3a}

/* Roster */
.cr-roster-panel{padding:14px}
.cr-roster-tools{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.cr-room{display:flex;align-items:center;gap:8px}.cr-room select{min-height:44px;font-size:17px;padding:4px 10px;border-radius:10px;border:1px solid #d9c9e0}
.cr-search{flex:1;min-width:180px}.cr-search input{width:100%;min-height:44px;font-size:16px;padding:6px 12px;border-radius:10px;border:1px solid #d9c9e0}
.cr-roster{display:flex;flex-direction:column}
.cr-row{display:grid;grid-template-columns:44px 1fr auto;gap:10px;align-items:center;width:100%;min-height:56px;padding:8px 6px;border:0;border-bottom:1px solid #eee5f1;background:#fff;text-align:left;font:inherit;color:inherit;cursor:pointer}
.cr-row:hover,.cr-row:focus-visible{background:#f8f2fa}
.cr-no{font-size:18px;font-weight:700;color:#51255e;text-align:center;line-height:1.1}
.cr-name{font-size:16px;line-height:1.3;white-space:pre-wrap}.cr-name small{display:block;color:#807184;font-size:12px}
.cr-stat{text-align:right;font-size:14px;white-space:nowrap}.cr-stat b{color:#51255e}.cr-stat em{display:block;font-style:normal;font-size:12px;margin-top:2px}
.cr-empty{padding:20px;text-align:center}
.tone-green{color:#2f6b45}.tone-blue{color:#3b5f9a}.tone-amber{color:#9a6c12}.tone-orange{color:#b4561c}.tone-red{color:#a33a3a;font-weight:700}
em[class^=tone-]{font-style:normal}
.cr-dot{display:inline-block;width:9px;height:9px;border-radius:50%;vertical-align:middle}.cr-dot.wait{background:#e2b84f}.cr-dot.had{background:#e2b84f;box-shadow:0 0 0 2px #fff7df}
.cr-blocked-row{display:flex;justify-content:space-between;gap:10px;align-items:center;margin:6px 0}

/* Entry sheet: full screen on phones, a centred panel on wide screens */
body.cr-lock{overflow:hidden}
.cr-sheet{position:fixed;inset:0;z-index:50;background:#1b042066;display:flex;justify-content:center;align-items:stretch}
.cr-sheet[hidden]{display:none}
.cr-sheet-box{background:#fff;width:100%;max-width:640px;display:flex;flex-direction:column;overflow:hidden}
@media (min-width:760px){.cr-sheet{align-items:center;padding:24px}.cr-sheet-box{max-height:92vh;border-radius:18px;box-shadow:0 20px 60px #30003140}}
.cr-sheet-head{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:10px 16px 12px;background:linear-gradient(160deg,#300031,#51255e);color:#fff;padding-top:max(10px,env(safe-area-inset-top))}
.cr-sheet-head h2{margin:0;font-size:20px;color:#fff;white-space:pre-wrap}.cr-sheet-head p{margin:0;color:#e6d8ea;font-size:14px}
.cr-back{grid-column:1/-1;justify-self:start;background:none;border:0;color:#fbe7a8;font:inherit;font-size:15px;padding:6px 0;min-height:40px;cursor:pointer}
.cr-total{text-align:right}.cr-total b{display:block;font-size:24px;color:#fbe7a8;line-height:1}.cr-total span{font-size:13px;color:#e6d8ea}.cr-total em{display:block;font-size:12px;font-style:normal;color:#fff;opacity:.9}
.cr-sheet-body{flex:1;overflow:auto;padding:12px 16px 24px;-webkit-overflow-scrolling:touch;padding-bottom:max(24px,env(safe-area-inset-bottom))}
.cr-sheet-body h3{margin:10px 0 8px;font-size:18px;color:#3d1048}
.cr-years{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:8px}
.cr-years button,.cr-term button,.cr-months button{min-height:40px;border:1px solid #e3d5e8;background:#fff;border-radius:10px;font:inherit;color:#51255e;cursor:pointer}
.cr-years button{padding:4px 14px}.cr-years .on,.cr-months .on,.cr-term .on{background:#51255e;color:#fff;border-color:#51255e}
.cr-term{margin-left:auto;display:inline-flex;align-items:center;gap:6px;color:#807184}.cr-term button{width:42px}
.cr-months{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;margin-bottom:10px}.cr-months button{padding:2px;font-size:15px}
.cr-days{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}
.cr-wd{text-align:center;font-size:12px;color:#807184}
.cr-days button{aspect-ratio:1/1;min-height:42px;border:1px solid #eadff0;background:#fbf8fc;border-radius:12px;font:inherit;font-size:18px;color:#26102c;cursor:pointer;position:relative}
.cr-days button:hover{background:#f1e7f4}.cr-days button:disabled{opacity:.3;cursor:default}
.cr-days button.had{border-color:#e2b84f;background:#fff7df}
.cr-days button.had::after{content:'';position:absolute;left:50%;bottom:5px;width:6px;height:6px;margin-left:-3px;border-radius:50%;background:#c99a2e}
.cr-days button.sel{background:#51255e;color:#fff;border-color:#51255e}
.cr-hint{font-size:13px;color:#807184;margin:8px 0}
.cr-dateline{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-weight:600;color:#3d1048;background:#f7f1f9;border-radius:10px;padding:8px 12px}
.cr-link{background:none;border:0;color:#7a3f8c;font:inherit;text-decoration:underline;cursor:pointer;min-height:36px;padding:0 4px}
.cr-groups{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.cr-groups button{min-height:60px;border:1px solid #e3d5e8;border-radius:14px;background:#fff;font:inherit;font-size:17px;color:#3d1048;cursor:pointer;box-shadow:0 2px 0 #eadff0}
.cr-groups button:hover{border-color:#c9a9d6;background:#fbf7fc}
.cr-rules{display:flex;flex-direction:column;gap:8px}
.cr-rules button{display:flex;justify-content:space-between;gap:12px;align-items:center;text-align:left;min-height:56px;padding:10px 14px;border:1px solid #e3d5e8;border-radius:14px;background:#fff;font:inherit;font-size:16px;color:#26102c;cursor:pointer}
.cr-rules button strong{flex:none;font-size:18px;color:#a33a3a}
.cr-rules button:active{background:#f1e7f4}.cr-rules button:disabled{opacity:.5}
.cr-result{display:flex;flex-direction:column;gap:4px;padding:14px;border-radius:14px;margin:4px 0 12px;background:#eef6f0;border:1px solid #cfe3d5}
.cr-result strong{font-size:20px;color:#2f6b45}
.cr-result.state-waiting,.cr-result.state-saving{background:#fdf6e3;border-color:#f0dfa8}.cr-result.state-waiting strong,.cr-result.state-saving strong{color:#9a6c12}
.cr-result.state-blocked{background:#fbeeee;border-color:#ecc9c9}.cr-result.state-blocked strong{color:#a33a3a}
.cr-detail{display:flex;flex-direction:column;gap:4px;margin-bottom:8px}.cr-detail textarea{font:inherit;font-size:16px;padding:8px 10px;border-radius:10px;border:1px solid #d9c9e0}
.cr-actions{margin-bottom:10px}
.cr-next{display:grid;gap:8px}.cr-next .btn{min-height:50px;font-size:16px;justify-content:center}
.cr-records{margin-top:18px;border-top:1px solid #eee5f1;padding-top:8px}
.cr-records summary{cursor:pointer;font-weight:600;color:#3d1048;min-height:40px;display:flex;align-items:center}
.cr-rec{display:flex;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid #f1eaf4}
.cr-rec p{margin:4px 0 0;font-size:14px}.cr-rec strong{color:#a33a3a}.cr-rec.voided{opacity:.55}.cr-rec.voided strong{text-decoration:line-through}
.cr-rec-actions{display:flex;flex-direction:column;gap:4px;align-items:flex-end}.cr-rec-actions .btn{min-height:36px;padding:2px 12px}
.cr-st-waiting,.cr-st-saving{color:#9a6c12}.cr-st-blocked{color:#a33a3a}
.cr-none{margin-top:16px}
.cr-log{background:#faf7fb;border-radius:10px;padding:8px 12px;margin-top:8px}.cr-log h4{margin:0 0 6px}
.cr-log-row{padding:4px 0;border-bottom:1px dashed #eadff0}
.cr-edit .field{margin-bottom:10px}.cr-edit input,.cr-edit select,.cr-edit textarea{width:100%;font:inherit;font-size:16px;min-height:42px}
.cr-hist-row{padding:8px 0;border-bottom:1px solid #f1eaf4}.cr-hist-who{display:block}
.cr-levels{padding-left:18px}
.cr-rules-table td:nth-child(3){white-space:nowrap;color:#a33a3a;font-weight:700}

/* Annual report (one room). Same table as the 2568 sheet plus "การใช้สื่อ". */
.cr-report-tools{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center}
.cr-report-frame{overflow:auto;background:#eee6f0;border-radius:12px;padding:12px}
.cr-report{background:#fff;color:#000;padding:18px 20px;min-width:820px;font-family:Sarabun,Tahoma,sans-serif}
.cr-report header{text-align:center;margin-bottom:8px}.cr-report header img{width:44px}.cr-report h2{margin:2px 0;font-size:18px;color:#000}.cr-report header p{margin:0;font-size:14px}
.cr-report table{width:100%;border-collapse:collapse;font-size:13px}
.cr-report th,.cr-report td{border:1px solid #000;padding:3px 4px;background:#fff;color:#000;font-weight:400}
.cr-report th{font-weight:700;text-transform:none;letter-spacing:0}
.cr-report .c{text-align:center}.cr-report .nm{white-space:pre;min-width:170px}.cr-report .tot{font-weight:700}
.cr-report th.rot{height:96px;width:30px;padding:2px;vertical-align:bottom}
.cr-report th.rot span{writing-mode:vertical-rl;transform:rotate(180deg);white-space:nowrap;display:inline-block}
.cr-report tfoot td{font-weight:700}
.cr-signs{display:flex;justify-content:space-around;margin-top:28px;font-size:14px}
.cr-print{display:none}
@media print{
  @page{size:A4 landscape;margin:10mm}
  body.cr-printing .app-shell,body.cr-printing .cr-sheet,body.cr-printing #toast{display:none!important}
  body.cr-printing .cr-print{display:block}
  .cr-print .cr-report{min-width:0;padding:0;break-after:page;page-break-after:always}
  .cr-print .cr-report:last-child{break-after:auto;page-break-after:auto}
  .cr-print tr{break-inside:avoid}
}
@media (max-width:520px){.cr-row{grid-template-columns:36px 1fr auto;gap:8px}.cr-name{font-size:15px}.cr-groups button{font-size:16px}}
/* Phones: keep the account bar and menu to two short lines, so the roster starts high on the screen. */
@media (max-width:760px){
  .central-user{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;font-size:14px}
  .central-user .btn{min-height:34px;padding:2px 10px;font-size:13px}
  .sl-nav{flex-wrap:nowrap;overflow-x:auto;margin-bottom:10px;scrollbar-width:none}.sl-nav::-webkit-scrollbar{display:none}
  .sl-nav a{flex:none;min-height:36px;padding:4px 12px;font-size:14px}
  .cr-roster-panel{padding:10px}
}
.sl-check input{width:20px;height:20px;min-height:0;flex:none;margin:0;accent-color:#51255e}
/* Keep the two spaces between first and last name (user decision) wherever a name is shown. */
.cr-hist-who,.cr-rec small,.cr-log-row,.central-user strong{white-space:pre-wrap}
