:root {
  --navy: #051A32;
  --teal: #02978D;
  --emerald: #2FBC9B;
  --mint: #D8EADF;
  --slate: #8699A9;
  --paper: #FFFFFF;
  --paper-2: #EDF5F2;
  --ink: #051A32;
  --muted: #5C6B77;
  --line: rgba(5, 26, 50, 0.12);
  --danger: #B0443A;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

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

/* ensure the hidden attribute always wins over display styles */
[hidden] { display: none !important; }

/* fixed 3D ambient background */
.bg-3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.app { position: relative; z-index: 1; }

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

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--paper-2);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* app shell */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  color: var(--ink);
  padding: 0 max(16px, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px -14px rgba(5, 26, 50, 0.3);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  filter: drop-shadow(0 0 6px rgba(47, 188, 155, 0.4));
}
.brand-name {
  color: var(--navy);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.header-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: rgba(2, 151, 141, 0.1);
  border-radius: 999px;
  padding: 5px 11px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px -12px rgba(5, 26, 50, 0.25);
  padding-bottom: env(safe-area-inset-bottom);
}
.view-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}
.view-btn svg { width: 22px; height: 22px; }
.view-btn.is-active { color: var(--teal); }
.view-btn.is-active span { font-weight: 600; }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 30;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--teal), var(--emerald));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(2, 151, 141, 0.7);
  transition: transform 0.15s ease;
  animation: fab-pulse 2.4s ease-out infinite;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(0.94); }
@keyframes fab-pulse {
  0% { box-shadow: 0 10px 24px -8px rgba(2, 151, 141, 0.7), 0 0 0 0 rgba(47, 188, 155, 0.45); }
  70% { box-shadow: 0 10px 24px -8px rgba(2, 151, 141, 0.7), 0 0 0 16px rgba(47, 188, 155, 0); }
  100% { box-shadow: 0 10px 24px -8px rgba(2, 151, 141, 0.7), 0 0 0 0 rgba(47, 188, 155, 0); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(5, 26, 50, 0.6);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 104px;
}

.view { display: none; }
.view.is-active { display: block; }

.community-head {
  margin-bottom: 20px;
}
.community-head h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.community-head p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 16px;
  max-width: 48ch;
}

/* buttons */
.btn-primary, .btn-ghost {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--emerald), var(--teal));
  background-size: 220% 220%;
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(2, 151, 141, 0.6);
  animation: btn-shift 5s ease infinite;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(0.98); }
@keyframes btn-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.btn-ghost { background: transparent; color: var(--navy); border-color: rgba(5, 26, 50, 0.3); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-block { display: block; width: 100%; text-align: center; }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }

/* feed */
.feed { display: flex; flex-direction: column; gap: 12px; }
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 56px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-icon { width: 56px; height: 56px; color: var(--teal); opacity: 0.85; }
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--ink); }
.empty-state p { font-size: 14px; }
.issue-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.issue-card:hover { border-color: rgba(2, 151, 141, 0.4); box-shadow: 0 8px 24px -14px rgba(5, 26, 50, 0.35); }
.issue-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.issue-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.issue-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.category-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
  background: rgba(2, 151, 141, 0.08);
  border-radius: 6px;
  padding: 3px 8px;
}
.cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex: 0 0 auto;
}
.issue-note { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* status badges */
.status {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.status-submitted { color: var(--navy); border-color: rgba(5, 26, 50, 0.5); }
.status-under_review { color: var(--slate); border-color: rgba(134, 153, 169, 0.6); }
.status-verified { color: var(--teal); border-color: rgba(2, 151, 141, 0.6); }
.status-in_progress { color: var(--navy); background: rgba(47, 188, 155, 0.12); border-color: var(--emerald); }
.status-resolved { color: var(--navy); background: var(--emerald); border-color: var(--emerald); }

/* stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.stat-num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* admin list */
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.admin-row .issue-title { font-size: 15px; }
.admin-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.admin-controls select, .admin-controls input {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
}
.admin-controls select { flex: 1; min-width: 0; }
.admin-controls input { flex: 1; min-width: 0; }
.save-owner {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}

/* modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 26, 50, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 560px) {
  .modal { align-items: center; padding: 24px; }
}
.modal-card {
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}
@media (min-width: 560px) { .modal-card { border-radius: 20px; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h2 { font-size: 19px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

/* form */
.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--paper);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(47, 188, 155, 0.15);
}
.field input.invalid, .field select.invalid { border-color: var(--danger); }
.form-status { font-size: 14px; min-height: 18px; margin-bottom: 8px; }
.form-status.error { color: var(--danger); }
.form-status.success { color: var(--teal); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* issue detail */
.detail-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.detail-meta { margin: 10px 0 16px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; }
.timeline { display: flex; flex-direction: column; margin: 16px 0 20px; }
.tl-step {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 20px;
}
.tl-step::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.tl-step:last-child::before { display: none; }
.tl-dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 2px solid var(--slate);
  margin-top: 2px;
  z-index: 1;
}
.tl-step.is-done .tl-dot { background: var(--emerald); border-color: var(--emerald); }
.tl-step.is-current .tl-dot { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(2,151,141,0.2); }
.tl-label { font-size: 14px; font-weight: 500; }
.tl-step.is-current .tl-label { color: var(--teal); }
.tl-step:not(.is-done):not(.is-current) .tl-label { color: var(--muted); }

