/* Design tokens ---------------------------------------------------- */
:root {
  --paper: #EFEAE0;
  --paper-raised: #FBF8F1;
  --ink: #1E2A4A;
  --ink-muted: #5B6178;
  --accent: #C2871F;
  --accent-ink: #2E2000;
  --verde: #3C6E47;
  --verde-bg: #E3EDE3;
  --vermelho: #A13D2E;
  --vermelho-bg: #F3E4DF;
  --linha: #D9D0B9;
  --shadow: rgba(30, 42, 74, 0.10);
  --erro: #A13D2E;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141B2E;
    --paper-raised: #1C2540;
    --ink: #EDEAE0;
    --ink-muted: #A9AEC4;
    --accent: #E7A83E;
    --accent-ink: #241800;
    --verde: #7BB489;
    --verde-bg: #1E3327;
    --vermelho: #E08972;
    --vermelho-bg: #3A2420;
    --linha: #33406B;
    --shadow: rgba(0, 0, 0, 0.4);
    --erro: #E08972;
  }
}

:root[data-theme="dark"] {
  --paper: #141B2E;
  --paper-raised: #1C2540;
  --ink: #EDEAE0;
  --ink-muted: #A9AEC4;
  --accent: #E7A83E;
  --accent-ink: #241800;
  --verde: #7BB489;
  --verde-bg: #1E3327;
  --vermelho: #E08972;
  --vermelho-bg: #3A2420;
  --linha: #33406B;
  --shadow: rgba(0, 0, 0, 0.4);
  --erro: #E08972;
}

/* Reset & base ------------------------------------------------------ */
* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Bitter", Georgia, serif;
  font-weight: 600;
  text-wrap: balance;
  margin: 0 0 4px;
}

p { line-height: 1.55; }

a { color: var(--ink); }

/* App shell: sidebar nav (desktop) / top bar (mobile) ------------------ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sidebar {
  background: var(--ink);
  border-bottom: 1px solid var(--linha);
}

.sidebar-top {
  padding-inline: 24px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Bitter", Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--paper-raised);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-icon { width: 30px; height: 30px; flex-shrink: 0; }

/* Nav itself: hidden-unless-open dropdown by default (mobile baseline),
   promoted to an always-visible vertical list by the desktop media query
   below. Keeping mobile as the default avoids re-breaking the phone-width
   layout that was fixed with real device screenshots earlier. */
.masthead-nav {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px 20px;
}

.masthead-nav.is-open { display: flex; }

.nav-group { width: 100%; }

.nav-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--paper-raised);
  font-weight: 700;
  margin: 14px 0 4px;
}

.nav-group:first-child .nav-group-label { margin-top: 2px; }

.masthead-nav a {
  display: block;
  color: var(--paper-raised);
  opacity: 0.72;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 0;
}

.masthead-nav a:hover,
.masthead-nav a.is-active {
  opacity: 1;
}

.masthead-nav .nav-sep {
  display: none;
  height: 1px;
  width: 100%;
  background: var(--linha);
  opacity: 0.4;
  margin: 14px 0;
}

.masthead-nav .nav-cta {
  opacity: 1;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  display: inline-block;
  margin-top: 6px;
}

/* Nav toggle (hamburger) - shown at/below the breakpoint where the full
   nav (up to 11 links when logged in) no longer fits and would otherwise
   wrap into a wall of links pushing page content below the fold (caught
   live on a real phone-width screenshot, not assumed). Hidden above it,
   once the nav becomes the always-visible sidebar. */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--paper-raised);
  border-radius: 1px;
}

@media (min-width: 861px) {
  .app-shell { flex-direction: row; }

  .sidebar {
    width: 240px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--linha);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
  }

  .nav-toggle { display: none; }

  .masthead-nav {
    display: flex;
    gap: 2px;
    padding: 8px 14px 24px;
  }

  .masthead-nav .nav-sep { display: block; }
}

.site-footer {
  border-top: 1px solid var(--linha);
  margin-top: 48px;
}

