/* ============================================================
   WorkPhoto — Design System
   Professional Engineering Management Tool
   ============================================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Background (Light/White) */
  --bg-primary: #f0f4f8;      /* Light grayish blue for body */
  --bg-surface: #ffffff;      /* Pure white for cards */
  --bg-elevated: #f8fafc;     /* Slightly off-white for inputs/headers */
  --bg-hover: #e2e8f0;        /* Grayish blue on hover */
  --bg-modal: rgba(15, 23, 42, 0.5); /* Modal overlay */

  /* Accent Colors (Calm Blue) */
  --accent-blue: #1e40af;       /* Deep calm blue primary */
  --accent-blue-hover: #1e3a8a; /* Darker blue active */
  --accent-blue-glow: rgba(30, 64, 175, 0.2);
  --accent-orange: #f97316;     /* Secondary / Highlight */
  --accent-orange-hover: #ea580c;
  --accent-green: #059669;
  --accent-red: #dc2626;
  --accent-yellow: #d97706;

  /* Text (Dark for light bg) */
  --text-primary: #0f172a;      /* Slate 900 */
  --text-secondary: #475569;    /* Slate 600 */
  --text-muted: #64748b;        /* Slate 500 */
  --text-inverse: #ffffff;      /* White text on dark buttons */

  /* Border */
  --border: #cbd5e1;          /* Slate 300 */
  --border-active: var(--accent-blue);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 12px var(--accent-blue-glow);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-navbar: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-sync-bar: 500;

  /* DocAHA compatibility aliases (used by RepairWorkstation module) */
  --bg-card: var(--bg-surface);
  --bg-input: var(--bg-elevated);
  --border-light: var(--border);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-blue-hover);
}

img, video {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* --- Utility Classes --- */

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Text */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--accent-orange); }
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-yellow { color: var(--accent-yellow); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spacing */
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.px-md { padding-left: var(--space-md); padding-right: var(--space-md); }
.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* --- Component Styles --- */

/* Card */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}
.card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.card-static {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

/* Record Card overrides for compact display */
.record-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.record-card {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
}

.record-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.record-card-footer {
  margin-top: var(--space-xs);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 48px;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent-blue);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-blue-hover);
  box-shadow: var(--shadow-md), 0 0 16px var(--accent-blue-glow);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: white;
}
.btn-danger:hover {
  background: linear-gradient(135deg, var(--accent-red-hover), var(--accent-red));
  transform: translateY(-1px);
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: 16px 32px;
  font-size: var(--text-base);
  min-height: 56px;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--text-xs);
  min-height: 36px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Input */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.input-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  min-height: 48px;
  transition: all var(--transition-fast);
}
.input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}
.input::placeholder {
  color: var(--text-muted);
}

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

/* Badge / Tag */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-orange {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
}
.badge-blue {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-blue);
}
.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
}
.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}
.badge-yellow {
  background: rgba(234, 179, 8, 0.15);
  color: var(--accent-yellow);
}

/* Phase badges for construction stages */
.phase-before {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(14, 165, 233, 0.3);
}
.phase-during {
  background: rgba(234, 179, 8, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(234, 179, 8, 0.3);
}
.phase-after {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Modal / Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 480px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Page layout */
.page {
  flex: 1;
  padding: var(--space-lg) var(--space-md);
  padding-bottom: calc(80px + var(--space-lg));
}

.page-header {
  margin-bottom: var(--space-lg);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Section */
.section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }
.animate-slide-down { animation: slideDown 0.3s ease; }
.animate-pulse { animation: pulse 2s ease infinite; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .hide-mobile {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* --- PWA / Offline bar --- */
.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: var(--accent-blue);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  z-index: var(--z-sync-bar);
  animation: slideDown 0.3s ease;
}

.offline-bar .pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--text-inverse);
  border-radius: 50%;
  animation: pulse 1.5s ease infinite;
}

/* When offline bar is visible, push content down */
body.is-offline #root {
  padding-top: 36px;
}

/* --- Print --- */
@media print {
  body {
    background: white;
    color: black;
  }
  .no-print {
    display: none !important;
  }
}
.toast-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  pointer-events: all;
  animation: slideUp 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
}

.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.toast-message {
  flex: 1;
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.3);
}
.toast-success .toast-icon {
  color: var(--accent-green);
  background: rgba(34, 197, 94, 0.15);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
}
.toast-error .toast-icon {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.15);
}