.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.confirm-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  background: var(--emerald);
  color: var(--navy);
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
}
.comment-box { display: flex; gap: 8px; width: 100%; margin-top: 8px; }
.comment-box input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}

/* community interaction row */
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.act:hover { color: var(--navy); border-color: var(--teal); }
.act b { font-weight: 600; color: var(--ink); }
.act-confirm { color: var(--teal); }
.act-confirm:hover { background: rgba(47, 188, 155, 0.1); border-color: var(--emerald); }
.act-note { font-size: 13px; color: var(--muted); margin-left: auto; }

/* comments in issue detail */
.comments { margin: 18px 0 12px; }
.comments h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.comment {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--paper-2);
  border-radius: 10px;
  margin-bottom: 8px;
}
.comment-text { font-size: 14px; color: var(--ink); }
.comment-time { font-size: 12px; color: var(--muted); }
.comments-empty { font-size: 14px; color: var(--muted); margin: 12px 0; }

/* connection + conversation */
.connected-banner {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(47, 188, 155, 0.12);
  border: 1px solid rgba(47, 188, 155, 0.35);
  color: var(--navy);
  font-size: 14px;
  font-weight: 500;
}
.connected-open { background: var(--paper-2); border-color: var(--line); color: var(--muted); }
.msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.msg-reporter { background: var(--paper-2); }
.msg-solver { background: rgba(47, 188, 155, 0.1); }
.msg-author { font-size: 12px; font-weight: 600; color: var(--ink); }
.msg-author em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  margin-left: 4px;
}
.msg-solver .msg-author em { color: var(--emerald); }
.msg-text { font-size: 14px; color: var(--ink); }
.msg-time { font-size: 12px; color: var(--muted); }

/* ---------- onboarding ---------- */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ob-inner { max-width: 520px; width: 100%; text-align: center; }
.ob-logo { height: 84px; width: auto; margin-bottom: 20px; }
.onboarding h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }
.ob-sub { font-size: 15px; color: var(--muted); margin-bottom: 28px; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.role-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.role-card:hover {
  border-color: var(--teal);
  box-shadow: 0 12px 30px -18px rgba(5, 26, 50, 0.35);
  transform: translateY(-2px);
}
.role-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.role-icon svg { width: 24px; height: 24px; }
.role-icon-report { background: rgba(2, 151, 141, 0.12); color: var(--teal); }
.role-icon-solve { background: rgba(47, 188, 155, 0.14); color: var(--emerald); }
.role-card b { font-size: 17px; font-weight: 600; color: var(--ink); }
.role-desc { font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ---------- solver view ---------- */
.name-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.name-field span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.name-field input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--paper);
  color: var(--ink);
}
.list-heading {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 10px;
}
.solver-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.solver-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.solver-row .issue-note { margin-bottom: 4px; }
.solve-btn { margin-top: 12px; width: 100%; }

