:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17375e;
  background: #f3f7fc;
  font-synthesis: none;
  --brand-blue: #1768e8;
  --brand-blue-dark: #114fae;
  --brand-blue-soft: #eaf4ff;
  --brand-orange: #ef6b21;
  --ink: #17375e;
  --muted: #6f8197;
  --border: #dce7f3;
  --surface: #ffffff;
  --success: #238f4d;
  --success-soft: #eaf8ef;
  --warning: #b85a10;
  --warning-soft: #fff4e8;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 14px 38px rgba(26, 79, 145, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #f3f7fc;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 0%, rgba(29, 145, 255, 0.13), transparent 28%),
    linear-gradient(180deg, #eef6ff 0, #f7f9fc 420px, #f4f7fb 100%);
  color: var(--ink);
}

a {
  color: var(--brand-blue-dark);
}

button,
input,
select {
  font: inherit;
}

button,
.button {
  min-height: 44px;
}

:focus-visible {
  outline: 3px solid rgba(23, 104, 232, 0.25);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand-blue-dark);
  box-shadow: var(--shadow);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #1168ec 0%, #155ad4 64%, #214eb4 100%);
  box-shadow: 0 10px 28px rgba(17, 78, 174, 0.2);
}

.header-shell {
  display: grid;
  width: 100%;
  min-height: 72px;
  margin: 0 auto;
  padding: 10px 28px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: #ffffff;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(7, 50, 123, 0.22);
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 17px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-link.active {
  background: #ffffff;
  color: var(--brand-blue-dark);
  box-shadow: 0 6px 16px rgba(7, 48, 122, 0.16);
}

.admin-shell {
  display: grid;
  width: 100%;
  min-height: calc(100vh - 72px);
  grid-template-columns: 244px minmax(0, 1fr);
}

.admin-main {
  width: 100%;
  max-width: 1360px;
  min-width: 0;
  margin: 0;
  padding: 30px 24px 56px;
}

.side-navigation {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  padding: 26px 18px 30px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
}

.mobile-navigation {
  display: none;
}

.nav-tree {
  display: grid;
  gap: 22px;
}

.nav-group {
  display: grid;
  gap: 5px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.nav-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.nav-group-title {
  margin: 0 0 7px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #e7eff7;
  color: #51677e;
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.side-nav-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #48647f;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.side-nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  object-fit: contain;
  filter: invert(43%) sepia(13%) saturate(1049%) hue-rotate(166deg) brightness(97%) contrast(86%);
  opacity: 0.92;
}

.side-nav-link:hover {
  border-color: #d7e7f8;
  background: #f4f9ff;
  color: var(--brand-blue-dark);
}

.side-nav-link.active {
  border-color: #d7e8fb;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  box-shadow: inset 3px 0 0 var(--brand-blue);
}

.side-nav-link:hover .side-nav-icon,
.side-nav-link.active .side-nav-icon {
  filter: invert(38%) sepia(99%) saturate(1847%) hue-rotate(198deg) brightness(93%) contrast(94%);
  opacity: 1;
}

.nav-pending-approval:not(.active) .side-nav-icon {
  filter: invert(54%) sepia(95%) saturate(2771%) hue-rotate(346deg) brightness(101%) contrast(101%);
  opacity: 1;
}

.nav-waiting-download:not(.active) .side-nav-icon {
  filter: invert(38%) sepia(99%) saturate(1847%) hue-rotate(198deg) brightness(93%) contrast(94%);
  opacity: 0.94;
}

body:has(#recent-activity:target) .nav-overview,
body:has(#unit-settings:target) .nav-overview,
body:has(#grade-presets:target) .nav-overview,
body:has(#create-user:target) .nav-user-list,
body:has(#import-users:target) .nav-user-list,
body:has(#binding-code:target) .nav-device-status,
body:has(#binding-history:target) .nav-device-status {
  border-color: transparent;
  background: transparent;
  color: #48647f;
  box-shadow: none;
}

body:has(#recent-activity:target) .nav-overview .side-nav-icon,
body:has(#unit-settings:target) .nav-overview .side-nav-icon,
body:has(#grade-presets:target) .nav-overview .side-nav-icon,
body:has(#create-user:target) .nav-user-list .side-nav-icon,
body:has(#import-users:target) .nav-user-list .side-nav-icon,
body:has(#binding-code:target) .nav-device-status .side-nav-icon,
body:has(#binding-history:target) .nav-device-status .side-nav-icon {
  filter: invert(43%) sepia(13%) saturate(1049%) hue-rotate(166deg) brightness(97%) contrast(86%);
  opacity: 0.92;
}

body:has(#recent-activity:target) .nav-recent-activity,
body:has(#unit-settings:target) .nav-unit-settings,
body:has(#grade-presets:target) .nav-grade-presets,
body:has(#create-user:target) .nav-create-user,
body:has(#import-users:target) .nav-import-users,
body:has(#user-list:target) .nav-user-list,
body:has(#binding-code:target) .nav-binding-code,
body:has(#device-status:target) .nav-device-status,
body:has(#binding-history:target) .nav-binding-history {
  border-color: #d7e8fb;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  box-shadow: inset 3px 0 0 var(--brand-blue);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading-copy {
  min-width: 0;
}

.eyebrow,
.page-context {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0;
  color: var(--brand-blue-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

h1 {
  margin: 8px 0 0;
  color: #15385f;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0 0 8px;
  color: #183b62;
  font-size: 21px;
}

p {
  line-height: 1.65;
}

.muted {
  color: var(--muted);
}

.page-intro {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
}

.panel,
.metric {
  border: 1px solid rgba(66, 126, 203, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.panel {
  margin-bottom: 20px;
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-heading h2,
.panel-heading p {
  margin-top: 0;
}

.grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-grid {
  gap: 0;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid rgba(66, 126, 203, 0.14);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  display: grid;
  min-height: 124px;
  padding: 19px;
  align-content: space-between;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  text-decoration: none;
}

.metric::after {
  display: none;
}

.metric:hover {
  background: #f5faff;
}

.metric.attention {
  background: linear-gradient(145deg, #ffffff, #fff7ef);
}

.metric:last-child {
  border-right: 0;
}

.metric-value {
  color: var(--brand-blue);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric.attention .metric-value {
  color: var(--brand-orange);
}

.metric-label {
  color: #506985;
  font-size: 14px;
  font-weight: 700;
}

.metric-hint {
  color: #8796a7;
  font-size: 12px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-link {
  display: grid;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fbff;
  color: var(--ink);
  text-decoration: none;
  gap: 4px;
}

.quick-link strong {
  color: var(--brand-blue-dark);
}

.quick-link span {
  color: var(--muted);
  font-size: 13px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.orders-table {
  min-width: 1050px;
}

.orders-table th:last-child,
.orders-table td:last-child {
  width: 330px;
}

.orders-page-heading {
  margin-bottom: 14px;
}

.orders-filter-panel {
  padding: 16px 18px;
}

.scope-form.order-scope-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.order-scope-form .scope-search {
  grid-column: auto;
}

.order-filter-actions {
  display: flex;
  grid-column: span 2;
  align-self: end;
  justify-content: flex-end;
  gap: 10px;
}

.orders-list-panel {
  padding: 18px;
}

.orders-list-heading {
  align-items: center;
  margin-bottom: 12px;
}

.orders-list-heading h2 {
  margin: 0;
}

.orders-result-count {
  color: var(--muted);
  font-size: 13px;
}

.orders-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.orders-pagination-top {
  margin-bottom: 12px;
}

.orders-pagination-bottom {
  margin-top: 14px;
}

.orders-pagination-summary {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.orders-pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.orders-page-link {
  display: inline-flex;
  min-width: 36px;
  min-height: 36px;
  padding: 7px 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b8cde5;
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand-blue-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.orders-page-link:hover,
.orders-page-link:focus-visible {
  border-color: var(--brand-blue);
  background: #f1f7ff;
}

.orders-page-link.current {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
  color: #ffffff;
}

.orders-page-link.disabled {
  border-color: #dce6f0;
  background: #f5f8fb;
  color: #9aaabd;
  cursor: not-allowed;
}

.orders-page-step {
  min-width: 68px;
}

.orders-page-ellipsis {
  min-width: 20px;
  color: var(--muted);
  text-align: center;
}

.orders-table-scroll {
  border-radius: 12px;
}

.orders-table-scroll,
.users-table-scroll,
.statistics-table-scroll {
  max-height: min(62vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
}

.orders-table-scroll .orders-flat-table thead th,
.users-table-scroll .users-table thead th,
.statistics-table-scroll .statistics-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  background: #f1f7fd;
  box-shadow: 0 1px 0 var(--border);
}

.orders-scroll-top,
.users-scroll-top,
.statistics-scroll-top {
  max-width: 100%;
  height: 16px;
  margin: 0 2px 7px;
  overflow-x: auto;
  overflow-y: hidden;
}

.orders-scroll-top-spacer,
.users-scroll-top-spacer,
.statistics-scroll-top-spacer {
  height: 1px;
}

.users-scroll-top {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
}

.orders-flat-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.orders-flat-table th,
.orders-flat-table td {
  padding: 9px;
  vertical-align: middle;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}

.orders-flat-table th:last-child,
.orders-flat-table .orders-action-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  border-left: 1px solid var(--border);
  background: #ffffff;
  box-shadow: -8px 0 18px rgba(38, 77, 122, 0.06);
}

.orders-flat-table th:last-child {
  z-index: 4;
  background: #f1f7fd;
}

.orders-flat-table tbody tr:hover .orders-action-cell {
  background: #fbfdff;
}

.order-no-cell,
.order-phone,
.orders-flat-table time {
  white-space: nowrap;
}

.order-approver-name {
  overflow-wrap: normal;
}

.order-no-cell {
  color: var(--brand-blue-dark);
  font-variant-numeric: tabular-nums;
}

.compact-cell-stack,
.compact-file-list,
.compact-print-list {
  display: grid;
  width: max-content;
  min-width: max-content;
  margin-inline: auto;
  gap: 3px;
  justify-items: center;
  text-align: center;
}

.compact-file-list,
.compact-print-list {
  overflow: visible;
}

.order-file-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
}

.order-file-name,
.compact-print-list > span {
  display: block;
  width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.order-file-name {
  color: #274b74;
}

.compact-print-list {
  color: #4e6681;
}

.scope-form.statistics-filter-form {
  grid-template-columns: minmax(170px, 0.85fr) minmax(280px, 1.35fr) repeat(2, minmax(180px, 0.85fr)) max-content;
}

.statistics-filter-form .scope-search {
  grid-column: auto;
}

.statistics-filter-actions {
  grid-column: auto;
  flex-wrap: nowrap;
}

.statistics-export {
  white-space: nowrap;
}

.metric-grid.statistics-metric-grid {
  grid-template-columns: repeat(3, minmax(0, 0.65fr)) minmax(400px, 2.05fr);
  margin-bottom: 20px;
}

.statistics-summary-metric {
  min-height: 168px;
  grid-template-rows: auto minmax(64px, 1fr) auto;
  align-content: stretch;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.statistics-summary-label {
  color: #60758d;
  font-size: 13px;
  font-weight: 700;
}

.statistics-summary-value {
  align-self: center;
  max-width: 100%;
  color: var(--brand-blue-dark);
  font-size: clamp(40px, 3.2vw, 54px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.statistics-summary-pair {
  font-size: clamp(24px, 2.6vw, 40px);
  line-height: 1.1;
}

.statistics-summary-value .statistics-not-output,
.statistics-paper-usage-metric .statistics-not-output {
  color: var(--danger);
}

.statistics-summary-metric.success .statistics-summary-value {
  color: #118758;
}

.statistics-summary-metric.info .statistics-summary-value {
  color: #1768e8;
}

.statistics-summary-hint {
  color: #8b99a9;
  font-size: 11px;
  line-height: 1.35;
}

.statistics-paper-usage-metric {
  gap: 10px;
  align-content: start;
  text-align: center;
}

.statistics-paper-usage-total {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  padding: 10px 14px;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(23, 104, 232, 0.2);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-blue-soft), #f7fbff);
  box-shadow: inset 4px 0 0 var(--brand-blue);
  color: #385774;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.statistics-paper-usage-total strong {
  min-width: 0;
  color: var(--brand-blue-dark);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  overflow-wrap: anywhere;
}

.statistics-paper-usage-total > span:last-child {
  color: #506985;
  font-size: 12px;
  font-weight: 500;
}

.statistics-paper-usage-list {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
}

.statistics-paper-usage-list > div {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.statistics-paper-usage-list dt,
.statistics-paper-usage-list dd {
  margin: 0;
}

.statistics-paper-usage-list dt {
  overflow: hidden;
  color: #506985;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-paper-usage-list dd {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  align-items: baseline;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.statistics-paper-usage-list dd strong {
  min-width: 0;
  color: var(--brand-blue);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.statistics-paper-usage-list dd > span {
  color: var(--muted);
  font-size: 12px;
}

.statistics-list-heading {
  align-items: flex-start;
}

.statistics-list-heading p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.statistics-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.statistics-table th,
.statistics-table td {
  padding: 9px;
  vertical-align: middle;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}

.statistics-table time,
.statistics-table .order-phone,
.statistics-paper-count {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.statistics-value-list {
  display: grid;
  width: max-content;
  min-width: max-content;
  margin-inline: auto;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.statistics-value-list > span {
  white-space: nowrap;
  overflow-wrap: normal;
}

.order-reject-note {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: 11px;
  cursor: help;
}

.order-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.order-row-actions form {
  margin: 0;
}

.grade-preset-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.compact-action {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12px;
}

.order-reject-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(12, 43, 82, 0.28);
}

.order-reject-dialog::backdrop {
  background: rgba(10, 35, 65, 0.45);
  backdrop-filter: blur(2px);
}

.order-reject-dialog-form {
  display: grid;
  padding: 22px;
  gap: 12px;
}

.order-reject-dialog-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.order-reject-dialog-heading h2 {
  margin: 0;
}

.order-reject-dialog-heading span {
  color: var(--muted);
  font-size: 12px;
}

.order-reject-dialog label {
  font-size: 13px;
  font-weight: 700;
}

.order-reject-dialog textarea {
  width: 100%;
  min-height: 112px;
  padding: 11px;
  resize: vertical;
  border: 1px solid #b8c8da;
  border-radius: 11px;
  color: var(--ink);
  font: inherit;
}

.order-reject-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.users-table {
  min-width: 1120px;
  table-layout: fixed;
}

.users-page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.users-page .page-heading,
.users-page .section-heading {
  justify-content: center;
  text-align: center;
}

.users-list-panel {
  padding: 18px;
}

.users-table-scroll {
  border-radius: 12px;
}

.users-table th,
.users-table td {
  padding: 10px 8px;
  text-align: center;
}

.users-table td {
  overflow-wrap: anywhere;
}

.users-table th:nth-child(1) { width: 7%; }
.users-table th:nth-child(2) { width: 10%; }
.users-table th:nth-child(3) { width: 11%; }
.users-table th:nth-child(4) { width: 7%; }
.users-table th:nth-child(5) { width: 9%; }
.users-table th:nth-child(6) { width: 10%; }
.users-table th:nth-child(7) { width: 9%; }
.users-table th:nth-child(8) { width: 9%; }
.users-table th:nth-child(9) { width: 13%; }
.users-table th:nth-child(10) { width: 15%; }

.users-table.editing-active {
  min-width: 1650px;
}

.users-table.editing-active th:nth-child(1) { width: 150px; }
.users-table.editing-active th:nth-child(2) { width: 190px; }
.users-table.editing-active th:nth-child(3) { width: 140px; }
.users-table.editing-active th:nth-child(4) { width: 260px; }
.users-table.editing-active th:nth-child(5) { width: 150px; }
.users-table.editing-active th:nth-child(6) { width: 145px; }
.users-table.editing-active th:nth-child(7) { width: 160px; }
.users-table.editing-active th:nth-child(8) { width: 120px; }
.users-table.editing-active th:nth-child(9) { width: 175px; }
.users-table.editing-active th:nth-child(10) { width: 160px; }

.users-table th:nth-child(2),
.users-table td:nth-child(2),
.users-table th:nth-child(9),
.users-table td:nth-child(9) {
  white-space: nowrap;
}

.users-table .action-group {
  justify-content: center;
  gap: 6px;
}

.users-table .action-group .button {
  padding-right: 10px;
  padding-left: 10px;
}

.device-table {
  min-width: 1120px;
}

.binding-code-table {
  min-width: 980px;
}

.grade-preset-table {
  min-width: 1080px;
}

.audit-table {
  min-width: 900px;
  table-layout: fixed;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 145px;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 130px;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 160px;
}

.audit-table td:nth-child(3),
.audit-table td:nth-child(4) {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.audit-table time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid #e8eef5;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
}

th {
  background: #f1f7fd;
  color: #4b6582;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfdff;
}

.status-badge,
.state-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.success,
.state-badge {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.attention {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.muted,
.state-badge.unbound {
  background: #eef1f5;
  color: #5e6b79;
}

.status-message {
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid #bfe3cb;
  border-left: 4px solid var(--success);
  border-radius: 12px;
  background: var(--success-soft);
  color: #176a39;
}

.status-message.error {
  border-color: #f2c0bb;
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: #7a271a;
}

.factory-empty-hint {
  max-width: 680px;
  padding: 12px 14px;
  border: 1px solid #f0d7a5;
  border-radius: 11px;
  background: var(--warning-soft);
  color: #73510c;
  font-size: 13px;
  line-height: 1.6;
}

.filter-bar,
.compact-form,
.device-binding-form,
.merchant-switcher,
.form-actions,
.action-group,
.approval-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-bar,
.compact-form,
.device-binding-form {
  flex-wrap: wrap;
}

.filter-field,
.field {
  display: grid;
  gap: 6px;
  color: #4e6681;
  font-size: 13px;
  font-weight: 700;
}

.filter-field.search-field {
  min-width: min(100%, 280px);
  flex: 1 1 280px;
}

input,
select {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #b8c8da;
  border-radius: 11px;
  background: #ffffff;
  color: var(--ink);
}

input::placeholder {
  color: #94a2b1;
}

.localized-date-control {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.localized-date-trigger {
  display: none;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #b8c8da;
  border-radius: 11px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.localized-date-trigger:hover {
  border-color: #82a9d4;
  background: #f8fbff;
}

.localized-date-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.localized-date-value.is-placeholder {
  color: #94a2b1;
}

.localized-date-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #31597f;
}

.localized-date-control.is-enhanced .localized-date-trigger {
  display: flex;
}

.localized-date-control.is-enhanced .localized-date-native {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.searchable-select-control {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.searchable-select-control > .searchable-select-source {
  display: none;
}

.searchable-select-input {
  width: 100%;
  min-width: 0;
  padding-right: 52px;
  background-color: #ffffff;
}

.searchable-select-toggle {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 46px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: #143c68;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.searchable-select-toggle:hover,
.searchable-select-toggle:focus-visible {
  background: #edf5fd;
}

.searchable-select-toggle:disabled {
  border: 0;
  background: transparent;
  color: #9aa9b8;
  cursor: not-allowed;
}

.searchable-select-control.is-open {
  z-index: 30;
}

.searchable-select-menu {
  position: absolute;
  z-index: 31;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  padding: 6px 0;
  border: 1px solid #c9d7e6;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(20, 60, 104, 0.2);
}

.searchable-select-menu[hidden] {
  display: none;
}

.searchable-select-option {
  display: flex;
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
  background: #edf5fd;
  color: #0f5cae;
}

.searchable-select-option[aria-selected="true"] {
  box-shadow: inset 4px 0 0 var(--brand-blue);
}

.searchable-select-empty {
  display: block;
  padding: 12px 14px;
  color: #6b7f94;
}

.searchable-select-input:invalid {
  border-color: #c65f55;
}

.button,
button {
  display: inline-flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid var(--brand-blue);
  border-radius: 11px;
  background: linear-gradient(135deg, #219df6, #1768e8);
  color: #ffffff;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover,
button:hover {
  background: linear-gradient(135deg, #188be0, #1259c8);
}

.button-secondary {
  border-color: #a8bed6;
  background: #ffffff;
  color: #35536f;
}

.button-secondary:hover {
  background: #edf5fd;
}

.button-danger,
.device-delete-button {
  border-color: #df938c;
  background: #ffffff;
  color: var(--danger);
}

.button-danger:hover,
.device-delete-button:hover {
  background: var(--danger-soft);
}

.button-success {
  border-color: #2e9f59;
  background: #2b9a55;
}

.button-success:hover {
  background: #238348;
}

.button:disabled,
button:disabled {
  border-color: #cbd4df;
  background: #e8edf3;
  color: #7c8998;
  cursor: not-allowed;
}

.filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.audit-filter-actions {
  margin-left: auto;
  align-self: flex-end;
}

.audit-filter-summary {
  margin-bottom: 14px;
}

.summary-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf5ff;
  color: #496986;
  font-size: 12px;
}

.summary-chip.attention {
  background: var(--warning-soft);
  color: var(--warning);
}

.approval-actions {
  min-width: 310px;
  align-items: stretch;
}

.cell-stack,
.print-summary {
  display: grid;
  gap: 4px;
}

.cell-subtext,
.print-summary {
  color: var(--muted);
  font-size: 12px;
}

.print-summary {
  grid-template-columns: repeat(2, minmax(0, max-content));
  column-gap: 12px;
}

.order-file-list {
  display: grid;
  min-width: 430px;
  margin-top: 10px;
  gap: 10px;
}

.order-file-card {
  padding: 11px;
  border: 1px solid #dbe8f6;
  border-radius: 12px;
  background: #f8fbff;
}

.order-file-heading,
.order-file-parameters,
.file-approval-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-file-heading {
  justify-content: space-between;
}

.order-file-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--brand-blue-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-file-parameters {
  flex-wrap: wrap;
  margin-top: 8px;
  color: #4e6681;
  font-size: 12px;
}

.order-file-parameters span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eaf3ff;
}

.order-file-approver,
.order-file-reason {
  margin-top: 8px;
  font-size: 12px;
}

.order-file-reason {
  color: var(--danger);
}

.file-approval-actions {
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 10px;
}

.file-approval-actions form {
  margin: 0;
}

.file-approval-actions .reject-form {
  min-width: 310px;
}

.approval-actions form {
  margin: 0;
}

.reject-form {
  display: flex;
  flex: 1;
  gap: 8px;
}

.reject-form input {
  min-width: 150px;
}

.rejection-reason {
  display: grid;
  gap: 4px;
  color: var(--danger);
}

.rejection-reason small {
  color: var(--muted);
}

.empty-state,
.empty-row {
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 14px;
  align-items: end;
}

.merchant-switcher label {
  color: #4f6781;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.merchant-switcher select,
.merchant-switcher .searchable-select-input {
  min-width: 170px;
}

.checkbox-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.form-submit-field {
  display: grid;
  gap: 6px;
}

.table-checkbox {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
}

.table-checkbox input {
  width: 20px;
  min-height: 20px;
  height: 20px;
}

.checkbox-field input,
.compact-form input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 0;
}

.selected-merchant {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #f4f8fc;
  font-weight: 600;
}

.compact-form label,
.compact-merchant {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.compact-form input[type="file"] {
  flex: 1 1 300px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
}

.users-table td,
.device-table td,
.binding-code-table td {
  vertical-align: middle;
}

.users-table input,
.users-table select {
  min-width: 0;
}

.users-table tr.editing td {
  background: #f4f9ff;
}

.users-table tr[id^="user-"] {
  scroll-margin-block: 96px;
}

.users-table tr:target td {
  background: #eaf8f2;
}

.users-table tr:target td:first-child {
  box-shadow: inset 4px 0 0 #19a974;
}

.subject-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.subject-choice-option {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

.subject-choice-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.subject-choice-option span {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid #cfdeec;
  border-radius: 9px;
  background: #ffffff;
  color: #45617e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.subject-choice-option:hover span {
  border-color: #6da6dc;
  background: #f4f9ff;
}

.subject-choice-option input:checked + span {
  border-color: #1677d2;
  background: #e8f3ff;
  color: #0b5fab;
  box-shadow: 0 0 0 2px rgba(22, 119, 210, 0.12);
}

.subject-choice-option input:focus-visible + span {
  outline: 3px solid rgba(22, 119, 210, 0.24);
  outline-offset: 2px;
}

.subject-choice-option.is-disabled {
  cursor: not-allowed;
}

.subject-choice-option.is-disabled span {
  border-style: dashed;
  background: #f4f6f8;
  color: #94a2af;
}

.inline-form,
.device-delete-form,
.binding-code-delete-form {
  display: inline;
  margin: 0;
}

.protected-note {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.device-binding-form label {
  display: grid;
  min-width: 150px;
  flex: 1 1 150px;
  gap: 6px;
  color: #4e6681;
  font-size: 13px;
  font-weight: 700;
}

.device-binding-form button {
  flex: 0 0 auto;
}

.binding-code-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) repeat(3, minmax(150px, 1fr)) auto;
  align-items: end;
}

.binding-code-form > * {
  min-width: 0;
}

.factory-routing-form {
  display: grid;
  grid-template-columns: minmax(125px, 0.55fr) minmax(240px, 1.25fr) minmax(280px, 1.4fr) auto;
  align-items: end;
}

.factory-routing-form > * {
  min-width: 0;
}

.factory-routing-form .checkbox-field {
  display: flex;
  min-height: 44px;
  grid-column: 3;
  grid-row: 1;
  align-self: end;
  align-items: center;
  flex-direction: row;
}

.factory-routing-form .checkbox-field input {
  width: 20px;
  min-width: 20px;
  flex: 0 0 20px;
}

.factory-routing-school {
  grid-column: 1;
  grid-row: 1;
}

.factory-routing-device {
  grid-column: 2;
  grid-row: 1;
}

.factory-routing-form .factory-empty-hint {
  max-width: none;
  grid-column: 1 / -1;
  grid-row: 2;
}

.factory-routing-form > button {
  grid-column: 4;
  grid-row: 1;
}

.import-users-form {
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) minmax(300px, 1.5fr) minmax(220px, 1fr);
  align-items: end;
  gap: 14px;
}

.import-users-form > * {
  min-width: 0;
}

.import-users-form .import-update-toggle {
  min-height: 44px;
}

.import-users-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.import-users-actions > * {
  white-space: nowrap;
}

.anchor-section {
  scroll-margin-top: 92px;
}

.merchant-settings-grid {
  display: grid;
  margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
}

.settings-card,
.disclosure-panel {
  border: 1px solid var(--border);
  border-radius: 17px;
  background: #f9fcff;
}

.settings-card {
  padding: 17px;
}

.settings-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.settings-card-heading h3 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 18px;
}

.settings-kicker {
  color: var(--brand-blue-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.settings-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.settings-stats span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--brand-blue-soft);
  color: #55718e;
  font-size: 11px;
  white-space: nowrap;
}

.settings-form-grid,
.preset-form-grid {
  display: grid;
  gap: 12px;
}

.settings-form-grid {
  align-items: start;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.preset-form-grid {
  align-items: end;
}

.settings-form-grid .field small,
.toggle-field small,
.disclosure-panel summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.settings-submit {
  grid-column: 1 / -1;
}

.subject-manager {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #dce9f6;
  border-radius: 13px;
  background: #ffffff;
}

.subject-manager summary {
  display: flex;
  min-height: 50px;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.subject-manager summary > span:first-child {
  display: grid;
  gap: 2px;
}

.subject-manager summary small,
.subject-empty,
.subject-usage {
  color: var(--muted);
  font-size: 12px;
}

.subject-count {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.subject-manager[open] summary {
  border-bottom: 1px solid #dce9f6;
  background: #f5f9fd;
}

.subject-manager-body {
  display: grid;
  padding: 12px;
  gap: 12px;
}

.subject-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 10px;
}

.subject-row,
.subject-create-form {
  display: grid;
  align-items: end;
  gap: 9px;
}

.subject-row {
  grid-template-columns: minmax(130px, 1fr) auto auto;
  padding: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fbfdff;
}

.subject-name-field {
  min-width: 0;
}

.subject-row-meta {
  display: grid;
  min-width: 76px;
  align-content: center;
  gap: 2px;
}

.subject-row .button {
  min-width: 68px;
  padding-right: 10px;
  padding-left: 10px;
}

.subject-create-form {
  grid-template-columns: minmax(170px, 1fr) auto;
  padding-top: 11px;
  border-top: 1px dashed #cbdced;
}

.subject-enabled {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  color: #4e6681;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.subject-enabled input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 0;
}

.subject-usage {
  min-width: 0;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}

.disclosure-panel {
  margin-top: 15px;
  overflow: hidden;
}

.disclosure-panel summary {
  display: flex;
  min-height: 56px;
  padding: 12px 15px;
  align-items: center;
  cursor: pointer;
  list-style-position: inside;
}

.disclosure-panel summary > span {
  display: inline-grid;
  margin-left: 7px;
  gap: 2px;
}

.disclosure-panel[open] summary {
  border-bottom: 1px solid var(--border);
  background: #f1f7fd;
}

.disclosure-panel form {
  padding: 16px;
  background: #ffffff;
}

.create-merchant-form {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.field-wide {
  grid-column: span 2;
}

.preset-disclosure {
  margin: 0 0 16px;
  overflow: visible;
  scroll-margin-top: 92px;
}

.preset-form-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.toggle-stack {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toggle-field {
  display: flex;
  min-height: 54px;
  padding: 8px 10px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #f8fbff;
}

.toggle-field input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
}

.toggle-field span {
  display: grid;
  gap: 2px;
}

.toggle-field strong {
  font-size: 13px;
}

.preset-actions {
  grid-column: 1 / -1;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.admin-footer {
  margin-left: 244px;
  padding: 0 24px 28px;
  color: #8796a7;
  font-size: 12px;
  text-align: center;
}

.scope-panel {
  padding: 20px 22px;
}

.scope-panel .panel-heading {
  margin-bottom: 14px;
}

.scope-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.8fr) minmax(210px, 1.2fr) auto auto;
  align-items: end;
  gap: 12px;
}

.scope-form.scope-form-compact {
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto auto;
}

.scope-form.users-filter-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.users-filter-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: center;
  gap: 10px;
}

.users-filter-actions > * {
  min-width: 160px;
}

.scope-form.scope-form-compact.school-scope-form {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.school-scope-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.school-scope-actions .button {
  min-width: 112px;
}

.scope-form.order-scope-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.scope-form.device-scope-form {
  grid-template-columns: minmax(220px, 360px) auto;
  justify-content: start;
}

.scope-form .filter-field {
  min-width: 0;
}

.scope-current {
  display: flex;
  min-height: 48px;
  margin-top: 14px;
  padding: 11px 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbff;
  color: #49647f;
  font-size: 13px;
}

.scope-current strong {
  color: var(--ink);
}

.operation-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.operation-group {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--border);
}

.operation-group:last-child {
  border-right: 0;
}

.operation-group h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 16px;
}

.operation-list {
  display: grid;
  gap: 8px;
}

.operation-link {
  display: flex;
  min-height: 44px;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: #2d4f70;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.operation-link:hover {
  border-color: #a8c8ee;
  background: #f5faff;
  color: var(--brand-blue-dark);
}

@media (max-width: 1500px) {
  .scope-form.statistics-filter-form {
    grid-template-columns: minmax(170px, 0.85fr) minmax(280px, 1.35fr) repeat(2, minmax(180px, 0.85fr));
  }

  .statistics-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .header-shell {
    gap: 16px;
  }

  .brand-copy span {
    display: none;
  }

  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .admin-footer {
    margin-left: 220px;
  }

  .side-navigation {
    padding-right: 14px;
    padding-left: 14px;
  }

  .scope-form,
  .scope-form.scope-form-compact,
  .scope-form.users-filter-form,
  .scope-form.order-scope-form,
  .scope-form.statistics-filter-form,
  .scope-form.device-scope-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .order-scope-form .scope-search {
    grid-column: 1 / -1;
  }

  .scope-search {
    grid-column: 1 / -1;
  }

  .scope-apply,
  .scope-clear {
    width: 100%;
  }

  .metric-grid,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid.statistics-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(-n + 3) {
    border-bottom: 0;
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(2) {
    border-right: 1px solid var(--border);
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(3) {
    border-right: 0;
  }

  .metric-grid.statistics-metric-grid .statistics-paper-usage-metric {
    border-top: 1px solid var(--border);
    border-right: 0;
    grid-column: 1 / -1;
  }

  .metric-grid .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric-grid .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .user-form-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .binding-code-form,
  .factory-routing-form,
  .import-users-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .factory-routing-school,
  .factory-routing-device,
  .factory-routing-form .factory-empty-hint,
  .factory-routing-form .checkbox-field,
  .import-file-field,
  .import-users-actions {
    grid-row: auto;
    grid-column: 1 / -1;
  }

  .factory-routing-form > button {
    width: fit-content;
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .merchant-settings-grid,
  .create-merchant-form,
  .preset-form-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .field-wide,
  .toggle-stack {
    grid-column: span 2;
  }

  .subject-row {
    grid-template-columns: minmax(130px, 1fr) auto auto;
  }

  .subject-row .button {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .header-shell {
    display: grid;
    min-height: 62px;
    padding: 8px 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .brand {
    width: auto;
  }

  .brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .mobile-navigation {
    display: block;
  }

  .mobile-navigation summary {
    display: list-item;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 11px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 750;
    line-height: 42px;
    text-align: center;
    cursor: pointer;
  }

  .mobile-navigation nav {
    position: fixed;
    z-index: 30;
    top: 62px;
    right: 0;
    left: 0;
    max-height: calc(100vh - 62px);
    padding: 18px 16px 28px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.99);
    box-shadow: 0 20px 34px rgba(24, 64, 110, 0.18);
  }

  .mobile-navigation .nav-tree {
    gap: 16px;
  }

  .mobile-navigation .nav-group {
    padding-bottom: 12px;
  }

  .mobile-navigation .side-nav-link {
    min-height: 44px;
    gap: 12px;
  }

  .mobile-navigation .side-nav-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .admin-shell {
    display: block;
    min-height: calc(100vh - 62px);
  }

  .side-navigation {
    display: none;
  }

  .admin-main {
    padding: 22px 14px 42px;
  }

  .admin-footer {
    margin-left: 0;
  }

  .page-heading,
  .panel-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading {
    margin-bottom: 18px;
  }

  h1 {
    font-size: 30px;
  }

  .panel {
    padding: 17px;
    border-radius: 18px;
  }

  .metric-grid,
  .grid,
  .quick-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid.statistics-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(1),
  .metric-grid.statistics-metric-grid .metric:nth-child(2) {
    border-bottom: 1px solid var(--border);
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(1) {
    border-right: 1px solid var(--border);
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(2),
  .metric-grid.statistics-metric-grid .metric:nth-child(3) {
    border-right: 0;
  }

  .metric-grid.statistics-metric-grid .metric:nth-child(3),
  .metric-grid.statistics-metric-grid .statistics-paper-usage-metric {
    grid-column: 1 / -1;
  }

  .metric {
    min-height: 112px;
    padding: 16px;
    border-radius: 0;
  }

  .metric-value {
    font-size: 30px;
  }

  .filter-bar,
  .compact-form,
  .merchant-switcher,
  .device-binding-form {
    align-items: stretch;
    flex-direction: column;
  }

  .binding-code-form,
  .factory-routing-form,
  .import-users-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .factory-routing-form .checkbox-field,
  .import-file-field,
  .import-users-actions {
    grid-column: 1;
  }

  .factory-routing-school,
  .factory-routing-device,
  .factory-routing-form .factory-empty-hint,
  .factory-routing-form > button {
    width: 100%;
    grid-column: 1;
    grid-row: auto;
  }

  .import-users-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .import-users-actions > * {
    width: 100%;
  }

  .filter-field,
  .filter-field.search-field,
  .filter-bar .button,
  .compact-form > *,
  .merchant-switcher > *,
  .device-binding-form > * {
    width: 100%;
    min-width: 0;
  }

  .filter-field.search-field,
  .compact-form input[type="file"],
  .device-binding-form label {
    flex: 0 0 auto;
  }

  .audit-filter-actions {
    width: 100%;
    margin-left: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .audit-filter-actions > * {
    width: 100%;
  }

  .scope-form,
  .scope-form.scope-form-compact,
  .scope-form.users-filter-form,
  .scope-form.order-scope-form,
  .scope-form.statistics-filter-form,
  .scope-form.device-scope-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .order-scope-form .scope-search,
  .statistics-filter-form .scope-search,
  .statistics-filter-form > .filter-field:first-child,
  .order-filter-actions {
    grid-column: 1 / -1;
  }

  .order-filter-actions > * {
    flex: 1 1 0;
  }

  .statistics-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-filter-actions .statistics-export {
    width: 100%;
    grid-column: 1 / -1;
  }

  .scope-panel .panel-heading {
    margin-bottom: 10px;
  }

  .scope-panel .panel-heading p {
    display: none;
  }

  .scope-search,
  .scope-apply {
    grid-column: 1 / -1;
  }

  .scope-apply,
  .scope-clear {
    width: 100%;
  }

  .scope-clear {
    grid-column: 1 / -1;
    border-color: transparent;
    background: transparent;
    color: var(--brand-blue);
  }

  .scope-form.scope-form-compact.school-scope-form {
    grid-template-columns: 1fr;
  }

  .school-scope-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .school-scope-actions .button {
    width: 100%;
    min-width: 0;
  }

  .school-scope-actions .scope-clear {
    grid-column: auto;
    border-color: var(--border);
    background: #ffffff;
    color: var(--brand-blue-dark);
  }

  .orders-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .orders-pagination-controls {
    justify-content: space-between;
  }

  .scope-current {
    align-items: flex-start;
    flex-direction: column;
  }

  .operation-groups {
    grid-template-columns: 1fr;
  }

  .operation-group {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .operation-group:last-child {
    border-bottom: 0;
  }

  .table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .orders-table-scroll,
  .users-table-scroll,
  .statistics-table-scroll {
    max-height: none;
    overscroll-behavior: auto;
  }

  .orders-scroll-top,
  .users-scroll-top,
  .statistics-scroll-top {
    display: none;
  }

  .orders-flat-table,
  .statistics-table {
    width: 100%;
    min-width: 0;
  }

  .orders-flat-table th,
  .orders-flat-table td,
  .statistics-table th,
  .statistics-table td {
    white-space: normal;
  }

  .compact-cell-stack,
  .compact-file-list,
  .compact-print-list,
  .statistics-value-list {
    width: auto;
    min-width: 0;
  }

  .order-file-row {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .order-file-name,
  .compact-print-list > span,
  .statistics-value-list > span {
    width: auto;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .order-approver-name {
    overflow-wrap: anywhere;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table {
    min-width: 0;
    background: transparent;
  }

  .responsive-table.audit-table {
    table-layout: auto;
  }

  .responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .responsive-table tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(26, 79, 145, 0.06);
  }

  .responsive-table td {
    display: grid;
    min-height: 44px;
    padding: 10px 12px;
    grid-template-columns: minmax(86px, 0.38fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    overflow-wrap: anywhere;
  }

  .responsive-table.audit-table td {
    width: auto !important;
  }

  .responsive-table td::before {
    color: #7b8da1;
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
  }

  .responsive-table td[data-label="操作"] {
    display: block;
  }

  .responsive-table td[data-label="操作"]::before {
    display: block;
    margin-bottom: 8px;
  }

  .orders-flat-table .orders-action-cell {
    position: static;
    border-left: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .orders-flat-table tbody tr:hover .orders-action-cell {
    background: #ffffff;
  }

  .order-row-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .order-row-actions form {
    width: auto;
  }

  .compact-action {
    min-height: 40px;
  }

  .approval-actions,
  .reject-form,
  .action-group {
    width: 100%;
    min-width: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .approval-actions form,
  .approval-actions button,
  .reject-form input,
  .action-group > * {
    width: 100%;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .merchant-settings-grid,
  .settings-form-grid,
  .create-merchant-form,
  .preset-form-grid,
  .subject-row,
  .subject-create-form {
    grid-template-columns: 1fr;
  }

  .subject-list {
    grid-template-columns: 1fr;
  }

  .users-table.editing-active {
    min-width: 0;
  }

  .subject-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-card-heading {
    flex-direction: column;
  }

  .settings-stats {
    justify-content: flex-start;
  }

  .field-wide,
  .toggle-stack {
    grid-column: 1;
  }

  .toggle-stack {
    grid-template-columns: 1fr;
  }

  .preset-disclosure {
    scroll-margin-top: 112px;
  }

  .settings-submit .button,
  .preset-actions,
  .preset-actions > *,
  .subject-row .button,
  .subject-create-form .button {
    width: 100%;
  }

  .subject-usage {
    padding: 0;
    text-align: left;
  }

  .users-table input,
  .users-table select {
    min-width: 0;
  }

  .users-table td {
    text-align: left;
  }
}

@media (max-width: 430px) {
  .order-date-filter {
    grid-column: 1 / -1;
  }

  .scope-form.users-filter-form {
    grid-template-columns: 1fr;
  }

  .users-filter-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .users-filter-actions > * {
    width: 100%;
    min-width: 0;
  }

  .metric-grid,
  .grid,
  .quick-links {
    grid-template-columns: 1fr 1fr;
  }

  .statistics-paper-usage-list {
    grid-template-columns: 1fr;
  }

  .metric-hint {
    display: none;
  }

  .quick-link {
    min-height: 80px;
    padding: 13px;
  }
}

@media (min-width: 761px) {
  body:has(.orders-flat-table) .admin-main {
    max-width: none;
  }

  body:has(.users-table) .admin-main {
    max-width: none;
    margin-right: auto;
    margin-left: auto;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