.toast-info {
  border-color: rgba(14, 165, 233, 0.3);
}
.toast-info .toast-icon {
  color: var(--accent-blue);
  background: rgba(14, 165, 233, 0.15);
}

.toast-warning {
  border-color: rgba(234, 179, 8, 0.3);
}
.toast-warning .toast-icon {
  color: var(--accent-yellow);
  background: rgba(234, 179, 8, 0.15);
}
.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: var(--z-navbar);
  backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: 500px;
  margin: 0 auto;
  padding: 6px 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-item.active .nav-label {
  color: var(--accent-orange);
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px var(--accent-orange-glow));
}

/* Central capture button */
.nav-primary {
  margin-top: -18px;
}

.nav-capture-btn {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-orange), #ea580c);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 16px var(--accent-orange-glow), 0 0 24px var(--accent-orange-glow);
  transition: all var(--transition-fast);
}

.nav-primary:active .nav-capture-btn {
  transform: scale(0.9);
}

.nav-primary .nav-label {
  color: var(--accent-orange);
  margin-top: 2px;
}

/* Hover effects on desktop */
@media (hover: hover) {
  .nav-item:hover {
    background: var(--bg-elevated);
  }
  .nav-primary:hover .nav-capture-btn {
    box-shadow: 0 6px 24px var(--accent-orange-glow), 0 0 32px var(--accent-orange-glow);
    transform: translateY(-2px);
  }
}
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
  padding: 1rem;
}

.login-box {
  background: white;
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-logo {
  font-size: 2rem;
  font-weight: bold;
  text-align: center;
  color: #ea580c;
  margin-bottom: 0.5rem;
}

.login-box h2 {
  text-align: center;
  margin: 0;
  color: #1f2937;
  font-size: 1.5rem;
}

.login-desc {
  text-align: center;
  color: #6b7280;
  margin: 0;
  font-size: 0.875rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.divider span {
  padding: 0 0.5rem;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.google-btn:hover {
  background-color: #f9fafb;
}

.toggle-text {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.toggle-text span {
  color: #ea580c;
  cursor: pointer;
  font-weight: 500;
}

.toggle-text span:hover {
  text-decoration: underline;
}

.error-text {
  color: #dc2626;
  font-size: 0.875rem;
  margin: 0;
  text-align: center;
}
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.dash-greeting {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-secondary);
}

.dash-user-name {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.dash-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-orange), #ea580c) !important;
  color: white !important;
  border-radius: 50% !important;
  font-weight: 700;
  font-size: var(--text-lg);
  flex-shrink: 0;
}

/* Stats grid */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.dash-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dash-stat-card:active {
  transform: scale(0.96);
}

.dash-stat-icon {
  font-size: 24px;
}

.dash-stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.dash-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.dash-stat-pending {
  border-color: rgba(249, 115, 22, 0.3);
  grid-column: 1 / -1;
}

.dash-stat-pending .dash-stat-value {
  color: var(--accent-orange);
}

/* Quick actions */
.dash-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.dash-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.dash-action-card:active {
  transform: scale(0.95);
}

.dash-action-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.dash-action-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Project list */
.dash-project-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.dash-project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) !important;
  cursor: pointer;
}

.dash-project-name {
  font-size: var(--text-base);
  font-weight: 600;
}

.dash-project-meta {
  margin-top: 2px;
}

.dash-project-stats {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

@media (max-width: 380px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-stat-pending {
    grid-column: 1 / -1;
  }
}
.export-center-page {
  padding-bottom: var(--space-2xl);
}

/* ─── Filter Card ─── */
.filter-card {
  margin-bottom: var(--space-lg);
}

.filter-grid-v2 {
  display: flex;
  gap: var(--space-md);
  align-items: end;
}

.filter-grid-v2 .input-group {
  min-width: 0;
}

@media (max-width: 768px) {
  .filter-grid-v2 {
    flex-direction: column;
  }
}

/* ─── Sub Project Selection Card ─── */
.sub-select-card {
  margin-bottom: var(--space-lg);
  padding: 0;
  overflow: hidden;
}

.sub-select-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.03), rgba(139, 92, 246, 0.03));
}

.sub-select-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.sub-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--primary, #3b82f6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}