/* claimed indicator */
.claimed { color: var(--teal); font-weight: 500; }

@media (max-width: 480px) {
  .role-cards { grid-template-columns: 1fr; }
}

/* home view */
.home-hero {
  position: relative;
  min-height: 240px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(2, 151, 141, 0.06), rgba(47, 188, 155, 0.02));
  padding: 24px 22px;
}
.hero-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}
.hero-3d canvas { width: 100%; height: 100%; display: block; }
.home-hero h1, .home-hero p { position: relative; z-index: 1; }
.home-hero h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.home-hero p { font-size: 15px; color: var(--muted); }
.home-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.home-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.home-action:hover { border-color: var(--teal); box-shadow: 0 12px 28px -18px rgba(5, 26, 50, 0.35); transform: translateY(-2px); }
.ha-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.ha-icon svg { width: 22px; height: 22px; }
.ha-report { background: rgba(2, 151, 141, 0.12); color: var(--teal); }
.ha-browse { background: rgba(5, 26, 50, 0.08); color: var(--navy); }
.ha-solve { background: rgba(47, 188, 155, 0.14); color: var(--emerald); }
.home-action b { font-size: 15px; font-weight: 600; color: var(--ink); }
.ha-sub { font-size: 13px; color: var(--muted); line-height: 1.4; }

@media (max-width: 560px) {
  .home-actions { grid-template-columns: 1fr; }
}

/* location + camera */
.loc-row { display: flex; gap: 8px; }
.loc-row input { flex: 1; min-width: 0; }
.loc-btn {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--teal);
  background: rgba(2, 151, 141, 0.08);
  border: 1px solid rgba(2, 151, 141, 0.25);
  border-radius: 10px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}
.loc-btn:hover { background: rgba(2, 151, 141, 0.14); }
.loc-status {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
  background: rgba(2, 151, 141, 0.08);
  border-radius: 999px;
  padding: 5px 12px;
}

/* splash screen */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(160deg, #04121f, #062a4a 55%, #05384a);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-logo {
  width: 96px;
  height: auto;
  filter: drop-shadow(0 8px 26px rgba(47, 188, 155, 0.45));
  animation: splash-pop 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.splash-name {
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.splash-tag {
  color: rgba(216, 234, 223, 0.72);
  font-size: 14px;
}
@keyframes splash-pop {
  from { opacity: 0; transform: scale(0.72); }
  to { opacity: 1; transform: none; }
}

/* home stats */
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 8px;
}
.hstat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.hstat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.hstat span { font-size: 11px; color: var(--muted); }

/* auth screen */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.auth-inner { width: 100%; max-width: 420px; text-align: center; }
.auth-logo { width: 72px; height: auto; margin-bottom: 14px; }
.auth-screen h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.auth-sub { font-size: 14px; color: var(--muted); margin: 6px 0 22px; }
.auth-tabs {
  display: flex;
  background: rgba(5, 26, 50, 0.06);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
}
.auth-tab.is-active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 8px -3px rgba(5, 26, 50, 0.25);
}
.auth-form {
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
.auth-form .btn-block { width: 100%; margin-top: 6px; }
.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 14px;
}
.role-pick-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 10px;
  padding: 12px 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.role-pick-btn.is-active {
  border-color: var(--teal);
  color: var(--navy);
  background: rgba(2, 151, 141, 0.08);
}
.header-right { display: flex; align-items: center; gap: 8px; }
.logout-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.logout-btn:hover { color: var(--navy); border-color: var(--navy); }

/* ---------- typography + layout refinement ---------- */
h1, h2, h3,
.brand-name, .splash-name, .issue-title, .detail-title,
.home-action b, .role-card b, .role-pick-btn, .onboarding h1, .auth-screen h1 {
  font-family: var(--font-display);
}

