/* ═══════════════════════════════════════════════════════
   HE-Autowork 設計系統 — Navy + Teal 深色科技主題
   施工日報上傳系統 · Desktop / Tablet / Mobile
   ═══════════════════════════════════════════════════════ */

/* ── 1. CSS Variables ── */
:root {
  --navy:   #0D1B2A;
  --navy2:  #162032;
  --navy3:  #1E2D40;
  --teal:   #00C2A0;
  --teal2:  #00876E;
  --teal-glow: rgba(0,194,160,0.18);
  --amber:  #F5A623;
  --red:    #E85353;
  --gray1:  #8A9BB0;
  --gray2:  #4A5C70;
  --gray3:  #2A3A4D;
  --white:  #EDF2F8;
  --white2: #C8D5E4;
  --border: rgba(0,194,160,0.18);
  --tap:    48px;
  --radius: 10px;
  --transition: 0.2s ease;
  --font: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
}

/* ── 2. Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* 滾動條 */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray3); border-radius: 2px; }

/* 隱藏工具 */
.hidden { display: none !important; }

/* ── 3. Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--white); }
h2 { font-size: 1.4rem; font-weight: 600; color: var(--white); }
h3 { font-size: 1.15rem; font-weight: 600; color: var(--white); }
h4 { font-size: 1rem; font-weight: 600; color: var(--teal); }
.text-muted { color: var(--gray1); }
.text-small { font-size: 0.8125rem; }

/* ── 4. Login Page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, var(--navy) 0%, #0a1628 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 1.5rem;
  letter-spacing: 0.5px;
}

.login-logo .pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.login-subtitle {
  text-align: center;
  color: var(--gray1);
  font-size: 0.875rem;
  margin-bottom: 32px;
}

/* Google 登入按鈕容器 */
.google-btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

/* 分隔線 */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--gray2);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray3);
}

/* 輸入區 */
.input-group {
  margin-bottom: 12px;
}

.email-group {
  margin-bottom: 16px;
}

/* WebAuthn 區段 */
.webauthn-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--gray3);
}

/* 設備類型指示器 */
.device-indicator {
  text-align: center;
  font-size: 0.75rem;
  padding: 4px 12px;
  margin: 8px auto 16px;
  border-radius: 12px;
  width: fit-content;
  font-weight: 500;
}

.device-indicator.desktop {
  background: rgba(0, 194, 160, 0.15);
  color: var(--teal);
  border: 1px solid rgba(0, 194, 160, 0.3);
}

.device-indicator.mobile {
  background: rgba(245, 166, 35, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.device-indicator.tablet {
  background: rgba(168, 85, 247, 0.15);
  color: #A855F7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* 認證檢測結果指示器 */
.biometric-indicator {
  text-align: center;
  font-size: 0.75rem;
  padding: 6px 14px;
  margin: 4px auto 12px;
  border-radius: 14px;
  width: fit-content;
  font-weight: 500;
  display: none; /* 預設隱藏，有檢測結果才顯示 */
  transition: all 0.2s ease;
}

.biometric-indicator.supported {
  background: rgba(34, 197, 94, 0.15);
  color: #22C55E;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.biometric-indicator.partial {
  background: rgba(245, 166, 35, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.biometric-indicator.unsupported {
  background: rgba(232, 83, 83, 0.15);
  color: var(--red);
  border: 1px solid rgba(232, 83, 83, 0.3);
}

/* 提示訊息框 */
.notice-box {
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: center;
}

.notice-box p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--amber);
  line-height: 1.4;
}

/* Desktop 特殊樣式 */
@media (min-width: 769px) {
  .webauthn-section {
    opacity: 0.85;
  }

  .webauthn-section:hover {
    opacity: 1;
  }
}

.webauthn-label {
  text-align: center;
  color: var(--gray2);
  font-size: 0.8125rem;
  margin-bottom: 12px;
}

.webauthn-buttons {
  margin-bottom: 12px;
}

.webauthn-note {
  text-align: center;
  color: var(--gray2);
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0;
}

/* 錯誤提示 */
.login-error {
  background: rgba(232,83,83,0.12);
  border: 1px solid rgba(232,83,83,0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--red);
  font-size: 0.875rem;
  margin-bottom: 16px;
  text-align: center;
}

/* 成功提示 */
.login-success {
  background: rgba(0,194,160,0.12);
  border: 1px solid var(--teal-glow);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--teal);
  font-size: 0.875rem;
  margin-bottom: 16px;
  text-align: center;
}

/* ── 5. 表單元件 ── */
.form-input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  background: var(--navy3);
  border: 1px solid var(--gray3);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 0.9375rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-input::placeholder { color: var(--gray2); }
.form-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-glow); }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--gray1);
  margin-bottom: 6px;
  font-weight: 500;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238A9BB0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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

