/* ============================================
   Ocorrências do Ponto — Design System
   Palette: Milk #FFF3E6 + Plum #381932
   ============================================ */

:root {
  /* Paleta oficial Fiobras (Manual de Marca, jan/2026):
     Verde #008835, Amarelo #FFCB00, Azul #0076BE.
     Variáveis mantêm nomes legacy --milk/--plum por compatibilidade
     do código existente; valores semânticos: --milk = surface clara,
     --plum = primário da marca (verde). */
  --milk: #F5F8F4;
  --milk-warm: #E8F0E5;
  --milk-edge: #D2E2CD;
  --plum: #008835;
  --plum-soft: #1AA34F;
  --plum-deep: #006328;

  --fiobras-yellow: #FFCB00;
  --fiobras-blue: #0076BE;

  /* Semantic */
  --bg: var(--milk);
  --surface: #FFFFFF;
  --surface-warm: var(--milk-warm);
  --border: #D2E2CD;
  --border-strong: #A8C5A0;

  --text: var(--plum-deep);
  --text-body: #1E2D1A;
  --text-muted: #5D7858;
  --text-on-plum: #FFFFFF;

  --accent: #C8A165;
  --success: #2F6B3F;
  --success-bg: #E0EAD8;
  --warning: #B27429;
  --warning-bg: #F8E4C8;
  --danger: #962F32;
  --danger-bg: #F4D6D2;
  --info: #2F5A6B;
  --info-bg: #D8E6EA;

  /* Type — Poppins (apoio da marca) + fallback system */
  --font: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Poppins", var(--font);

  /* Geometry */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 28px;

  --shadow-xs: 0 1px 2px rgba(56, 25, 50, 0.06);
  --shadow-sm: 0 2px 6px rgba(56, 25, 50, 0.08);
  --shadow: 0 8px 24px rgba(56, 25, 50, 0.12);
  --shadow-lg: 0 20px 60px rgba(56, 25, 50, 0.22);

  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; border: 0; background: none; }

a { color: var(--plum); text-decoration: none; }
a:hover { color: var(--plum-soft); }

.hidden { display: none !important; }

/* ============================================
   LOGIN SCREEN
   ============================================ */

.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--milk);
}

.login__brand {
  background: var(--plum);
  color: var(--text-on-plum);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login__brand::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--plum-soft) 0%, transparent 70%);
  opacity: .5;
}

.login__logo {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.login__logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--milk);
  color: var(--plum);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.login__pitch {
  position: relative;
  z-index: 1;
}

.login__pitch h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 20px 0;
  font-weight: 800;
}

.login__pitch p {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 243, 230, .75);
  max-width: 420px;
  margin: 0;
}

.login__footer {
  font-size: 13px;
  color: rgba(255, 243, 230, .5);
  position: relative;
  z-index: 1;
}

.login__form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.login__form h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
  color: var(--plum);
}

.login__form p.lead {
  color: var(--text-muted);
  margin: 0 0 32px 0;
}

.login__quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

.login__quick button {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  transition: var(--transition);
  text-align: left;
}

.login__quick button:hover {
  border-color: var(--plum);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.login__quick button strong {
  color: var(--plum);
  font-weight: 700;
}

.login__quick button span {
  color: var(--text-muted);
  font-size: 12px;
}

.login__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.login__divider::before,
.login__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login__brand {
    padding: 28px;
    min-height: 220px;
  }
  .login__pitch h1 { font-size: 32px; }
  .login__form { padding: 28px; }
}

