/* ============================================================
   CoMe PWA — Dark theme, mobile-first
   Background: #0D1117 | Accent: #4CD964
   Fonts: Playfair Display (headings), DM Sans (body)
   ============================================================ */

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

:root {
  --bg: #0D1117;
  --bg-card: #161B22;
  --bg-card-hover: #1C2333;
  --bg-input: #0D1117;
  --border: #30363D;
  --border-focus: #4CD964;
  --accent: #4CD964;
  --accent-hover: #5FE87A;
  --accent-glow: rgba(76, 217, 100, 0.25);
  --text: #E6EDF3;
  --text-muted: #8B949E;
  --text-heading: #FFFFFF;
  --danger: #F85149;
  --danger-hover: #FF6B63;
  --warning: #F59E0B;
  --success: #4CD964;
  --doc-valid-border: #4CD964;
  --doc-expired-border: #2E8B57;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-card: #F5F5F5;
  --bg-card-hover: #EAEAEA;
  --bg-input: #FFFFFF;
  --border: #DDDDDD;
  --border-focus: #00AA55;
  --accent: #00AA55;
  --accent-hover: #00C666;
  --accent-glow: rgba(0, 170, 85, 0.2);
  --text: #0A0A0A;
  --text-muted: #555555;
  --text-heading: #000000;
  --danger: #D1242F;
  --danger-hover: #B5151E;
  --warning: #B25B00;
  --success: #00AA55;
  --doc-valid-border: #00AA55;
  --doc-expired-border: #1F6F3B;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* --- App Shell --- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 24px);
  transition: opacity 0.2s ease;
}

.app.transitioning {
  opacity: 0;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.3;
}

/* --- Screen Layout --- */
.screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 40px);
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px);
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-top: 8px;
}

.screen-header .screen-title {
  flex: 1 1 auto;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.screen-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.screen-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* --- Welcome Screen --- */
.welcome-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-logo img {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(76, 217, 100, 0.2);
}

.welcome-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, #5FE87A 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
}

.welcome-cta {
  margin-top: 20px;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0;
  max-width: 300px;
}

.welcome-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.welcome-feature-icon {
  color: var(--accent);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.welcome-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 280px;
  margin-top: 8px;
  line-height: 1.4;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 12px 24px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #3BBF52 100%);
  color: #000000;
  box-shadow: 0 4px 16px rgba(76, 217, 100, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  box-shadow: 0 6px 24px rgba(76, 217, 100, 0.4);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 81, 73, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 12px 24px;
}

.btn-ghost:hover {
  background: rgba(76, 217, 100, 0.08);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.05rem;
  border-radius: 14px;
}

.btn-full {
  width: 100%;
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.btn-back:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

/* --- Cards (Home Screen) --- */
.card-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.profile-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-2px);
}

.profile-card:active {
  transform: translateY(0);
}

.card-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(76, 217, 100, 0.08);
  border-radius: 14px;
  color: var(--accent);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.card-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.profile-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

.home-footer {
  display: flex;
  justify-content: center;
  padding-top: 16px;
  margin-top: auto;
}

/* --- Forms --- */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.form-input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  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 d='M2 4l4 4 4-4' fill='none' stroke='%238B949E' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.form-error.visible {
  min-height: 1.2em;
  max-height: 3em;
}

.form-actions {
  margin-top: 8px;
  padding-top: 8px;
}

.form-status {
  text-align: center;
  font-size: 0.9rem;
  padding: 8px 0;
  border-radius: var(--radius-sm);
  min-height: 2rem;
}

.form-status.success {
  color: var(--success);
}

.form-status.error {
  color: var(--danger);
}

/* --- Photo Upload --- */
.photo-upload {
  width: 100%;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s ease;
  overflow: hidden;
}