/* ── 6. 按鈕 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: #00E5BF; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { background: var(--gray3); color: var(--gray2); cursor: not-allowed; }

.btn-secondary {
  background: var(--gray3);
  color: var(--white2);
}
.btn-secondary:hover { background: var(--gray2); }
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary:disabled { background: var(--navy3); color: var(--gray2); cursor: not-allowed; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--teal);
  color: var(--teal);
}
.btn-outline:hover { background: var(--teal-glow); }
.btn-outline:active { transform: scale(0.97); }
.btn-outline:disabled { border-color: var(--gray3); color: var(--gray2); cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--white2);
  color: var(--white2);
}
.btn-ghost:hover { border-color: var(--red); color: var(--red); }

.btn-danger {
  background: rgba(232,83,83,0.15);
  border: 1px solid rgba(232,83,83,0.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(232,83,83,0.25); }

.btn-block { width: 100%; }

.btn-icon {
  width: var(--tap); height: var(--tap);
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── 7. Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(13,27,42,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--white);
}

.header-logo .pulse-dot {
  width: 6px; height: 6px;
  background: var(--teal);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--teal);
}

.header-status .dot {
  width: 6px; height: 6px;
  background: var(--teal);
  border-radius: 50%;
}
.header-status.offline .dot { background: var(--red); }
.header-status.offline { color: var(--red); }

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white2);
  font-size: 0.875rem;
}

.hamburger {
  display: none;
  width: var(--tap); height: var(--tap);
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.4rem;
}

/* ── 8. Layout ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ── 9. Sidebar ── */
.sidebar {
  width: 240px;
  background: var(--navy2);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section { margin-bottom: 20px; }
.sidebar-section-title {
  font-size: 0.75rem;
  color: var(--gray2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

/* Pill 按鈕（文件類型） */
.pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pill {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--gray3);
  background: transparent;
  color: var(--gray1);
  font-size: 0.8125rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 36px;
}
.pill:hover { border-color: var(--teal); color: var(--teal); }
.pill.active {
  background: var(--teal-glow);
  border-color: var(--teal);
  color: var(--teal);
}

/* 最近上傳 */
.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.8125rem;
  color: var(--white2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.recent-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.recent-dot.success { background: var(--teal); }
.recent-dot.pending { background: var(--amber); }

/* ── 10. Main Content ── */
.main-content {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

/* ── 11. Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--gray3);
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 24px;
}
.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 120%, rgba(0,194,160,0.05), transparent);
  pointer-events: none;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--teal);
  background: rgba(0,194,160,0.04);
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 12px; }
.drop-zone-title { font-size: 1rem; font-weight: 600; color: var(--white); margin-bottom: 6px; }
.drop-zone-desc { font-size: 0.8125rem; color: var(--gray1); }

/* ── 12. 表單 Grid ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.form-grid .full-width { grid-column: 1 / -1; }

/* ── 13. Checkbox 列 */
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--white2);
  cursor: pointer;
}
.check-item input[type="checkbox"] {
  accent-color: var(--teal);
  width: 16px; height: 16px;
}

/* ── 14. 檔案佇列 ── */
.file-queue { margin-bottom: 20px; }
.file-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.file-queue-header h4 { font-size: 0.875rem; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--navy3);
  border-radius: 8px;
  margin-bottom: 6px;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.file-type-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.badge-img { background: rgba(245,166,35,0.15); color: var(--amber); }
.badge-pdf { background: rgba(232,83,83,0.15); color: var(--red); }
.badge-doc { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-xls { background: rgba(0,194,160,0.15); color: var(--teal); }
.badge-dwg { background: rgba(139,92,246,0.15); color: #a78bfa; }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.8125rem; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.6875rem; color: var(--gray1); }

.file-progress {
  width: 80px; height: 4px;
  background: var(--gray3);
  border-radius: 2px;
  overflow: hidden;
}
.file-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--teal2), var(--teal));
  border-radius: 2px;
  transition: width 0.15s;
}

.file-remove {
  width: 28px; height: 28px;
  background: none;
  border: none;
  color: var(--gray2);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
}
.file-remove:hover { background: rgba(232,83,83,0.15); color: var(--red); }

/* ── 15. Action Bar ── */
.action-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(13,27,42,0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  margin: 0 -28px;
}
.action-stats { font-size: 0.8125rem; color: var(--gray1); }
.action-buttons { display: flex; gap: 8px; }

/* ── 16. Toast ── */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 360px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-success { background: var(--navy3); border-left: 3px solid var(--teal); color: var(--teal); }
.toast-error { background: var(--navy3); border-left: 3px solid var(--red); color: var(--red); }
.toast-info { background: var(--navy3); border-left: 3px solid var(--amber); color: var(--amber); }

/* ── 17. Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-content {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── 18. Collapsible (日報區段) ── */
details.collapsible { margin-bottom: 12px; }
details.collapsible summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray1);
  cursor: pointer;
  list-style: none;
}
details.collapsible summary::before {
  content: '▶';
  font-size: 0.6rem;
  transition: transform var(--transition);
}
details.collapsible[open] summary::before { transform: rotate(90deg); }