.site-footer-inner {
  max-width: 1180px;
  margin-inline: auto;
  padding: 20px 24px 40px;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

/* Containers ---------------------------------------------------------- */
.shell {
  max-width: 460px;
  margin-inline: auto;
  padding-inline: 20px;
  padding-block: 48px 64px;
}

.shell--wide {
  max-width: 1180px;
  padding-inline: clamp(20px, 4vw, 24px);
}

.shell--flush {
  max-width: none;
  padding-inline: 0;
  padding-block: 0;
}

.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 24px);
}

/* Page head ------------------------------------------------------------ */
.page-head {
  margin-bottom: 28px;
}

.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: clamp(1.55rem, 2.6vw, 2.1rem);
}

.page-head .lead {
  color: var(--ink-muted);
  font-size: 1rem;
  max-width: 70ch;
  margin: 8px 0 0;
}

.page-head .kicker {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.perfil-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-circulo {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.perfil-selos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.perfil-selo {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.avatar-inicial {
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 1.4rem;
}

.link-quiet {
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.link-quiet:hover { text-decoration: underline; }

.whatsapp-share-link {
  display: inline-flex;
  align-items: center;
}
.whatsapp-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Step indicator ------------------------------------------------------ */
.steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}
.steps .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--linha);
}
.steps .dot.done,
.steps .dot.current {
  background: var(--accent);
}
.steps .step-label {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-left: 6px;
}

/* Status badge -------------------------------------------------------- */
.status-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
  white-space: nowrap;
}
.status-badge.pendente { background: var(--linha); color: var(--ink); }
.status-badge.aprovado { background: var(--verde-bg); color: var(--verde); }
.status-badge.rejeitado { background: var(--vermelho-bg); color: var(--vermelho); }
.status-badge.parcial { background: var(--linha); color: var(--ink); }
.status-badge.completa { background: var(--verde-bg); color: var(--verde); }
.status-badge.nao_preenchida { background: var(--vermelho-bg); color: var(--vermelho); }

/* Shared data table (convites, histórico eleitoral, perfil do usuário,
   perfil de vereador) --------------------------------------------------- */
.voto-tema-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}

.voto-tema-table th,
.voto-tema-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--linha);
  vertical-align: middle;
}

.voto-tema-table th {
  color: var(--ink-muted);
  font-weight: 600;
}

.voto-tema-table .status-badge {
  margin-bottom: 0;
}

.alerta-atraso {
  background: var(--vermelho);
  color: var(--paper-raised);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* Card ------------------------------------------------------------- */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 26px 24px;
  box-shadow: 0 2px 10px var(--shadow);
}

.card h1 { font-size: 1.4rem; margin-bottom: 6px; }

.voto-botoes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.lead {
  color: var(--ink-muted);
  font-size: 0.92rem;
  margin: 6px 0 20px;
}

.note {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 16px;
}
.note a { color: var(--accent); }

.fine-print {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.fine-print a { color: var(--accent); }

hr.divider {
  border: none;
  border-top: 1px solid var(--linha);
  margin: 18px 0;
}

/* Forms -------------------------------------------------------------- */
form p {
  margin: 0 0 16px;
}

form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink);
}

form input,
form select,
form textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--linha);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}

form textarea {
  resize: vertical;
}

form input:focus,
form select:focus,
form textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

form .helptext {
  display: block;
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-top: 5px;
}

/* Toggle switch (boolean settings, e.g. "tornar público") -------------- */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 6px 0;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
}

.toggle-track {
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--vermelho);
  border: 1px solid var(--vermelho);
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-raised);
  box-shadow: 0 1px 3px var(--shadow);
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--verde);
  border-color: var(--verde);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-label-text {
  font-size: 0.95rem;
}

