/* 简约灰阶主题（Bootstrap 之上轻量覆盖） */
:root {
  --app-primary: #111827;
  --app-bg: #f3f4f6;
  --app-surface: #ffffff;
  --app-text: #111827;
  --app-muted: rgba(17, 24, 39, 0.62);
  --app-border: rgba(17, 24, 39, 0.12);
  --app-shadow-sm: 0 4px 14px rgba(17, 24, 39, 0.06);
  --app-shadow-md: 0 10px 28px rgba(17, 24, 39, 0.1);
  --app-radius: 14px;
  --app-radius-sm: 12px;
  --app-transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html,
body {
  height: 100%;
}

body {
  color: var(--app-text);
  background: var(--app-bg);
}

a {
  text-decoration: none;
}

.app-main {
  min-height: calc(100vh - 72px - 220px);
}

/* 导航栏 */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-border);
}

.app-navbar.app-navbar-scrolled {
  background: rgba(255, 255, 255, 0.96);
}

.app-navbar .navbar-brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--app-text) !important;
}

.app-navbar .navbar-toggler {
  border-color: rgba(17, 24, 39, 0.22);
}

.app-navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.12rem rgba(17, 24, 39, 0.12);
}

.app-navbar .nav-link {
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  transition: background-color var(--app-transition), color var(--app-transition);
  color: var(--app-muted) !important;
}

.app-navbar .nav-link.active,
.app-navbar .nav-link:hover {
  background: rgba(17, 24, 39, 0.06);
  color: var(--app-text) !important;
}

.app-navbar .nav-link.btn-link {
  color: var(--app-muted) !important;
}

.app-navbar .nav-link.btn-link:hover {
  color: var(--app-text) !important;
}

/* 页脚 */
.app-footer {
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--app-border);
  backdrop-filter: blur(8px);
}

.app-footer-divider {
  height: 1px;
  background: rgba(17, 24, 39, 0.08);
}

/* 通用 */
.page-title {
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--app-text);
}

.hero {
  padding: 0.75rem 0 1.25rem;
}

.hero-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(78, 89, 105, 0.95);
  letter-spacing: 0.02em;
}

.stat-chip {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(10px);
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: rgba(245, 247, 251, 0.8);
  border: 1px solid rgba(17, 24, 39, 0.1);
}

.kv .k {
  color: rgba(78, 89, 105, 0.95);
  font-weight: 700;
}

.kv .v {
  font-weight: 900;
  color: #1d2129;
  text-align: right;
}

.glass-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
}

.hover-lift {
  transition: transform var(--app-transition), box-shadow var(--app-transition);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-md);
}

.btn-gradient {
  border: 1px solid rgba(17, 24, 39, 0.7);
  color: var(--app-text);
  font-weight: 800;
  background: transparent;
  box-shadow: none;
}

.btn-gradient:hover {
  color: var(--app-text);
  background: rgba(17, 24, 39, 0.06);
  transform: translateY(-1px);
}

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

.btn-outline-secondary {
  border-color: rgba(17, 24, 39, 0.14);
  color: var(--app-text);
}

.btn-outline-secondary:hover {
  border-color: rgba(17, 24, 39, 0.22);
  background: rgba(17, 24, 39, 0.04);
  color: var(--app-text);
}

/* 上传 */
.upload-container {
  max-width: 880px;
  margin: 0 auto;
}

.upload-dropzone {
  border: 1.5px dashed rgba(17, 24, 39, 0.18);
  border-radius: var(--app-radius);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  transition: border-color var(--app-transition), background-color var(--app-transition);
}

.upload-dropzone:hover {
  border-color: rgba(17, 24, 39, 0.28);
  background: rgba(255, 255, 255, 0.95);
}

.upload-dropzone.border-primary,
.upload-dropzone.is-dragover {
  border-color: rgba(13, 110, 253, 0.55) !important;
  background: rgba(13, 110, 253, 0.04);
}

.upload-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.upload-icon i {
  color: rgba(78, 89, 105, 0.55);
}

/* 图片与标注 */
.image-container {
  position: relative;
  display: inline-block;
  border-radius: var(--app-radius-sm);
  overflow: hidden;
  background: #fff;
  padding: 0.75rem;
  box-shadow: var(--app-shadow-sm);
}