/* ============================================
   FORM FIELDS
   ============================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--plum);
}

.field input,
.field select,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text-body);
  transition: var(--transition);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(56, 25, 50, 0.1);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.field.error input,
.field.error select {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.field__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.field__error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--plum);
  color: var(--text-on-plum);
}
.btn--primary:hover { background: var(--plum-soft); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn--ghost {
  background: transparent;
  color: var(--plum);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-warm); }

.btn--soft {
  background: var(--surface-warm);
  color: var(--plum);
  border-color: var(--border);
}
.btn--soft:hover { background: var(--milk-edge); }

.btn--danger {
  background: var(--danger);
  color: white;
}
.btn--danger:hover { background: #7B1F22; }

.btn--block { width: 100%; }
.btn--sm { padding: 11px 14px; font-size: 13px; min-height: 36px; } /* min-h ajuda touch */
.btn--lg { padding: 14px 22px; font-size: 15px; }
.btn--icon { width: 44px; min-height: 44px; padding: 0; } /* WCAG 2.5.5 */

.btn .icon { width: 16px; height: 16px; }

/* ============================================
   APP LAYOUT
   ============================================ */

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr;
  min-height: 100dvh;
}

.app__sidebar {
  background: var(--plum);
  color: var(--text-on-plum);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.app__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 16px;
  border-bottom: 1px solid rgba(255, 243, 230, .1);
}

.app__brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--milk);
  color: var(--plum);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
}

.app__brand-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.app__brand-text small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: rgba(255, 243, 230, .5);
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: rgba(255, 243, 230, .75);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  width: 100%;
  text-align: left;
}

.nav__item:hover {
  background: rgba(255, 243, 230, .08);
  color: var(--milk);
}

.nav__item.active {
  background: var(--milk);
  color: var(--plum);
  font-weight: 600;
}

.nav__badge {
  margin-left: auto;
  background: var(--plum);
  color: var(--milk);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}
.nav__item.active .nav__badge { background: var(--plum); color: var(--milk); }
.nav__item:not(.active) .nav__badge { background: rgba(255, 243, 230, .15); color: var(--milk); }

/* Acessibilidade: focus-visible em todos os interativos pra teclado/screen-reader */
*:focus { outline: none; } /* baseline limpo */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary, #008835);
  outline-offset: 2px;
  border-radius: 4px;
}
/* No header escuro, usa cor clara pra contraste */
.app__sidebar button:focus-visible,
.app__sidebar a:focus-visible,
.topbar button:focus-visible {
  outline-color: var(--milk, #fffaf2);
}

/* Pulse animado ao lado do nome FioPulse na sidebar */
.brand-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #FFCB00;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  animation: brandPulse 1.8s ease-in-out infinite;
}
@keyframes brandPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 203, 0, 0.7);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(255, 203, 0, 0);
  }
}

/* ===== Sidebar: presença minimalista ===== */
.sidebar-presence {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255, 243, 230, .08);
  min-height: 0;
}
/* Cluster de avatares na sidebar — só aparece quando há outros online */
.sp-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sp-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: pulse-live 1.6s ease-in-out infinite;
  margin-right: 4px;
}

.app__user {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 243, 230, .06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--milk);
  color: var(--plum);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar--lg { width: 44px; height: 44px; font-size: 16px; }
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }

.app__user-info { flex: 1; min-width: 0; }
.app__user-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--milk);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app__user-info span {
  display: block;
  font-size: 11px;
  color: rgba(255, 243, 230, .5);
}

.app__user-logout {
  color: rgba(255, 243, 230, .5);
  transition: var(--transition);
  padding: 6px;
  border-radius: 6px;
}
.app__user-logout:hover { background: rgba(255, 243, 230, .1); color: var(--milk); }

.app__main {
  padding: 32px 40px;
  overflow-x: hidden;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app__sidebar {
    position: fixed;
    inset: 0 30% 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(.4, 0, .2, 1);
    height: 100dvh;
  }
  .app__sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .app__main { padding: 16px 16px 100px; }
}

/* ============================================
   MOBILE TOP BAR
   ============================================ */

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--plum);
  color: var(--milk);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__title { font-weight: 700; font-size: 15px; }
.topbar__menu {
  width: 44px; height: 44px; /* WCAG 2.5.5 touch target */
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--milk);
}
.topbar__menu:hover { background: rgba(255, 243, 230, .1); }

/* Presence — estilo Google Sheets: avatares circulares sobrepostos */
.presence {
  margin-left: auto;
  display: flex;
  align-items: center;
  min-width: 0;
}