.toggle-status {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.toggle-status.publico { background: var(--verde-bg); color: var(--verde); }
.toggle-status.privado { background: var(--vermelho-bg); color: var(--vermelho); }

/* Django's password validators render as a <ul> inside .helptext (e.g. on
   password1) — reset the browser's default list spacing so it reads as a
   compact hint, not a large bulleted block. */
form .helptext ul {
  margin: 4px 0 0;
  padding-left: 16px;
  list-style: disc;
}

form .helptext li {
  margin-bottom: 2px;
}

form ul.errorlist {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  color: var(--erro);
  font-size: 0.82rem;
}

form .field-error {
  margin: 4px 0 0;
  color: var(--erro);
  font-size: 0.82rem;
}

button, input[type="submit"] {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 6px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover, input[type="submit"]:hover {
  filter: brightness(1.05);
}

/* Auth screens (login/signup) - hero banner on top, form below. Always
   stacked (not side-by-side): a long form (signup has ~11 fields) made a
   side-by-side split look broken - the short hero text either left a
   huge empty gap or (on mobile) pushed the form off-screen below a
   full-height panel. Stacking removes that mismatch at every width. ---- */
.auth-hero {
  background: var(--ink);
  color: var(--paper-raised);
  padding: 40px clamp(20px, 5vw, 72px);
}

.auth-hero .kicker {
  color: var(--paper-raised);
  opacity: 0.65;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.auth-hero h1 {
  color: var(--paper-raised);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.2;
  max-width: 48ch;
}

.auth-hero p {
  color: var(--paper-raised);
  opacity: 0.78;
  max-width: 52ch;
  margin-top: 10px;
}

.auth-form-wrap {
  padding: 32px 20px 64px;
  display: flex;
  justify-content: center;
}

.auth-form-wrap .shell {
  padding: 0;
  margin: 0;
  max-width: 420px;
  width: 100%;
}

/* Landing page --------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  padding-block: 64px 40px;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-block: 40px 24px; gap: 32px; }
}

.landing .kicker {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.landing h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  line-height: 1.12;
  margin-bottom: 18px;
}

.landing .lead {
  font-size: 1.1rem;
  color: var(--ink-muted);
  max-width: 52ch;
  margin: 0 0 32px;
}

.landing .features {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing .features li {
  padding: 18px 20px;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}

.landing .features strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.landing .features span {
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.cta {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 6px;
  padding: 13px 22px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.cta:hover {
  filter: brightness(1.05);
}

/* Dashboard (home) ------------------------------------------------------ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.dashboard-card {
  display: block;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  padding: 26px 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px var(--shadow);
}

.dashboard-card h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.dashboard-card p {
  color: var(--ink-muted);
  font-size: 0.92rem;
  margin: 0;
}

.dashboard-card .link-quiet {
  display: inline-block;
  margin-top: 14px;
}

/* Toolbar (filters) ------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  padding: 18px 20px;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 10px;
  margin-bottom: 28px;
}
.filters > div { flex: 1 1 160px; }
.filters p { margin: 0; }
.filters button { width: auto; flex: 0 0 auto; padding-inline: 22px; }

/* Obras: summary cards ---------------------------------------------------- */
.obra-resumo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
}

.obra-resumo-card {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 16px 18px;
}

.obra-resumo-count {
  font-family: "Bitter", Georgia, serif;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--ink);
}

.obra-resumo-label {
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.obra-resumo-valor {
  font-weight: 600;
  color: var(--accent);
}

.obra-resumo-nota {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0 0 28px;
}

/* Obras: card list (one per line - each card carries enough detail now
   that a multi-column grid left little room per card) ------------------- */
.obra-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.obra-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.obra-card:hover {
  border-color: var(--accent);
}

.obra-card .status-badge {
  margin-bottom: 0;
  align-self: flex-start;
}

.obra-card .obra-meta {
  color: var(--ink-muted);
  font-size: 0.84rem;
}

.obra-card .obra-title {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-muted);
  background: var(--paper-raised);
  border: 1px dashed var(--linha);
  border-radius: 10px;
}

/* Two-column detail layout ------------------------------------------------ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 860px) {
  .detail-layout { grid-template-columns: 1fr; }
}

.detail-main { min-width: 0; }

.sidebar-panel {
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 22px;
  position: sticky;
  top: 20px;
}

.sidebar-panel h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.fact-list {
  margin: 0;
}
.fact-list dt {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 14px;
}
.fact-list dt:first-child { margin-top: 0; }
.fact-list dd {
  margin: 2px 0 0;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Legislativo: ledger list ------------------------------------------------ */
.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--linha);
}

.ledger-item {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--linha);
}

