:root {
  color-scheme: light;
  font-family: 'Source Han Sans SC', 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --outer-bg: #f4f6fd;
  --frame-radius: 16px;
  --frame-shadow: 0 18px 40px rgba(20, 24, 44, 0.18);
  --app-bg: #f8f9ff;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(248, 250, 255, 0.82);
  --border: rgba(178, 190, 222, 0.4);
  --divider: rgba(146, 161, 198, 0.22);
  --panel-border: rgba(170, 184, 220, 0.32);
  --panel-shadow: 0 12px 32px rgba(40, 56, 110, 0.08);
  --card-shadow: 0 10px 26px rgba(45, 69, 140, 0.08);
  --text: #1f2742;
  --text-dim: #7480a3;
  --accent: #4c7df0;
  --accent-ink: #0e1a3a;
  --accent-soft: rgba(76, 125, 240, 0.12);
  --success: #36c98c;
  --success-soft: rgba(54, 201, 140, 0.12);
  --danger: #dd4a68;
  --danger-soft: rgba(221, 74, 104, 0.14);
  --warning: #f0b24b;
  --warning-soft: rgba(240, 178, 75, 0.16);
  --table-head: #eef1f7;
  --row-hover: #f3f6ff;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #f7f8ff, #edf1ff 58%);
  font-family: inherit;
  color: var(--text);
  letter-spacing: 0.01em;
}

.app-frame {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--app-bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 10;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
  text-decoration: none;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zone-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  background: #2f3150;
  color: #ffffff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.topbar-meta {
  font-size: 0.78rem;
  color: #7d8695;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 600;
}

.main {
  background: var(--app-bg);
  min-height: calc(100vh - 64px);
  padding: 68px 72px 64px 280px;
}

.sidebar {
  position: fixed;
  top: 64px;
  bottom: 0;
  left: 0;
  width: 240px;
  background: #2e3347;
  color: #cdd2e6;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 18px;
}

.brand-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.08em;
}

.brand-meta {
  display: grid;
  gap: 4px;
}

.brand-meta strong {
  color: #ffffff;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.brand-meta span {
  font-size: 0.82rem;
  color: rgba(205, 210, 230, 0.72);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav h3 {
  margin: 16px 12px 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(205, 210, 230, 0.75);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 6px;
  border-radius: 10px;
  color: #cdd2e6;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  color: #ffffff;
  background: rgba(76, 125, 240, 0.28);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 12px 8px;
  font-size: 0.84rem;
  color: rgba(205, 210, 230, 0.7);
  line-height: 1.5;
}

.sidebar-support {
  font-weight: 600;
  color: #ffffff;
}

.content-area {
  width: min(1180px, 100%);
  margin: 0;
  padding: 32px 40px 56px;
  display: grid;
  gap: 32px;
  align-content: start;
}

.content-area section,
.content-area .panel {
  scroll-margin-top: 88px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(226, 231, 244, 0.9);
}

.page-title {
  display: grid;
  gap: 8px;
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
  color: #1a2340;
  letter-spacing: -0.01em;
}

.account {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}

.notify-button {
  gap: 6px;
}

.notify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.notify-button .notify-badge[hidden] {
  display: none;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid rgba(76, 125, 240, 0.35);
  padding: 8px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  background: #eef1ff;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.12s ease, background 0.2s ease;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(76, 125, 240, 0.18);
  background: #e5ecff;
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(76, 125, 240, 0.18);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.logout-btn {
  background: #ffe9ef;
  border-color: rgba(221, 74, 104, 0.38);
  color: #d53c5a;
}

.secondary-btn {
  background: #f2f5ff;
  border-color: rgba(76, 125, 240, 0.4);
  color: var(--accent-ink);
}

.danger-btn {
  background: #fff2e5;
  border-color: rgba(240, 178, 75, 0.38);
  color: #a15b12;
}

.status {
  min-height: 2.4rem;
  display: inline-flex;
  align-items: center;
  padding: 14px 22px;
  border-radius: 14px;
  background: #ecf8f1;
  border: 1px solid rgba(54, 201, 140, 0.25);
  color: #237a55;
  font-size: 0.94rem;
  width: 100%;
  box-sizing: border-box;
}

.status:empty {
  display: none;
}

.status.error {
  background: #fcebee;
  border-color: rgba(221, 74, 104, 0.32);
  color: #c23d4e;
}

.status.success {
  background: #e2f6eb;
  border-color: rgba(54, 201, 140, 0.32);
  color: #1c7c52;
}

#teacher-panels,
#normal-panels {
  display: grid;
  gap: 20px;
}

.panel-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 24px;
  display: grid;
  gap: 20px;
  box-shadow: var(--panel-shadow);
}