.presence-stack {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform .15s ease;
}
.presence-stack:hover { transform: translateY(-1px); }
.presence-stack:focus-visible {
  outline: 2px solid var(--verde, #008835);
  outline-offset: 3px;
  border-radius: 999px;
}

.presence-avatar {
  border-radius: 50%;
  border: 2px solid;
  margin-left: -8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
  background-color: #555;
  position: relative;
  overflow: hidden;
}
.presence-avatar:first-child { margin-left: 0; }
.presence-avatar--idle { opacity: 0.55; }
.presence-avatar--extra {
  background: #4a4a4a !important;
  color: #fff;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* Dropdown estilo Google Sheets: clica nos avatares e abre lista completa */
.presence-dropdown {
  position: fixed;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
  min-width: 280px;
  max-width: 340px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 1000;
  animation: dropdown-in .18s ease-out;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.presence-dropdown__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  color: var(--plum);
}
.presence-dropdown__header .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse-live 1.6s ease-in-out infinite;
}
.presence-dropdown__list { padding: 4px 0; }
.presence-dropdown__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  transition: background .12s;
}
.presence-dropdown__item:hover { background: rgba(0,0,0,.03); }
.presence-dropdown__item.is-idle { opacity: 0.7; }
.presence-dropdown__info { flex: 1; min-width: 0; }
.presence-dropdown__name {
  font-weight: 600;
  color: var(--plum);
  font-size: 14px;
}
.presence-dropdown__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.presence-dropdown__role {
  background: rgba(0,118,190,.1);
  color: #0076be;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.presence-dropdown__activity { color: var(--text-muted); }

/* Banner de outros usuários editando o mesmo PJ (real, via Firestore) */
.modal-colab-banner {
  margin: 0 28px 12px;
  background: linear-gradient(90deg, rgba(0, 118, 190, 0.08), rgba(0, 118, 190, 0.02));
  border-left: 3px solid #0076BE;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text);
  animation: collabBadgeIn 0.3s ease-out;
}
.modal-colab-banner .presence__avatar {
  width: 24px;
  height: 24px;
  font-size: 9px;
}

/* Animação usada pelo .modal-colab-banner (mantida do mock antigo) */
@keyframes collabBadgeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast de atualização colaborativa */
.collab-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border-left: 3px solid var(--collab-color, #0076BE);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  z-index: 9999;
  animation: slideUp 240ms cubic-bezier(.4,0,.2,1), collabToastOut 0.4s ease-in 4s forwards;
}
@keyframes collabToastOut {
  to { opacity: 0; transform: translateY(8px); }
}
.collab-toast__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.collab-toast__body strong { display: block; font-size: 13px; }
.collab-toast__body small { color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .topbar { display: flex; }
}

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(31, 11, 28, .5);
  z-index: 99;
}
.sidebar-backdrop.show { display: block; }

/* ============================================
   PAGE HEADER + STATS
   ============================================ */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--plum);
  font-weight: 800;
}
.page-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.stat {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat:hover { background: rgba(0,0,0,0.015); }

.stat__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.stat__value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--plum);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stat__hint {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0;
  opacity: 0.75;
}

.stat--accent {
  background: rgba(0, 136, 53, 0.06);
  border-color: rgba(0, 136, 53, 0.25);
}
.stat--accent .stat__value { color: var(--verde, #008835); }

/* ============================================
   FILTER BAR
   ============================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar__search {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.toolbar__search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px 10px 38px;
  font-size: 14px;
  transition: var(--transition);
}

.toolbar__search input:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(56, 25, 50, 0.08);
}

.toolbar__search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
}

.toolbar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-body);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--surface-warm);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
}

.tab {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab.active {
  background: var(--surface);
  color: var(--plum);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.tab:hover:not(.active) { color: var(--plum); }

.tab__count {
  margin-left: 6px;
  background: rgba(56, 25, 50, .08);
  color: var(--plum);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.tab.active .tab__count { background: var(--plum); color: var(--milk); }

/* ============================================
   OCORRÊNCIA CARDS / TABLE
   ============================================ */

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.occ {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  cursor: pointer;
}

.occ:hover {
  border-color: var(--plum);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.occ__date {
  text-align: center;
  padding: 4px 0;
  border-right: 1px solid var(--border);
  padding-right: 16px;
}

.occ__date strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--plum);
  line-height: 1;
}

.occ__date span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 2px;
}

