:root {
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);

  --primary: #3498db;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;

  --radius: 14px;
  --radius-sm: 10px;
  --gap: 16px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
    "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(900px 600px at 20% 15%, rgba(52, 152, 219, 0.22), transparent 55%),
    radial-gradient(900px 600px at 85% 25%, rgba(231, 76, 60, 0.14), transparent 55%),
    radial-gradient(900px 600px at 50% 95%, rgba(39, 174, 96, 0.14), transparent 55%),
    linear-gradient(180deg, #070a14 0%, #0b1020 50%, #070a14 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: var(--gap);
}

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

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

.flex {
  display: flex;
  gap: 10px;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 10, 20, 0.62);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.95), rgba(39, 174, 96, 0.9));
  box-shadow: 0 8px 28px rgba(52, 152, 219, 0.25);
}

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

.nav-link {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: background 150ms ease, border 150ms ease, color 150ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.nav-link.active {
  color: var(--text);
  background: rgba(52, 152, 219, 0.12);
  border-color: rgba(52, 152, 219, 0.22);
}

.page {
  padding: 22px 0 40px;
}

.page-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.page-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.action-cluster {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body {
  padding: 14px 16px;
}

.stat-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: radial-gradient(600px 240px at 15% 10%, rgba(52, 152, 219, 0.16), transparent 60%),
    radial-gradient(600px 240px at 85% 20%, rgba(39, 174, 96, 0.14), transparent 60%),
    rgba(255, 255, 255, 0.05);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.3px;
}

.stat-value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: 0.4px;
}

.hero-card {
  overflow: hidden;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: center;
}

.hero-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: 0.2px;
}