.panel h2 {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.panel h3 {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-dim);
}

.summary-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.summary-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  border: 1px solid rgba(160, 176, 220, 0.28);
  padding: 20px;
  display: grid;
  gap: 12px;
  min-height: 112px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.22s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(45, 69, 140, 0.14);
}

.summary-label {
  font-size: 0.8rem;
  color: rgba(53, 65, 112, 0.62);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1d2642;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.summary-sub {
  font-size: 0.84rem;
  color: rgba(43, 53, 96, 0.55);
}

.status-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(137, 150, 189, 0.28);
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.96), rgba(238, 242, 255, 0.88));
  display: grid;
  gap: 10px;
  font-size: 0.94rem;
  color: var(--text);
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-line strong {
  font-weight: 600;
  color: var(--text);
}

.status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.status-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-note {
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.5;
}


.license-overview {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.license-metric {
  background: var(--surface-soft);
  border-radius: 14px;
  border: 1px solid rgba(160, 176, 220, 0.28);
  padding: 16px;
  display: grid;
  gap: 8px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.22s ease;
}


.license-metric strong {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.license-metric span {
  font-size: 0.82rem;
  color: rgba(40, 52, 104, 0.62);
}

.license-metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(45, 69, 140, 0.14);
}

.subsection {
  display: grid;
  gap: 12px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(144, 160, 209, 0.32);
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-dim);
}

label input,
label select,
label textarea {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 12px;
  font-size: 0.95rem;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

label textarea {
  padding: 12px;
  min-height: 108px;
}

label input:focus,
label select:focus,
label textarea:focus {
  outline: none;
  border-color: rgba(76, 125, 240, 0.6);
  box-shadow: 0 0 0 3px rgba(76, 125, 240, 0.15);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(226, 231, 244, 0.9);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(33, 43, 90, 0.06);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.table-pagination-info {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.table-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-pagination-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-pagination-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.table-pagination select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(137, 150, 189, 0.42);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text);
}

.table-pagination select:focus {
  outline: none;
  border-color: rgba(76, 125, 240, 0.6);
  box-shadow: 0 0 0 3px rgba(76, 125, 240, 0.15);
}

.pagination-btn {
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 680px;
  color: var(--text);
  font-size: 0.94rem;
}

thead th {
  background: var(--table-head);
  color: var(--text-dim);
  font-weight: 600;
  text-align: left;
  font-size: 0.78rem;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: #3a4052;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(76, 125, 240, 0.08);
}

#pending-panel table th:nth-child(1),
#pending-panel table td:nth-child(1) {
  width: 20%;
}

#pending-panel table th:nth-child(2),
#pending-panel table td:nth-child(2) {
  width: 32%;
}

#pending-panel table th:nth-child(3),
#pending-panel table td:nth-child(3) {
  width: 20%;
}

#pending-panel table th:nth-child(4),
#pending-panel table td:nth-child(4) {
  width: 20%;
  text-align: left;
}

#pending-panel table th:nth-child(5),
#pending-panel table td:nth-child(5) {
  width: 10%;
  text-align: center;
}

#pending-panel .inline-actions {
  justify-content: flex-start;
}

#service-terms table th:nth-child(1),
#service-terms table td:nth-child(1) {
  width: 6%;
  text-align: center;
}

#service-terms table th:nth-child(2),
#service-terms table td:nth-child(2) {
  width: 13%;
}

