/* ========================================
   天齐锂业 · 承包商/访客安全培训平台
   Tianqi Lithium Contractor & Visitor Safety Training
   Brand Colors: Teal #1993A0 | Deep Blue #002060 | Gold #F5A623
   ======================================== */

:root {
  --tq-primary: #1993A0;
  --tq-primary-dark: #137A85;
  --tq-primary-light: #E6F6F8;
  --tq-deep: #002060;
  --tq-deep-light: #0A2A6B;
  --tq-gold: #F5A623;
  --tq-gold-light: #FFF4E0;
  --tq-success: #0D9488;
  --tq-danger: #DC2626;
  --tq-warning: #F59E0B;
  --tq-bg: #F0F5F7;
  --tq-card-bg: #FFFFFF;
  --tq-text: #1A202C;
  --tq-text-secondary: #5A6B7B;
  --tq-border: #DDE5EA;
  --tq-shadow: 0 4px 20px rgba(0, 32, 96, 0.08);
  --tq-shadow-lg: 0 12px 32px rgba(0, 32, 96, 0.14);
  --tq-radius: 16px;
  --tq-radius-sm: 12px;

  /* 兼容旧变量名 */
  --primary: var(--tq-primary);
  --primary-dark: var(--tq-primary-dark);
  --success: var(--tq-success);
  --danger: var(--tq-danger);
  --warning: var(--tq-warning);
  --bg: var(--tq-bg);
  --card-bg: var(--tq-card-bg);
  --text: var(--tq-text);
  --text-secondary: var(--tq-text-secondary);
  --border: var(--tq-border);
  --shadow: var(--tq-shadow);
  --shadow-lg: var(--tq-shadow-lg);
  --radius: var(--tq-radius);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #F0F5F7 0%, #E8F1F4 100%);
  color: var(--tq-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
.container-wide { max-width: 900px; margin: 0 auto; padding: 20px; }
.admin-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ========================================
   Brand Header
   ======================================== */
.brand-topbar {
  background: linear-gradient(135deg, var(--tq-deep) 0%, var(--tq-primary) 100%);
  color: #fff;
  padding: 14px 20px;
  box-shadow: 0 4px 12px rgba(0,32,96,0.18);
}
.brand-topbar-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-topbar-wide .brand-topbar-inner { max-width: 1200px; }
.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.brand-topbar-text { flex: 1; }
.brand-topbar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.3;
}
.brand-topbar-sub {
  font-size: 12px;
  opacity: 0.92;
  margin-top: 2px;
}

/* ========================================
   Hero Banner
   ======================================== */
.hero-banner {
  position: relative;
  width: 100%;
  height: 230px;
  border-radius: 0 0 var(--tq-radius) var(--tq-radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--tq-shadow);
}
.hero-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(0,32,96,0.82) 0%, rgba(0,32,96,0.55) 55%, rgba(25,147,160,0.35) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 24px;
  color: #fff;
}
.hero-title {
  font-size: 23px;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
  margin-bottom: 8px;
}
.hero-desc {
  font-size: 13px;
  opacity: 0.96;
  max-width: 55%;
  line-height: 1.55;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}
.hero-mascot {
  position: absolute;
  right: 20px;
  bottom: 0;
  height: 190px;
  width: auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.25));
  pointer-events: none;
}

/* Header (legacy, now enhanced) */
.header {
  text-align: center;
  padding: 28px 16px 20px;
}
.header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--tq-deep);
  margin-bottom: 6px;
}
.header .subtitle {
  font-size: 14px;
  color: var(--tq-text-secondary);
}
.header .factory-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--tq-primary), var(--tq-primary-dark));
  color: white;
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 13px;
  margin-top: 10px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(25,147,160,0.22);
}