.sub-select-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary, #3b82f6);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-link:hover {
  background: rgba(59, 130, 246, 0.08);
}

.divider-dot {
  color: var(--text-muted, #9ca3af);
  font-size: 0.7rem;
}

/* Status filter pills */
.status-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color, #e5e7eb);
  background: transparent;
  color: var(--text-secondary, #6b7280);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.status-pill:hover {
  border-color: var(--pill-color, var(--primary, #3b82f6));
  color: var(--pill-color, var(--primary, #3b82f6));
}

.status-pill.active {
  background: var(--pill-color, var(--primary, #3b82f6));
  border-color: var(--pill-color, var(--primary, #3b82f6));
  color: #fff;
}

.pill-count {
  font-size: 0.72rem;
  opacity: 0.8;
}

/* Sub-project list */
.sub-list {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
}

.sub-list-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted, #9ca3af);
  font-size: 0.9rem;
}

.sub-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.sub-item:hover {
  background: rgba(59, 130, 246, 0.04);
}

.sub-item.selected {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.2);
}

.sub-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #3b82f6);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.sub-item-body {
  flex: 1;
  min-width: 0;
}

.sub-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.sub-case-num {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.sub-status-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.sub-item-location {
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-item-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.sub-item-meta span {
  font-size: 0.72rem;
  color: var(--text-muted, #9ca3af);
  white-space: nowrap;
}

/* ─── Export Actions Card ─── */
.export-actions-card {
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
}

/* Document type selector */
.doc-type-section {
  margin-bottom: var(--space-lg);
}

.doc-type-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.doc-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.doc-type-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.85rem;
}

.doc-type-item:hover {
  border-color: var(--primary, #3b82f6);
  background: rgba(59, 130, 246, 0.03);
}

.doc-type-item.checked {
  border-color: var(--primary, #3b82f6);
  background: rgba(59, 130, 246, 0.06);
}

.doc-type-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary, #3b82f6);
  cursor: pointer;
}

.doc-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.doc-type-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.doc-type-desc {
  font-size: 0.72rem;
  color: var(--text-muted, #9ca3af);
}

/* Export buttons */
.export-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 600px) {
  .export-buttons {
    grid-template-columns: 1fr;
  }
}

.export-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.export-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.export-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.export-btn-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.export-btn-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.export-btn-desc {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  margin-top: 2px;
}

.csv-export-btn:hover:not(:disabled) {
  border-color: #22c55e;
}

.word-export-btn:hover:not(:disabled) {
  border-color: #3b82f6;
}

/* ─── Stats bar ─── */
.export-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(139, 92, 246, 0.06));
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 12px;
  flex-wrap: wrap;
}

.export-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.export-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.export-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted, #9ca3af);
  font-weight: 500;
}

.export-stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color, #e5e7eb);
}

@media (max-width: 600px) {
  .export-stats-bar {
    gap: var(--space-md);
  }
  .export-stat-value {
    font-size: 1.1rem;
  }
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (max-width: 480px) {
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-elevated);
}

.photo-cell:active {
  opacity: 0.8;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.photo-cell:hover .photo-img {
  transform: scale(1.05);
}

.photo-overlay {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
}

.photo-overlay .badge {
  font-size: 10px;
  padding: 2px 8px;
  backdrop-filter: blur(4px);
}

.photo-overlay .badge-editable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-overlay .badge-editable:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.phase-select {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.6);
  color: #fff;
  backdrop-filter: blur(4px);
  cursor: pointer;
  outline: none;
}

.phase-select option {
  background: #333;
  color: #fff;
}

.phase-other {
  background: rgba(156, 163, 175, 0.3);
  color: #6b7280;
  border: 1px solid rgba(156, 163, 175, 0.5);
}

.photo-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}

.photo-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
}

.photo-address {
  display: block;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-fade-in 0.2s ease;
}

@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10001;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  backdrop-filter: blur(8px);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  transition: transform 0.15s ease;
  border-radius: 4px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 36px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10000;
  backdrop-filter: blur(8px);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

.lightbox-info {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 20px;
  border-radius: 24px;
  backdrop-filter: blur(8px);
  z-index: 10000;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lightbox-phase {
  color: #fbbf24;
  font-size: 13px;
  font-weight: 500;
}

.lightbox-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .lightbox-nav {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .lightbox-image {
    max-width: 100vw;
    max-height: 80vh;
  }

  .lightbox-info {
    bottom: 16px;
    padding: 6px 16px;
    gap: 8px;
  }
}
.validation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.validation-card {
  background: var(--bg-primary, #1a1a2e);
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.validation-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Steps indicator */
.validation-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.v-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.v-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid var(--border-color, #333);
  color: var(--text-secondary, #888);
  transition: all 0.3s;
}

.v-step.active .v-step-dot {
  border-color: var(--primary, #6c5ce7);
  background: var(--primary, #6c5ce7);
  color: white;
  animation: pulse 1.5s infinite;
}

.v-step.passed .v-step-dot {
  border-color: #00b894;
  background: #00b894;
  color: white;
}

.v-step.failed .v-step-dot {
  border-color: #e17055;
  background: #e17055;
  color: white;
}

.v-step-label {
  font-size: 0.72rem;
  color: var(--text-secondary, #888);
  text-align: center;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108, 92, 231, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(108, 92, 231, 0); }
}

/* Check items */
.validation-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.v-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-secondary, #16213e);
  font-size: 0.85rem;
}

.v-check-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.v-check-item.pass { border-left: 3px solid #00b894; }
.v-check-item.fail { border-left: 3px solid #e17055; }
.v-check-item.pending { border-left: 3px solid #636e72; opacity: 0.6; }

.v-check-detail {
  font-size: 0.75rem;
  color: var(--text-secondary, #888);
  margin-top: 2px;
}

/* Result banner */
.validation-result {
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.validation-result.approved {
  background: rgba(0, 184, 148, 0.15);
  color: #00b894;
  border: 1px solid rgba(0, 184, 148, 0.3);
}

.validation-result.pending_review {
  background: rgba(253, 203, 110, 0.15);
  color: #fdcb6e;
  border: 1px solid rgba(253, 203, 110, 0.3);
}

.validation-result.rejected {
  background: rgba(225, 112, 85, 0.15);
  color: #e17055;
  border: 1px solid rgba(225, 112, 85, 0.3);
}

.validation-result-icon {
  font-size: 1.4rem;
}

/* Score */
.quality-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

.score-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  border: 3px solid;
}

.score-circle.high { border-color: #00b894; color: #00b894; }
.score-circle.mid { border-color: #fdcb6e; color: #fdcb6e; }
.score-circle.low { border-color: #e17055; color: #e17055; }

.score-label {
  font-size: 0.8rem;
  color: var(--text-secondary, #888);
}

/* Actions */
.validation-actions {
  display: flex;
  gap: 10px;
}

.validation-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
}

/* Set comparison */
.set-comparison {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg-secondary, #16213e);
}

.similarity-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border-color, #333);
  margin: 10px 0;
  overflow: hidden;
}

.similarity-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.similarity-fill.high { background: #00b894; }
.similarity-fill.mid { background: #fdcb6e; }
.similarity-fill.low { background: #e17055; }
.project-info-card {
  margin-top: var(--space-md);
}

.project-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.project-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-info-stats {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* Record list */
.record-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.record-card {
  cursor: pointer;
  padding: 8px 12px !important;
}

.record-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.record-card-phases {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.badge-muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Record photo section */
.record-photo-section {
  margin-bottom: var(--space-md);
}

.record-photo-empty {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* FAB */
.fab-capture {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange), #ea580c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px var(--accent-orange-glow);
  z-index: var(--z-dropdown);
  transition: all var(--transition-fast);
  animation: slideUp 0.3s ease;
}

.fab-capture:active {
  transform: scale(0.9);
}

@media (hover: hover) {
  .fab-capture:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px var(--accent-orange-glow);
  }
}

/* Delete confirmation inline */
.delete-confirm-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  background: rgba(239, 68, 68, 0.06);
  border-radius: 6px;
  animation: fadeIn 0.15s ease;
}

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

/* Map container */
.map-container {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  background: #f9fafb;
}

.map-embed {
  width: 100%;
  height: 220px;
  position: relative;
}

.map-coords-display {
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-top: 1px solid var(--border-color, #e5e7eb);
  text-align: center;
}

.map-drag-note {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  border-radius: 6px;
  text-align: center;
  pointer-events: none;
}