.occ__main { min-width: 0; }

.occ__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.occ__sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  flex-wrap: wrap;
}

.occ__sub .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .4; }

.occ__time {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--plum);
}

.occ__chevron {
  color: var(--text-muted);
  width: 18px; height: 18px;
}

@media (max-width: 720px) {
  .occ {
    grid-template-columns: 60px 1fr auto;
    gap: 12px;
    padding: 14px;
  }
  .occ__time { display: none; }
  .occ__date { padding-right: 12px; }
  .occ__date strong { font-size: 18px; }
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--neutral { background: var(--surface-warm); color: var(--text-muted); }

.badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ============================================
   MODAL / DRAWER
   ============================================ */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(31, 11, 28, .55);
  display: grid;
  place-items: center;
  z-index: 200;
  animation: fadeIn 180ms ease-out;
  padding: 16px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 220ms cubic-bezier(.4, 0, .2, 1);
  position: relative; /* âncora pro form-blocker absoluto */
}

/* Overlay bloqueante usado durante OCR/upload (não deixa editar) */
.form-blocker {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 50;
  border-radius: var(--radius-xl);
  text-align: center;
  padding: 24px;
}
.form-blocker__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e6e6e6;
  border-top-color: var(--primary, #008835);
  border-radius: 50%;
  animation: spinBlocker 0.7s linear infinite;
}
.form-blocker__msg {
  font-weight: 700;
  font-size: 16px;
  color: var(--text, #222);
}
.form-blocker__hint {
  font-size: 13px;
  color: var(--muted, #666);
}
.form-blocker__steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted, #777);
}
.form-blocker__step {
  opacity: 0.45;
  transition: opacity 0.2s;
}
.form-blocker__step.is-active {
  opacity: 1;
  font-weight: 600;
  color: var(--primary, #008835);
}
.form-blocker__step.is-done {
  opacity: 0.7;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
@keyframes spinBlocker {
  to { transform: rotate(360deg); }
}

.modal__header {
  padding: 24px 28px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal__header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 700;
  margin: 0;
  color: var(--plum);
}

.modal__header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.modal__close {
  width: 44px; height: 44px; /* WCAG 2.5.5 touch target */
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}
.modal__close:hover { background: var(--surface-warm); color: var(--plum); }

.modal__body {
  padding: 8px 28px 8px;
}

.modal__footer {
  padding: 16px 28px 24px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 540px) {
  .modal { max-height: 96vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; align-self: flex-end; margin-top: auto; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal__footer { flex-direction: column-reverse; }
  .modal__footer .btn { width: 100%; }
}

/* ============================================
   DETAIL VIEW (Confer)
   ============================================ */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-cell {
  padding: 12px 14px;
  background: var(--surface-warm);
  border-radius: var(--radius);
}

.detail-cell label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.detail-cell strong {
  font-size: 15px;
  color: var(--plum);
  font-weight: 600;
}

@media (max-width: 540px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.timeline {
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin: 16px 0;
}

.timeline__item {
  position: relative;
  padding-bottom: 14px;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--plum);
}

.timeline__item.done::before { background: var(--plum); }

.timeline__item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--plum);
}

.timeline__item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================
   FAB (only desktop; mobile usa bottom nav)
   ============================================ */

.fab {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--plum);
  color: var(--milk);
  z-index: 30;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.fab:hover { background: var(--plum-soft); transform: scale(1.05); }
.fab .icon { width: 24px; height: 24px; }

/* ============================================
   BOTTOM NAV (mobile) — estilo Nubank suspenso
   Flutuante, com cantos arredondados e sombra. Não cola na borda.
   ============================================ */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  right: 16px;
  z-index: 60;
  background: var(--surface);
  border-radius: 24px;
  padding: 10px;
  box-shadow:
    0 12px 32px rgba(22, 60, 30, 0.18),
    0 4px 12px rgba(22, 60, 30, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  height: 68px;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: var(--transition);
  min-width: 48px;
  position: relative;
  background: transparent;
}

.bottom-nav__item .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.bottom-nav__item.active {
  color: var(--plum);
  background: var(--milk-warm);
}

.bottom-nav__badge {
  position: absolute;
  top: 4px;
  right: 50%;
  margin-right: -22px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  line-height: 1.3;
}

.bottom-nav__item--fab {
  flex: 0 0 56px;
  padding: 0;
}

.bottom-nav__item--fab .bottom-nav__fab {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--plum);
  color: var(--milk);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 136, 53, 0.4);
  transition: var(--transition);
}

