@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  font-family: 'DM Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #172b4d;
  background: #f5f7fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --blue: #2563eb;
  --blue-dark: #1747a6;
  --ink: #172b4d;
  --muted: #6b7890;
  --line: #e2e8f0;
  --surface: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f5f7fa; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { width: min(100% - 32px, 420px); margin: 10vh auto 48px; padding: 42px 38px 32px; background: var(--surface); border: 1px solid #e8edf4; border-radius: 8px; box-shadow: 0 18px 55px rgba(23,43,77,.08); animation: enter .42s ease-out both; }
.login-mark, .brand-mark { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; background: var(--blue); border-radius: 12px; font-weight: 700; }
.login-shell h1 { margin: 8px 0 7px; font-size: 30px; letter-spacing: -.04em; }
.login-copy { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.eyebrow { margin: 0; color: #5b6e8c; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 10px; color: #455571; font-size: 13px; font-weight: 600; }
.login-form input, .year-input { min-height: 44px; padding: 0 13px; color: var(--ink); border: 1px solid #ccd5e2; border-radius: 5px; background: #fff; outline: none; }
.login-form input:focus, .year-input:focus, .reply-input:focus { border-color: #7aa5ff; box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.fine-print { margin: 22px 0 0; color: #8792a5; font-size: 12px; line-height: 1.6; }

.topbar { height: 68px; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.admin-name { max-width: 190px; overflow: hidden; color: #52627c; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.workspace { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 224px minmax(0,1fr); }
.sidebar { display: flex; flex-direction: column; padding: 28px 16px 22px; background: #f9fafc; border-right: 1px solid var(--line); }
.side-label { padding: 0 12px 10px; color: #9aa4b3; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 0 12px; color: #53627b; text-align: left; background: transparent; border: 0; border-radius: 5px; font-size: 13px; }
.nav-item span { color: #a0aabd; font-size: 10px; }
.nav-item.active { color: #1747a6; background: #eaf1ff; font-weight: 700; }
.nav-item.active span { color: var(--blue); }
.count-badge { margin-left: auto; min-width: 21px; padding: 3px 6px; color: #fff; background: #d44940; border-radius: 12px; text-align: center; font-size: 10px; }
.side-note { margin: auto 8px 0; padding: 17px 0 0; border-top: 1px solid var(--line); }
.side-note strong { color: #53627b; font-size: 12px; }
.side-note p { margin: 8px 0 0; color: #7f8ba0; font-size: 11px; line-height: 1.65; }
.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px clamp(20px,4vw,58px) 54px; }
.panel { display: none; animation: enter .25s ease-out both; }
.panel.active { display: block; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 25px; }
.page-heading h1 { margin: 8px 0 8px; color: #12233d; font-size: clamp(26px,3vw,34px); letter-spacing: -.045em; line-height: 1.15; }
.lede { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.deadline-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; color: #485b78; background: #fff; border: 1px solid var(--line); border-radius: 5px; white-space: nowrap; font-size: 11px; }
.status-dot { width: 7px; height: 7px; background: #2ca66f; border-radius: 50%; box-shadow: 0 0 0 3px rgba(44,166,111,.12); }
.roster-layout { display: grid; grid-template-columns: minmax(0,1fr) 285px; gap: 24px; align-items: start; }
.main-column, .side-column { min-width: 0; }
.section-block { padding: 24px 0 26px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.section-block + .section-block { margin-top: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 24px 19px; }
.section-title > div { display: flex; align-items: center; gap: 11px; }
.section-title h2, .guide-block h2 { margin: 0; color: #1d2e49; font-size: 16px; letter-spacing: -.02em; }
.step { display: grid; place-items: center; width: 25px; height: 25px; color: #2462d1; background: #edf3ff; border-radius: 50%; font-size: 11px; font-weight: 700; }
.text-button { padding: 0; color: #245ec3; background: transparent; border: 0; font-size: 12px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 78px 150px 1fr; gap: 11px; align-items: center; margin: 0 24px 17px; }
.field-label { color: #485974; font-size: 12px; font-weight: 600; }
.year-input { width: 100%; min-height: 39px; font-size: 13px; }
.field-help { margin: 0; color: #7e899c; font-size: 11px; line-height: 1.6; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 142px; gap: 9px; margin: 0 24px 16px; color: #394b67; background: #fbfcfe; border: 1px dashed #b8c5d8; border-radius: 5px; cursor: pointer; transition: background .18s,border-color .18s,transform .18s; }
.dropzone:hover, .dropzone.dragging { background: #f1f6ff; border-color: var(--blue); transform: translateY(-1px); }
.dropzone strong { font-size: 13px; }
.dropzone span:last-child { color: #8290a6; font-size: 11px; }
.upload-glyph { display: grid; place-items: center; width: 30px; height: 30px; color: var(--blue); background: #eaf1ff; border-radius: 8px; font-size: 19px; }
.column-guide { display: grid; gap: 5px; margin: 0 24px 19px; color: #58677f; font-size: 11px; }
.column-guide strong { color: #283b59; font-size: 11px; }
.column-guide small { color: #8490a2; font-size: 10px; line-height: 1.5; }
.button { min-height: 38px; padding: 0 15px; border-radius: 5px; border: 1px solid transparent; font-size: 12px; font-weight: 600; transition: background .16s, border-color .16s, transform .16s; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button.primary { color: #fff; background: var(--blue); }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary { color: #3f506b; background: #fff; border-color: #cbd5e1; }
.button.secondary:hover:not(:disabled) { background: #f7f9fc; border-color: #98a7bc; }
.button.quiet { min-height: 33px; padding: 0 12px; color: #596981; background: transparent; border-color: #e0e6ee; }
.danger-button { color: #a43a32 !important; border-color: #f0c9c4 !important; }
.button.wide { width: 100%; min-height: 44px; margin-top: 15px; }
#validate-button { margin-left: 24px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 13px 15px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.search-label { color: #53627b; font-size: 12px; font-weight: 600; }
.search-input { flex: 1; min-height: 37px; padding: 0 11px; color: var(--ink); border: 1px solid #ccd5e2; border-radius: 5px; outline: none; }
.search-input:focus { border-color: #7aa5ff; box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.overview-list, .teachers-list { display: grid; gap: 15px; }
.overview-item, .teacher-item { padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.overview-head h2 { margin: 0 0 5px; color: #1d2e49; font-size: 16px; }
.subheading { margin: 18px 0 8px; color: #6c7a91; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.compact-list { display: grid; gap: 7px; }
.compact-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 10px; background: #fafbfd; border: 1px solid #edf0f4; border-radius: 5px; }
.compact-row strong, .compact-row span { display: block; }
.compact-row strong { color: #43536d; font-size: 12px; }
.compact-row .feedback-meta { margin-top: 3px; }
.device-state { color: #7e899c; font-size: 10px; }
.device-state.online { color: #18724a; }
.device-state.offline { color: #a43a32; }
.guide-block { padding: 22px 19px 20px; background: #eff4fb; border-radius: 6px; }
.guide-block .eyebrow { margin-bottom: 10px; color: #62799d; }
.guide-block h2 { max-width: 200px; line-height: 1.5; }
.guide-block ol { display: grid; gap: 15px; margin: 20px 0 0; padding: 0; list-style: none; counter-reset: rule; }
.guide-block li { display: grid; gap: 4px; counter-increment: rule; }
.guide-block li b { color: #334762; font-size: 11px; }
.guide-block li b::before { content: counter(rule, decimal-leading-zero) ' / '; color: #7791b8; font-size: 9px; }
.guide-block li span { padding-left: 30px; color: #697a94; font-size: 10px; line-height: 1.55; }
.caution-block { display: flex; gap: 11px; margin-top: 16px; padding: 14px 13px; background: #fff9ef; border-left: 2px solid #edaa52; }
.caution-mark { display: grid; flex: 0 0 18px; place-items: center; width: 18px; height: 18px; color: #a96812; background: #ffe7bd; border-radius: 50%; font-size: 11px; font-weight: 700; }
.caution-block strong { color: #71532c; font-size: 11px; }
.caution-block p { margin: 5px 0 0; color: #877252; font-size: 10px; line-height: 1.55; }
.preview-block { overflow: hidden; }
.state-pill { padding: 5px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.state-pill.ok { color: #18724a; background: #e7f7ee; }
.state-pill.bad { color: #a43a32; background: #fff0ee; }
.validation-list { margin: 0 24px 16px; padding: 11px 13px; border-radius: 4px; }
.validation-list.errors { color: #9e332d; background: #fff2f0; }
.validation-list.warnings { color: #775316; background: #fff8e9; }
.validation-item { margin: 2px 0; font-size: 11px; line-height: 1.6; }
.preview-block > .field-help { margin: 0 24px 15px; }
.table-wrap { max-width: 100%; overflow: auto; border-top: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4; }
table { width: 100%; border-collapse: collapse; min-width: 670px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #edf0f4; font-size: 10px; white-space: nowrap; }
th { color: #7f8b9d; background: #fafbfd; font-size: 9px; font-weight: 700; }
td { color: #43536d; }
tr:last-child td { border-bottom: 0; }
.more-row { text-align: center; color: #8a95a6; }
.import-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px 0; }
.import-actions span { color: #8791a0; font-size: 10px; }
.message-banner { margin: 0 0 18px; padding: 11px 14px; border-radius: 4px; font-size: 12px; animation: enter .2s ease-out both; }
.message-banner.success { color: #145e40; background: #e8f7ef; }
.message-banner.error { color: #9d2e28; background: #fff0ee; }
.message-banner.info { color: #345b9d; background: #edf4ff; }
.message { min-height: 20px; margin: 10px 0 0; font-size: 12px; }
.message.error { color: #b42318; }
.message.info { color: #245ec3; }
.message.success { color: #16804e; }
.empty-state { padding: 80px 15px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.empty-mark { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 15px; color: #198754; background: #e7f6ed; border-radius: 50%; font-size: 19px; }
.empty-state h2 { margin: 0; font-size: 16px; }
.empty-state p { color: var(--muted); font-size: 12px; }
.feedback-list { display: grid; gap: 12px; }
.feedback-item { padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; animation: enter .3s ease-out both; }
.feedback-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.feedback-identity strong, .feedback-identity span { display: block; }
.feedback-identity strong { color: #273c5b; font-size: 14px; }
.feedback-meta { color: #8a95a6; font-size: 10px; line-height: 1.6; }
.feedback-status { padding: 4px 8px; color: #76570e; background: #fff5d9; border-radius: 20px; font-size: 10px; }
.feedback-status.replied { color: #2857a7; background: #eaf1ff; }
.feedback-status.closed { color: #426254; background: #e9f5ed; }
.feedback-details { margin: 15px 0 9px; color: #33455f; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.selection-summary { margin: 0 0 9px; padding: 8px 10px; color: #506482; background: #f5f8fc; border-radius: 4px; font-size: 10px; }
.reply-history { color: #5c7193; font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.reply-input { display: block; width: 100%; min-height: 76px; margin-top: 12px; padding: 10px 12px; color: #243754; border: 1px solid #d5deea; border-radius: 4px; resize: vertical; outline: none; font-size: 11px; line-height: 1.6; }
.feedback-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.confirm-dialog { width: min(100% - 32px, 520px); max-height: 84vh; padding: 0; color: var(--ink); background: #fff; border: 1px solid #e1e7ef; border-radius: 8px; box-shadow: 0 24px 80px rgba(15,33,60,.24); animation: enter .2s ease-out both; }
.confirm-dialog::backdrop { background: rgba(18,35,61,.43); backdrop-filter: blur(2px); }
.dialog-inner { padding: 25px 26px 20px; }
.dialog-mark { display: grid; place-items: center; width: 31px; height: 31px; margin-bottom: 15px; color: #98651c; background: #fff1d2; border-radius: 50%; font-weight: 700; }
.dialog-inner h2 { margin: 6px 0 9px; font-size: 19px; }
.dialog-copy { color: #68778f; font-size: 12px; line-height: 1.7; }
.dialog-warnings { display: grid; gap: 7px; max-height: 180px; margin: 12px 0 0; padding: 13px 13px 13px 29px; overflow: auto; color: #6e5016; background: #fff8e9; border-radius: 4px; font-size: 11px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 23px; }

@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1050px) { .roster-layout { grid-template-columns: minmax(0,1fr) 240px; gap: 16px; } .content { padding-inline: 22px; } }
@media (max-width: 760px) {
  .topbar { height: 58px; padding: 0 15px; }
  .workspace { min-height: calc(100vh - 58px); grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 2; top: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-label, .side-note { display: none; }
  .nav-item { justify-content: center; min-height: 38px; }
  .content { padding: 23px 14px 38px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
  .deadline-chip { order: -1; }
  .roster-layout { grid-template-columns: 1fr; }
  .guide-block { display: none; }
  .field-row { grid-template-columns: 67px 132px 1fr; gap: 8px; margin-inline: 16px; }
  .section-title { margin-inline: 16px; }
  .dropzone, .column-guide { margin-inline: 16px; }
  #validate-button { margin-left: 16px; }
  .validation-list, .preview-block > .field-help { margin-inline: 16px; }
  .import-actions { align-items: flex-start; flex-direction: column; padding-inline: 16px; }
  .import-actions .button { width: 100%; }
  .feedback-item { padding: 15px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .compact-row { align-items: flex-start; flex-direction: column; }
  .compact-row .button { align-self: flex-end; }
}
@media (max-width: 430px) {
  .login-shell { margin-top: 7vh; padding: 32px 24px 25px; }
  .field-row { grid-template-columns: 65px minmax(120px, 150px); }
  .field-help { grid-column: 1 / -1; }
  .deadline-chip { white-space: normal; }
  .section-block { padding-top: 20px; }
}

.management-field { display: grid; gap: 8px; margin-bottom: 20px; font-size: 14px; }
.management-field input, .management-field select { width: 100%; min-height: 42px; border: 1px solid #d6dde7; border-radius: 8px; padding: 8px 12px; background: white; color: #24364b; box-sizing: border-box; font: inherit; }
.management-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.selection-control { display: inline-flex; align-items: center; gap: 6px; color: #52657d; font-size: 13px; }
.selection-control input { width: 17px; height: 17px; accent-color: #245fba; }
.compact-row { flex-wrap: wrap; gap: 12px; }
#academic-form { max-width: 700px; }
#academic-panel > .page-heading { font-size: 28px; font-weight: 700; }
.section-block > .button { margin: 4px 8px 4px 0; }
.confirm-dialog { max-height: 90vh; overflow-y: auto; }
