:root {
  --bg: #ebe5da;
  --card: #f7f4ec;
  --card-soft: #f2eee5;
  --ink: #0f2f38;
  --ink-muted: #4f6469;
  --line: #d3d0c8;
  --accent: #c5822f;
  --primary: #105866;
  --primary-hover: #0c4b57;
  --primary-soft: #dde8ea;
  --danger: #9f2e2a;
  --danger-soft: #f7e4e1;
  --success: #2f6c4f;
  --success-soft: #e2efe6;
  --warning: #895b1f;
  --warning-soft: #f6ebda;
  --shadow: 0 10px 26px rgba(63, 54, 37, 0.08);
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-display: "Songti SC", "STSong", "Noto Serif SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(220px 220px at 92% 10%, #eadfcf 0%, transparent 72%),
    radial-gradient(200px 200px at 8% 86%, #ece2d5 0%, transparent 72%),
    var(--bg);
}

.container {
  width: min(940px, 92vw);
  margin: 0 auto;
}

.topbar {
  padding: 14px 0 8px;
}

.topbar-inner {
  min-height: 62px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a,
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #d8d5cd;
  white-space: nowrap;
}

.nav-links a {
  color: var(--ink-muted);
  background: #eeeadf;
}

.nav-links a:hover {
  color: var(--ink);
  background: #e7e2d5;
}

.logout-form {
  margin: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d8d5cd;
  background: #f0ece2;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.logout-btn {
  background: #f3dedb;
  color: #7b2a27;
  cursor: pointer;
}

.logout-btn:hover {
  background: #eed2ce;
}

.page {
  padding: 4px 0 52px;
  display: grid;
  gap: 14px;
}

.page > * {
  width: 100%;
}

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.page-home .container {
  width: min(900px, 94vw);
}

.page-home .topbar-inner {
  justify-content: flex-start;
  min-height: 56px;
  border-radius: 8px;
  border: 1px solid #e6eaf0;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.page-home .brand {
  font-size: 22px;
  color: #333333;
  font-weight: 700;
}

.page-home .page {
  padding-top: 0;
  gap: 20px;
}

body.page-home {
  background: #f5f7fa;
}

.page-head,
.panel,
.banner,
.role-card,
.exam-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.page-head {
  padding: 22px 24px;
}

.page-head h1 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 5.2vw, 56px);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.page-head p {
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-size: 16px;
}

.text-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.text-link:hover {
  color: var(--primary-hover);
}

.page-head-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-home-link {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d5dce5;
  background: #ffffff;
  color: #5f7691;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.header-home-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-home-link:hover {
  background: #f6f9ff;
  border-color: #c0cfdf;
  color: #34597f;
}

.page-head-actions .text-link {
  margin-top: 0;
}

.page-head.with-side-action {
  position: relative;
  padding-right: 132px;
}

.page-head.with-side-action .page-head-actions {
  position: absolute;
  top: 22px;
  right: 24px;
  margin-top: 0;
}

.entry-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.entry-panel {
  padding: 22px 26px 24px;
}

.entry-panel h2 {
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 40px);
  line-height: 1.12;
}

body.page-home .login-header,
body.page-home .exam-info,
body.page-home .entry-panel,
body.page-home .home-footnote {
  background: #ffffff;
  border: 1px solid #e6eaf0;
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(17, 39, 64, 0.08);
}

body.page-home .login-header,
body.page-home .exam-info,
body.page-home .home-footnote {
  padding: 22px 24px;
}

body.page-home .login-header .login-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

body.page-home .login-header .login-header-home-link {
  flex: 0 0 auto;
}

body.page-home .login-header h1 {
  margin: 0;
  color: #333333;
  font-family: var(--font-ui);
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
}

body.page-home .school-name {
  margin: 0;
  color: #888888;
  font-size: 14px;
}

body.page-home .login-note {
  margin: 0;
  color: #77879a;
  font-size: 13px;
}

body.page-home .task-status {
  padding: 16px 18px;
}

body.page-home .task-status.has-task {
  background: #f4f9ff;
  border-color: #d6e5f8;
}

body.page-home .task-status.no-task {
  background: #fffaf2;
  border-color: #f0e1c7;
}