.image-preview {
  max-width: 100%;
  border-radius: 10px;
  display: block;
}

#bike-bounding-box,
[id^="bike-bounding-box-"] {
  position: absolute;
  border: 3px solid #111827;
  background-color: rgba(17, 24, 39, 0.08);
  z-index: 10;
}

#fault-bounding-box,
[id^="fault-bounding-box-"] {
  position: absolute;
  border: 3px dashed rgba(17, 24, 39, 0.5);
  background-color: rgba(17, 24, 39, 0.1);
  z-index: 15;
}

.bounding-label {
  position: absolute;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 800;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.18);
  z-index: 20;
}

#bike-label,
[id^="bike-label-"] {
  background-color: #111827;
}

#fault-label,
[id^="fault-label-"] {
  background-color: rgba(17, 24, 39, 0.72);
}

/* 结果卡片 */
.result-card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
}

.result-card.bike-card {
  border-left: 4px solid var(--app-primary);
}

.result-card.fault-card {
  border-left: 4px solid rgba(17, 24, 39, 0.55);
}

.result-card.info-card {
  border-left: 4px solid rgba(78, 89, 105, 0.45);
}

/* 表单 */
.form-control,
.form-select {
  border-radius: var(--app-radius-sm);
  border-color: rgba(17, 24, 39, 0.12);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(17, 24, 39, 0.25);
  box-shadow: 0 0 0 0.15rem rgba(17, 24, 39, 0.08);
}

.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--app-muted);
}

/* 进度条 */
.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  overflow: hidden;
}

.progress-bar {
  border-radius: 999px;
  background-color: #111827;
}

/* 表格 */
.table thead tr {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--app-muted) !important;
}

.table tbody tr:hover {
  background: rgba(17, 24, 39, 0.03);
}

/* 分页 */
.pagination .page-link {
  border-radius: 8px !important;
  margin: 0 0.1rem;
  border: 1px solid var(--app-border);
  color: var(--app-text);
}

.pagination .page-item.active .page-link {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

.pagination .page-link:hover {
  background: rgba(17, 24, 39, 0.06);
  color: var(--app-text);
}

/* 折叠 */
.accordion-item {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm) !important;
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.accordion-button:not(.collapsed) {
  background: rgba(17, 24, 39, 0.04);
  color: var(--app-text);
}

/* 通知 */
.notification-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: grid;
  gap: 0.75rem;
}

/* 样本页图标 */
.sample-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.06);
  border: 1px solid rgba(17, 24, 39, 0.14);
  flex-shrink: 0;
}

.sample-icon i {
  font-size: 26px;
  color: rgba(17, 24, 39, 0.78);
}

/* 错误页 */
.error-page {
  text-align: center;
  padding: 3rem 1rem 4rem;
}

.error-page .glass-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.error-code {
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 800;
  line-height: 1;
  color: #dc3545;
  margin-bottom: 0.5rem;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #dc3545;
}

.error-message {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 0.75rem;
}

.error-suggestion {
  font-size: 0.95rem;
  color: var(--app-muted);
  margin-bottom: 1.5rem;
  text-align: left;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.error-suggestion ul {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem 0 0;
}

.error-suggestion li {
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}

.error-suggestion li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6c757d;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.22);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 24, 39, 0.3);
}

/* 看板 KPI：细顶线，无渐变 */
.stat-kpi {
  position: relative;
  overflow: hidden;
}

.stat-kpi::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(17, 24, 39, 0.18);
}

.stat-kpi--ok::after {
  background: rgba(34, 197, 94, 0.55);
}

.stat-kpi--warn::after {
  background: rgba(234, 179, 8, 0.65);
}

.stat-kpi--pending::after {
  background: rgba(107, 114, 128, 0.45);
}

.app-auth-card {
  max-width: 480px;
  margin: 2.5rem auto;
}

.badge.text-bg-light.border {
  background: #fff !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
  font-weight: 600;
}

@media (max-width: 768px) {
  .app-navbar .nav-link {
    padding: 0.55rem 0.75rem;
  }

  .upload-dropzone {
    padding: 1.1rem;
  }
}