#service-terms table th:nth-child(3),
#service-terms table td:nth-child(3) {
  width: 15%;
}

#service-terms table th:nth-child(4),
#service-terms table td:nth-child(4) {
  width: 14%;
}

#service-terms table th:nth-child(5),
#service-terms table td:nth-child(5) {
  width: 6%;
}

#service-terms table th:nth-child(6),
#service-terms table td:nth-child(6) {
  width: 12%;
}

#service-terms table th:nth-child(7),
#service-terms table td:nth-child(7) {
  width: 18%;
  text-align: left;
  white-space: nowrap;
}

#service-terms table th:nth-child(8),
#service-terms table td:nth-child(8) {
  width: 10%;
  text-align: center;
}

#student-memberships table {
  min-width: 600px;
}

#student-memberships table th:nth-child(1),
#student-memberships table td:nth-child(1) {
  width: 24%;
}

#student-memberships table th:nth-child(2),
#student-memberships table td:nth-child(2) {
  width: 12%;
  text-align: center;
  white-space: nowrap;
}

#student-memberships table th:nth-child(3),
#student-memberships table td:nth-child(3) {
  width: 18%;
}

#student-memberships table th:nth-child(4),
#student-memberships table td:nth-child(4) {
  width: 18%;
}

#student-memberships table th:nth-child(5),
#student-memberships table td:nth-child(5) {
  width: 12%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#student-memberships table th:nth-child(6),
#student-memberships table td:nth-child(6) {
  width: 16%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#student-memberships table td:nth-child(1) {
  font-weight: 600;
}

#student-memberships table td.status-col {
  text-align: center;
}

.status-badge {
  white-space: nowrap;
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--text-dim);
  background: var(--surface);
  border-radius: 12px;
  border: 1px dashed rgba(137, 150, 189, 0.4);
}

.channel-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.channel-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  border: 1px solid rgba(160, 176, 220, 0.28);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.22s ease;
  min-height: 140px;
}

/* 标题行样式 */
.channel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.channel-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  flex: 1;
}

/* 有效期标签样式 */
.expire-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: #2d9068;
  background: rgba(54, 201, 140, 0.1);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(54, 201, 140, 0.2);
  white-space: nowrap;
}

.channel-meta {
  display: grid;
  gap: 8px;
  font-size: 0.84rem;
  color: rgba(40, 52, 104, 0.6);
}

/* 余额信息样式 */
.channel-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
}

.balance-label {
  font-size: 0.78rem;
  color: rgba(40, 52, 104, 0.5);
  font-weight: 500;
}

.balance-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

/* 不可用状态样式 */
.channel-status-unavailable {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
}

.status-label {
  font-size: 0.78rem;
  color: rgba(40, 52, 104, 0.5);
  font-weight: 500;
}

.status-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--danger);
}

/* 单价信息样式 */
.channel-pricing {
  margin: 6px 0;
}

.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.price-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  background: rgba(76, 125, 240, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(76, 125, 240, 0.1);
}

.price-type {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
}

.price-value {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}


/* 原因信息样式 */
.reason-info {
  padding: 8px 12px;
  background: rgba(221, 74, 104, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(221, 74, 104, 0.18);
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 500;
}

.channel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(45, 69, 140, 0.14);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  border: 1px solid rgba(77, 99, 255, 0.12);
}

.status-badge.apply {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.passed {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.activated {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.pending {
  background: rgba(76, 125, 240, 0.12);
  color: var(--accent);
}

.status-badge.reject {
  background: var(--danger-soft);
  color: var(--danger);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

#pending-panel .inline-actions,
#service-terms .inline-actions {
  flex-wrap: nowrap;
}

@media (max-width: 960px) {
  #pending-panel .inline-actions,
  #service-terms .inline-actions {
    flex-wrap: wrap;
  }
  #service-terms table td:nth-child(7) {
    white-space: normal;
  }
}

.term-date-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}

