/* ==========================================================================
   全新高大上灰白极简响应式 UI 框架 (Modern Slate Gray Design System)
   适用于 PC 大屏桌面控制台与 手机 APP/WebView/iOS 完美响应式适配
   ========================================================================== */

:root {
  /* 灰白高质感调色板 */
  --bg-main: #f4f6f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border-light: #e2e8f0;
  --border-focus: #94a3b8;

  /* 状态与功能色 */
  --color-slate-900: #0f172a;
  --color-slate-800: #1e293b;
  --color-slate-700: #334155;
  --color-slate-600: #475569;
  --color-slate-500: #64748b;
  
  --color-emerald: #10b981;
  --color-emerald-bg: #ecfdf5;
  --color-amber: #f59e0b;
  --color-amber-bg: #fffbeb;
  --color-rose: #f43f5e;
  --color-rose-bg: #fff1f2;
  --color-indigo: #6366f1;
  --color-indigo-bg: #eef2ff;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 20px 45px -10px rgba(15, 23, 42, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全局去除任何黑色外边框与点击高亮 */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  -webkit-font-smoothing: antialiased; 
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
}

*:focus, *:active, *:hover {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

html, body { 
  width: 100%; 
  max-width: 100%; 
  min-height: 100%; 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; 
  background-color: var(--bg-main); 
  color: var(--text-primary); 
  font-size: 14px; 
  line-height: 1.5;
  overflow-x: hidden !important; 
}

/* 页面布局容器 */
.app-viewport { width: 100%; max-width: 100%; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; box-sizing: border-box; }

/* 头部 Header */
.app-header { background: var(--color-slate-900); color: var(--text-inverse); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; box-shadow: var(--shadow-md); position: relative; z-index: 10; width: 100%; box-sizing: border-box; }
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-brand-icon { width: 32px; height: 32px; background: rgba(255,255,255,0.1); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.header-title { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; color: #ffffff; margin: 0; line-height: 1.2; }
.header-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.device-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(255,255,255,0.1); border-radius: var(--radius-full); font-size: 12px; color: #e2e8f0; border: 1px solid rgba(255,255,255,0.15); white-space: nowrap; }

/* 主体 Content 容器 */
.app-main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; box-sizing: border-box; overflow-x: hidden; }

/* 响应式 Grid Layout */
.grid-cols-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; width: 100%; box-sizing: border-box; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; }
.col-span-7 { grid-column: span 7; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

.grid-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; box-sizing: border-box; }

/* 独立高质感卡片式 Stat Box (柔和淡灰边框) */
.stat-box { 
  background: var(--bg-card);
  border: 1px solid #e2e8f0 !important;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition-fast);
  width: 100%;
  box-sizing: border-box;
  outline: none !important;
  user-select: none;
}
.stat-box:hover, .stat-box:focus, .stat-box:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1 !important;
  outline: none !important;
}
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.stat-info .num {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-slate-900);
  line-height: 1.2;
}
.stat-info .label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