/* Cards */
.card {
  background: var(--tq-card-bg);
  border-radius: var(--tq-radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--tq-shadow);
  border: 1px solid var(--tq-border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  box-shadow: var(--tq-shadow-lg);
}

/* Section title */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--tq-deep);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--tq-primary-light);
}
.section-title::before {
  content: '';
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--tq-primary), var(--tq-gold));
}

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--tq-text);
}
.form-group label .required {
  color: var(--tq-danger);
  margin-left: 2px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--tq-border);
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s;
  background: #fff;
  font-family: inherit;
  color: var(--tq-text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--tq-primary);
  box-shadow: 0 0 0 4px rgba(25,147,160,0.12);
}
.form-group input::placeholder, .form-group select::placeholder {
  color: #A8B5C0;
}
.form-group input:disabled {
  background: #F4F7F9;
  color: var(--tq-text-secondary);
}
.form-group small {
  display: block;
  margin-top: 5px;
  color: var(--tq-text-secondary);
  font-size: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.btn-primary {
  background: linear-gradient(135deg, var(--tq-primary) 0%, var(--tq-primary-dark) 100%);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--tq-primary-dark) 0%, #0F6A73 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(25,147,160,0.28);
}
.btn-success {
  background: linear-gradient(135deg, var(--tq-success) 0%, #0A7A70 100%);
  color: #fff;
}
.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13,148,136,0.28);
}
.btn-danger {
  background: linear-gradient(135deg, var(--tq-danger) 0%, #B91C1C 100%);
  color: #fff;
}
.btn-outline {
  background: transparent;
  color: var(--tq-primary);
  border: 2px solid var(--tq-primary);
  box-shadow: none;
}
.btn-outline:hover {
  background: var(--tq-primary-light);
}
.btn-block { width: 100%; }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #E6F6F8; color: var(--tq-primary-dark); }
.badge-primary { background: #E6F6F8; color: var(--tq-primary-dark); }

/* Identity selector on register page */
.radio-row { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.radio-pill {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--tq-border); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: all 0.18s; font-size: 14px; color: var(--tq-text);
  background: #fff;
}
.radio-pill:hover { border-color: var(--tq-primary); background: var(--tq-primary-light); }
.radio-pill input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--tq-primary); }
.radio-pill.active,
.radio-pill:has(input:checked) {
  border-color: var(--tq-primary);
  background: linear-gradient(135deg, #E6F6F8 0%, #FFFFFF 100%);
  box-shadow: 0 4px 16px rgba(25,147,160,0.16);
}
.radio-pill b { color: var(--tq-deep); }
.radio-pill .type-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.radio-pill .type-icon.contractor { background: var(--tq-primary-light); }
.radio-pill .type-icon.visitor { background: var(--tq-gold-light); }

/* Safety notice acknowledgment */
.notice-ack {
  background: linear-gradient(135deg, #F8FAFC 0%, var(--tq-primary-light) 100%);
  border: 1px solid var(--tq-border); border-radius: 12px;
  padding: 14px; margin: 8px 0 18px;
}
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--tq-text); cursor: pointer; }
.checkbox-label input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--tq-primary); }
.checkbox-label a { color: var(--tq-primary); text-decoration: underline; font-weight: 600; }

/* Notice document page */
.notice-doc { line-height: 1.7; }
.notice-intro {
  background: linear-gradient(135deg, var(--tq-primary-light) 0%, #FFFFFF 100%);
  border-left: 4px solid var(--tq-primary);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 18px;
  color: var(--tq-text);
}
.notice-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--tq-border); }
.notice-num {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tq-primary) 0%, var(--tq-primary-dark) 100%);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(25,147,160,0.22);
}
.notice-body h3 { font-size: 15px; color: var(--tq-deep); margin-bottom: 4px; }
.notice-body p { font-size: 13px; color: var(--tq-text-secondary); }
.notice-foot {
  font-size: 12px;
  color: var(--tq-text-secondary);
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--tq-border);
}