@media (max-width: 700px) {
  .ledger-item { grid-template-columns: 1fr; gap: 6px; }
}

.ledger-meta {
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.ledger-body .obra-title,
.ledger-body strong { font-size: 1rem; }

.ledger-body p { margin: 6px 0 0; }

/* Vote breakdown table --------------------------------------------------- */
.table-wrap { overflow-x: auto; margin-top: 10px; }
.votos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.votos-table th, .votos-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--linha);
}
.votos-table th {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Theme / type tags on a proposição card ---------------------------------- */
.ledger-body .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--linha);
  color: var(--ink-muted);
}
.tag-simbolico { background: var(--linha); color: var(--ink); }

/* Feed counters: efeito prático vs. homenagens e datas -------------------- */
.contadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--linha);
  border: 1px solid var(--linha);
  border-radius: 10px;
  overflow: hidden;
  margin: 18px 0 10px;
}
.contador { background: var(--paper-raised); padding: 14px 16px; }
.contador .num {
  font-family: "Bitter", Georgia, serif;
  font-weight: 700;
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  display: block;
}
.contador .label { color: var(--ink-muted); font-size: 0.82rem; margin-top: 4px; display: block; }
.contador .label small { font-size: 0.74rem; }
.contador-simbolico .num { color: var(--ink-muted); }

/* Back button on detail pages ---------------------------------------------- */
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 14px;
  border: 1px solid var(--linha);
  border-radius: 8px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}
.back-link:hover, .back-link:focus-visible { border-color: var(--accent); color: var(--accent); }

/* PWA install banner -------------------------------------------------- */
.pwa-install-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  background: var(--ink);
  color: var(--paper-raised);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
  padding: 16px;
}

.pwa-install-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  max-width: 640px;
  margin-inline: auto;
}

.pwa-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-install-text strong {
  font-family: "Bitter", Georgia, serif;
  font-size: 0.98rem;
}

.pwa-install-text span {
  font-size: 0.84rem;
  opacity: 0.8;
}

.pwa-install-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.pwa-install-actions button {
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
}

#pwa-install-button {
  background: var(--accent);
  color: var(--accent-ink);
}

#pwa-install-dismiss {
  background: transparent;
  color: var(--paper-raised);
  opacity: 0.72;
  border: 1px solid var(--linha);
}

@media (max-width: 480px) {
  .pwa-install-banner-inner { justify-content: center; }
  .pwa-install-actions { margin-left: 0; width: 100%; justify-content: center; }
}

/* Minhas prioridades: reorderable list -------------------------------- */
.prioridades-lista {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  max-width: 560px;
}

.prioridade-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  touch-action: pan-y;
}

.prioridade-item.prioridade-top {
  border-left: 4px solid var(--accent);
}

.prioridade-item.dragging {
  opacity: 0.6;
  border-color: var(--accent);
}

.prioridade-alca {
  cursor: grab;
  color: var(--ink-muted);
  font-size: 1.1rem;
  padding: 4px 6px;
  touch-action: none;
  user-select: none;
}

.prioridade-numero {
  font-family: "Bitter", Georgia, serif;
  font-weight: 700;
  color: var(--ink-muted);
  width: 22px;
  flex-shrink: 0;
  text-align: center;
}

.prioridade-item.prioridade-top .prioridade-numero {
  color: var(--accent);
}

.prioridade-label {
  flex: 1 1 auto;
}