.hero-subtitle {
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.mini-stat-value {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 750;
}

.search-shell {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.search-helper {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

.result-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.result-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.result-card-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.search-empty {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

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

.board-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.board-card.tone-danger {
  border-color: rgba(231, 76, 60, 0.3);
  background: rgba(231, 76, 60, 0.08);
}

.board-card.tone-warning {
  border-color: rgba(243, 156, 18, 0.28);
  background: rgba(243, 156, 18, 0.08);
}

.board-card.tone-success {
  border-color: rgba(39, 174, 96, 0.28);
  background: rgba(39, 174, 96, 0.08);
}

.board-value {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 28px;
  font-weight: 800;
}

.board-unit {
  font-size: 12px;
  color: var(--muted);
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.trend-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  min-height: 220px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.trend-bars {
  height: 120px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
}

.trend-bar {
  width: 16px;
  min-height: 10px;
  border-radius: 999px 999px 4px 4px;
  background: rgba(255, 255, 255, 0.18);
}

.trend-borrow {
  background: linear-gradient(180deg, rgba(52, 152, 219, 0.95), rgba(52, 152, 219, 0.35));
}

.trend-return {
  background: linear-gradient(180deg, rgba(39, 174, 96, 0.95), rgba(39, 174, 96, 0.35));
}

.trend-notice {
  background: linear-gradient(180deg, rgba(243, 156, 18, 0.95), rgba(243, 156, 18, 0.35));
}

.trend-label {
  font-size: 12px;
  font-weight: 700;
}

.trend-meta,
.rank-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.rank-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.rank-item,
.activity-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.rank-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(52, 152, 219, 0.95), rgba(39, 174, 96, 0.95));
}

.activity-item {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.activity-dot {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(52, 152, 219, 0.16);
  border: 1px solid rgba(52, 152, 219, 0.28);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 150ms ease, border 150ms ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: rgba(52, 152, 219, 0.18);
  border-color: rgba(52, 152, 219, 0.28);
}

.btn-success {
  background: rgba(39, 174, 96, 0.18);
  border-color: rgba(39, 174, 96, 0.28);
}

.btn-danger {
  background: rgba(231, 76, 60, 0.18);
  border-color: rgba(231, 76, 60, 0.28);
}

.btn-warning {
  background: rgba(243, 156, 18, 0.18);
  border-color: rgba(243, 156, 18, 0.28);
}

.btn-outline {
  background: transparent;
}

.btn-sm {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 14px;
  border-radius: 14px;
}

.form-row {
  display: grid;
  gap: 10px;
}

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

.form-label {
  font-size: 12px;
  color: var(--muted);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  outline: none;
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(52, 152, 219, 0.55);
  box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.12);
}

.selection-toolbar {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(52, 152, 219, 0.2);
  background: rgba(52, 152, 219, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.selection-summary {
  font-size: 13px;
  line-height: 1.6;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: rgba(0, 0, 0, 0.18);
}

.table th,
.table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.table th {
  position: sticky;
  top: 0;
  background: rgba(7, 10, 20, 0.82);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  letter-spacing: 0.3px;
  z-index: 1;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.table-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.select-cell {
  width: 52px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.06);
}

.badge-available {
  border-color: rgba(39, 174, 96, 0.32);
  background: rgba(39, 174, 96, 0.12);
}

.badge-borrowed {
  border-color: rgba(231, 76, 60, 0.32);
  background: rgba(231, 76, 60, 0.12);
}

.badge-maintenance {
  border-color: rgba(243, 156, 18, 0.32);
  background: rgba(243, 156, 18, 0.12);
}

.badge-overdue {
  border-color: rgba(231, 76, 60, 0.36);
  background: rgba(231, 76, 60, 0.16);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 0 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  width: min(860px, 100%);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(7, 10, 20, 0.9);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.modal-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 14px 16px;
}

.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: grid;
  gap: 10px;
  z-index: 200;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 10, 20, 0.92);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
  animation: toast-in 220ms ease-out;
}

.toast-title {
  font-size: 13px;
  font-weight: 700;
}

.toast-message {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toast.success {
  border-color: rgba(39, 174, 96, 0.35);
}

.toast.error {
  border-color: rgba(231, 76, 60, 0.35);
}

.toast.warning {
  border-color: rgba(243, 156, 18, 0.35);
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.auth-container {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.auth-box {
  width: min(480px, 100%);
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
  padding: 20px;
}

.auth-title {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0.3px;
}

.scan-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px;
  align-items: start;
}

.scan-view {
  position: relative;
  width: min(100%, 460px);
  aspect-ratio: 1.6 / 1;
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  min-height: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.scan-focus {
  position: relative;
  width: min(82%, 360px);
  aspect-ratio: 2.2 / 1;
  overflow: hidden;
  border: 2px solid rgba(82, 196, 255, 0.95);
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(7, 10, 20, 0.35);
}

.scan-line {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  top: 12px;
  background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.95), transparent);
  filter: drop-shadow(0 0 12px rgba(52, 152, 219, 0.5));
  animation: scan 1.6s ease-in-out infinite;
}

@keyframes scan {
  0% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(140px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
}

@media (max-width: 768px) {
  .container {
    width: min(1120px, calc(100% - 20px));
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid,
  .scan-container,
  .hero-layout,
  .mini-stats,
  .search-results,
  .board-grid {
    grid-template-columns: 1fr;
  }

  .navbar-inner,
  .page-title,
  .modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .flex,
  .flex-between {
    flex-wrap: wrap;
  }

  .nav-links {
    gap: 6px;
    justify-content: flex-start;
  }

  .page {
    padding: 16px 0 28px;
  }

  .card-header,
  .card-body,
  .modal-header,
  .modal-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-title {
    font-size: 24px;
  }

  .trend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-card {
    min-height: 180px;
  }

  .action-cluster,
  .page-title .action-cluster,
  .page-title .flex {
    width: 100%;
  }

  .action-cluster .btn,
  .page-title .btn,
  .search-shell .btn {
    flex: 1 1 calc(50% - 10px);
    min-height: 42px;
  }

  .table {
    min-width: 640px;
  }

  .table.table-stack {
    min-width: 0;
    background: transparent;
  }

  .table.table-stack thead {
    display: none;
  }

  .table.table-stack,
  .table.table-stack tbody,
  .table.table-stack tr,
  .table.table-stack td {
    display: block;
    width: 100%;
  }

  .table.table-stack tr {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
  }

  .table.table-stack td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
    border-bottom: none;
    text-align: right;
  }

  .table.table-stack td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
    flex: 0 0 72px;
  }

  .table.table-stack td:last-child {
    padding-bottom: 0;
  }

  .table.table-stack td:last-child::before {
    padding-top: 8px;
  }

  .table.table-stack td[data-label="操作"] {
    align-items: stretch;
    flex-direction: column;
  }

  .table.table-stack td[data-label="操作"]::before {
    margin-bottom: 6px;
  }

  .table.table-stack td[data-label="操作"] .btn {
    width: 100%;
  }

  .table.table-stack td[data-label="选择"] {
    justify-content: flex-start;
    text-align: left;
  }

  .table.table-stack td[data-label="选择"]::before {
    margin-right: auto;
  }

  .activity-item {
    grid-template-columns: 1fr;
  }

  .activity-dot {
    width: 30px;
    height: 30px;
  }

  .pagination {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .modal {
    width: 100%;
    max-height: min(92vh, 100%);
    overflow: auto;
  }

  .scan-view {
    width: 100%;
    max-width: 100%;
  }

  .scan-focus {
    width: calc(100% - 28px);
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .selection-toolbar {
    align-items: stretch;
  }
}