/* Visitor pass */
.visitor-pass {
  border: 2px solid var(--tq-primary);
  border-radius: var(--tq-radius);
  padding: 22px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FCFD 100%);
  box-shadow: var(--tq-shadow);
}
.vp-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--tq-primary); padding-bottom: 14px; margin-bottom: 14px; }
.vp-header h2 { color: var(--tq-deep); font-size: 20px; margin: 0; }
.vp-tag { background: linear-gradient(135deg, var(--tq-primary), var(--tq-primary-dark)); color: #fff; font-size: 11px; padding: 4px 12px; border-radius: 12px; letter-spacing: 1px; }
.vp-status { background: #D1FAE5; color: #065F46; font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; text-align: center; font-weight: 600; }
.vp-table { width: 100%; border-collapse: collapse; }
.vp-table td { padding: 10px 6px; border-bottom: 1px solid var(--tq-border); font-size: 14px; vertical-align: top; }
.vp-label { color: var(--tq-text-secondary); width: 110px; white-space: nowrap; }
.vp-value { color: var(--tq-text); font-weight: 600; }
.vp-note { font-size: 12px; color: var(--tq-text-secondary); margin-top: 16px; padding: 12px; background: var(--tq-gold-light); border-radius: 10px; }

@media (max-width: 480px) {
  .type-selector { flex-direction: column; }
  .hero-title { font-size: 18px; }
  .hero-desc { font-size: 12px; max-width: 60%; }
  .hero-mascot { height: 155px; right: 6px; }
}

/* Tables */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--tq-border);
  font-size: 14px;
}
table th {
  background: #F4F8FA;
  font-weight: 700;
  color: var(--tq-text-secondary);
  font-size: 13px;
  white-space: nowrap;
}
table tr:hover { background: #F8FCFD; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--tq-card-bg);
  border-radius: var(--tq-radius);
  padding: 18px 16px;
  box-shadow: var(--tq-shadow);
  text-align: center;
  border: 1px solid var(--tq-border);
}
.stat-card .stat-value { font-size: 30px; font-weight: 800; color: var(--tq-primary); }
.stat-card .stat-label { font-size: 13px; color: var(--tq-text-secondary); margin-top: 4px; }
.stat-card.passed .stat-value { color: var(--tq-success); }
.stat-card.failed .stat-value { color: var(--tq-danger); }

/* Video player container */
.video-container {
  position: relative;
  background: #000;
  border-radius: var(--tq-radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--tq-shadow-lg);
}
.video-container video {
  width: 100%;
  display: block;
  max-height: 400px;
}
.video-controls-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex;
  align-items: center;
  gap: 10px;
}
.video-info { margin-bottom: 16px; }
.video-info h3 { font-size: 18px; margin-bottom: 4px; color: var(--tq-deep); }
.video-info p { color: var(--tq-text-secondary); font-size: 14px; }
.video-progress-bar {
  width: 100%; height: 8px;
  background: var(--tq-border);
  border-radius: 4px;
  overflow: hidden;
  margin: 14px 0;
}
.video-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tq-primary), var(--tq-gold));
  border-radius: 4px;
  transition: width 0.3s;
}
.video-progress-fill.completed { background: var(--tq-success); }