/* 白盘 Card */
.card { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid #e2e8f0 !important; box-shadow: var(--shadow-sm); overflow: hidden; transition: var(--transition-fast); width: 100%; box-sizing: border-box; outline: none !important; }
.card-header { padding: 14px 20px; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; background: #fafafa; box-sizing: border-box; }
.card-title { font-size: 15px; font-weight: 600; color: var(--color-slate-800); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 20px; width: 100%; overflow-x: hidden; box-sizing: border-box; }

/* SVG 图标通用 */
.svg-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.svg-icon-lg { width: 22px; height: 22px; }
.svg-icon-xl { width: 32px; height: 32px; }

/* Form 控件组 (柔和淡灰边框，焦点无黑框) */
.form-group { margin-bottom: 12px; width: 100%; overflow: hidden; box-sizing: border-box; }
.form-label { display: block; font-weight: 600; font-size: 12px; color: var(--color-slate-700); margin-bottom: 4px; }
.form-control { 
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding: 8px 10px;
  border: 1px solid #e2e8f0 !important;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  transition: var(--transition-fast);
  outline: none !important;
}
.form-control:focus { 
  border-color: #94a3b8 !important; 
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15) !important; 
}

/* 隔离容器 */
.input-contain-box {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  border-radius: var(--radius-md);
  display: block !important;
}

input[type="datetime-local"], input[type="date"], input[type="time"] {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block !important;
  font-size: 12px !important;
  padding: 8px 8px !important;
  margin: 0 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: var(--radius-md);
  outline: none !important;
}

/* 快捷时长选择按钮 */
.quick-duration-btns { display: flex; gap: 6px; width: 100%; box-sizing: border-box; }
.btn-chip { flex: 1; padding: 6px 0; text-align: center; font-size: 12px; font-weight: 600; border-radius: var(--radius-md); border: 1px solid #e2e8f0; background: #fff; color: var(--text-secondary); cursor: pointer; transition: var(--transition-fast); outline: none !important; }
.btn-chip:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-chip.active { background: var(--color-slate-900); color: #fff; border: 1px solid var(--color-slate-900); }

/* 按钮组 (消除各种按扭的深黑外边框) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; font-size: 13px; font-weight: 600; border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; transition: var(--transition-fast); text-decoration: none; outline: none !important; box-sizing: border-box; max-width: 100%; line-height: 1.4; }
.btn-dark { background: var(--color-slate-900); color: #fff; border: 1px solid var(--color-slate-900); }
.btn-dark:hover { background: var(--color-slate-800); }
.btn-success { background: var(--color-emerald); color: #fff; border: 1px solid var(--color-emerald); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--color-rose); color: #fff; border: 1px solid var(--color-rose); }
.btn-danger:hover { background: #e11d48; }

/* 彻底解决【上传照片】等 outline 按扭黑边框问题 */
.btn-outline { 
  background: #f8fafc !important; 
  border: 1px solid #cbd5e1 !important; 
  color: var(--text-secondary) !important; 
  box-shadow: none !important;
}
.btn-outline:hover, .btn-outline:focus, .btn-outline:active { 
  background: #f1f5f9 !important; 
  color: var(--color-slate-900) !important; 
  border-color: #94a3b8 !important; 
  outline: none !important;
  box-shadow: none !important;
}
.btn-block { width: 100%; }

/* Badge 胶囊组件 */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-warning { background: var(--color-amber-bg); color: #b45309; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-success { background: var(--color-emerald-bg); color: #047857; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-danger { background: var(--color-rose-bg); color: #be123c; border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-neutral { background: #f1f5f9; color: var(--color-slate-600); border: 1px solid #e2e8f0; }

/* 相机与单行双按钮 */
.photo-upload-container { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; box-sizing: border-box; }
.modern-camera-box { position: relative; width: 100%; max-width: 260px; aspect-ratio: 4/3; background: #0f172a; border-radius: var(--radius-lg); overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px solid #e2e8f0; box-shadow: var(--shadow-md); }
.modern-camera-box video { width: 100%; height: 100%; object-fit: cover; }
.modern-camera-box img { width: 100%; height: 100%; object-fit: cover; }
.face-guide-ring { position: absolute; width: 110px; height: 140px; border: 2px dashed rgba(16, 185, 129, 0.9); border-radius: 50%; pointer-events: none; z-index: 2; }
.single-row-buttons { display: flex !important; flex-direction: row !important; gap: 10px !important; width: 100% !important; align-items: center !important; box-sizing: border-box !important; }

/* Custom Modal */
.modal-overlay { 
  position: fixed !important; 
  top: 0 !important; 
  left: 0 !important; 
  width: 100vw !important; 
  height: 100vh !important; 
  right: 0 !important; 
  bottom: 0 !important; 
  background: rgba(15, 23, 42, 0.75) !important; 
  backdrop-filter: blur(6px) !important; 
  -webkit-backdrop-filter: blur(6px) !important; 
  z-index: 999999 !important; 
  display: flex !important; 
  align-items: center !important; 
  justify-content: center !important; 
  padding: 16px !important; 
  box-sizing: border-box !important; 
  animation: fadeIn 0.2s ease-out; 
}
.modal-card { 
  background: #ffffff !important; 
  border-radius: var(--radius-lg) !important; 
  width: 100% !important; 
  max-width: 380px !important; 
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important; 
  overflow: hidden !important; 
  border: 1px solid #e2e8f0 !important; 
  margin: auto !important;
  transform: scale(1); 
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1); 
  box-sizing: border-box !important;
  outline: none !important;
}

.modal-body { padding: 20px 16px 16px; text-align: center; box-sizing: border-box; }
.modal-icon-wrap { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.modal-icon-success { background: var(--color-emerald-bg); color: var(--color-emerald); }
.modal-icon-warning { background: var(--color-amber-bg); color: var(--color-amber); }
.modal-icon-danger { background: var(--color-rose-bg); color: var(--color-rose); }
.modal-icon-info { background: var(--color-indigo-bg); color: var(--color-indigo); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--color-slate-900); margin-bottom: 6px; }
.modal-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; word-break: break-word; }
.modal-footer { padding: 10px 16px 16px; display: flex; gap: 8px; justify-content: center; background: #fafafa; border-top: 1px solid #e2e8f0; box-sizing: border-box; }

.sync-progress-box { width: 100%; margin-top: 12px; }
.progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; position: relative; margin-bottom: 10px; }
.progress-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #10b981, #059669); transition: width 0.3s ease; }
.sync-step-text { font-size: 12px; color: var(--text-muted); text-align: center; min-height: 18px; word-break: break-word; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 移动端 Breakpoint (<= 768px) */
@media (max-width: 768px) {
  .app-main { padding: 8px; gap: 10px; width: 100%; overflow-x: hidden; }
  .grid-cols-12 { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  .col-span-3, .col-span-4, .col-span-5, .col-span-7, .col-span-8, .col-span-12 { width: 100%; }
  .grid-form-2 { display: flex; flex-direction: column; gap: 8px; width: 100%; }
  .app-header { padding: 10px 12px; }
  .header-subtitle { display: none; }
  .card-body { padding: 12px 14px; width: 100%; overflow-x: hidden; }
  .card-header { padding: 10px 14px; }
  .modal-card { max-width: 90% !important; width: 90% !important; }
  
  .btn { white-space: normal !important; word-break: break-word !important; text-align: center !important; font-size: 13px !important; padding: 10px 12px !important; }
  .dossier-grid { display: flex; flex-direction: column !important; align-items: center !important; gap: 14px !important; width: 100% !important; }
  .info-table { width: 100% !important; table-layout: fixed !important; }
  .info-table td { font-size: 13px !important; padding: 8px 6px !important; word-break: break-word !important; }
  .info-table td.label { width: 95px !important; }
}

/* 表格与分页组件 (Modern Slate Style) */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--color-slate-700);
  cursor: pointer;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
  outline: none !important;
}

.pagination button:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.pagination button.active {
  background: var(--color-slate-900);
  color: #ffffff;
  border-color: var(--color-slate-900);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.loading, .empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

