:root {
  --bg: #eef5fb;
  --panel: #ffffff;
  --ink: #152238;
  --muted: #64748b;
  --line: #d9e4ef;
  --blue: #1677df;
  --blue-dark: #0f5fb8;
  --cyan: #17a6b8;
  --green: #178b5b;
  --red: #d94343;
  --amber: #b77512;
  --shadow: 0 12px 30px rgba(35, 74, 112, 0.09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.teacher-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}
.teacher-header-inner {
  max-width: 1380px;
  min-height: 68px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.teacher-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; }
.teacher-brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--blue);
}
.teacher-brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.icon-button, .outline-button, .primary-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-button { width: 38px; padding: 0; font-size: 22px; }
.primary-button { color: #fff; border-color: var(--blue); background: var(--blue); }
.primary-button:hover { background: var(--blue-dark); }
.full-button { width: 100%; margin-top: 16px; }

.teacher-main { max-width: 1380px; margin: auto; padding: 28px 24px 50px; }
.school-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 11px; font-weight: 800; }
.school-heading h1 { margin: 0; font-size: 27px; letter-spacing: 0; }
.school-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-grid article {
  min-height: 128px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.summary-grid span, .summary-grid small { display: block; color: var(--muted); font-size: 13px; }
.summary-grid strong { display: block; margin: 8px 0 5px; font-size: 32px; }
.success { color: var(--green); }
.primary { color: var(--blue); }
.danger { color: var(--red); }

.device-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-toolbar {
  min-height: 76px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.section-toolbar h2 { margin: 0; font-size: 18px; }
.section-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.search-box {
  width: min(280px, 100%);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.device-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { min-height: 52px; padding: 13px 14px; text-align: left; border-bottom: 1px solid #e8eef4; white-space: nowrap; }
th { color: #536277; background: #f8fbfd; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.status { padding: 5px 9px; border-radius: 999px; font-size: 12px; }
.status.online { color: var(--green); background: #e9f8f0; }
.status.offline { color: var(--red); background: #fff0f0; }
.status.running { color: var(--blue); background: #eaf3ff; }
.status.standby { color: var(--amber); background: #fff5dc; }
.row-actions { display: flex; gap: 6px; }
.row-actions button, .row-actions a {
  height: 31px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #26364c;
  background: #fff;
  text-decoration: none;
  cursor: pointer;
}
.empty-cell { height: 140px; text-align: center; color: var(--muted); }

dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 28px 80px rgba(18, 41, 64, .24); }
dialog::backdrop { background: rgba(18, 31, 49, .52); }
.dialog-card { padding: 22px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; font-size: 20px; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 21px; }
.dialog-card label { display: block; margin-top: 14px; }
.dialog-card label span { display: block; margin-bottom: 7px; color: #45556c; font-size: 13px; }
.dialog-card input { width: 100%; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.dialog-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 119, 223, .12); }
.dialog-actions { display: flex; justify-content: end; gap: 10px; margin-top: 22px; }
.provision-note { padding: 12px; border-left: 3px solid var(--cyan); background: #eef9fb; color: #40546c; font-size: 13px; line-height: 1.7; }
.provision-values { margin: 14px 0 0; }
.provision-values div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.provision-values dt { color: var(--muted); font-size: 12px; }
.provision-values dd { margin: 5px 0 0; font-family: Consolas, monospace; overflow-wrap: anywhere; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 16px; border-radius: 6px; color: #fff; background: #19324b;
  transition: .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: #b42318; }

.teacher-login-body { background: #dceaf6; }
.teacher-login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr); }
.teacher-login-intro {
  padding: 48px 6vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background: #123a62;
}
.teacher-login-intro h1 { max-width: 680px; margin: 0; font-size: clamp(36px, 5vw, 68px); line-height: 1.12; letter-spacing: 0; }
.intro-copy { max-width: 620px; color: #c8dff2; font-size: 17px; line-height: 1.9; }
.intro-status { color: #c8dff2; font-size: 13px; }
.intro-status span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #50d59a; }
.teacher-login-panel { display: grid; place-items: center; padding: 30px; background: #f5f9fc; }
.teacher-login-card { width: min(390px, 100%); padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.teacher-login-card h2 { margin: 0; font-size: 24px; }
.teacher-login-card > p { margin: 8px 0 24px; color: var(--muted); font-size: 13px; }
.teacher-login-card label { display: block; margin-top: 15px; }
.teacher-login-card label span { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.teacher-login-card input { width: 100%; height: 45px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; }
.teacher-login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 119, 223, .12); }
.teacher-login-card button { width: 100%; height: 45px; margin-top: 22px; border: 0; border-radius: 6px; color: #fff; background: var(--blue); cursor: pointer; }
.login-help { margin-top: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.form-error { margin-bottom: 14px; padding: 10px 12px; color: #b42318; background: #fff0f0; border-radius: 6px; font-size: 13px; }
.mobile-brand { display: none; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .teacher-login-shell { grid-template-columns: 1fr; }
  .teacher-login-intro { display: none; }
  .teacher-login-panel { min-height: 100vh; }
  .mobile-brand { display: block; margin-bottom: 28px; color: var(--blue); font-weight: 800; }
}
@media (max-width: 680px) {
  .teacher-header-inner, .teacher-main { padding-left: 14px; padding-right: 14px; }
  .school-heading { align-items: stretch; flex-direction: column; }
  .summary-grid { gap: 9px; }
  .summary-grid article { min-height: 110px; padding: 15px; }
  .summary-grid strong { font-size: 27px; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .device-table-wrap { padding: 8px 12px 12px; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr { margin-bottom: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; }
  td { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 42px; padding: 9px 0; white-space: normal; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 auto; }
  td:first-child { font-size: 16px; }
  td:first-child::before { display: none; }
  .row-actions { width: 100%; justify-content: flex-end; }
  .empty-cell::before { display: none; }
}
