﻿:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --text: #25252b;
  --muted: #62626c;
  --line: #ededf0;
  --primary: #ea616e;
  --primary-dark: #be3045;
  --primary-action: #d43e52;
  --accent: var(--primary);
  --accent-soft: #fff3f4;
  --accent-line: #f8c6cc;
  --success: #147a42;
  --success-bg: #e9f7ef;
  --warning: #9a5b00;
  --warning-bg: #fff3d6;
  --danger: #b42318;
  --danger-bg: #ffe8e5;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
h1, h2, h3, p { margin-top: 0; }

.app-shell { width: min(1560px, 100%); margin: 0 auto; padding: 10px 14px 24px; }
.top-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.screen-heading { min-width: 0; }
.screen-kicker { margin: 0 0 2px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
h1 { margin: 0; font-size: 18px; line-height: 1.2; }
h2 { margin-bottom: 8px; font-size: 17px; }
.screen { display: grid; gap: 10px; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; }

.icon-button, .menu-icon-button, .logout-pill, .primary-button, .secondary-button, .danger-button, .table-action, .save-button { min-height: 32px; border: 1px solid var(--line); border-radius: 5px; font-weight: 750; }
.icon-button { width: 34px; background: var(--surface); color: var(--text); font-size: 18px; }
.menu-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 32px; background: var(--surface); color: var(--text); font-size: 17px; line-height: 1; }
.menu-icon-button:hover, .menu-icon-button[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
#logoutButton.logout-pill { position: static; display: inline-flex; align-items: center; justify-content: center; justify-self: end; align-self: center; flex: 0 0 auto; width: auto; min-width: 0; max-width: max-content; height: 26px; min-height: 26px; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1; white-space: nowrap; }
.primary-button, .save-button { border-color: var(--primary-action); background: var(--primary-action); color: white; }
.primary-button:hover, .save-button:hover { background: var(--primary-dark); }
.secondary-button { padding: 3px 10px; background: var(--surface); color: var(--text); }
.danger-button { padding: 3px 10px; border-color: #efb0aa; background: var(--danger-bg); color: var(--danger); }
.compact { min-height: 29px; font-size: 12px; }
.scroll-top-button { position: fixed; right: 16px; bottom: 66px; z-index: 30; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #293241; color: white; font-size: 19px; box-shadow: 0 4px 12px rgba(0,0,0,0.18); }

.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); text-align: left; }
.role-button strong { font-size: 17px; }
.role-button span { color: var(--muted); font-size: 13px; }
.role-button b { color: var(--primary); font-size: 12px; }
.role-button:hover, .role-button:focus-visible { border-color: var(--primary); outline: none; }

.notice { padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; line-height: 1.45; }
.notice.warning { border-color: #efcc7a; background: var(--warning-bg); color: var(--warning); }
.notice.danger { border-color: #ffc0ba; background: var(--danger-bg); color: var(--danger); }
.notice.success { border-color: #a8dfbf; background: var(--success-bg); color: var(--success); }
.page-intro { display: grid; gap: 4px; padding: 10px 0 2px; }
.page-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.home-page-intro { padding-top: 2px; }
.home-zone { display: grid; gap: 8px; }
.zone-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.zone-heading h2 { margin: 0; }
.zone-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.search-result-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 5px; }
.search-result-button { display: grid; gap: 2px; min-height: 46px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); text-align: left; }
.search-result-button:hover, .search-result-button:focus-visible { border-color: var(--primary); outline: none; background: #f3f8ff; }
.search-result-button strong { font-size: 12px; }
.search-result-button span, .search-empty { color: var(--muted); font-size: 11px; }
.search-empty { padding: 8px; border: 1px dashed var(--line); border-radius: 5px; }
.selected-search-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.selected-search-summary span { padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.selected-search-summary strong { color: var(--text); }
.inline-transfer-control { display: flex; align-items: center; gap: 5px; }
.inline-transfer-control select { min-width: 170px; }

.home-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; padding: 7px 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; }
.home-meta span + span { position: relative; }
.home-meta span + span::before { content: "·"; position: absolute; left: -10px; color: #a0a7b2; }
.work-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--line); background: var(--surface); }
.work-panel > div:first-child { display: grid; gap: 2px; }
.work-panel > div:first-child span { color: var(--muted); font-size: 12px; }
.class-start-controls { display: flex; align-items: center; gap: 7px; }
.compact-select { min-height: 34px; padding: 4px 28px 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); }
.class-start-controls .primary-button { min-height: 34px; padding: 4px 14px; }

.overview-section, .settings-panel, .save-summary { border: 1px solid var(--line); background: var(--surface); }
.overview-section, .save-summary { padding: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h2 { margin: 0; }
.section-heading span { color: var(--muted); font-size: 11px; }
.table-scroll, .entry-table-wrap { overflow-x: auto; }
.entry-table-wrap:focus { outline: 2px solid #b9d3f7; outline-offset: 1px; }
.progress-table { width: 100%; min-width: 850px; border-collapse: collapse; }
.progress-table th, .progress-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.progress-table th { background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.progress-table td { font-size: 12px; }
.progress-table td:first-child strong, .progress-table td:first-child small { display: block; }
.progress-table small { color: var(--muted); font-size: 10px; }
.progress-table tbody tr:last-child td { border-bottom: 0; }
.table-action { min-height: 27px; padding: 2px 9px; background: var(--surface); color: var(--primary); font-size: 11px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.settings-panel > summary { padding: 10px 12px; font-size: 13px; font-weight: 800; cursor: pointer; }
.settings-panel > summary span { margin-left: 5px; color: var(--muted); font-size: 11px; }
.settings-content { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.settings-content > p { margin: 9px 0; color: var(--muted); font-size: 11px; }
.setting-add-form { display: grid; grid-template-columns: auto minmax(180px, 340px) auto; align-items: center; gap: 7px; margin-bottom: 8px; }
.setting-add-form label { font-size: 12px; font-weight: 700; }
.setting-add-form input, .setting-row input { min-height: 30px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; }
.setting-list { display: grid; gap: 5px; max-width: 570px; }
.setting-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 5px; }

.input-page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); }
.input-page-header > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.input-page-header strong { font-size: 16px; }
.input-page-header span { color: var(--muted); font-size: 11px; }
.input-progress { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.input-progress b { color: var(--primary); font-size: 15px; }
.input-progress small { color: var(--muted); font-size: 10px; }
.input-header-right, .input-page-actions { display: flex; align-items: center; gap: 7px; }
.input-header-right { justify-content: flex-end; }
.input-page-actions { flex-wrap: wrap; justify-content: flex-end; }

.bulk-toolbar, .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 8px; border: 1px solid var(--line); background: var(--surface); }
.toolbar-group { display: flex; align-items: center; gap: 4px; padding-right: 8px; border-right: 1px solid var(--line); }
.toolbar-group > span { margin-right: 2px; color: var(--muted); font-size: 11px; font-weight: 800; }
.bulk-button, .filter-button, .rate-button { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); font-weight: 700; }
.bulk-button { min-height: 28px; padding: 2px 8px; font-size: 11px; }
.bulk-button:hover { border-color: var(--primary); color: var(--primary); }
.selection-count, .filter-status { margin-left: auto; color: var(--muted); font-size: 11px; }
.filter-button { min-height: 27px; padding: 2px 8px; font-size: 11px; }
.filter-button.active { border-color: var(--primary); background: #e8f1ff; color: #0e4d99; }
.keyboard-hint { color: var(--muted); font-size: 10px; }
.copy-status { padding: 6px 9px; border: 1px solid var(--line); background: var(--surface); font-size: 11px; }
.copy-status.success { border-color: #a8dfbf; background: var(--success-bg); color: var(--success); }
.copy-status.danger { border-color: #ffc0ba; background: var(--danger-bg); color: var(--danger); }

.entry-table { width: 100%; min-width: 1680px; table-layout: fixed; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); background: var(--surface); user-select: text; }
.entry-table th, .entry-table td { height: 38px; padding: 3px 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 12px; }
.entry-table th:last-child, .entry-table td:last-child { border-right: 0; }
.entry-table tbody tr:last-child td { border-bottom: 0; }
.entry-table thead th { position: sticky; top: 0; z-index: 5; height: 32px; background: #e9edf2; color: #4a5565; font-size: 11px; white-space: nowrap; }
.table-header-with-action { display: inline-flex; align-items: center; gap: 5px; }
.header-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; min-height: 23px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1; }
.header-icon-button:hover { border-color: var(--primary); color: var(--primary); }
.entry-table tbody tr:nth-child(even) { background: #fafbfc; }
.entry-table tbody tr:hover { background: #eef5ff; }
.copy-selectable-cell { cursor: crosshair; }
.entry-table td.cell-selected { position: relative; background: #dceaff !important; box-shadow: inset 0 0 0 1px #78a9ec; }
.entry-table td.grid-cell-focused { background: #f7fbff; box-shadow: inset 0 0 0 2px #9dc5ff; }
.entry-table .col-select { width: 34px; }
.entry-table .col-number { width: 42px; }
.entry-table .col-name { width: 104px; }
.entry-table .col-school { width: 125px; }
.entry-table .col-attendance { width: 98px; }
.entry-table .col-reason { width: 160px; }
.entry-table .col-homework { width: 215px; }
.entry-table .col-missing { width: 155px; }
.entry-table .col-missing-other { width: 185px; }
.entry-table .col-memo { width: 220px; }
.entry-table .col-status { width: 80px; }
.school-grade { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cell-select { width: 100%; height: 29px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: white; font-size: 11px; }
.homework-cell { display: flex; align-items: center; gap: 5px; }
.quick-rate-buttons { display: flex; gap: 2px; }
.rate-button { width: 32px; height: 27px; padding: 0; font-size: 10px; }
.rate-button.rate-not-submitted { width: 50px; }
.rate-button.active { border-color: var(--primary); background: #e8f1ff; color: #0e4d99; }
.homework-cell > label { display: flex; align-items: center; gap: 2px; }
.rate-input { width: 53px; height: 29px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 3px; text-align: right; }
.homework-cell label span { color: var(--muted); font-size: 10px; }
.memo-input, .reason-input, .missing-other-input { width: 100%; height: 29px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; font-size: 11px; }
.memo-input:focus, .reason-input:focus, .missing-other-input:focus, .rate-input:focus, .cell-select:focus { border-color: var(--primary); outline: 1px solid #c7ddff; }
[data-grid-cell]:focus, [data-grid-cell]:focus-visible { border-color: var(--primary) !important; outline: 2px solid #9dc5ff !important; outline-offset: 1px; background-color: #f7fbff; }
[data-grid-cell]:focus-visible { box-shadow: 0 0 0 2px rgba(58, 123, 213, 0.12); }
.reason-input:disabled { background: var(--surface-soft); color: var(--muted); }

.missing-dropdown { position: relative; }
.missing-dropdown > summary { min-height: 27px; padding: 5px 6px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; background: white; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.missing-menu { display: grid; gap: 4px; min-width: 190px; padding: 7px; background: white; font-size: 10px; }
.missing-menu label { display: flex; align-items: center; gap: 5px; min-height: 22px; }
.missing-menu small { color: var(--warning); line-height: 1.35; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; min-height: 24px; padding: 2px 5px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.status-badge.good { background: var(--success-bg); color: var(--success); }
.status-badge.warn { background: var(--warning-bg); color: var(--warning); }
.status-badge.danger { background: var(--danger-bg); color: var(--danger); }
.status-badge.planned { background: #e8f1ff; color: #1756a9; }
.status-badge.neutral, .status-badge.saved { background: #edf1f5; color: var(--muted); }
.status-badge.hold { background: #f1edff; color: #5b43a6; }
.status-badge.makeup { background: #eef0ff; color: #3143a6; }
.save-state-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 20px; margin-top: 3px; padding: 1px 5px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.save-state-badge.saved { background: #edf1f5; color: var(--muted); }
.save-state-badge.pending { background: var(--warning-bg); color: var(--warning); }
.save-state-badge.invalid { background: var(--danger-bg); color: var(--danger); }
.row-needs-attention { box-shadow: inset 3px 0 0 var(--danger); }
.row-highlight { animation: row-highlight 2.2s ease; }
@keyframes row-highlight { 0%, 70% { background: #ffe9a8; } 100% { background: inherit; } }
.empty-row { height: 80px !important; color: var(--muted); text-align: center !important; }

.validation-panel { display: grid; gap: 7px; padding: 10px; border: 1px solid #f0a9a2; background: var(--danger-bg); color: var(--danger); font-size: 12px; }
.validation-group { display: grid; grid-template-columns: 210px 1fr; gap: 7px; align-items: start; }
.validation-group > span { font-weight: 800; }
.validation-group > div { display: flex; flex-wrap: wrap; gap: 4px; }
.validation-group button { padding: 2px 6px; border: 1px solid #efaaa3; border-radius: 3px; background: white; color: var(--danger); font-size: 10px; }

.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 7px 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.97); }
.save-bar > span { color: var(--muted); font-size: 11px; }
.save-button { min-width: 130px; padding: 4px 14px; }
.exam-import-action-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.exam-import-action-button { min-width: 150px; min-height: 38px; padding: 6px 16px; font-size: 13px; }
.confirm-import-button:not(:disabled) { border-color: var(--success); background: var(--success); color: white; }
.confirm-import-button:not(:disabled):hover { background: #0f6535; }
.result-metrics { display: grid; grid-template-columns: repeat(9, minmax(80px, 1fr)); gap: 5px; margin-top: 8px; }
.result-metrics > div { padding: 6px; background: var(--surface-soft); }
.result-metrics span, .result-metrics b { display: block; }
.result-metrics span { color: var(--muted); font-size: 10px; }
.result-metrics b { margin-top: 2px; font-size: 14px; }
.result-notes { margin-top: 7px; padding: 7px; background: var(--warning-bg); font-size: 11px; }
.result-notes > span { margin-left: 8px; color: var(--muted); }
.result-notes ul { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 5px 0 0; padding-left: 18px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(23, 32, 51, 0.42); }
.settings-modal { width: min(620px, 100%); max-height: min(78vh, 720px); overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 18px 45px rgba(0,0,0,0.2); }
.settings-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.settings-modal-header h2 { margin: 0; }
.settings-modal-header span { color: var(--muted); font-size: 11px; }
.modal-close-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 19px; line-height: 1; }
.copy-fallback-panel { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 7px; width: min(680px, calc(100vw - 32px)); padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 12px 32px rgba(0,0,0,0.2); }
.copy-fallback-panel > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.copy-fallback-panel span { color: var(--muted); font-size: 11px; }
.copy-fallback-panel textarea { width: 100%; height: 150px; padding: 7px; border: 1px solid var(--line); font: 11px/1.4 Consolas, monospace; white-space: pre; }
.copy-fallback-panel button { justify-self: end; min-height: 28px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.global-menu-backdrop { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; background: rgba(23, 32, 51, 0.28); }
.global-menu-panel { width: min(360px, calc(100vw - 28px)); height: 100%; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -16px 0 36px rgba(0,0,0,0.18); }
.global-menu-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.global-menu-header strong, .global-menu-header span { display: block; }
.global-menu-header span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.global-menu-list { display: grid; gap: 4px; padding: 10px; }
.global-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 50px; padding: 8px 10px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--text); text-align: left; }
.global-menu-item:hover, .global-menu-item.active { border-color: #b9d3f7; background: #edf5ff; }
.global-menu-item strong, .global-menu-item small { display: block; }
.global-menu-item small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.global-menu-item b { color: var(--muted); font-size: 10px; }
.global-menu-item.coming-soon { color: var(--muted); }
.global-menu-item.coming-soon:hover { border-color: transparent; background: transparent; }
.global-menu-divider { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; color: var(--muted); font-size: 10px; font-weight: 800; }
.global-menu-divider::before, .global-menu-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.global-menu-list.grouped { gap: 7px; }
.global-menu-section { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.global-menu-section.active { border-color: #b9d3f7; }
.global-menu-section-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; background: transparent; color: var(--text); text-align: left; }
.global-menu-section-button strong { font-size: 13px; }
.global-menu-section-button span { color: var(--muted); font-size: 10px; }
.global-submenu { display: none; gap: 3px; padding: 0 6px 6px; }
.global-menu-section.open .global-submenu { display: grid; }
.global-menu-section.active > .global-menu-section-button { background: #f4f8ff; color: #0e4d99; }
.global-submenu .global-menu-item { min-height: 42px; padding: 7px 8px; }
.feature-map-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.feature-map-section { padding: 10px; border: 1px solid var(--line); background: var(--surface); }
.feature-map-section h2 { margin: 0 0 8px; font-size: 15px; }
.feature-map-list { display: grid; gap: 5px; }
.feature-map-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); text-align: left; }
.feature-map-item:hover, .feature-map-item.active { border-color: #b9d3f7; background: #edf5ff; }
.feature-map-item strong, .feature-map-item small { display: block; }
.feature-map-item small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.feature-map-item b { flex: 0 0 auto; color: var(--success); font-size: 10px; }
.feature-map-item.coming-soon b { color: var(--warning); }
.paste-result { display: grid; gap: 7px; padding: 9px; border: 1px solid var(--line); background: var(--surface-soft); font-size: 11px; }
.paste-result > div { display: grid; grid-template-columns: 120px 1fr; gap: 7px; }
.paste-result > p { margin: 0; color: var(--muted); font-size: 10px; }
.paste-result b { color: var(--text); }
.paste-result span, .paste-result li { color: var(--muted); }
.paste-result ul { margin: 0; padding-left: 17px; }

.assignment-selector { display: grid; grid-template-columns: auto minmax(260px, 420px) auto 1fr; gap: 8px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); }
.assignment-selector > label { font-size: 11px; font-weight: 800; }
.assignment-info { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; min-width: 0; padding-left: 10px; border-left: 1px solid var(--line); }
.assignment-info strong { grid-row: span 3; max-width: 210px; font-size: 12px; }
.assignment-info span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.realtime-summary { display: grid; gap: 6px; padding: 7px 9px; border: 1px solid var(--line); background: var(--surface); }
.realtime-summary.has-issues { border-color: #e5b4ae; background: #fff9f8; }
.realtime-metrics, .realtime-actions, .issue-student-links { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; }
.realtime-metrics span { color: var(--muted); font-size: 10px; }
.realtime-metrics b { color: var(--text); }
.realtime-actions { justify-content: space-between; font-size: 10px; }
.issue-student-links { flex: 1; }
.issue-student-links button { padding: 2px 5px; border: 1px solid #efaaa3; border-radius: 3px; background: white; color: var(--danger); font-size: 9px; }
.entry-table { min-width: 1840px; }
.entry-table .col-recheck { width: 145px; }
.recheck-date-input { min-width: 126px; }

.homework-manager-modal { width: min(980px, 100%); }
.homework-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); background: var(--surface-soft); }
.homework-form-grid label { display: grid; gap: 3px; color: var(--muted); font-size: 10px; }
.homework-form-grid input, .homework-form-grid select { width: 100%; min-height: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--text); }
.homework-form-grid .wide-field { grid-column: span 2; }
.homework-form-grid .toggle-field { display: flex; align-items: center; gap: 6px; color: var(--text); }
.homework-form-grid .toggle-field input { width: auto; min-height: 0; }
.homework-setting-list { display: grid; gap: 6px; margin-top: 10px; }
.homework-setting-item { border: 1px solid var(--line); }
.homework-setting-item > summary { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; cursor: pointer; }
.homework-setting-item > summary span { color: var(--muted); font-size: 10px; }

.cumulative-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 7px; padding: 8px; border: 1px solid var(--line); background: var(--surface); }
.filter-button-group { display: flex; flex-wrap: wrap; gap: 5px; }
.cumulative-filters label { display: grid; gap: 2px; color: var(--muted); font-size: 10px; }
.cumulative-filters input, .cumulative-filters select { min-height: 28px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; background: white; }
.cumulative-table { min-width: 2180px; }
.cumulative-table th:nth-child(1) { width: 45px; }
.cumulative-table th:nth-child(2) { width: 105px; }
.cumulative-table th:nth-child(3) { width: 120px; }
.cumulative-table th:nth-child(4) { width: 220px; }
.cumulative-table th:nth-child(5) { width: 300px; }
.cumulative-table th:nth-child(6) { width: 190px; }
.cumulative-table th:nth-child(7) { width: 210px; }
.cumulative-table th:nth-child(8) { width: 210px; }
.cumulative-table th:nth-child(9), .cumulative-table th:nth-child(10), .cumulative-table th:nth-child(12) { width: 125px; }
.cumulative-table th:nth-child(11) { width: 120px; }
.cumulative-table th:nth-child(13) { width: 70px; }
.cumulative-table td { height: 42px; }
.cumulative-table input[type="date"] { min-width: 122px; }
.cumulative-rate { display: flex; align-items: center; gap: 4px; }
.cumulative-rate select { width: 72px; }
.cumulative-rate label { display: flex; align-items: center; }
.cumulative-rate input { width: 60px; }
.student-history-link { padding: 0; border: 0; background: transparent; color: #1e5ea8; font-weight: 800; text-decoration: underline; }
.range-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.completion-check { display: flex; align-items: center; gap: 5px; font-size: 10px; }
.row-action-stack { display: grid; gap: 4px; }
.modal-helper-text { margin: 8px 0; color: var(--muted); font-size: 10px; }
.student-history-modal { width: min(1120px, 100%); }
.student-history-table { min-width: 1300px; }
.student-detail-modal { width: min(1180px, 100%); }
.student-detail-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.student-detail-tabs button { min-height: 32px; padding: 6px 10px; border: 1px solid var(--line); border-bottom: 0; border-radius: 5px 5px 0 0; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; }
.student-detail-tabs button.active { background: white; color: var(--accent); border-color: var(--accent); }
.student-detail-content { gap: 12px; }
.student-detail-subfilters { margin-bottom: 8px; }
.student-detail-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.student-detail-info-grid div { display: grid; gap: 4px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; background: #fbfdff; }
.student-detail-info-grid span { color: var(--muted); font-size: 10px; font-weight: 800; }
.student-detail-info-grid strong { color: var(--text); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.student-detail-homework-table { min-width: 1620px; }
.student-detail-homework-table input[type="date"] { min-width: 122px; }
.student-detail-homework-table .memo-input { min-width: 120px; }
.student-detail-rate { display: flex; align-items: center; gap: 4px; }
.student-detail-rate select { width: 82px; }
.student-detail-rate label { display: flex; align-items: center; }
.student-detail-rate input { width: 58px; }
.editable-history-table { min-width: 1820px; }
.editable-history-table th:nth-child(1) { width: 270px; }
.editable-history-table th:nth-child(4) { width: 190px; }
.editable-history-table th:nth-child(5) { width: 210px; }
.editable-history-table th:nth-child(6) { width: 210px; }
.editable-history-table th:nth-child(7) { width: 135px; }
.editable-history-table th:nth-child(10) { width: 92px; }
.editable-history-table td > strong, .editable-history-table td > small { display: block; }
.editable-history-table td > small { margin-top: 2px; color: var(--muted); }
.cumulative-summary-table { min-width: 760px; }

@media (max-width: 900px) {
  .app-shell { padding: 8px; }
  .role-grid { grid-template-columns: 1fr; }
  .work-panel { align-items: stretch; flex-direction: column; }
  .class-start-controls { align-items: stretch; }
  .class-start-controls .compact-select { flex: 1; min-width: 0; }
  .result-metrics { grid-template-columns: repeat(3, minmax(80px, 1fr)); }
  .validation-group { grid-template-columns: 1fr; }
  .assignment-selector { grid-template-columns: 1fr; }
  .assignment-info { padding: 6px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .homework-form-grid { grid-template-columns: 1fr 1fr; }
  .student-detail-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .top-bar { min-height: 48px; }
  h1 { font-size: 16px; }
  #logoutButton.logout-pill { width: auto; height: 26px; min-height: 26px; padding: 2px 8px; }
  .home-meta span:last-child { display: none; }
  .class-start-controls { flex-direction: column; }
  .input-page-header { align-items: flex-start; }
  .zone-heading { align-items: flex-start; flex-direction: column; }
  .section-actions { justify-content: flex-start; }
  .global-menu-panel { width: min(340px, calc(100vw - 18px)); }
  .input-page-header > div:first-child { display: grid; gap: 2px; }
  .input-header-right { align-items: flex-end; flex-direction: column-reverse; }
  .bulk-toolbar, .filter-bar { align-items: flex-start; }
  .toolbar-group { width: 100%; border-right: 0; }
  .selection-count, .filter-status { width: 100%; margin-left: 0; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .save-button { width: 100%; }
  .scroll-top-button { right: 10px; bottom: 88px; }
  .setting-add-form { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .homework-form-grid { grid-template-columns: 1fr; }
  .homework-form-grid .wide-field { grid-column: auto; }
  .cumulative-filters > label { width: calc(50% - 4px); }
  .cumulative-filters input, .cumulative-filters select { width: 100%; }
}




.exam-home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.exam-home-card { display: grid; gap: 5px; align-content: start; min-height: 108px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); text-align: left; }
.exam-home-card:hover { border-color: #9db8d8; background: #f8fbff; }
.exam-home-card strong { font-size: 14px; }
.exam-home-card span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.exam-home-card b { justify-self: start; margin-top: 4px; padding: 2px 6px; border-radius: 999px; background: #e8f4ee; color: #1d6b43; font-size: 10px; }
.exam-home-card.is-pending b { background: #fff4df; color: #8a5a00; }
.exam-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.exam-form-grid label { display: grid; gap: 3px; color: var(--muted); font-size: 10px; }
.exam-form-grid input, .exam-form-grid select { width: 100%; min-height: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--text); }
.exam-form-grid .wide-field { grid-column: span 3; }
.exam-form-grid .toggle-field { display: flex; align-items: center; gap: 6px; color: var(--text); }
.exam-form-grid .toggle-field input { width: auto; min-height: 0; }
.exam-class-field { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
.exam-class-field legend { padding: 0 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.exam-class-field label { display: flex; align-items: center; gap: 4px; color: var(--text); }
.exam-class-field input { width: auto; min-height: 0; }
.external-grade-cutoff-field { margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
.external-grade-cutoff-field legend { padding: 0 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.external-grade-cutoffs { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.external-grade-cutoffs label { min-width: 0; }
.external-grade-cutoff-field small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.exam-list { display: grid; gap: 6px; margin-top: 8px; }
.exam-setting-item { background: var(--surface); }
.exam-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.exam-question-table { min-width: 1120px; }
.exam-question-table input, .exam-question-table select { width: 100%; min-height: 28px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 3px; background: white; }
.inline-save-bar { margin-top: 8px; }
.exam-import-selector { display: grid; gap: 10px; }
.exam-import-selector > label { display: grid; gap: 4px; max-width: 420px; color: var(--muted); font-size: 10px; font-weight: 800; }
.exam-import-selector select { min-height: 32px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--text); }
.exam-import-summary, .exam-import-result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.exam-import-summary > div, .exam-import-result-grid > div { display: grid; gap: 3px; min-height: 54px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: #fbfdff; }
.exam-import-summary span, .exam-import-result-grid span { color: var(--muted); font-size: 10px; }
.exam-import-summary strong, .exam-import-result-grid strong { font-size: 12px; line-height: 1.35; }
.exam-import-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.exam-import-flow li { min-height: 34px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); color: var(--text); font-size: 11px; font-weight: 800; }
.exam-import-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.exam-import-grid label { display: grid; gap: 5px; color: var(--text); font-size: 12px; font-weight: 800; }
.exam-bulk-drop-zone, .exam-file-drop-zone { display: grid; gap: 3px; padding: 8px; border: 1px dashed #9bb7d6; border-radius: 5px; background: #f7fbff; color: var(--text); }
.exam-bulk-drop-zone { margin-bottom: 8px; font-size: 12px; font-weight: 800; text-align: center; }
.exam-file-drop-zone { min-height: 76px; align-content: center; }
.exam-bulk-drop-zone.is-dragging, .exam-file-drop-zone.is-dragging { border-color: var(--accent); background: #eef7ff; }
.exam-file-drop-zone input { width: 100%; min-height: 28px; padding: 3px; font-size: 11px; }
.exam-file-drop-zone span { font-size: 11px; font-weight: 800; }
.exam-file-status { color: var(--accent); min-height: 14px; }
.exam-import-grid textarea { width: 100%; min-height: 190px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: white; font: 11px/1.45 Consolas, monospace; resize: vertical; }
.exam-import-grid small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.exam-import-table { min-width: 1280px; }
.exam-warning-list { display: grid; gap: 6px; }
.exam-warning-list details { border: 1px solid #f0d19a; border-radius: 5px; background: #fff8ea; }
.exam-warning-list summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; cursor: pointer; }
.exam-warning-list strong { color: #8a5a00; font-size: 11px; }
.exam-warning-list span, .exam-warning-list li { color: var(--text); font-size: 11px; line-height: 1.45; }
.exam-warning-list ul { margin: 0; padding: 0 8px 8px 24px; }
.exam-batch-list { display: grid; gap: 8px; }
.exam-batch-item { border: 1px solid var(--line); border-radius: 5px; background: #fbfdff; }
.exam-batch-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; cursor: pointer; }
.exam-batch-item > summary span { display: grid; gap: 3px; min-width: 0; }
.exam-batch-item > summary strong { color: var(--text); font-size: 12px; line-height: 1.35; }
.exam-batch-item > summary small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.exam-batch-meta { justify-items: end; text-align: right; }
.exam-batch-meta b { color: var(--success); font-size: 11px; }
.exam-batch-detail { display: grid; gap: 8px; padding: 0 10px 10px; }
.exam-batch-id { display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: white; }
.exam-batch-id span { color: var(--muted); font-size: 10px; }
.exam-batch-id strong { color: var(--text); font-size: 11px; overflow-wrap: anywhere; }
.danger-action { border-color: #efaaa3; color: var(--danger); }
.danger-action:hover { background: var(--danger-bg); }
.exam-analysis-controls { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.exam-analysis-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.exam-analysis-controls select, .exam-analysis-controls input { min-height: 32px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--text); }
.exam-analysis-table { min-width: 980px; }
.exam-analysis-table .row-danger, .exam-analysis-table tr.row-danger td { background: #fff8f7; }
.exam-analysis-table small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.student-history-controls { grid-template-columns: 1fr 2fr; }
.student-history-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 132px; overflow: auto; }
.student-history-picker button { display: grid; gap: 2px; min-width: 132px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--text); text-align: left; cursor: pointer; }
.student-history-picker button.active { border-color: var(--accent); background: var(--accent-soft); }
.student-history-picker button strong { font-size: 12px; }
.student-history-picker button span { color: var(--muted); font-size: 10px; }
.student-exam-history-table { min-width: 1280px; }
.student-retest-detail div { width: 420px; max-width: 55vw; }
.student-retest-detail span { white-space: normal; }
.external-score-table { min-width: 1480px; }
.external-score-table input { width: 88px; min-height: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; }
.external-score-table input[data-external-result-field="memo"] { width: 170px; }
.external-result-table { min-width: 1120px; }
.external-exam-list { display: grid; gap: 8px; }
.exam-retest-controls { display: grid; grid-template-columns: 1fr 1.7fr 1fr 1.2fr; gap: 8px; margin-top: 10px; }
.exam-retest-controls label, .exam-retest-bulk label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 800; }
.exam-retest-controls select, .exam-retest-controls input, .exam-retest-bulk input, .exam-retest-table input, .exam-retest-table select { min-height: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; background: white; color: var(--text); }
.exam-retest-bulk { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 8px; padding: 8px; border: 1px solid var(--line); background: var(--surface-soft); }
.exam-retest-bulk span { color: var(--muted); font-size: 11px; font-weight: 800; }
.exam-retest-table { min-width: 1580px; }
.exam-retest-table input[type="checkbox"] { width: auto; min-height: 0; }
.exam-retest-table input[type="date"] { width: 132px; }
.exam-retest-table input[type="number"] { width: 92px; }
.exam-retest-table input[type="text"] { width: 170px; }
.exam-retest-table select { width: 86px; }
.exam-retest-table small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.exam-question-detail summary { min-width: 48px; cursor: pointer; color: var(--accent); font-size: 11px; font-weight: 800; }
.exam-question-detail div { display: flex; flex-wrap: wrap; gap: 4px; width: 280px; max-width: 45vw; margin-top: 6px; }
.exam-question-detail span { padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: white; font-size: 10px; white-space: nowrap; }

@media (max-width: 900px) {
  .feature-map-grid { grid-template-columns: 1fr; }
  .exam-form-grid { grid-template-columns: 1fr 1fr; }
  .exam-form-grid .wide-field { grid-column: span 2; }
  .exam-analysis-controls, .exam-retest-controls, .student-history-controls { grid-template-columns: 1fr; }
  .exam-import-summary, .exam-import-result-grid, .exam-import-flow, .exam-import-grid { grid-template-columns: 1fr; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .exam-import-action-buttons { justify-content: stretch; }
  .exam-import-action-button { flex: 1 1 180px; }
}

@media (max-width: 560px) {
  .exam-home-grid { grid-template-columns: 1fr; }
  .exam-form-grid { grid-template-columns: 1fr; }
  .exam-form-grid .wide-field { grid-column: auto; }
  .exam-import-action-buttons { flex-direction: column; }
  .exam-import-action-button { width: 100%; }
}