.photo-upload:hover,
.photo-upload:focus-visible {
  border-color: var(--accent);
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.photo-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* --- Dashboard --- */
.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 0;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.status-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.status-card.complete {
  border-left: 3px solid var(--accent);
}

.status-card.incomplete {
  border-left: 3px solid var(--warning);
}

.status-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-detail h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.status-detail p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.consent-section {
  margin-top: 12px;
}

.consent-heading {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.consent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.consent-row:last-child {
  border-bottom: none;
}

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

.consent-purpose {
  font-weight: 500;
  font-size: 0.95rem;
}

.consent-granted {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.consent-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px 0;
}

/* --- Document Type Selector --- */
.doc-type-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-type-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
  color: var(--text);
}

.doc-type-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.doc-type-card.selected {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.doc-type-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(76, 217, 100, 0.08);
  border-radius: 10px;
  color: var(--accent);
  flex-shrink: 0;
}

.doc-type-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.doc-type-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.doc-add-card {
  border-style: dashed;
}

/* --- Scan/Manual Choice --- */
.entry-choice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

/* --- Selfie Capture --- */
.selfie-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.selfie-preview {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

.selfie-guide {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.selfie-actions {
  display: flex;
  gap: 12px;
}

/* --- Camera Video --- */
.camera-container {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.camera-video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
}

.camera-video.selfie-mode {
  border-radius: 50%;
  width: 200px;
  height: 200px;
  object-fit: cover;
  margin: 0 auto;
  display: block;
}

/* --- Error Screen --- */
.error-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 16px;
}

/* --- Responsive --- */
@media (min-width: 600px) {
  .app {
    max-width: 540px;
    padding-left: 32px;
    padding-right: 32px;
  }

  .welcome-title {
    font-size: 3rem;
  }

  .welcome-tagline {
    font-size: 1.2rem;
    max-width: 340px;
  }

  .card-grid {
    flex-direction: row;
  }

  .profile-card {
    flex: 1;
    flex-direction: column;
    text-align: center;
    padding: 28px 20px;
  }

  .card-arrow {
    display: none;
  }
}

@media (min-width: 768px) {
  .app {
    max-width: 640px;
  }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove tap highlight on mobile */
button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Selection color */
::selection {
  background: rgba(76, 217, 100, 0.3);
  color: var(--text-heading);
}

/* --- Typeahead / Org Search --- */
.typeahead-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.typeahead-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.9rem;
}

.typeahead-item:hover {
  background: var(--bg-card-hover);
}

.typeahead-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.typeahead-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.typeahead-badge.verified {
  background: rgba(76, 217, 100, 0.15);
  color: var(--accent);
}

.typeahead-badge.unverified {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.typeahead-add {
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-weight: 500;
}

.employer-status {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.employer-verified {
  color: var(--accent);
}

.employer-unverified {
  color: var(--warning);
}

/* --- Lock Screen / Auth --- */
.lock-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 24px;
}

.lock-icon {
  width: 64px;
  height: 64px;
  color: var(--accent);
}

.pin-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.pin-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.4rem;
  font-family: var(--font-body);
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  -webkit-appearance: none;
}

.pin-digit:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* --- Save to Phone --- */
.save-to-phone-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 24px;
  padding: 40px 20px;
}

.save-phone-icon {
  width: 80px;
  height: 80px;
  color: var(--accent);
}

.save-phone-heading {
  font-size: 1.5rem;
  font-weight: 700;
}

.save-phone-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 280px;
}

.save-phone-instruction {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.5;
}

.save-phone-skip {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  font-family: var(--font-body);
}

/* --- Language Selector --- */
.lang-selector {
  position: absolute;
  top: calc(var(--safe-top) + 16px);
  right: 20px;
  z-index: 10;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  border-color: var(--accent);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  text-align: left;
}

.lang-option:hover {
  background: var(--bg-card-hover);
}

.lang-option.active {
  color: var(--accent);
  font-weight: 600;
}

.lang-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 50vh;
  overflow-y: auto;
}

.lang-list .lang-option {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

/* --- RTL Support --- */
[dir="rtl"] .screen-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .profile-card {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .card-arrow {
  margin-left: 0;
  margin-right: auto;
  transform: scaleX(-1);
}

[dir="rtl"] .form-select {
  background-position: left 16px center;
  padding-left: 40px;
  padding-right: 16px;
}

[dir="rtl"] .lang-selector {
  right: auto;
  left: 20px;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: toastIn 0.3s ease;
}

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

/* --- Bottom Sheet Modal --- */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottom-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px calc(var(--safe-bottom) + 24px);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  animation: sheetSlideUp 0.3s ease;
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.bottom-sheet-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.bottom-sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- Plus Button --- */
.add-doc-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(76, 217, 100, 0.3);
  transition: all 0.2s ease;
  margin: 16px auto;
}

.add-doc-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(76, 217, 100, 0.4);
}

/* --- Document List --- */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.doc-list-item:hover {
  background: var(--bg-card-hover);
}

.doc-list-item.valid {
  border-color: var(--doc-valid-border);
}

.doc-list-item.expired {
  border-color: var(--doc-expired-border);
}

.doc-list-item.dragging {
  user-select: none;
}

.doc-list-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(76, 217, 100, 0.08);
  border-radius: 8px;
  color: var(--accent);
  flex-shrink: 0;
}

.doc-list-info {
  flex: 1;
}

.doc-list-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.doc-list-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Identity profile header --- */
.identity-profile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.identity-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-heading);
}

.identity-verified {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.identity-verified .verified-dot {
  color: var(--accent);
  margin-right: 4px;
}

/* --- Plus button (raised, 3D) --- */
.add-doc-btn-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, #7be58e 0%, #4cd964 55%, #2fa846 100%);
  color: #0a2a12;
  border: 1px solid rgba(26, 78, 38, 0.55);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 4px rgba(0, 0, 0, 0.18),
    0 2px 2px rgba(0, 0, 0, 0.15),
    0 6px 14px rgba(47, 168, 70, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.add-doc-btn-sm:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2),
    0 3px 4px rgba(0, 0, 0, 0.18),
    0 10px 20px rgba(47, 168, 70, 0.55);
}

.add-doc-btn-sm:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.28),
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(47, 168, 70, 0.35);
}

