:root {
  --brand-navy: #023D6E;
  --brand-blue: #02568A;
  --brand-cyan: #029BDE;
  --brand-orange: #FD5301;
  --brand-asphalt: #27394C;
  --white: #FFFFFF;
  --ink: #162033;
  --muted: #69758A;
  --line: #D9DFEB;
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --danger: #B03737;
  --brand-blue-soft: #EAF2F8;
  --brand-cyan-soft: #E1F5FC;
  --brand-orange-soft: #FFF0E8;
  --brand-asphalt-soft: #EDF0F3;
  --brand-blue-border: rgba(2, 86, 138, 0.28);
  --focus-ring: rgba(2, 86, 138, 0.2);
  --shadow: 0 10px 25px rgba(22, 32, 51, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
  color: var(--ink);
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: min(300px, 100%);
}

.brand-mark img {
  display: block;
  width: 100%;
  max-height: 72px;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0;
  color: var(--brand-navy);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .78rem;
}

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

.hero-card, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
  min-height: 300px;
  padding: clamp(24px, 4vw, 48px);
  margin-bottom: 24px;
}

.hero-copy { min-width: 0; }

.hero-card h2 {
  margin: 12px 0 10px;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  max-width: 680px;
}

.hero-card p {
  max-width: 620px;
  color: var(--muted);
  margin-bottom: 18px;
}

.hero-mark {
  display: block;
  width: 100%;
  max-height: 280px;
  height: auto;
  object-fit: contain;
  justify-self: center;
}

.chip {
  display: inline-block;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .85rem;
  font-weight: 700;
}

.auth-grid, .camera-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card {
  padding: 20px;
}

.card h2, .card h3, .card h4 { margin-top: 0; }
.card p { color: var(--muted); }

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: var(--ink);
}

input, select {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

button {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--brand-navy);
  color: var(--white);
  font-weight: 800;
  transition: background-color .16s ease;
}

button:hover:not(:disabled) { background: var(--brand-blue); }
button.secondary { background: var(--brand-blue); }
button.danger { background: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger); }

button.ghost {
  background: transparent;
  color: var(--brand-blue);
  border: 1px solid var(--brand-blue-border);
}

button.ghost:hover:not(:disabled) { background: var(--brand-blue-soft); }

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.compact { max-width: 420px; }
.compact-card {
  max-width: 520px;
  margin: 0 auto;
}
.mini-note { font-size: .92rem; }
.hidden { display: none !important; }

.auth-flow-card {
  padding: 28px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.text-link {
  background: transparent;
  color: var(--brand-blue);
  border: 1px solid var(--brand-blue-border);
}

.status-note {
  min-height: 24px;
  margin-top: 14px;
  font-size: .95rem;
  color: var(--brand-blue);
  font-weight: 700;
}

.info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.pill {
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--brand-cyan-soft);
  color: var(--brand-navy);
  font-weight: 800;
}

.camera-box {
  position: relative;
  background: var(--ink);
  border-radius: 16px;
  overflow: hidden;
  min-height: 280px;
}

#cameraPreview, #recordedPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  border-radius: 16px;
}

#cameraPreview {
  min-height: 280px;
  display: none;
}

.camera-placeholder {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(255,255,255,.8);
  text-align: center;
}

.camera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.status-text {
  min-height: 24px;
  font-weight: 700;
}

.recorded-preview { margin-top: 18px; }
.recorded-preview video { max-height: 320px; }

.feed-card { margin-top: 20px; }

.feed-actions { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.filter-label { font-size: .82rem; }
.filter-label select { min-width: 190px; padding: 9px 12px; }

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.feed-list {
  display: grid;
  gap: 18px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
}

.post-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}

.post-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.post-head-main {
  min-width: 0;
  flex: 1;
}

.post-head-main h3 {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.post-video-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  margin-top: 12px;
}

.post-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  background: #000;
  border-radius: 16px;
}

.post-meta, .post-location, .post-user {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: .95rem;
  min-width: 0;
}

.post-meta span, .post-user span, .post-location span, .post-url {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta-badge {
  background: var(--brand-asphalt-soft);
  color: var(--brand-asphalt);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-weight: 800;
}

.issue-badge { padding: 6px 10px; border-radius: 999px; font-weight: 800; }
.issue-badge.flood { background: var(--brand-cyan-soft); color: var(--brand-navy); }
.issue-badge.pothole { background: var(--brand-orange-soft); color: var(--ink); }
.issue-badge.paving { background: var(--brand-asphalt-soft); color: var(--brand-asphalt); }

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.post-link {
  color: var(--brand-blue);
  font-weight: 800;
  text-decoration: none;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(22,32,51,.94);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  transition: all .2s ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
  .auth-grid, .camera-layout, .info-banner {
    grid-template-columns: 1fr;
    display: grid;
  }

  .brand-mark { width: min(240px, 100%); }

  .feed-header, .post-head {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-actions {
    align-items: stretch;
  }

  .auth-actions button {
    width: 100%;
  }

  .feed-actions, .feed-actions button, .filter-label, .filter-label select { width: 100%; }
}

@media (max-width: 640px) {
  .hero-card {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: 0;
  }

  .hero-mark {
    width: min(184px, 100%);
    max-height: 220px;
  }
}

@media (max-width: 519px) {
  .app-shell { padding: 18px 12px 36px; }
  .topbar { gap: 12px; margin-bottom: 18px; }
  .brand-mark { width: 54px; }
  .brand-mark img { width: 54px; height: 54px; }
  .topbar > button { flex: 0 0 auto; }
  .hero-card, .card { padding: 16px; }
  .hero-card { padding: 22px 18px; }
  .camera-box, #cameraPreview, .camera-placeholder { min-height: 220px; }
  .camera-actions button { flex: 1 1 auto; }
}