/* Exam */
.question-card {
  background: var(--tq-card-bg);
  border-radius: var(--tq-radius);
  padding: 22px;
  margin-bottom: 14px;
  box-shadow: var(--tq-shadow);
  border: 1px solid var(--tq-border);
}
.question-number {
  display: inline-block;
  background: linear-gradient(135deg, var(--tq-primary), var(--tq-primary-dark));
  color: #fff;
  width: 30px; height: 30px;
  text-align: center;
  line-height: 30px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  margin-right: 8px;
}
.question-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}
.question-type-badge.single { background: #E6F6F8; color: var(--tq-primary-dark); }
.question-type-badge.multi { background: var(--tq-gold-light); color: #B45309; }
.question-type-badge.judge { background: #D1FAE5; color: #065F46; }
.question-content { font-size: 16px; font-weight: 700; margin: 14px 0; color: var(--tq-deep); }
.option-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 7px 0;
  border: 2px solid var(--tq-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
}
.option-item:hover { border-color: var(--tq-primary); background: var(--tq-primary-light); }
.option-item.selected { border-color: var(--tq-primary); background: #E6F6F8; }
.option-item.correct { border-color: var(--tq-success); background: #D1FAE5; }
.option-item.wrong { border-color: var(--tq-danger); background: #FEE2E2; }
.option-marker {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  margin-right: 12px;
  flex-shrink: 0;
  border: 2px solid var(--tq-border);
}
.option-item.selected .option-marker { border-color: var(--tq-primary); background: var(--tq-primary); color: #fff; }
.option-item.correct .option-marker { border-color: var(--tq-success); background: var(--tq-success); color: #fff; }
.option-item.wrong .option-marker { border-color: var(--tq-danger); background: var(--tq-danger); color: #fff; }
.option-item.multi .option-marker { border-radius: 4px; }

/* Result page */
.result-card {
  text-align: center;
  padding: 36px 28px;
}
.result-score {
  font-size: 68px;
  font-weight: 800;
  margin: 18px 0;
}
.result-score.passed {
  background: linear-gradient(135deg, var(--tq-success), #0A7A70);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.result-score.failed {
  background: linear-gradient(135deg, var(--tq-danger), #B91C1C);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.result-icon { font-size: 64px; margin-bottom: 8px; }
.certificate-card {
  background: linear-gradient(135deg, #F0FAFB 0%, #E8F4FF 100%);
  border: 2px solid var(--tq-primary);
  border-radius: var(--tq-radius);
  padding: 26px;
  text-align: center;
  margin-top: 16px;
  box-shadow: var(--tq-shadow);
}
.certificate-code {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--tq-primary);
  letter-spacing: 1px;
}

/* Certificate card detailed layout */
.cert-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cert-header h3 {
  color: var(--tq-deep);
  margin: 0;
  font-size: 20px;
}
.cert-seal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tq-success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.cert-body {
  text-align: left;
  margin: 16px 0;
  border-top: 1px dashed rgba(0,0,0,0.1);
  border-bottom: 1px dashed rgba(0,0,0,0.1);
  padding: 12px 0;
}
.cert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}
.cert-label {
  color: var(--tq-text-secondary);
  flex-shrink: 0;
  margin-right: 12px;
}
.cert-value {
  color: var(--tq-text);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}
.cert-code {
  font-family: 'Courier New', monospace;
  color: var(--tq-primary);
}
.cert-footer {
  font-size: 12px;
  color: var(--tq-text-secondary);
  margin-top: 8px;
}
.cert-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.cert-save-tip {
  font-size: 12px;
  color: var(--tq-text-secondary);
  text-align: center;
  margin-top: 8px;
}
.cert-img {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 14px auto 0;
  border-radius: 8px;
  border: 1px solid var(--tq-border);
}

/* Print styles for certificate */
@media print {
  body * {
    visibility: hidden;
  }
  #certificateCard, #certificateCard * {
    visibility: visible;
  }
  #certificateCard {
    position: absolute;
    left: 50%;
    top: 40px;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    margin: 0;
    box-shadow: none;
    border: 3px solid var(--tq-primary);
    page-break-inside: avoid;
  }
  .no-print {
    display: none !important;
  }
  .certificate-card {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Admin layout */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--tq-card-bg);
  box-shadow: var(--tq-shadow);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header .logo { font-size: 18px; font-weight: 700; color: var(--tq-deep); }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a {
  padding: 8px 14px;
  text-decoration: none;
  color: var(--tq-text-secondary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
}
.admin-nav a:hover, .admin-nav a.active {
  background: linear-gradient(135deg, var(--tq-primary), var(--tq-primary-dark));
  color: #fff;
}
.admin-user { font-size: 13px; color: var(--tq-text-secondary); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.filter-bar input, .filter-bar select {
  padding: 8px 12px;
  border: 2px solid var(--tq-border);
  border-radius: 8px;
  font-size: 14px;
}
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--tq-primary); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--tq-border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.pagination button.active { background: var(--tq-primary); color: #fff; border-color: var(--tq-primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,32,96,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--tq-radius);
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--tq-shadow-lg);
}
.modal h3 { margin-bottom: 16px; color: var(--tq-deep); }

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  z-index: 2000;
  animation: fadeIn 0.3s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.toast.success { background: var(--tq-success); }
.toast.error { background: var(--tq-danger); }
.toast.info { background: var(--tq-primary); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Login */
.login-container {
  max-width: 380px;
  margin: 80px auto;
}
.login-container .card { padding: 32px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--tq-text-secondary); }
.loading::after {
  content: '';
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--tq-border);
  border-top-color: var(--tq-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* QR Code */
.qr-container {
  text-align: center;
  padding: 20px;
}
.qr-container canvas, .qr-container img {
  border: 1px solid var(--tq-border);
  border-radius: 10px;
}
.qr-download-btn { margin-top: 12px; }

/* Visitor video CTA */
.visitor-cta { text-align: center; margin-top: 16px; }
.visitor-cta .btn { margin: 6px; }
.no-video-box { text-align: center; padding: 28px 12px; color: var(--tq-text-secondary); }
.no-video-box .icon { font-size: 44px; margin-bottom: 12px; }

/* Responsive */
@media (max-width: 768px) {
  .container, .container-wide { padding: 12px; }
  .admin-nav { width: 100%; overflow-x: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .brand-topbar-inner { max-width: 100%; }
  .hero-banner { border-radius: 0 0 var(--tq-radius) var(--tq-radius); margin: 0 -12px 16px; width: calc(100% + 24px); }
}

/* Anti-cheat: prevent text selection on video page */
.no-select {
  -webkit-user-select: none;
  user-select: none;
}

/* ============ 仪表盘 · 科技风 ============ */
.dash-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: linear-gradient(120deg, #002060 0%, #1993A0 100%);
  border-radius: var(--tq-radius); padding: 22px 26px; color: #fff;
  box-shadow: 0 12px 30px rgba(0,32,96,0.25); margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.dash-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,166,35,0.35), transparent 70%);
}
.dash-hero-label { font-size: 13px; opacity: 0.85; letter-spacing: 1px; }
.dash-hero-num { font-size: 46px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.dash-hero-unit { font-size: 18px; font-weight: 600; margin-left: 6px; opacity: 0.85; }
.dash-hero-sub { font-size: 12px; opacity: 0.7; }
.dash-hero-split { display: flex; gap: 12px; flex-wrap: wrap; z-index: 1; }
.dash-hero-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.14); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.2); border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
}
.dash-hero-chip b { font-size: 20px; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; }
.chip-contractor .chip-dot { background: #4FD1C5; }
.chip-visitor .chip-dot { background: #F5A623; }

.dash-section { margin-bottom: 26px; }
.dash-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dash-sec-bar { width: 5px; height: 22px; border-radius: 3px; background: linear-gradient(#1993A0, #002060); }
.dash-sec-bar.bar-gold { background: linear-gradient(#FFD27A, #F5A623); }
.dash-sec-head h2 { font-size: 19px; font-weight: 800; color: var(--text-primary); margin: 0; }
.dash-sec-tag {
  margin-left: auto; font-size: 12px; font-weight: 600;
  color: var(--tq-primary-dark); background: #E6F6F8;
  padding: 4px 12px; border-radius: 999px;
}
.dash-sec-tag.tag-gold { color: #92400E; background: #FEF3C7; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi-card {
  background: #fff; border-radius: var(--tq-radius); padding: 16px 18px;
  box-shadow: var(--tq-shadow); position: relative; overflow: hidden;
  border: 1px solid #eef2f5;
}
.kpi-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(#1993A0, #002060);
}
.kpi-card.kpi-good::before { background: linear-gradient(#34D399, #059669); }
.kpi-card.kpi-gold::before { background: linear-gradient(#FFD27A, #F5A623); }
.kpi-val { font-size: 30px; font-weight: 800; color: var(--tq-primary-dark); line-height: 1.1; }
.kpi-card.kpi-good .kpi-val { color: #059669; }
.kpi-card.kpi-gold .kpi-val { color: #B45309; }
.kpi-lbl { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.dash-chart-row { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.chart-card {
  background: #fff; border-radius: var(--tq-radius); padding: 16px;
  box-shadow: var(--tq-shadow); border: 1px solid #eef2f5;
}
.chart-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.donut-box { height: 170px; display: flex; align-items: center; justify-content: center; }
.line-box { height: 170px; }
.legend { font-size: 11px; color: var(--text-secondary); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.lg-line { background: #1993A0; }
.lg-pass { background: #F5A623; }

.rank-card { padding: 18px 20px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed #eef2f5; }
.rank-row:last-child { border-bottom: none; }
.rank-no {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  background: #002060; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rank-main { flex: 1; }
.rank-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.rank-name { font-weight: 600; color: var(--text-primary); }
.rank-val { color: var(--text-secondary); font-size: 12px; }
.rank-bar { height: 8px; background: #eef2f5; border-radius: 6px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #1993A0, #002060); }

.badge-contractor { background: #E6F6F8; color: var(--tq-primary-dark); font-weight: 700; }
.badge-visitor { background: #FEF3C7; color: #92400E; font-weight: 700; }

@media (max-width: 768px) {
  .dash-chart-row { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-hero { padding: 18px; }
  .dash-hero-num { font-size: 38px; }
}