/* --- Contact collapse button (3+ phones / emails) --- */
.contact-collapse {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-family: var(--font-body);
  color: var(--text);
  font-size: 0.95rem;
}

/* --- Scan helper --- */
.scan-passport-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.scan-passport-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ocr-status {
  font-size: 0.85rem;
  text-align: center;
  padding: 8px 0;
  min-height: 1.5rem;
}

.ocr-status.success { color: var(--success); }
.ocr-status.error { color: var(--danger); }
.ocr-status.loading { color: var(--text-muted); }

/* --- Photo capture side by side --- */
.photo-pair {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.photo-pair .photo-upload {
  flex: 1;
  min-height: 120px;
}

.photo-pair .photo-placeholder span {
  font-size: 0.75rem;
}

/* --- Country Search --- */
.country-search {
  position: relative;
}

.country-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.country-option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease;
  width: 100%;
  background: var(--bg-card);
  border: none;
  color: var(--text);
  text-align: left;
  font-family: var(--font-body);
}

.country-option:hover {
  background: var(--bg-card-hover);
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--border);
}

/* --- Settings --- */
.btn-settings {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-settings:hover {
  color: var(--accent);
  background: rgba(76, 217, 100, 0.08);
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  padding-left: 4px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.settings-item:first-child {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.settings-item:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.settings-item:only-child {
  border-radius: var(--radius-sm);
}

.settings-item + .settings-item {
  border-top: none;
}

.settings-item:hover {
  background: var(--bg-card-hover);
}

.settings-item-label {
  font-size: 0.95rem;
  font-weight: 500;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item-value {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 0 0 auto;
  white-space: nowrap;
  max-width: none;
  margin-left: 12px;
  text-align: right;
}

.settings-item-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.settings-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-toggle.active {
  background: var(--accent);
}

.settings-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.settings-toggle.active::after {
  transform: translateX(20px);
}

/* --- Confirm Dialog --- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.confirm-dialog h3 {
  margin-bottom: 8px;
}

.confirm-dialog p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions .btn {
  flex: 1;
}

/* --- Logout Farewell overlay --- */
.farewell-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.farewell-overlay.visible {
  opacity: 1;
}

.farewell-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(8px);
  transition: transform 0.22s ease;
}

.farewell-overlay.visible .farewell-card {
  transform: translateY(0);
}

.farewell-heart {
  font-size: 2.25rem;
  margin-bottom: 8px;
}

.farewell-message {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-heading);
  line-height: 1.35;
}

/* ===========================================================
   CoMe V2 — Identity (CoID) + Work (CoWork) page styles
   =========================================================== */

/* Identity hero with avatar */
.identity-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.identity-avatar {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 2.4rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  transition: border-color 0.2s ease, transform 0.1s ease;
}

.identity-avatar:hover {
  border-color: var(--accent);
}

.identity-avatar:active {
  transform: scale(0.97);
}

.identity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-camera {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--accent);
  color: #0a2a12;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Document BUTTONS (replaces doc-list) — colour-coded by validity */
.doc-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-button {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  min-height: 64px;
}

.doc-button:hover {
  background: var(--bg-card-hover);
}

.doc-button:active {
  transform: scale(0.99);
}

.doc-button.valid {
  border-color: #7EE89C;
  background: rgba(76, 217, 100, 0.06);
}

.doc-button.expiring {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.06);
}

.doc-button.expired {
  border-color: var(--danger);
  background: rgba(248, 81, 73, 0.06);
}

.doc-button-emoji {
  font-size: 1.8rem;
  width: 44px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.doc-button-text {
  flex: 1;
  min-width: 0;
}

.doc-button-text h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.doc-button-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* + menu bottom sheet — emoji + larger touch targets */
.bottom-sheet .sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: -8px auto 14px;
}

.identity-add-sheet {
  padding-top: 14px;
}

.add-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.add-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.add-menu-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.add-menu-emoji {
  font-size: 1.6rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.add-menu-label {
  flex: 1;
}

/* Section titles (work page + past-employer form) */
.section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 20px 0 12px;
}

/* Work — currently-here toggle */
.currently-here {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text);
  margin: -8px 0 16px;
  cursor: pointer;
}

.currently-here input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* Work history list */
.work-history-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.work-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.work-history-header .section-title {
  margin: 0;
}

.work-history-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 12px 0;
}

.past-employers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.past-employer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.past-employer-row:hover {
  background: var(--bg-card-hover);
}

.past-employer-info {
  flex: 1;
  min-width: 0;
}

.past-employer-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.past-employer-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.past-employer-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Past employer edit overlay */
.past-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.past-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.past-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Dashboard quick actions — wider spacing */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  min-height: 96px;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
}

/* Status partial state (dashboard Work "add your role") */
.status-card.partial {
  border-color: var(--warning);
}

/* National ID scan pair */
.scan-pair {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.scan-pair .scan-passport-btn {
  flex: 1;
  margin-bottom: 0;
}

/* Register screen */
.register-screen .form {
  margin-top: 8px;
}