body.page-home .task-status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #31485f;
  font-size: 14px;
}

body.page-home .task-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #2f6eb5;
  background: #e5f0ff;
  border: 1px solid #bfd4f2;
}

body.page-home .task-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

body.page-home .task-pill.active {
  color: #2f6eb5;
  background: #e8f2ff;
}

body.page-home .task-pill.empty {
  color: #94692f;
  background: #fff0d9;
}

body.page-home .exam-info p {
  margin: 0;
  color: #516276;
  font-size: 14px;
  line-height: 1.7;
}

body.page-home .entry-stack {
  display: grid;
  gap: 24px;
}

body.page-home .entry-panel {
  padding: 24px;
}

body.page-home .teacher-panel {
  border-color: #d2e2f5;
  box-shadow: 0 10px 26px rgba(47, 110, 181, 0.14);
  padding: 28px 28px 26px;
}

body.page-home .admin-panel {
  border-color: #e8edf4;
  box-shadow: 0 2px 10px rgba(18, 34, 55, 0.07);
  padding: 20px 22px;
}

body.page-home .entry-panel h2,
body.page-home .admin-entry-title {
  margin: 0 0 14px;
  color: #333333;
  font-family: var(--font-ui);
  font-size: 19px;
  line-height: 1.3;
  font-weight: 700;
}

body.page-home .admin-entry-title {
  color: #6a7d92;
  font-size: 16px;
}

body.page-home label span {
  display: block;
  margin-bottom: 7px;
  color: #333333;
  font-size: 14px;
  font-weight: 600;
}

body.page-home input,
body.page-home select,
body.page-home textarea {
  min-height: 42px;
  border: 1px solid #dddddd;
  border-radius: 6px;
  padding: 9px 11px;
  color: #333333;
  background: #ffffff;
  font-size: 14px;
}

body.page-home input:focus,
body.page-home select:focus,
body.page-home textarea:focus {
  border-color: #2f6eb5;
  box-shadow: 0 0 0 3px rgba(47, 110, 181, 0.15);
}

body.page-home .inline-grid {
  grid-template-columns: 1fr 1fr;
}

body.page-home .teacher-step-grid {
  gap: 14px;
  padding: 12px;
  border: 1px solid #d9e6f8;
  border-radius: 8px;
  background: #f6faff;
}

body.page-home .teacher-entry-form {
  gap: 14px;
}

body.page-home .teacher-entry-form .step-pick span {
  color: #2f6eb5;
  font-weight: 700;
}

body.page-home .teacher-entry-form .step-pick select {
  border: 2px solid #b8d0ee;
  background: #ffffff;
  font-weight: 600;
  min-height: 54px;
  padding: 11px 14px;
  font-size: 17px;
}

body.page-home .teacher-entry-form .step-pick select:focus {
  border-color: #2f6eb5;
}

body.page-home .btn {
  min-height: 50px;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
  transition: background-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

body.page-home .btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

body.page-home .btn.primary {
  color: #eaf5f7;
  background: var(--primary);
}

body.page-home .btn.primary:hover {
  background: var(--primary-hover);
}

body.page-home .btn.secondary {
  color: #164754;
  background: var(--primary-soft);
  border-color: #cbdde1;
}

body.page-home .btn.secondary:hover {
  background: #d2e1e5;
}

body.page-home .home-footnote {
  padding: 14px 16px;
  color: #7b8797;
  font-size: 12px;
  line-height: 1.75;
}

body.page-home .home-footnote p {
  margin: 0;
}

.role-card {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 24px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.role-card::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -85px;
  bottom: -110px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #ebdfca 0%, #ebdfca 50%, transparent 75%);
}

.role-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(63, 54, 37, 0.1);
}

.role-card h2 {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.08;
}

.panel {
  padding: 20px 22px;
}

.panel h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.14;
}

