/* Proof — Mobile-first, clean, trustworthy */
:root {
  --teal: #0e9488;
  --teal-dark: #0a7a71;
  --teal-light: #e6f7f5;
  --teal-mid: #99dbd6;
  --slate: #1e293b;
  --slate-mid: #475569;
  --slate-light: #94a3b8;
  --bg: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #10b981;
  --success-light: #ecfdf5;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'DM Sans', 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  color: var(--slate);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ── */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--teal);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.app-logo span { color: var(--slate); }

.app-main { flex: 1; padding: 1.25rem 1rem; max-width: 640px; margin: 0 auto; width: 100%; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  min-height: 48px; /* big tap targets */
  white-space: nowrap;
}

.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); }

.btn-secondary {
  background: var(--white); color: var(--teal);
  border: 1.5px solid var(--teal);
}
.btn-secondary:hover { background: var(--teal-light); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-ghost { background: transparent; color: var(--slate-mid); }
.btn-ghost:hover { background: var(--border); }

.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; color: var(--slate); }
.form-input {
  width: 100%; padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem; font-family: inherit;
  background: var(--white); color: var(--slate);
  transition: border-color .15s;
  min-height: 48px;
}
.form-input:focus { outline: none; border-color: var(--teal); }
.form-input.error { border-color: var(--danger); }

/* ── Alerts ── */
.alert { padding: .875rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1rem; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }

/* ── Auth page ── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo h1 { font-size: 1.75rem; font-weight: 800; color: var(--teal); letter-spacing: -.03em; }
.auth-logo p { color: var(--slate-mid); font-size: .95rem; margin-top: .25rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--slate-mid); }
.auth-switch a { color: var(--teal); font-weight: 600; text-decoration: none; }

/* ── Dashboard ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 1.1rem; font-weight: 700; color: var(--slate); }

.project-grid { display: flex; flex-direction: column; gap: .75rem; }

.project-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  text-decoration: none; color: inherit;
  transition: box-shadow .15s, border-color .15s;
  cursor: pointer;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--teal-mid); }

.project-thumb {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  background: var(--teal-light); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-thumb-icon { font-size: 1.75rem; }

.project-info { flex: 1; min-width: 0; }
.project-name { font-weight: 700; font-size: 1rem; color: var(--slate); margin-bottom: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { font-size: .8rem; color: var(--slate-light); }

.project-count {
  font-weight: 700; font-size: 1.1rem; color: var(--teal);
  flex-shrink: 0; text-align: center; min-width: 36px;
}
.project-count small { display: block; font-size: .7rem; font-weight: 400; color: var(--slate-light); }

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1.5rem;
  background: var(--white); border: 2px dashed var(--border); border-radius: var(--radius);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-title { font-weight: 700; font-size: 1.1rem; margin-bottom: .5rem; }
.empty-text { color: var(--slate-mid); font-size: .9rem; margin-bottom: 1.5rem; }

/* ── Project detail ── */
.capture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.capture-thumb {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--teal-light); overflow: hidden;
  position: relative; cursor: pointer;
}
.capture-thumb img { width: 100%; height: 100%; object-fit: cover; }
.capture-tag {
  position: absolute; bottom: .25rem; left: .25rem;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: .65rem; padding: .15rem .35rem; border-radius: 4px;
}

/* ── Camera screen ── */
.camera-screen {
  position: fixed; inset: 0; background: #000; z-index: 100;
  display: flex; flex-direction: column;
}

.camera-viewfinder {
  flex: 1; position: relative; overflow: hidden;
}

#camera-video {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}

.camera-overlay {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 1rem; background: linear-gradient(to bottom, rgba(0,0,0,.6) 0%, transparent 100%);
}

.camera-overlay-back {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  border-radius: 50%; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.25rem; backdrop-filter: blur(4px);
}

.camera-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: .75rem 1rem; background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 100%);
}

.camera-timestamp {
  color: #fff; font-size: .8rem; font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.camera-gps {
  color: rgba(255,255,255,.8); font-size: .7rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.camera-controls {
  background: #0a0a0a; padding: 1.25rem;
  display: flex; align-items: center; justify-content: center;
}

.shutter-btn {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--white); border: 4px solid rgba(255,255,255,.4);
  cursor: pointer; transition: transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.shutter-btn:active { transform: scale(.93); }
.shutter-inner {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--white); border: 2px solid #ddd;
}

/* Flash animation */
@keyframes flash { 0% { opacity:1 } 50% { opacity: 0 } 100% { opacity:1 } }
.camera-flash {
  position: absolute; inset: 0; background: #fff;
  animation: flash .25s ease-out;
  pointer-events: none;
}

/* Tag prompt */
.tag-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7); display: flex;
  align-items: flex-end; backdrop-filter: blur(4px);
}
.tag-sheet {
  background: var(--white); border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem; width: 100%;
}
.tag-title { font-weight: 700; margin-bottom: .5rem; font-size: 1.05rem; }
.tag-success { color: var(--success); font-size: .85rem; margin-bottom: 1rem; }
.tag-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tag-chip {
  padding: .45rem .9rem; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--white);
  font-size: .85rem; cursor: pointer; transition: all .15s;
}
.tag-chip:hover, .tag-chip.selected { background: var(--teal-light); border-color: var(--teal); color: var(--teal); font-weight: 600; }
.tag-free { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tag-free input {
  flex: 1; padding: .65rem .9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit;
}
.tag-free input:focus { outline: none; border-color: var(--teal); }
.tag-actions { display: flex; gap: .75rem; }

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── User menu ── */
.user-menu { position: relative; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--teal-light); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; cursor: pointer; border: none;
}
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + .5rem);
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  min-width: 160px; padding: .5rem 0; display: none; z-index: 100;
}
.user-dropdown.open { display: block; }
.user-dropdown a, .user-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: .65rem 1rem; font-size: .9rem; color: var(--slate);
  text-decoration: none; background: none; border: none; cursor: pointer;
  font-family: inherit;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--bg); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 300; display: none; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.modal-backdrop.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 400px; }
.modal-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }

/* ── Capture timestamp overlay ── */
.capture-ts-overlay {
  position: absolute; bottom: .25rem; right: .25rem;
  background: rgba(0,0,0,.55); color: rgba(255,255,255,.9);
  font-size: .6rem; padding: .1rem .3rem; border-radius: 4px;
  pointer-events: none;
}

/* ── Logo image in header ── */
.app-logo-img { height: 28px; width: auto; object-fit: contain; }

/* ── Responsive ── */
@media (min-width: 480px) {
  .app-main { padding: 1.5rem; }
  .capture-grid { grid-template-columns: repeat(4, 1fr); }
}