.term-date-main {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.term-date-time {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.inline-threshold {
  width: 92px;
  padding: 6px 8px;
  font-size: 0.82rem;
  border: 1px solid rgba(137, 150, 189, 0.4);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.inline-threshold::-webkit-outer-spin-button,
.inline-threshold::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.inline-threshold {
  -moz-appearance: textfield;
}

.inline-threshold:disabled {
  background: var(--surface-soft);
  color: var(--text-dim);
  cursor: not-allowed;
}

.term-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

button.small {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.toolbar-count {
  font-size: 0.86rem;
  color: var(--text-dim);
  background: var(--surface-soft);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(137, 150, 189, 0.44);
}

.cost-details {
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid rgba(137, 150, 189, 0.28);
  box-shadow: 0 6px 18px rgba(33, 43, 90, 0.06);
  overflow-x: auto;
}

.cost-details table {
  min-width: 520px;
}

.cost-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.cost-summary strong {
  color: var(--accent-ink);
  font-size: 1rem;
}

.cost-table thead th {
  text-transform: none;
  font-size: 0.82rem;
}

.cost-table thead th.amount,
.cost-table tbody td.amount {
  text-align: right;
  white-space: nowrap;
}

.cost-table tbody td.amount {
  font-weight: 600;
}

.cost-table tbody td.job-ref {
  color: var(--text-dim);
  font-size: 0.85rem;
}

input[type='checkbox'] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(137, 150, 189, 0.6);
  accent-color: var(--accent);
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(19, 24, 44, 0.45);
  backdrop-filter: blur(4px);
  padding: 32px 20px;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-window {
  width: min(960px, 100%);
  max-height: calc(100vh - 64px);
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid rgba(226, 231, 244, 0.95);
  box-shadow: 0 24px 80px rgba(25, 30, 63, 0.32);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(226, 231, 244, 0.9);
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding-block: 4px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  background: rgba(76, 125, 240, 0.08);
  color: var(--accent-ink);
}

.modal-close:focus-visible {
  outline: 2px solid rgba(76, 125, 240, 0.45);
  outline-offset: 2px;
}

@media (max-width: 1080px) {
  .sidebar {
    width: 200px;
  }

  .main {
    padding: 64px 56px 48px 224px;
  }

  .content-area {
    padding: 28px 32px 40px;
  }
}

@media (max-width: 900px) {
  .topbar {
    padding: 0 20px;
  }

  .main {
    padding-left: 0;
  }

  .sidebar {
    position: fixed;
    inset-inline: 0;
    top: 64px;
    width: 100%;
    height: auto;
    max-height: 240px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(46, 51, 71, 0.98);
    overflow-x: auto;
    overflow-y: auto;
  }

  .sidebar-brand {
    width: 100%;
    justify-content: space-between;
    padding-bottom: 8px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .sidebar-nav h3 {
    margin: 8px 12px 0 0;
    width: auto;
  }

  .content-area {
    padding: 112px 24px 40px;
    min-height: calc(100vh - 64px);
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
  }

  .content-area {
    padding: 140px 20px 36px;
  }

  .page-actions,
  button {
    width: 100%;
  }

  table {
    min-width: 520px;
  }
}

body.is-student .sidebar {
  display: none;
}

body.is-student .main {
  padding: 64px 24px 56px;
}

body.is-student .content-area {
  padding: 32px 24px 48px;
  width: min(720px, 100%);
  margin: 0 auto;
}

body.is-student #refresh-btn {
  display: none;
}

body.is-student .page-header {
  align-items: center;
  justify-content: center;
  text-align: center;
}

body.is-student .page-title {
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-right: 24px;
}

body.is-student .page-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-left: 0;
}

body.is-student #open-bind-modal {
  display: none !important;
}

body.is-student #teacher-panels,
body.is-student .sidebar-nav,
body.is-student .sidebar-brand,
body.is-student .sidebar-footer {
  display: none !important;
}

body.is-teacher #normal-panels {
  display: none !important;
}

body.show-cost-overview #teacher-page-header,
body.show-cost-overview #page-top,
body.show-cost-overview #teacher-panels {
  display: none !important;
}

body.show-cost-overview #cost-overview {
  display: block;
}
