/* Scoped list/detail layout; existing forms and permission gates are retained. */
#studentArchivePage:has(.student-management) > .tips { display:none; }
#studentArchivePage:has(.student-management[data-view="detail"]) > .section-title { display:none!important; }
#studentArchivePage .student-management { display:block!important; min-width:0; letter-spacing:0; }
#studentArchivePage .student-management[data-view="list"] > .student-archive-detail-panel,
#studentArchivePage .student-management[data-view="detail"] > .student-archive-master-panel { display:none!important; }
#studentArchivePage .student-management > .student-archive-master-panel { position:static; width:100%; max-height:none; padding:0; background:#fff; border:1px solid #dfe5ed; border-radius:8px; box-shadow:none; overflow:hidden; }
#studentArchivePage .student-management .student-archive-master-head { padding:20px 22px 12px; margin:0; }
#studentArchivePage .student-management .student-archive-master-head > div > span { display:none; }
#studentArchivePage .student-management .student-archive-master-head h3 { display:block; margin:0; font-size:18px; }
#studentArchivePage .student-management .student-archive-master-head strong { color:#596579; font-size:14px; }
#studentArchivePage .student-management .student-archive-master-search { margin:0 22px 12px; max-width:480px; }
#studentArchivePage .student-management .student-archive-master-filters { display:flex; flex-wrap:wrap; gap:10px; padding:0 22px 18px; margin:0; }
#studentArchivePage .student-management .student-archive-master-filters select { width:auto; min-width:145px; max-width:240px; margin:0; border-radius:6px; font-size:14px; height:40px; padding:8px 30px 8px 10px; }
#studentArchivePage .student-management .student-archive-master-list { display:block; padding:0; max-height:none; overflow:visible; }
.sm-table-scroll { overflow:auto; }
.sm-table { width:100%; border-collapse:collapse; text-align:left; table-layout:fixed; font-size:14px; }
.sm-table th { padding:13px 18px; background:#f4f6f9; color:#556175; font-weight:600; white-space:nowrap; border-block:1px solid #e3e8f0; }
.sm-table td { padding:16px 18px; border-bottom:1px solid #edf0f4; vertical-align:middle; color:#344258; overflow-wrap:anywhere; }
.sm-table th:first-child { width:25%; }
.sm-table th:nth-child(2) { width:23%; }
.sm-table th:nth-child(3) { width:14%; }
.sm-table th:nth-child(4) { width:11%; }
.sm-table th:nth-child(5) { width:17%; }
.sm-table th:last-child { width:10%; }
.sm-table tbody tr:hover { background:#f7faff; }
.sm-table small,.sm-student-link small { display:block; margin-top:5px; color:#788498; font-size:12px; font-weight:400; line-height:1.5; }
.sm-student-link { display:flex; align-items:center; gap:12px; width:100%; min-height:44px; padding:0; border:0; background:transparent; color:#1668d7; text-align:left; font:inherit; font-weight:600; cursor:pointer; }
.sm-student-link > span:nth-child(2) { min-width:0; flex:1; overflow-wrap:anywhere; }
.sm-student-link small { max-width:180px; }
.sm-student-link svg { width:16px; height:16px; flex-shrink:0; }
.sm-avatar { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; flex-shrink:0; border-radius:50%; background:#eaf3ff; color:#176cda; font-weight:600; }
.sm-neutral { color:#667487; font-size:12px; }
.sm-pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 22px; color:#5d697b; font-size:13px; }
.sm-pagination > div { display:flex; gap:8px; }
.sm-icon { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px; flex-shrink:0; border:1px solid #d7dfeb; border-radius:6px; background:#fff; color:#47617d; cursor:pointer; }
.sm-icon:disabled { opacity:.4; cursor:default; }
.sm-icon svg { width:18px; height:18px; }
.sm-empty { padding:70px 20px; display:grid; justify-items:center; gap:12px; color:#6c778b; }
.sm-empty > svg { width:32px; height:32px; color:#9eafc7; }
.sm-empty p { margin:0; font-size:14px; }
#studentArchivePage .student-management > .student-archive-detail-panel { min-width:0; background:#fff; padding:22px; border:1px solid #dfe5ed; border-radius:8px; }
.sm-breadcrumb { display:flex; align-items:center; gap:12px; color:#6c7888; font-size:14px; margin-bottom:22px; min-width:0; flex-wrap:wrap; }
.sm-breadcrumb button { display:flex; align-items:center; gap:8px; background:transparent; border:0; color:#236bc5; padding:4px 0; cursor:pointer; font:inherit; }
.sm-breadcrumb svg { width:16px; height:16px; }
.sm-student-header { display:flex; gap:18px; align-items:center; padding-bottom:22px; border-bottom:1px solid #e7ebf1; margin-bottom:18px; }
.sm-avatar-large { width:56px; height:56px; font-size:23px; }
.sm-student-header > div { min-width:0; }
.sm-student-header h3 { font-size:22px; margin:0 0 8px; color:#202c3e; overflow-wrap:anywhere; }
.sm-student-header p { margin:5px 0 0; color:#627085; font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.sm-student-header p span { padding:0 9px; }
#studentArchivePage .student-management .student-archive-control-card { display:flex; justify-content:space-between; align-items:end; gap:12px; box-shadow:none; border:0; background:none; padding:0; margin-bottom:18px; }
#studentArchivePage .student-management[data-active-tab="summary"] .student-archive-control-card { display:none; }
#studentArchivePage .student-management .student-archive-control-card > div:nth-child(2) { width:185px; max-width:100%; }
#studentArchivePage .student-management .student-archive-control-card label { font-size:13px; }
#studentArchivePage .student-management .student-archive-quick-actions { display:flex; flex-wrap:wrap; gap:8px; }
#studentArchivePage .student-management .student-archive-quick-actions .small-btn { font-size:13px; border-radius:6px; }
#studentArchivePage .student-management #archiveStatusCard,
#studentArchivePage .student-management .student-archive-priority-block { display:none; }
#studentArchivePage .student-management[data-active-tab="overview"] #archiveStatusCard,
#studentArchivePage .student-management[data-active-tab="overview"] .student-archive-priority-block { display:block; }
#studentArchivePage .student-management .student-archive-tab-shell { position:relative; display:flex; flex-wrap:wrap; gap:8px; padding:0 0 12px; margin-bottom:0; background:none; border:0; border-bottom:1px solid #e2e8f0; border-radius:0; box-shadow:none; }
#studentArchivePage .student-management .student-archive-tab-scroll { display:none; }
#studentArchivePage .student-management .student-archive-tabs { display:flex; flex:1; min-width:0; flex-wrap:wrap; gap:2px; overflow:visible; padding:0; }
#studentArchivePage .student-management .student-archive-tab { padding:10px 12px; margin:0; border:0; border-radius:5px; background:transparent; color:#5b6678; box-shadow:none; font-size:14px; white-space:normal; min-height:40px; }
#studentArchivePage .student-management .student-archive-tab.active { color:#1265d0; background:#edf4ff; font-weight:600; }
.sm-more { position:relative; align-self:flex-start; margin-left:auto; }
.sm-more summary { display:flex; align-items:center; gap:5px; padding:10px; font-size:14px; color:#5d6980; cursor:pointer; list-style:none; }
.sm-more summary::-webkit-details-marker { display:none; }
.sm-more summary svg { width:16px; height:16px; }
.sm-more-menu { position:absolute; right:0; top:100%; z-index:60; width:210px; max-height:340px; overflow-y:auto; padding:6px; border:1px solid #dde4ee; border-radius:6px; background:#fff; box-shadow:0 8px 24px #1e36501a; }
.sm-more-menu .student-archive-tab { display:block; width:100%; text-align:left; }
#studentArchivePage .student-management .student-archive-tab-panel { padding-top:22px; }
.sm-facts { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:20px; padding:4px 0 24px; border-bottom:1px solid #e7ebf1; }
.sm-facts span { display:block; color:#68778d; font-size:13px; margin-bottom:10px; }
.sm-facts strong { font-size:22px; color:#24344a; overflow-wrap:anywhere; }
.sm-summary-section { padding:24px 0; border-bottom:1px solid #e7ebf1; }
.sm-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.sm-section-heading h3 { font-size:16px; color:#24344a; margin:0; }
.sm-section-heading button { display:flex; align-items:center; gap:5px; background:transparent; border:0; color:#1c6bd2; font-size:13px; cursor:pointer; padding:5px 0; }
.sm-section-heading svg { width:15px; height:15px; }
.sm-summary-section p { font-size:14px; line-height:1.85; color:#41516a; white-space:pre-wrap; overflow-wrap:anywhere; }
.sm-summary-section .sm-meta,.sm-muted { color:#7b8798; font-size:13px; }
.sm-feedback-excerpt { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }
#studentArchivePage .student-management button:focus-visible,#studentArchivePage .student-management summary:focus-visible { outline:2px solid #287be8; outline-offset:3px; }
@media(max-width:760px){
  #studentArchivePage .student-management .student-archive-master-head { padding:16px 14px 12px; }
  #studentArchivePage .student-management .student-archive-master-search { margin:0 14px 12px; }
  #studentArchivePage .student-management .student-archive-master-filters { padding:0 14px 14px; gap:8px; }
  #studentArchivePage .student-management .student-archive-master-filters select { min-width:0; max-width:none; flex:1 1 120px; }
  .sm-table th:nth-child(n+3),.sm-table td:nth-child(n+3) { display:none; }
  .sm-table th:first-child { width:55%; }
  .sm-table th:nth-child(2) { width:45%; }
  .sm-table th,.sm-table td { padding:14px 12px; }
  .sm-student-link { gap:8px; font-size:14px; }
  .sm-student-link small { font-size:11px; }
  .sm-avatar { width:30px; height:30px; }
  .sm-pagination { padding:14px; font-size:12px; }
  #studentArchivePage .student-management > .student-archive-detail-panel { padding:14px; }
  .sm-avatar-large { width:44px; height:44px; }
  .sm-student-header { gap:12px; }
  .sm-student-header h3 { font-size:19px; }
  #studentArchivePage .student-management .student-archive-control-card { flex-wrap:wrap; }
  #studentArchivePage .student-management .student-archive-quick-actions { display:none; }
  #studentArchivePage .student-management .student-archive-tab { font-size:13px; padding:9px; }
  #studentArchivePage .student-management .student-archive-tabs { flex-basis:100%; }
  #studentArchivePage .student-management[data-view="detail"] { margin-top:0; }
  .sm-breadcrumb { margin-bottom:14px; }
  .sm-student-header { padding-bottom:14px; margin-bottom:8px; }
  #studentArchivePage .student-management .student-archive-tab-shell { margin-top:10px; }
  .sm-more { margin-left:0; }
  .sm-more-menu { right:auto; left:0; }
  .sm-facts { grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
  .sm-facts strong { font-size:19px; }
}

/* V2: compact, factual workspace shared with the existing feedback form. */
.sm-restore-status { display:none; padding:50px 20px; text-align:center; font-size:14px; color:#78889d; }
#studentArchivePage .student-management[data-restoring="1"] > .student-archive-master-panel,
#studentArchivePage .student-management[data-restoring="1"] > .student-archive-detail-panel { display:none!important; }
#studentArchivePage .student-management[data-restoring="1"] > .sm-restore-status { display:block; }
html body > .merged-header-shell + .container:has(.student-management),
html body.student-context-feedback > .merged-header-shell + .container { background:#fff!important; border:1px solid #e3e9f0!important; box-shadow:none!important; border-radius:8px!important; padding:24px!important; }
#studentArchivePage:has(.student-management) { padding:24px!important; border:0; border-radius:8px; box-shadow:none; }
#studentArchivePage:has(.student-management) { padding:0!important; }
.student-context-feedback .stitch-showcase-grid { display:none; }
.student-context-feedback #writePage > .section-title { font-size:20px; margin:0 0 18px; }
body.student-context-feedback #writePage .feedback-mode { display:flex; width:320px; max-width:100%; gap:4px; padding:4px; margin:0 0 22px; border:1px solid #e1e7ef; border-radius:7px; background:#f6f8fb; }
body.student-context-feedback #writePage .feedback-mode .mode-btn { flex:1; min-height:38px!important; padding:8px 12px!important; border:0; border-radius:4px!important; box-shadow:none!important; font-size:14px!important; background:transparent!important; color:#65758b!important; }
body.student-context-feedback #writePage .feedback-mode .mode-btn.active { background:#1769d2!important; color:#fff!important; }
body.student-context-feedback #writePage .feedback-mode .mode-btn svg { width:16px!important; height:16px!important; }
.student-context-feedback #singleFeedbackArea > .sub-title { display:none!important; }
#studentArchivePage .student-management { margin-top:18px; }
#studentArchivePage .student-management > .student-archive-detail-panel { padding:0; border:0; border-radius:0; background:transparent; }
#studentArchivePage .student-management > .student-archive-master-panel { box-shadow:none; }
.sm-student-heading { flex:1; min-width:0; }
.sm-student-title { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.sm-student-title h3 { margin:0; }
.sm-student-title .sm-neutral { background:#f0f4f8; color:#53657b; padding:3px 7px; border-radius:4px; }
.sm-student-header .sm-student-id { color:#7c899b; font-size:12px; }
.sm-header-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.sm-primary,.sm-secondary { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:40px; padding:8px 14px; border-radius:6px; font-family:inherit; font-size:14px; font-weight:600; line-height:1.5; cursor:pointer; white-space:normal; }
.sm-primary { background:#1769d2; border:1px solid #1769d2; color:#fff; }
.sm-secondary { background:#fff; border:1px solid #d8e1ec; color:#3f536d; }
.sm-primary:disabled { background:#edf1f6; border-color:#e1e6ed; color:#8c98a8; cursor:default; }
.sm-primary svg,.sm-secondary svg { width:17px; height:17px; flex-shrink:0; }
.sm-record-counts { display:flex; flex-wrap:wrap; align-items:center; gap:22px; padding:15px 0; border-bottom:1px solid #e7ebf1; color:#64758b; font-size:13px; }
.sm-record-counts > span { display:flex; align-items:center; gap:7px; }
.sm-record-counts svg { width:16px; height:16px; }
.sm-record-counts b { color:#34445d; font-variant-numeric:tabular-nums; }
.sm-record-counts button { display:flex; align-items:center; gap:6px; margin-left:auto; border:0; padding:4px 0; color:#236ac5; background:transparent; cursor:pointer; font-size:13px; }
.sm-workspace-grid { display:grid; grid-template-columns:minmax(0,1.45fr) minmax(260px,1fr); gap:30px; padding-top:24px; }
.sm-activity-section { min-width:0; }
.sm-workspace-aside { min-width:0; padding-left:26px; border-left:1px solid #e7ebf1; }
.sm-workspace-aside .sm-summary-section { padding:0 0 22px; margin-bottom:22px; }
.sm-workspace-aside .sm-summary-section:last-child { margin-bottom:0; border-bottom:0; }
.sm-workspace-aside h4 { margin:12px 0; color:#33465f; font-size:14px; }
.sm-activity-filters { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding-bottom:20px; }
#studentArchivePage .student-management .sm-activity-filters select,
#studentArchivePage .student-management .sm-activity-filters input { width:auto; min-width:0; max-width:185px; min-height:38px; padding:7px 10px; border:1px solid #dce4ef; border-radius:6px; background:#fff; font-size:13px; margin:0; box-shadow:none; }
.sm-activity-list { list-style:none; margin:0; padding:0; }
.sm-activity-item { display:flex; gap:14px; padding:0 0 24px; position:relative; }
.sm-activity-item:not(:last-child)::after { content:''; position:absolute; width:1px; top:36px; bottom:0; left:17px; background:#e3e9ef; }
.sm-activity-icon { display:flex; align-items:center; justify-content:center; width:36px; height:36px; flex-shrink:0; border-radius:50%; color:#226ed0; background:#edf4fe; }
.sm-activity-icon svg { width:17px; height:17px; }
.sm-activity-item[data-activity-type="lesson"] .sm-activity-icon { color:#198064; background:#ecf8f2; }
.sm-activity-item[data-activity-type="followup"] .sm-activity-icon { color:#a47124; background:#fcf5e8; }
.sm-activity-item[data-activity-type="parent"] .sm-activity-icon { color:#337f8d; background:#edf8fa; }
.sm-activity-body { flex:1; min-width:0; padding-top:2px; }
.sm-activity-meta { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:5px 12px; font-size:12px; color:#8995a4; }
.sm-activity-meta > span { color:#61738a; }
.sm-activity-body h4 { margin:8px 0; font-size:14px; line-height:1.6; color:#273b56; overflow-wrap:anywhere; }
.sm-activity-body p { font-size:13px; line-height:1.85; color:#596c84; margin:8px 0; overflow-wrap:anywhere; white-space:pre-wrap; }
.sm-activity-body .sm-meta { color:#8995a4; font-size:12px; }
.sm-activity-excerpt { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.sm-activity-source { margin-top:8px; }
.sm-activity-source summary { width:fit-content; font-size:12px; color:#2b6bc0; cursor:pointer; padding:4px 0; }
.sm-activity-source p { border-left:2px solid #d5e5fa; padding-left:12px; }
.sm-activity-source small { color:#8995a4; overflow-wrap:anywhere; font-size:11px; }
.sm-activity-empty { color:#8b98a7; text-align:center; padding:50px 12px; font-size:14px; }
.sm-load-more { width:100%; margin:0 0 20px; font-size:13px; }
.sm-load-more[hidden] { display:none!important; }
.sm-text-button { display:inline-flex; align-items:center; gap:6px; background:transparent; border:0; padding:4px 0; color:#226bc7; font-size:13px; cursor:pointer; }
.sm-text-button svg { width:15px; height:15px; }
.sm-followup-status { display:inline-block; padding:3px 7px; border-radius:4px; background:#edf6f2; color:#417d67; font-size:12px; }
.sm-followup-plan { display:flex; gap:10px; padding:13px 0 0; color:#78879a; border-top:1px solid #eff2f6; }
.sm-followup-plan svg { width:17px; height:17px; }
.sm-followup-plan span { display:block; font-size:12px; margin-bottom:5px; }
.sm-followup-plan strong { color:#4d617c; font-size:13px; font-weight:500; }
.sm-contact-list { margin:0; font-size:13px; }
.sm-contact-list > div { display:grid; grid-template-columns:90px minmax(0,1fr); gap:12px; padding:8px 0; }
.sm-contact-list dt { color:#7b899b; }
.sm-contact-list dd { margin:0; color:#485d77; overflow-wrap:anywhere; }
.sm-feedback-context { border-bottom:1px solid #dfe6ef; padding:0 0 22px; margin-bottom:24px; }
.sm-feedback-back { display:inline-flex; gap:7px; align-items:center; margin-bottom:18px; text-decoration:none; color:#2c70c6; font-size:13px; }
.sm-feedback-back svg { width:16px; height:16px; }
.sm-feedback-context-main { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.sm-feedback-context-main > div { flex:1; min-width:180px; }
.sm-feedback-context-main strong { color:#233a56; font-size:18px; }
.sm-feedback-context-main p { margin:7px 0 0; font-size:13px; line-height:1.7; color:#697c94; overflow-wrap:anywhere; }
.sm-feedback-context[data-tone="warning"] .sm-feedback-context-main p { color:#986c2a; }
.student-context-feedback #writePage { box-shadow:none; border-radius:8px; }
.sm-teaching-settings { margin:0 0 18px; border:1px solid #e0e7f0; border-radius:6px; padding:12px 14px; background:#fafbfd; }
.sm-teaching-settings > summary { font-size:13px; color:#63778e; cursor:pointer; }
.sm-teaching-settings .home-config-card { margin:12px 0 0; border:0; box-shadow:none; }
@media(hover:hover) and (pointer:fine){
  .sm-primary:not(:disabled):hover { background:#125ab8; }
  .sm-secondary:hover { background:#f5f8fc; }
}
.sm-primary:not(:disabled):active,.sm-secondary:active { background-color:#eaf2fe; color:#1f63b7; }
@media(max-width:760px){
  html body > .merged-header-shell + .container:has(.student-management),
  html body.student-context-feedback > .merged-header-shell + .container { padding:16px 12px!important; }
  #studentArchivePage:has(.student-management) { padding:0!important; }
  .sm-student-header { flex-wrap:wrap; }
  .sm-student-heading { flex-basis:calc(100% - 60px); }
  .sm-header-actions { width:100%; }
  .sm-header-actions button { flex:1; font-size:13px; }
  .sm-student-header .sm-student-id { font-size:11px; }
  .sm-record-counts { gap:12px; }
  .sm-record-counts button { margin-left:0; }
  .sm-workspace-grid { grid-template-columns:minmax(0,1fr); gap:20px; padding-top:20px; }
  .sm-workspace-aside { border-left:0; border-top:1px solid #e3e9f1; padding:22px 0 0; }
  .sm-activity-item { gap:10px; }
  .sm-activity-meta { display:block; }
  .sm-activity-meta time { display:block; margin-top:4px; font-size:11px; }
  #studentArchivePage .student-management .sm-activity-filters select { flex:1; max-width:none; }
  #studentArchivePage .student-management .sm-activity-filters input { flex:1; max-width:155px; }
}