.muted {
  color: var(--ink-muted);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.exam-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

.admin-tool {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tool-label {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.feature-check-list {
  display: grid;
  gap: 8px;
}

.feature-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #f7f9fc;
  cursor: pointer;
}

.feature-switch input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: #2f6eb5;
}

.feature-switch em {
  margin: 0;
  font-style: normal;
  color: #4f657f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.tool-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.tool-inline-single {
  grid-template-columns: 1fr;
}

.admin-tool-export .btn {
  width: 100%;
}

.admin-tool-upload input[type="file"] {
  min-width: 0;
}

.tool-hint {
  margin: 0;
  color: #b03d3d;
  font-size: 12px;
  line-height: 1.45;
}

.tool-hint-wide {
  margin-top: 10px;
}

.admin-details-head {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-details-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  flex-wrap: wrap;
}

.admin-details-top .stat {
  margin: 0;
}

.admin-roster-stats {
  flex: 1 1 420px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid #c3ccd1;
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 16px;
  font-family: var(--font-ui);
  background: #f0f2f3;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7ba2ab;
  box-shadow: 0 0 0 4px rgba(123, 162, 171, 0.2);
}

textarea {
  resize: vertical;
  min-height: 126px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 50px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.btn.wide {
  width: 100%;
}

.btn.small {
  min-height: 38px;
  font-size: 14px;
  padding: 0 14px;
}

.btn.primary {
  color: #eaf5f7;
  background: var(--primary);
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.btn.secondary {
  color: #164754;
  background: var(--primary-soft);
  border-color: #cbdde1;
}

.btn.secondary:hover {
  background: #d2e1e5;
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e8c5c0;
}

.btn.danger:hover {
  background: #f2d8d4;
}

.card-list {
  display: grid;
  gap: 10px;
}

.exam-card {
  padding: 16px 18px;
}

.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.exam-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.2;
}

.exam-feature-badges {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exam-actions {
  margin-top: 12px;
}

.stat {
  margin: 10px 0 8px;
}

.progress {
  height: 8px;
  background: #e4dfd2;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid #ddd8cf;
  padding: 10px 8px;
  text-align: left;
  font-size: 15px;
}

.table th {
  color: var(--ink-muted);
  font-weight: 700;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.tag.success {
  color: var(--success);
  background: var(--success-soft);
}

.tag.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.banner {
  padding: 14px 16px;
  display: grid;
  gap: 5px;
  border-radius: 18px;
}

.banner strong {
  font-size: 16px;
}

.banner.info {
  color: #174b58;
  background: #e2ecee;
  border-color: #c6d9dd;
}

.banner.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #c8e1d2;
}

.banner.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e6c6c2;
}

.teacher-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.teacher-head-main {
  min-width: 0;
  flex: 1;
}

.teacher-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 700;
}

.teacher-head-divider {
  height: 1px;
  background: #dfe6ef;
  margin: 10px 0;
}

.teacher-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.teacher-meta p {
  margin: 0;
  color: #55677b;
  font-size: 14px;
  line-height: 1.45;
}

.teacher-meta strong {
  color: #2a3645;
}

.teacher-meta-primary p {
  font-size: 16px;
  font-weight: 700;
  color: #1f3552;
  background: #f2f8ff;
  border: 1px solid #d5e4f8;
  border-radius: 8px;
  padding: 8px 10px;
}

.teacher-meta-primary strong {
  color: #2f6eb5;
}

.teacher-head-logout {
  margin: 0;
  flex: 0 0 auto;
}

.teacher-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.teacher-head-logout .btn {
  min-width: 86px;
}

.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #cfe0f4;
  color: #2f6eb5;
  background: #f2f8ff;
  font-size: 13px;
  font-weight: 700;
}

.roster-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.count-pill.neutral {
  border-color: #d8e0ea;
  color: #5f738a;
  background: #f6f8fb;
}

.count-pill.eng {
  border-color: #c5dcf4;
  color: #2e6aa8;
  background: #ecf4fe;
}

.count-pill.jpn {
  border-color: #c7e4d0;
  color: #2e7a49;
  background: #ecf8f0;
}