.prioridade-setas {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.prioridade-setas button {
  background: none;
  border: 1px solid var(--linha);
  border-radius: 4px;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  padding: 2px 6px;
}

.prioridade-setas button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Segurança pública: small-multiple line charts ------------------------ */
.seguranca-periodo {
  align-items: center;
  background: var(--paper-raised);
  border: 1px solid var(--linha);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
  padding: 10px 14px;
}

.seguranca-periodo label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.seguranca-periodo select {
  background: var(--paper);
  border: 1px solid var(--linha);
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  padding: 4px 8px;
}

.seguranca-periodo-dica {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.seguranca-toggle-valores {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 0.84rem;
  margin-bottom: 16px;
  cursor: pointer;
}

body.seguranca-ocultar-valores .seguranca-ponto-valor {
  display: none;
}

.seguranca-card {
  margin-bottom: 20px;
}

.seguranca-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.seguranca-card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.seguranca-descricao {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.seguranca-subtipo {
  background: var(--paper);
  border: 1px solid var(--linha);
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  padding: 6px 10px;
}

.seguranca-toggle {
  background: none;
  border: 1px solid var(--linha);
  border-radius: 6px;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 12px;
}

.seguranca-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.seguranca-grafico-wrap {
  margin-top: 10px;
  max-width: 100%;
}

.seguranca-grafico-container {
  position: relative;
}

.seguranca-grafico {
  width: 100%;
  max-width: 100%;
  /* Proporção fixa (igual ao viewBox 600x160 de charts.py) em vez de uma
     altura fixa em px - evita que o gráfico fique mais largo que a tela
     em telas estreitas (precisaria rolar pra ver). preserveAspectRatio
     continua "none" (ver comentário no template) - com a proporção já
     travada aqui, "none" só estica o SVG como um todo pra ocupar a
     área, sem distorcer os rótulos de valor, que agora são <span> de
     HTML por cima (.seguranca-valores), não <text> dentro do SVG. */
  aspect-ratio: 600 / 160;
  height: auto;
  display: block;
  /* The período filter sets viewBox to a sub-range of the path's own
     coordinates (zooming in) - with overflow visible, the unzoomed rest
     of that same continuous path painted outside this box. clip it. */
  overflow: hidden;
}

.seguranca-linha {
  fill: none;
  stroke: var(--vermelho);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.seguranca-ponto-alvo {
  fill: transparent;
  cursor: pointer;
}

.seguranca-valores {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Deixa os eventos de clique/hover passarem direto pros círculos do
     SVG embaixo (tooltip ao passar o mouse) - os rótulos são só
     visuais. */
  pointer-events: none;
}

/* HTML, não <circle> dentro do SVG - mesmo motivo do rótulo de valor
   (ver comentário no template): sob preserveAspectRatio="none" com o
   viewBox zoomado, um <circle> estica desigual em x/y e vira uma
   elipse achatada. Tamanho fixo em px + border-radius não distorce. */
.seguranca-ponto-visivel {
  position: absolute;
  width: 5px;
  height: 5px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--vermelho);
}

.seguranca-ponto-valor {
  position: absolute;
  transform: translate(-50%, calc(-100% - 3px));
  font-size: 0.64rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.seguranca-eixo-x-mes {
  position: relative;
  height: 14px;
  margin-top: 4px;
}

.seguranca-eixo-x-mes span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--ink-muted);
  opacity: 0.8;
}

.seguranca-eixo-x {
  position: relative;
  height: 18px;
  margin-top: 1px;
}

.seguranca-eixo-x span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.seguranca-tabela-wrap {
  margin-top: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.seguranca-tooltip {
  position: fixed;
  z-index: 60;
  background: var(--ink);
  color: var(--paper-raised);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  pointer-events: none;
  box-shadow: 0 4px 12px var(--shadow);
}

/* Dê uma ideia ----------------------------------------------------------- */
.ideia-destino-opcoes {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 4px;
}

.ideia-destino-opcao {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-weight: 500 !important;
  cursor: pointer;
}

.ideia-destino-opcao input {
  width: auto !important;
}

.ideia-campos-condicionais {
  border-left: 3px solid var(--linha);
  padding-left: 14px;
  margin-bottom: 16px;
}

.ideia-descricao-wrap {
  position: relative;
  display: block;
}

.ideia-descricao-wrap textarea {
  padding-right: 48px;
}

.ideia-microfone {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--linha);
  background: var(--paper-raised);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.ideia-microfone-ativo {
  background: var(--vermelho);
  border-color: var(--vermelho);
}

.ideia-microfone-dica {
  display: block;
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-top: 5px;
}

/* "display: block" acima vence a regra padrão do navegador pro atributo
   hidden (que só é display:none) - precisa reafirmar explicitamente,
   senão a dica aparece sempre, mesmo com hidden presente. */
.ideia-microfone-dica[hidden] {
  display: none;
}