.community-head h1, .home-hero h1, .auth-screen h1, .onboarding h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.splash-name { font-weight: 800; letter-spacing: -0.03em; }
.issue-title { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; }
.detail-title { font-weight: 700; font-size: 20px; }
.home-action b { font-weight: 700; font-size: 16px; }
.community-head p { font-size: 15px; line-height: 1.55; }

.btn-primary, .btn-ghost, .save-owner, .confirm-btn { font-weight: 600; }
.btn-primary, .btn-ghost { height: 50px; border-radius: 12px; font-size: 16px; }

.issue-card, .solver-row { border-radius: 16px; padding: 18px 16px; }
.feed, .solver-list { gap: 14px; }
.community-head { margin-bottom: 24px; }
.field input, .field select, .field textarea { padding: 13px 14px; border-radius: 12px; }
.app-header { height: 64px; }
.list-heading { letter-spacing: 0.08em; }

/* ---------- theme toggle + dark mode ---------- */
.theme-toggle {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }

body.dark {
  --paper: #0D1F35;
  --paper-2: #06111F;
  --ink: #E8F1EF;
  --muted: #93AAB6;
  --line: rgba(255, 255, 255, 0.12);
  --navy: #16395e;
  --mint: #12352e;
  background: #06111F;
}
body.dark .app-header { background: #0A1A2E; border-bottom-color: rgba(255,255,255,0.1); box-shadow: 0 4px 20px -14px rgba(0,0,0,0.85); }
body.dark .bottom-nav { background: #0A1A2E; border-top-color: rgba(255,255,255,0.1); }
body.dark .auth-tab.is-active { background: #12304d; color: var(--ink); box-shadow: none; }
body.dark .home-hero { background: linear-gradient(180deg, rgba(47,188,155,0.12), rgba(47,188,155,0.03)); }
body.dark .brand-name { color: var(--ink); }
body.dark .header-badge { color: #7fe0c8; background: rgba(47,188,155,0.14); }
body.dark .status-submitted { color: #a8c6ff; border-color: rgba(168,198,255,0.5); }
body.dark .status-under_review { color: #c3cfdb; border-color: rgba(195,207,219,0.5); }
body.dark .status-verified { color: #6fe0cd; border-color: rgba(111,224,205,0.5); }
body.dark .status-in_progress { color: var(--ink); background: rgba(47,188,155,0.16); border-color: rgba(47,188,155,0.5); }
body.dark .status-resolved { color: #052c1e; background: #4fe0a5; border-color: #4fe0a5; }
body.dark .role-pick-btn.is-active { color: var(--ink); background: rgba(47,188,155,0.14); }
body.dark .connected-banner { color: var(--ink); background: rgba(47,188,155,0.12); }
body.dark .connected-open { background: rgba(255,255,255,0.05); color: var(--muted); }
body.dark .ha-browse { color: #8fd0ff; background: rgba(120,180,255,0.1); }
body.dark .ha-report { background: rgba(47,188,155,0.14); color: #6fe0cd; }
body.dark .field input, body.dark .field select, body.dark .field textarea { background: #0A1A2E; color: var(--ink); border-color: var(--line); }
body.dark .act { background: rgba(255,255,255,0.05); color: var(--muted); border-color: var(--line); }
body.dark .act b { color: var(--ink); }
body.dark .comment, body.dark .msg-reporter { background: rgba(255,255,255,0.05); }
body.dark .msg-solver { background: rgba(47,188,155,0.12); }
body.dark .comment-text { color: var(--ink); }
body.dark .toast { background: #16395e; }
body.dark .solver-name-field input, body.dark .name-field input { background: #0A1A2E; color: var(--ink); }
body.dark .loc-status { color: #6fe0cd; background: rgba(47,188,155,0.14); }

/* photo preview */
.photo-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.detail-photo { margin: 4px 0 12px; }

/* feed filter */
.feed-filter {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.filter-btn {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.filter-btn.is-active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}
body.dark .filter-btn.is-active { background: var(--teal); border-color: var(--teal); color: #fff; }

/* loading spinner */
.loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 17, 31, 0.25);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(2, 151, 141, 0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