.student-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.student-item {
  border: 1px solid #ddd8cf;
  border-radius: 14px;
  padding: 12px;
  background: var(--card-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.student-add-row {
  margin: 0;
}

.student-add-box {
  display: block;
  border-top: 1px dashed #d7dfeb;
  padding-top: 12px;
  margin: 0;
}

.student-add-title {
  color: #516276;
  font-size: 13px;
  font-weight: 600;
}

.student-add-inline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 132px 132px minmax(0, 190px) auto;
  gap: 8px;
  align-items: center;
}

.student-add-inline.no-language {
  grid-template-columns: auto minmax(0, 1fr) 132px minmax(0, 190px) auto;
}

.student-add-inline.no-specialty {
  grid-template-columns: auto minmax(0, 1fr) 132px auto;
}

.student-add-inline.no-language.no-specialty {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.student-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.student-copy {
  min-width: 0;
  flex: 1;
}

.student-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.student-index {
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 600;
  flex: 0 0 auto;
}

.student-name {
  font-size: 17px;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.name-side-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-switch {
  display: flex;
  align-items: center;
}

.lang-pill {
  display: inline-flex;
  align-items: stretch;
  min-height: 28px;
  border: 1px solid #d5dce5;
  border-radius: 999px;
  overflow: hidden;
  background: #f3f5f8;
}

.lang-pill-form {
  display: flex;
  margin: 0;
}

.lang-pill-btn,
.lang-pill-half {
  min-width: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #909aad;
  font-size: 12px;
  font-weight: 700;
}

.lang-pill-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.lang-pill-btn:hover:not(:disabled):not(.active) {
  background: #edf2fb;
  color: #667995;
}

.lang-pill-btn.active,
.lang-pill-half.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.lang-pill-btn.left.active,
.lang-pill-half.left.active {
  background: #4a9cf0;
  color: #ffffff;
}

.lang-pill-btn.right.active,
.lang-pill-half.right.active {
  background: #46b86e;
  color: #ffffff;
}

.lang-pill-btn:disabled {
  opacity: 1;
  cursor: default;
}

.lang-pill.static {
  cursor: default;
}

.lang-pill-divider {
  width: 1px;
  background: #d5dce5;
}

.specialty-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid #cfdae8;
  background: #ffffff;
  color: #6f8199;
  font-size: 12px;
  font-weight: 700;
  box-sizing: border-box;
}

.specialty-chip.has-value {
  border-color: #d9e8d8;
  background: #f0f9ef;
  color: #356e46;
}

.specialty-label {
  display: inline-block;
  line-height: 1;
}

.specialty-editor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.specialty-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px dashed #cfdae8;
  background: #ffffff;
  color: #6f8199;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  box-sizing: border-box;
}

.specialty-trigger.empty {
  border-style: solid;
}

.specialty-trigger.has-value {
  border: 1px solid #d9e8d8;
  background: #f0f9ef;
  color: #356e46;
}

.specialty-trigger:hover {
  border-color: #bfd1e5;
  background: #f6f9fe;
}

.specialty-trigger.has-value:hover {
  border-color: #bfd8bd;
  background: #e9f7e8;
}

.specialty-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 288px;
  padding: 10px;
  border: 1px solid #dce4ef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(40, 62, 97, 0.18);
}

.specialty-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.specialty-option-form {
  margin: 0;
}

.specialty-option {
  width: 100%;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid #d7e0ec;
  background: #f7f9fc;
  color: #5d728e;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.specialty-option:hover {
  background: #edf3fb;
  border-color: #c3d1e4;
  color: #49627f;
}

.specialty-option.active {
  border-color: #9fc0e6;
  background: #eaf3ff;
  color: #2f6eb5;
}

.specialty-custom-form {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.specialty-custom-form input {
  min-height: 32px;
  border: 1px solid #cfd9e7;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
}

.specialty-custom-form button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #9fc0e6;
  border-radius: 8px;
  background: #eaf3ff;
  color: #2f6eb5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.student-add-input {
  min-height: 40px;
  width: 100%;
}

.student-add-select {
  min-height: 40px;
  width: 100%;
}

.student-add-custom {
  min-width: 0;
}

.student-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.student-delete-form {
  display: flex;
  align-items: center;
  margin: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #d5dce5;
  background: #ffffff;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8e97a8;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  background: #f6f9ff;
  border-color: #c0cfdf;
  color: #6f809d;
}

.icon-btn.delete-btn {
  color: #e25c5c;
  border-color: #f0c8c8;
}

.icon-btn.delete-btn:hover {
  background: #fff5f5;
  border-color: #e9a7a7;
  color: #d94b4b;
}

.icon-btn.add-btn {
  color: #2f6eb5;
  border-color: #c6d9f2;
}