.bottom-nav__item--fab:hover .bottom-nav__fab,
.bottom-nav__item--fab:active .bottom-nav__fab {
  background: var(--plum-soft);
  transform: scale(1.05);
}

.bottom-nav__item--fab .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
}

@media (max-width: 900px) {
  .bottom-nav { display: flex; }
  .fab { display: none !important; }
  .app__main { padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important; }
  /* Topbar pode some no mobile pra dar mais espaço — sidebar acessada via "Conta" no nav */
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty__icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--surface-warm);
  color: var(--plum);
  display: grid; place-items: center;
  margin: 0 auto 16px;
}

.empty__icon .icon { width: 28px; height: 28px; }

.empty h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--plum);
  margin: 0 0 4px;
}

.empty p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 16px;
}

/* ============================================
   TOAST
   ============================================ */

.toast-root {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--plum);
  color: var(--milk);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp 220ms cubic-bezier(.4, 0, .2, 1);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast--success { background: var(--success); }
.toast--danger { background: var(--danger); }

/* ============================================
   UTILS
   ============================================ */

.icon { width: 18px; height: 18px; stroke-width: 2; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: 200ms;
}
.toggle__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 200ms;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle input:checked + .toggle__slider {
  background: var(--plum);
}
.toggle input:checked + .toggle__slider::before {
  transform: translateX(20px);
}
.toggle__row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
.icon.spin { animation: spin 0.8s linear infinite; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

.row { display: flex; align-items: center; gap: 8px; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }

.stack { display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 720px) {
  .page-header h1 { font-size: 24px; }
}

/* ============================================
   DEMO MODE BANNER
   Visível só quando Firebase NÃO está configurado.
   Sinaliza que dados são locais e auth não é real.
   ============================================ */

.demo-banner {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 400;
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 4px 12px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.demo-banner::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

html.firebase-mode .demo-banner { display: none; }

/* Em modo Firebase: esconde quick login + lead demo + divider */
html.firebase-mode .login__quick,
html.firebase-mode .login .lead,
html.firebase-mode .login__divider { display: none; }

/* Login: link "esqueci senha" só em modo Firebase */
.login__forgot {
  display: none;
  margin-top: 8px;
  text-align: right;
  font-size: 13px;
}
html.firebase-mode .login__forgot { display: block; }
.login__forgot button {
  color: var(--plum);
  font-weight: 600;
  text-decoration: underline;
  font-size: inherit;
}
.login__forgot button:hover { color: var(--plum-soft); }

/* Logo header (Fiobras) — substitui o "OP" quando definida.
   IMPORTANTE: usa max-width/max-height pra logo não esticar
   independente do aspect ratio do arquivo. */
.brand-logo {
  height: 28px;
  width: auto;
  max-width: 100%;
}
.app__brand-mark.has-logo {
  background: transparent;
  width: 40px;
  height: 40px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.app__brand-mark.has-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}
.login__logo-mark.has-logo {
  background: transparent;
  width: 56px;
  height: 56px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.login__logo-mark.has-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}