/* ── 19. Responsive — Tablet ── */
@media (max-width: 1023px) {
  .sidebar { width: 220px; }
  .main-content { padding: 20px 22px; }
  .action-bar { margin: 0 -22px; padding: 14px 22px; }
}

/* ── 20. Responsive — Mobile ── */
@media (max-width: 767px) {
  .app-header { height: 52px; }
  .hamburger { display: flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed;
    top: 52px; left: 0; bottom: 0;
    width: 280px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    top: 52px;
    z-index: 199;
    background: rgba(0,0,0,0.5);
  }

  .main-content { padding: 16px; padding-bottom: 90px; }
  .form-grid { grid-template-columns: 1fr; }
  .drop-zone { padding: 28px 16px; }

  .action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    margin: 0;
    border-radius: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .file-progress { display: none; }
  .login-card { padding: 32px 24px; }

  .toast-container { right: 12px; left: 12px; bottom: 90px; top: auto; }
  .toast { max-width: 100%; }
}

@media (max-width: 374px) {
  .btn { padding: 9px 12px; font-size: 0.875rem; }
  .action-bar { padding: 10px 12px; }
}

/* ═══════════════════════════════════════════
   認證系統 — 圖示選擇式 UI
   ═══════════════════════════════════════════ */

/* ── 認證步驟切換 ── */
.auth-step.hidden { display: none; }

.auth-welcome {
  text-align: center;
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.btn-back {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  color: var(--gray1);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 8px 16px;
}
.btn-back:hover { color: var(--teal); }

/* ── 認證圖示網格 ── */
.auth-icon-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.auth-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--navy3);
  border: 2px solid var(--gray3);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-icon-btn:hover {
  border-color: var(--teal);
  background: rgba(0, 194, 160, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 194, 160, 0.15);
}
.auth-icon-btn:active { transform: translateY(0); }

.auth-icon-emoji {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 4px;
}
.auth-icon-label {
  font-size: 0.7rem;
  color: var(--gray1);
  font-weight: 500;
}

.no-methods {
  text-align: center;
  color: var(--red);
  font-size: 0.875rem;
  padding: 12px;
}

.email-hint {
  text-align: center;
  color: var(--gray1);
  font-size: 0.75rem;
  margin-top: 8px;
}

/* ── 覆蓋層（PIN / 圖形鎖共用） ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-dialog {
  background: var(--navy2);
  border: 1px solid var(--gray3);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 340px;
  width: 90%;
  text-align: center;
}
.auth-dialog h3 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 16px;
}

.btn-cancel {
  margin-top: 12px;
  background: none;
  border: 1px solid var(--gray3);
  color: var(--gray1);
  padding: 8px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}
.btn-cancel:hover { border-color: var(--gray1); }

/* ── PIN 數字鍵盤 ── */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--gray2);
  transition: all 0.15s;
}
.pin-dot.filled {
  background: var(--teal);
  border-color: var(--teal);
}

.pin-hint {
  color: var(--gray1);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 240px;
  margin: 0 auto 12px;
}

.pin-key {
  height: 52px;
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--navy3);
  border: 1px solid var(--gray3);
  border-radius: 12px;
  color: var(--white);
  cursor: pointer;
  transition: all 0.15s;
}
.pin-key:hover { background: var(--gray3); }
.pin-key:active { transform: scale(0.95); }
.pin-key-action { color: var(--amber); font-size: 1.1rem; }
.pin-key-confirm { color: var(--teal); font-size: 1.1rem; }

.pin-error, .pattern-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-bottom: 8px;
  min-height: 1.2em;
}

/* ── 圖形鎖 3x3 點陣 ── */
.pattern-container {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 16px auto;
}

.pattern-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.pattern-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pattern-dot::before {
  content: '';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gray3);
  border: 2px solid var(--gray2);
  transition: all 0.15s;
}
.pattern-dot.selected::before {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 8px rgba(0, 194, 160, 0.4);
}

.pattern-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ── 設定精靈（Phase 5 用） ── */
.setup-wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.setup-wizard {
  background: var(--navy2);
  border: 1px solid var(--teal-glow);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 400px;
  width: 90%;
}
.setup-wizard h3 {
  color: var(--teal);
  text-align: center;
  margin-bottom: 16px;
}
.setup-step {
  padding: 12px;
  border: 1px solid var(--gray3);
  border-radius: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.setup-step:hover { border-color: var(--teal); }
.setup-step.completed { border-color: var(--teal); opacity: 0.6; }
.setup-step-icon { font-size: 1.5rem; }
.setup-step-text { color: var(--white); font-size: 0.9rem; }
.setup-step-status { margin-left: auto; color: var(--teal); font-size: 0.8rem; }

/* ── 憑證管理清單 ── */
.credential-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--gray3);
}
.credential-icon { font-size: 1.2rem; }
.credential-label { color: var(--white); font-size: 0.9rem; flex: 1; }
.credential-status { color: var(--gray1); font-size: 0.75rem; }
.btn-ghost {
  background: none;
  border: none;
  color: var(--gray1);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.75rem;
}
.btn-ghost:hover { color: var(--red); }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