.icon-btn.add-btn:hover {
  background: #f3f8ff;
  border-color: #aac7ea;
  color: #285f9d;
}

.submit-panel {
  text-align: center;
}

.submit-panel form {
  display: flex;
  justify-content: center;
}

.submit-state {
  margin: 0 0 12px;
  color: #2f6c4f;
  font-size: 14px;
}

.submit-cta {
  width: min(560px, 100%);
  min-height: 48px;
  border-radius: 8px;
  font-size: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 34, 52, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 18px 46px rgba(20, 36, 61, 0.18);
}

.modal-card h3 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.modal-open {
  overflow: hidden;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.flash-stack {
  display: grid;
  gap: 8px;
}

.flash {
  border-radius: 12px;
  border: 1px solid;
  padding: 10px 12px;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(63, 54, 37, 0.07);
}

.flash.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bfd8c8;
}

.flash.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e2bfba;
}

@media (max-width: 760px) {
  .container {
    width: 94vw;
  }

  .topbar-inner {
    padding: 10px 12px;
    border-radius: 16px;
  }

  .brand {
    font-size: 14px;
  }

  .page-home .brand {
    font-size: 18px;
  }

  .page-head,
  .panel,
  .role-card {
    border-radius: 18px;
  }

  .entry-panel h2 {
    font-size: clamp(24px, 6.2vw, 32px);
  }

  .entry-panel {
    border-radius: 18px;
  }

  .entry-panel,
  .page-head,
  .panel {
    padding: 18px;
  }

  body.page-home .inline-grid {
    grid-template-columns: 1fr 1fr;
  }

  body.page-home .entry-stack {
    gap: 16px;
  }

  body.page-home .teacher-panel,
  body.page-home .admin-panel {
    padding: 18px;
  }

  body.page-home .task-status-head {
    flex-wrap: wrap;
  }

  .page-head {
    padding: 18px;
  }

  .page-head h1 {
    font-size: clamp(30px, 8.2vw, 42px);
  }

  .page-head p {
    font-size: 15px;
  }

  .page-head.with-side-action {
    padding-right: 18px;
  }

  .page-head.with-side-action .page-head-actions {
    position: static;
    margin-top: 10px;
  }

  .panel {
    padding: 16px;
  }

  .panel h2 {
    font-size: clamp(24px, 6.4vw, 32px);
  }

  .role-card {
    min-height: 130px;
    padding: 18px;
  }

  .role-card h2 {
    font-size: clamp(30px, 8vw, 42px);
  }

  .inline-grid,
  .inline-form,
  .exam-feature-grid {
    grid-template-columns: 1fr;
  }

  .teacher-head {
    flex-direction: column;
  }

  .teacher-meta {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .tool-inline {
    grid-template-columns: 1fr;
  }

  .student-item {
    padding: 10px;
  }

  .name-side-meta {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .student-add-inline {
    grid-template-columns: 1fr;
  }

  .specialty-panel {
    left: 0;
    right: auto;
    min-width: min(260px, 80vw);
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .exam-header {
    flex-direction: column;
  }

  .btn,
  input,
  select,
  textarea {
    min-height: 46px;
  }
}

/* Unified Internal Theme (match login page style) */
body:not(.page-home) {
  background: #f5f7fa;
  color: #333333;
}

body:not(.page-home) .container {
  width: min(900px, 94vw);
}

body:not(.page-home) .topbar-inner {
  min-height: 56px;
  border-radius: 8px;
  border: 1px solid #e6eaf0;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body:not(.page-home) .brand {
  color: #333333;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

body:not(.page-home) .nav-links a,
body:not(.page-home) .user-chip,
body:not(.page-home) .logout-btn {
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid #d8e1ec;
  background: #ffffff;
  color: #2f6eb5;
  font-size: 13px;
  font-weight: 600;
}

body:not(.page-home) .logout-btn {
  border-color: #f0c3c3;
  color: #c04747;
}

body:not(.page-home) .page {
  gap: 16px;
}

body:not(.page-home) .page-head,
body:not(.page-home) .panel,
body:not(.page-home) .banner,
body:not(.page-home) .exam-card {
  background: #ffffff;
  border: 1px solid #e6eaf0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body:not(.page-home) .page-head,
body:not(.page-home) .panel {
  padding: 24px;
}

body:not(.page-home) .eyebrow {
  color: #2f6eb5;
  font-size: 12px;
  letter-spacing: 0.04em;
}

body:not(.page-home) .page-head h1 {
  margin: 4px 0 8px;
  color: #333333;
  font-family: var(--font-ui);
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
}

body:not(.page-home) .page-head p {
  margin: 0;
  color: #888888;
  font-size: 14px;
}

body:not(.page-home) .text-link {
  margin-top: 10px;
  color: #2f6eb5;
  font-size: 14px;
}

body:not(.page-home) .panel h2 {
  margin: 0 0 12px;
  color: #333333;
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}

body:not(.page-home) .muted {
  color: #888888;
}

body:not(.page-home) label span {
  color: #333333;
  font-size: 14px;
  font-weight: 600;
}

body:not(.page-home) input,
body:not(.page-home) select,
body:not(.page-home) textarea {
  min-height: 40px;
  border: 1px solid #dddddd;
  border-radius: 6px;
  background: #ffffff;
  color: #333333;
  font-size: 14px;
  padding: 8px 10px;
}

body:not(.page-home) input:focus,
body:not(.page-home) select:focus,
body:not(.page-home) textarea:focus {
  border-color: #2f6eb5;
  box-shadow: 0 0 0 3px rgba(47, 110, 181, 0.15);
}

body:not(.page-home) textarea {
  min-height: 120px;
}

body:not(.page-home) .btn {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
}

body:not(.page-home) .btn.primary {
  background: #2f6eb5;
  color: #ffffff;
  border: none;
}

body:not(.page-home) .btn.primary:hover {
  background: #285f9d;
}

body:not(.page-home) .btn.secondary {
  background: #ffffff;
  color: #2f6eb5;
  border: 1px solid #2f6eb5;
}

body:not(.page-home) .btn.secondary:hover {
  background: #f3f8ff;
}

body:not(.page-home) .btn.danger {
  background: #ffffff;
  color: #c04747;
  border: 1px solid #c04747;
}

body:not(.page-home) .btn.danger:hover {
  background: #fff5f5;
}

body:not(.page-home) .progress {
  height: 8px;
  background: #edf1f5;
  border-radius: 999px;
}

body:not(.page-home) .progress span {
  background: #2f6eb5;
}

body:not(.page-home) .table th,
body:not(.page-home) .table td {
  border-bottom: 1px solid #e8edf3;
  padding: 10px 8px;
  font-size: 14px;
}

body:not(.page-home) .table th {
  color: #666666;
}

body:not(.page-home) .tag.success {
  color: #2f6c4f;
  background: #edf7f1;
}

body:not(.page-home) .tag.warning {
  color: #8a621f;
  background: #fff5e5;
}

body:not(.page-home) .banner {
  border-radius: 8px;
  padding: 12px 14px;
}

body:not(.page-home) .banner.info {
  background: #f3f8ff;
  border-color: #dbe8f8;
  color: #2f6eb5;
}

body:not(.page-home) .banner.success {
  background: #edf7f1;
  border-color: #d7eadf;
  color: #2f6c4f;
}

body:not(.page-home) .banner.danger {
  background: #fff2f2;
  border-color: #f2d7d7;
  color: #b03d3d;
}

body:not(.page-home) .student-item {
  background: #ffffff;
  border: 1px solid #e6eaf0;
  border-radius: 6px;
}

body:not(.page-home) .student-name {
  font-size: 16px;
}

@media (max-width: 760px) {
  body:not(.page-home) .brand {
    font-size: 16px;
  }

  body:not(.page-home) .page-head,
  body:not(.page-home) .panel,
  body:not(.page-home) .banner,
  body:not(.page-home) .exam-card {
    border-radius: 8px;
  }

  body:not(.page-home) .page-head,
  body:not(.page-home) .panel,
  body:not(.page-home) .exam-card {
    padding: 16px;
  }

  body:not(.page-home) .page-head h1 {
    font-size: 22px;
  }

  .roster-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-details-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-roster-stats {
    justify-content: flex-start;
  }

  body.page-home .login-header .login-header-top {
    align-items: center;
  }
}
