.routine-check-status { display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:18px;margin-bottom:18px; }
.routine-check-status p { margin:4px 0 0;color:var(--text-muted); }
.routine-check-status .routine-check-actions { display:flex;flex-wrap:wrap;gap:8px; }
.routine-check-status button { min-height:44px; }
.routine-check-label { font-size:var(--font-label);color:var(--text-muted);white-space:normal; }
.routine-check-dialog .routine-check-content { padding:20px; }
.routine-check-dialog p { color:var(--text-secondary);line-height:1.7; }
.routine-check-options { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:16px; }
.routine-check-options label { display:flex;align-items:center;gap:10px;min-height:52px;border:1px solid var(--border);border-radius:12px;padding:10px;overflow-wrap:anywhere; }
.routine-check-options input { width:20px;height:20px;flex-shrink:0;accent-color:var(--primary); }
.routine-check-options small { display:block;color:var(--text-muted); }
.routine-check-dialog .form-error { margin:12px 0; }
.routine-check-dialog .modal-actions { flex-wrap:wrap; }
#routine-export .form-field { display:block;max-width:12rem; }
.routine-week-dialog { width:min(1100px,calc(100vw - 32px)); }
.routine-week-table-wrap { overflow-x:auto; }
.routine-week-table { border-collapse:collapse;width:100%;min-width:740px; }
.routine-week-table th,.routine-week-table td { padding:12px;border-bottom:1px solid var(--border);text-align:start; }
.routine-week-table small { display:block;font-weight:400;color:var(--text-muted); }
.routine-week-details { margin-top:20px; }
.routine-week-details details { border-top:1px solid var(--border);padding:12px 0; }
.routine-week-details summary { cursor:pointer;min-height:44px;display:list-item; }
.routine-week-details li { margin:8px 0;line-height:1.6;overflow-wrap:anywhere; }
@media(max-width:600px){.routine-check-options{grid-template-columns:1fr}.routine-check-dialog .modal-actions button{flex:1 1 160px}.routine-check-status .routine-check-actions{width:100%}.routine-check-status button{flex:1}.routine-check-dialog .routine-check-content{padding:16px}}

/* Class rule editor inherits the existing teacher dialog, fields and palette. */
.routine-rules-dialog { max-width:760px; }
.routine-rules-content { padding:0 24px 24px; }
.routine-rules-content > p { line-height:1.65;color:var(--text-secondary,#596079); }
.routine-rule-tabs { display:flex;flex-wrap:wrap;gap:8px;margin:16px 0; }
.routine-rule-tabs button { min-height:44px; }
.routine-rule-tabs [aria-pressed="true"] { background:var(--primary,#234d41);color:var(--surface,#fff); }
.routine-rule-form { display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:14px; padding:18px 0;border-block:1px solid var(--border,#e7e1d8); }
.routine-rule-form h3,.routine-rule-form label:first-of-type,.routine-rule-form-actions { grid-column:1/-1; }
.routine-rule-form h3 { margin:0; }
.routine-rule-form label { display:grid;align-content:start;gap:7px;min-width:0;font-size:14px;font-weight:600; }
.routine-rule-form input,.routine-rule-form select { width:100%;min-width:0;min-height:44px;border:1px solid var(--border,#d8d3c9);border-radius:8px;padding:10px 12px;background:var(--surface,#fff);color:var(--text,#283b35);font:inherit; }
.routine-rule-form small { font-weight:400;line-height:1.5;color:var(--text-secondary,#596079); }
.routine-rule-form-actions { display:flex;flex-wrap:wrap;gap:8px; }
.routine-rule-form button,.routine-rule-list button { min-height:44px; }
.routine-rule-list { padding:0;margin:0;list-style:none; }
.routine-rule-list li { display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 0;border-bottom:1px solid var(--border,#e7e1d8); }
.routine-rule-list li > span { min-width:0;overflow-wrap:anywhere; }
.routine-rule-list small { display:block;margin-top:5px;color:var(--text-secondary,#596079); }
.routine-rule-list li > div { display:flex;gap:8px;flex-shrink:0; }
.routine-rule-tabs button:focus-visible,.routine-rule-form :is(input,select,button):focus-visible,.routine-rule-list button:focus-visible { outline:2px solid var(--primary,#234d41);outline-offset:3px; }
.routine-rules-dialog button:disabled { opacity:.55;cursor:wait; }
.student-score-actions [hidden] { display:none; }
@media(max-width:520px){
  .routine-rules-content { padding:0 16px 20px; }
  .routine-rule-form { grid-template-columns:1fr; }
  .routine-rule-form label { grid-column:1/-1; }
  .routine-rule-list li { align-items:flex-start;flex-direction:column;gap:10px; }
}

/* Daily scoreboard: students lead; connection recovery is shown only on errors. */
.routine-live-status:not([hidden]) { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;margin-bottom:12px;color:var(--danger);background:var(--danger-soft);border-radius:12px; }
.routine-roster-grid { grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:12px; }
.routine-student-tile { display:flex;flex-direction:column;justify-content:center;align-items:center;gap:8px;min-height:184px;padding:18px 12px;text-align:center;border:0;background:var(--surface-soft); }
.routine-student-avatar { display:grid;place-items:center;flex-shrink:0;width:56px;height:56px;border-radius:50%;background:var(--primary-soft);color:var(--primary);font-size:24px;font-weight:600; }
.routine-student-tile strong { width:100%;white-space:normal;overflow-wrap:anywhere;font-size:16px;line-height:1.4; }
.routine-student-score { display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;margin:0;padding:0;border:0; }
.routine-student-score b { font-size:28px;line-height:1.2;color:var(--primary); }
.routine-student-score em { font-size:12px;line-height:1.4; }
.routine-student-tile.has-bonus { background:var(--primary-soft); }
.routine-student-tile.has-deduction { background:var(--danger-soft); }
.routine-student-tile.has-deduction .routine-student-score b { color:var(--danger); }
.routine-student-tile:focus-visible { outline:2px solid var(--primary);outline-offset:3px;box-shadow:none; }
[data-class-work-panel="routine"] > .class-work-grid { grid-template-columns:minmax(0,2fr) minmax(280px,1fr); }
@media(max-width:900px){[data-class-work-panel="routine"] > .class-work-grid { grid-template-columns:1fr; }}
@media(max-width:520px){.routine-roster-grid {grid-template-columns:repeat(2,minmax(0,1fr));}.routine-student-tile {min-height:172px;}}

@media(max-width:520px){
 .routine-date-toolbar{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:12px;}
 .routine-date-toolbar [data-routine-date="previous"],.routine-date-toolbar [data-routine-date="next"],.routine-date-toolbar .routine-date-state{display:none;}
 .routine-date-toolbar label{grid-column:1/3;grid-row:1;min-width:0;}
 .routine-date-toolbar label input{min-width:0;width:100%;}
 .routine-date-toolbar .routine-today-button{grid-column:3;grid-row:1;width:auto;min-width:0;}
 .routine-date-toolbar [data-routine-rules-open],.routine-date-toolbar [data-routine-week],.routine-date-toolbar [data-routine-export]{width:100%;min-width:0;padding:10px 4px;font-size:13px;}
}
