:root {
  --page: #F8FAFC;
  --panel: #FFFFFF;
  --panel-soft: #F1F5F9;
  --mint: #D1FAE5;
  --mint-dark: #047857;
  --ink: #0F172A;
  --muted: #64748B;
  --subtle: #94A3B8;
  --dark: #155E75;
  --dark-hover: #0E7490;
  --orange: #F59E0B;
  --orange-dark: #B45309;
  --orange-soft: #FEF3C7;
  --orange-button: #F59E0B;
  --orange-hover: #FBBF24;
  --line: #E2E8F0;
  --sidebar: #ECFEFF;
  --sidebar-line: #BAE6FD;
  --focus: rgba(21, 94, 117, 0.28);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.is-hidden {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 22% 18%, rgba(16, 185, 129, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(236, 254, 255, 0.96), rgba(248, 250, 252, 0.94) 44%, rgba(254, 243, 199, 0.36)),
    var(--page);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  gap: 18px;
  width: min(980px, 100%);
  align-items: stretch;
}

.login-copy,
.login-card {
  display: grid;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-copy {
  align-content: center;
  gap: 18px;
  min-height: 420px;
  background: linear-gradient(135deg, #FFFFFF 0%, #ECFEFF 58%, #F0FDFA 100%);
}

.login-copy img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.login-copy h1 {
  max-width: 520px;
  font-size: 34px;
  line-height: 1.18;
}

.login-copy p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.85;
}

.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-points span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  color: var(--dark);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #BAE6FD;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.login-card {
  align-content: center;
  gap: 16px;
}

.login-title {
  margin-bottom: 4px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
}

.code-row .ghost-button {
  height: 40px;
  padding: 0 10px;
}

.login-error {
  min-height: 18px;
  margin: -2px 0 0;
  color: #DC2626;
  font-size: 13px;
  font-weight: 800;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-strip div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-strip strong {
  font-size: 13px;
}

.shell {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: 72px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-foot span,
.eyebrow,
small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: var(--panel);
  border-color: var(--line);
}

.nav-item.active {
  color: var(--dark);
  border-color: #67E8F9;
  box-shadow: inset 3px 0 0 var(--dark);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar-foot strong {
  display: block;
  margin-top: 4px;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.top-actions,
menu {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.icon-button {
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  letter-spacing: 0;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  background: var(--orange-button);
  border-color: #D97706;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.22);
}

.primary-button:hover {
  background: var(--orange-hover);
  border-color: #F59E0B;
  box-shadow: 0 10px 22px rgba(245, 158, 11, 0.28);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
  text-decoration: none;
}

.ghost-button:hover {
  background: #ECFEFF;
  border-color: #67E8F9;
  box-shadow: 0 8px 18px rgba(21, 94, 117, 0.09);
}

.primary-button:active,
.ghost-button:active,
.icon-button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--panel);
  border-color: var(--line);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  background: #ECFEFF;
  border-color: #67E8F9;
}

.top-actions .primary-button,
.top-actions .ghost-button,
.table-toolbar .primary-button,
.import-box .ghost-button,
.form-grid .primary-button {
  min-width: 108px;
}

.action-button {
  white-space: nowrap;
}

.small-button {
  height: 32px;
  min-width: 64px;
  padding: 0 12px;
  font-size: 12px;
}

#logout-button {
  color: #B91C1C;
  background: #FEF2F2;
  border-color: #FECACA;
}

#logout-button:hover {
  color: #991B1B;
  background: #FEE2E2;
  border-color: #FCA5A5;
}

.wide {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.stat-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.stat-card strong {
  font-size: 30px;
}

.stat-card.mint {
  background: #ECFDF5;
}

.stat-card.orange {
  background: var(--orange-soft);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.panel {
  padding: 20px;
}

.panel-head,
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 0 0 16px;
  padding: 14px;
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filter-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 40px;
}

.filter-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty-cell {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.page-size-control,
.page-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.page-size-control select {
  width: 86px;
}

#code-page-info {
  min-width: 92px;
  color: var(--ink);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  font-size: 12px;
  font-weight: 800;
}

.badge.success,
.status-normal {
  color: var(--mint-dark);
  background: var(--mint);
}

.timeline,
.rule-list,
.subject-grid {
  display: grid;
  gap: 10px;
}

.timeline div,
.rule-list div,
.subject-grid div {
  display: grid;
  gap: 4px;
  padding: 13px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline span,
.rule-list span,
.subject-grid span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.accent-panel {
  background: linear-gradient(135deg, #FFFFFF 0%, #ECFEFF 54%, #ECFDF5 100%);
}

.permission-model {
  display: grid;
  grid-template-columns: 1fr 20px 1fr 20px 1fr 20px 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
}

.permission-model span {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  text-align: center;
}

.permission-model i {
  height: 2px;
  background: var(--dark);
}

.search-box,
.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box {
  min-width: 260px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--dark);
  box-shadow: 0 0 0 3px rgba(21, 94, 117, 0.12);
}

input,
select {
  height: 40px;
}

input[type="file"] {
  height: auto;
  min-height: 44px;
  padding: 7px;
  background: var(--panel-soft);
}

input[type="file"]::file-selector-button {
  height: 30px;
  margin-right: 12px;
  padding: 0 12px;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

input[type="file"]::file-selector-button:hover {
  background: #ECFEFF;
  border-color: #67E8F9;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 800;
}

.pill.neutral {
  background: var(--panel-soft);
  color: var(--muted);
}

.pill.warning {
  background: #FEF3C7;
  color: var(--orange-dark);
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.permission-checks,
.form-message {
  grid-column: 1 / -1;
}

.import-box {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.import-box .ghost-button {
  height: 42px;
  justify-content: center;
}

.import-box a.ghost-button {
  color: var(--mint-dark);
  background: #ECFDF5;
  border-color: #A7F3D0;
}

.import-box a.ghost-button:hover {
  background: #D1FAE5;
  border-color: #6EE7B7;
}

#question-excel-button {
  color: var(--orange-dark);
  background: #FFFBEB;
  border-color: #FDE68A;
}

#question-excel-button:hover {
  background: #FEF3C7;
  border-color: #FCD34D;
}

#questions-table td:nth-child(3),
#questions-table td:nth-child(4) {
  min-width: 240px;
  max-width: 420px;
  white-space: normal;
  line-height: 1.55;
}

.permission-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.permission-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.permission-checks input {
  width: 16px;
  height: 16px;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--orange-dark);
  font-size: 13px;
  font-weight: 800;
}

.modal {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.modal-card {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

menu {
  justify-content: flex-end;
  padding: 0;
  margin: 18px 0 0;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: block;
    padding: 12px;
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    text-align: center;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .table-toolbar,
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .split-layout,
  .form-grid,
  .login-layout,
  .filter-panel,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: auto;
  }

  .login-copy h1 {
    font-size: 28px;
  }

  .search-box {
    min-width: 0;
  }

  .permission-model {
    grid-template-columns: 1fr;
  }

  .permission-model i {
    width: 2px;
    height: 16px;
    margin: auto;
  }
}
