/* ===================================================
   DESIGN SYSTEM — VISTORIA APP
   =================================================== */

:root {
  --bg:          #F2F4F7;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFC;
  --text:        #111827;
  --text-2:      #6B7280;
  --border:      #E5E7EB;
  --brand:       #2563EB;
  --brand-dark:  #1D4ED8;
  --brand-light: #EFF6FF;
  --success:     #10B981;
  --success-bg:  #ECFDF5;
  --success-text:#065F46;
  --warning:     #F59E0B;
  --warning-bg:  #FFFBEB;
  --warning-text:#92400E;
  --info-bg:     #EFF6FF;
  --info-text:   #1D4ED8;
  --danger:      #EF4444;
  --danger-bg:   #FEF2F2;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:      0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:   0 24px 60px rgba(22,38,54,.16);
  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   24px;
  --radius-xl:   32px;
  --nav-h:       72px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

[data-theme="dark"] {
  --bg:          #0D1117;
  --surface:     #161B22;
  --surface-2:   #21262D;
  --text:        #FFFFFF;
  --text-2:      #C9D1D9;
  --border:      #30363D;
  --brand:       #58A6FF;
  --brand-dark:  #1F6FEB;
  --brand-light: #1E3A5F;
  --success-bg:  #0A2F1E;
  --success-text:#6EE7B7;
  --warning-bg:  #2D1B00;
  --warning-text:#FCD34D;
  --info-bg:     #1E2D4A;
  --info-text:   #93C5FD;
  --danger-bg:   #2D0A0A;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow:      0 4px 16px rgba(0,0,0,.3);
  --shadow-lg:   0 24px 60px rgba(0,0,0,.5);
}

/* ===================================================
   RESET + BASE
   =================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin: 0; }

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; border: none; }

/* ===================================================
   APP SHELL + PHONE FRAME
   =================================================== */

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone {
  position: relative;
  width: min(100%, 460px);
  height: min(940px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ===================================================
   APP HEADER
   =================================================== */

.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) calc(20px + var(--safe-right)) 16px calc(20px + var(--safe-left));
  background: #0F2040;
  color: #fff;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 34px;
  height: 34px;
  background: var(--brand);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.profile-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.15);
  transition: background .2s;
}
.profile-button:hover { background: rgba(255,255,255,0.2); }

/* ===================================================
   SCREENS CONTAINER
   =================================================== */

.screens-container {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

.view-section { display: block; animation: fadeIn .2s ease; }
.view-section.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   PAGE CONTENT WRAPPER
   =================================================== */

.page-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

/* ===================================================
   BOTTOM NAVIGATION
   =================================================== */

.bottom-nav {
  flex-shrink: 0;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr 1fr 68px 1fr 1fr;
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 calc(8px + var(--safe-right)) var(--safe-bottom) calc(8px + var(--safe-left));
  z-index: 20;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.65rem;
  font-weight: 600;
  transition: color .2s, background .2s;
}
.nav-btn svg { transition: stroke .2s; }
.nav-btn.active { color: var(--brand); }
.nav-btn.active svg { stroke: var(--brand); }
.nav-btn span { letter-spacing: 0.01em; }

.nav-btn-center {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(37,99,235,.45);
  margin: 0 auto;
  transition: transform .15s, box-shadow .15s;
}
.nav-btn-center:active { transform: scale(.93); box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.nav-btn-center svg { stroke: #fff !important; }

/* ===================================================
   FAB BUTTON
   =================================================== */

.fab-btn {
  position: absolute;
  bottom: calc(var(--nav-h) + 16px);
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(37,99,235,.45);
  z-index: 15;
  transition: transform .15s, box-shadow .15s;
}
.fab-btn:active { transform: scale(.93); }
.fab-btn.hidden { display: none; }

/* ===================================================
   ASSISTENTE FLUTUANTE
   =================================================== */

@keyframes pulse-subtle {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(16,185,129,.35);
  }
  50% {
    box-shadow: 0 4px 20px rgba(16,185,129,.5);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.assistant-btn {
  position: fixed;
  bottom: 100px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(16,185,129,.35);
  z-index: 14;
  transition: transform .2s, box-shadow .2s, width .3s, padding .3s;
  cursor: pointer;
  animation: pulse-subtle 2.5s ease-in-out infinite;
}

.assistant-icon {
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-text {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.assistant-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(16,185,129,.5);
}

.assistant-btn:active { 
  transform: scale(.95);
}

.assistant-modal {
  position: fixed;
  inset: 0;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  animation: fadeIn .25s ease-out;
  backdrop-filter: blur(2px);
}

.assistant-modal.hidden { 
  display: none; 
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.assistant-panel {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  max-height: calc(80vh - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  animation: slideUp .3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.assistant-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, rgba(16,185,129,.08) 0%, rgba(5,150,105,.04) 100%);
  z-index: 51;
}

.assistant-header-content {
  flex: 1;
}

.assistant-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.assistant-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 400;
  line-height: 1.4;
}

.assistant-close-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 28px;
  cursor: pointer;
  transition: all .2s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}

.assistant-close-btn:hover {
  color: var(--text);
  background: var(--surface-2);
  transform: scale(1.05);
}

.assistant-close-btn:active {
  transform: scale(.95);
}

.assistant-content {
  padding: 24px;
}

.assistant-chat-history {
  min-height: 0;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.assistant-message {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.assistant-message.user {
  text-align: right;
}

.assistant-message.user .message-text {
  background: #10B981;
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  display: inline-block;
  max-width: 85%;
  word-wrap: break-word;
}

.assistant-message.assistant {
  text-align: left;
}

.assistant-message.assistant .message-text {
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  display: inline-block;
  max-width: 85%;
  word-wrap: break-word;
}

.assistant-answer { width: 100%; }
.assistant-answer h4 { margin: 0 0 8px; color: var(--brand); font-size: 14px; }
.assistant-answer p { margin: 0 0 8px; line-height: 1.5; }
.assistant-answer p:last-child { margin-bottom: 0; }
.assistant-answer ul { margin: 6px 0 10px; padding-left: 18px; }
.assistant-answer li { margin: 4px 0; }

.assistant-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.assistant-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all .2s;
}

.assistant-input:focus {
  border-color: #10B981;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(16,185,129,.1);
}

.assistant-input::placeholder {
  color: var(--text-2);
}

.assistant-send-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  font-weight: 600;
}

.assistant-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}

.assistant-send-btn:active {
  transform: scale(.95);
}

.assistant-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.assistant-loading {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.assistant-loading span {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #10B981;
  animation: pulse 1s ease-in-out infinite;
}

.assistant-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.assistant-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

.assistant-quick-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.assistant-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
  text-align: center;
  font-family: inherit;
}

.assistant-quick-btn:hover {
  background: linear-gradient(135deg, rgba(16,185,129,.1) 0%, rgba(5,150,105,.05) 100%);
  border-color: #10B981;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16,185,129,.15);
}

.assistant-quick-btn:active {
  transform: scale(.96);
}

.quick-btn-icon {
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-btn-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.2px;
}

.assistant-response {
  padding: 20px;
}

.assistant-response.hidden { 
  display: none; 
}

.assistant-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #10B981;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}

.assistant-back-btn:hover {
  background: rgba(16,185,129,.1);
  border-color: #10B981;
  transform: translateX(-2px);
}

.assistant-back-btn:active {
  transform: translateX(-1px) scale(.96);
}

.assistant-response-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.85;
}

.assistant-response-text h4 {
  margin: 0 0 14px 0;
  font-size: 16px;
  font-weight: 600;
  color: #10B981;
}

.assistant-response-text strong {
  color: var(--text);
  font-weight: 600;
}

.assistant-response-text p {
  margin: 0 0 12px 0;
  line-height: 1.8;
}

.assistant-response-text ul {
  margin: 0;
  padding-left: 20px;
  list-style: none;
}

.assistant-response-text li {
  margin: 6px 0;
  padding-left: 8px;
  position: relative;
}

.assistant-response-text li:before {
  content: "→";
  position: absolute;
  left: -8px;
  color: #10B981;
  font-weight: 600;
}

/* Responsivo */
@media (max-width: 640px) {
  .assistant-btn {
    bottom: 88px;
    right: 12px;
    width: 52px;
    height: 52px;
  }

  .assistant-icon {
    font-size: 24px;
  }

  .assistant-text {
    font-size: 8px;
  }

  .assistant-quick-buttons {
    grid-template-columns: 1fr;
  }

  .assistant-panel {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .assistant-header {
    padding: 16px;
  }

  .assistant-title {
    font-size: 16px;
  }

  .assistant-subtitle {
    font-size: 12px;
  }

  .assistant-close-btn {
    width: 32px;
    height: 32px;
    font-size: 24px;
  }

  .assistant-content {
    padding: 20px;
  }

  .assistant-chat-history {
    max-height: 200px;
  }

  .assistant-input-area {
    gap: 6px;
    padding: 10px 0;
  }

  .assistant-input {
    font-size: 12px;
    padding: 8px 12px;
  }

  .assistant-send-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .assistant-message.user .message-text,
  .assistant-message.assistant .message-text {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* Tema escuro */
[data-theme="dark"] .assistant-btn {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(5,150,105,.4);
}

[data-theme="dark"] .assistant-btn:hover {
  box-shadow: 0 6px 24px rgba(5,150,105,.5);
}

[data-theme="dark"] .assistant-header {
  background: linear-gradient(135deg, rgba(5,150,105,.12) 0%, rgba(5,150,105,.06) 100%);
}

[data-theme="dark"] .assistant-quick-btn:hover {
  background: linear-gradient(135deg, rgba(16,185,129,.15) 0%, rgba(5,150,105,.08) 100%);
  box-shadow: 0 4px 12px rgba(16,185,129,.2);
}

[data-theme="dark"] .assistant-back-btn:hover {
  background: rgba(16,185,129,.15);
}

/* Assistente: painel de conversa compacto e profissional */
.assistant-btn {
  right: auto;
  left: max(18px, calc((100vw - 460px) / 2 + 18px));
  bottom: calc(var(--nav-h) + 18px);
  width: auto;
  height: 48px;
  padding: 0 17px;
  flex-direction: row;
  gap: 9px;
  border-radius: 16px;
  background: var(--brand);
  box-shadow: 0 8px 24px rgba(37,99,235,.28);
  animation: none;
}
.assistant-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37,99,235,.34); }
.assistant-icon { width: 21px; height: 21px; font-size: 0; }
.assistant-icon svg, .assistant-avatar svg, .assistant-send-btn svg { width: 100%; height: 100%; }
.assistant-text { font-size: 13px; font-weight: 750; letter-spacing: 0; opacity: 1; }

.assistant-modal {
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left));
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(5px);
}
.assistant-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 430px);
  max-height: min(720px, calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom)));
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(15,23,42,.28);
}
.assistant-header {
  position: relative;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.assistant-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 13px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 6px 14px rgba(37,99,235,.22);
}
.assistant-title { font-size: 16px; margin-bottom: 3px; }
.assistant-subtitle { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.assistant-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.13); }
.assistant-close-btn { width: 34px; height: 34px; font-size: 24px; background: var(--surface-2); }
.assistant-content { padding: 18px 20px 20px; overflow-y: auto; }
.assistant-welcome { display: grid; gap: 5px; margin-bottom: 18px; }
.assistant-welcome strong { color: var(--text); font-size: 16px; }
.assistant-welcome span { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.assistant-section-label { margin: 0 0 9px; color: var(--text-2); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.assistant-chat-history:empty { display: none; }
.assistant-chat-history { padding: 4px 2px 12px; margin-bottom: 14px; border-bottom: 0; }
.assistant-quick-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.assistant-quick-btn {
  min-height: 66px;
  padding: 11px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: left;
}
.assistant-quick-btn:last-child { grid-column: 1 / -1; }
.quick-btn-icon { font-size: 20px; }
.quick-btn-label { font-size: 11.5px; line-height: 1.25; }
.assistant-input-area { margin-top: 16px; padding: 12px 0 0; }
.assistant-input { min-width: 0; height: 44px; padding: 0 14px; border-radius: 12px; font-size: 13px; }
.assistant-send-btn { width: 44px; height: 44px; padding: 12px; border-radius: 12px; background: var(--brand); }
.assistant-response { padding: 20px; overflow-y: auto; }

@media (max-width: 640px) {
  .assistant-btn { right: auto; left: 14px; bottom: calc(var(--nav-h) + 12px); width: 48px; height: 48px; padding: 0; border-radius: 15px; }
  .assistant-btn .assistant-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .assistant-modal { align-items: flex-end; padding: var(--safe-top) var(--safe-right) 0 var(--safe-left); }
  .assistant-panel { width: 100%; max-height: min(82dvh, calc(680px - var(--safe-top))); border-radius: 22px 22px 0 0; border-bottom: 0; }
  .assistant-header { padding: 16px 18px; }
  .assistant-content { padding: 16px 18px calc(18px + var(--safe-bottom)); }
  .assistant-response { padding-bottom: calc(20px + var(--safe-bottom)); }
  .assistant-quick-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assistant-quick-btn { min-height: 60px; padding: 9px; }
}

.resumo-periodo-row { align-items: flex-end; }
.resumo-mes-label { display: grid; gap: 5px; color: var(--text-2); font-size: .7rem; font-weight: 700; }
.resumo-mes-label input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

@media (max-width: 360px) {
  .assistant-quick-buttons { grid-template-columns: 1fr; }
  .assistant-quick-btn:last-child { grid-column: auto; }
}

/* ===================================================
   TOAST NOTIFICATION
   =================================================== */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1E293B;
  color: #fff;
  padding: 11px 22px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }

/* ===================================================
   HOME SCREEN
   =================================================== */

.home-content {
  display: grid;
  gap: 20px;
  padding: 20px 20px 0;
}

/* Greeting */
.home-greeting {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.greeting-period {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 2px;
}
.greeting-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.greeting-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: right;
  line-height: 1.4;
  margin-top: 4px;
  white-space: nowrap;
}

/* Today card (hero) */
.today-card {
  background: linear-gradient(135deg, #0F2040 0%, #1E3A8A 50%, #2563EB 100%);
  border-radius: var(--radius-lg);
  padding: 24px 22px 20px;
  color: #fff;
}
.today-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.today-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #93C5FD;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.today-date-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,.7);
}
.today-total {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.today-count {
  font-size: 0.88rem;
  color: #93C5FD;
  font-weight: 600;
}
.today-progress-wrap { margin-top: 16px; }
.today-progress-bar {
  height: 6px;
  background: rgba(255,255,255,.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.today-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width .6s ease;
  max-width: 100%;
}
.today-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: rgba(255,255,255,.7);
  font-weight: 600;
}

/* Next card */
.section-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.next-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.next-card-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  text-align: center;
}
.next-card-empty p { font-size: 0.9rem; color: var(--text-2); }
.next-card-content { display: grid; gap: 6px; }
.next-time {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--brand);
}
.next-address {
  font-size: 0.9rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.next-tipo {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  width: fit-content;
}
.next-tipo.entrada { background: var(--info-bg); color: var(--info-text); }
.next-tipo.saida   { background: var(--success-bg); color: var(--success-text); }

/* Actions grid */
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.link-btn {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.link-btn:hover { background: var(--brand-light); }

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.action-card:active { transform: scale(.97); }
.action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-icon svg { stroke: var(--brand); }

/* Recent list */
.recent-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.recent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.recent-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
}
.recent-card-icon.entrada { background: var(--info-bg); color: var(--info-text); }
.recent-card-icon.saida   { background: var(--success-bg); color: var(--success-text); }
.recent-card-info { flex: 1; }
.recent-card-info strong { font-size: 0.92rem; display: block; }
.recent-card-info small  { font-size: 0.78rem; color: var(--text-2); }
.recent-card-valor {
  font-size: 1rem;
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

/* ===================================================
   ALERTS
   =================================================== */

.alertas-container { display: grid; gap: 8px; }

.alerta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}
.alerta::before { font-size: 1rem; flex-shrink: 0; }
.alerta.info    { background: var(--info-bg);    color: var(--info-text);   }
.alerta.info::before    { content: 'ℹ️'; }
.alerta.success { background: var(--success-bg); color: var(--success-text);}
.alerta.success::before { content: '✅'; }
.alerta.warning { background: var(--warning-bg); color: var(--warning-text);}
.alerta.warning::before { content: '⚠️'; }

/* ===================================================
   FORMS
   =================================================== */

.form-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.form-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.field, .field-group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.field span, .field-group legend {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input, .field textarea, .field select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { padding: 13px 14px; min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
  background: var(--surface);
}
.field input[readonly], .field textarea[readonly] {
  color: var(--text-2);
  background: var(--surface-2);
  cursor: default;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.vistoria-origin-card, .acceptance-card {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.vistoria-origin-card.hidden { display: none; }
.acceptance-card > legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}
.address-details summary {
  padding: 8px 0;
  color: var(--brand);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
.address-details[open] { display: grid; gap: 12px; }
.acceptance-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  line-height: 1.45;
  cursor: pointer;
}
.acceptance-check:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.acceptance-check input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--brand); }

/* Segmented control */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
}
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background .2s, color .2s;
}
.segmented input:checked + span {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* Switch cards */
.switch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s;
}
.switch-card:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.switch-card-info { display: flex; flex-direction: column; gap: 4px; }
.switch-icon { font-size: 1.2rem; }
.switch-label { font-size: 0.82rem; font-weight: 700; color: var(--text-2); }
.switch-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.switch-card-right strong { font-size: 0.88rem; color: var(--brand); font-weight: 800; }
.switch-card input[type="checkbox"] {
  width: 40px;
  height: 22px;
  accent-color: var(--brand);
  cursor: pointer;
  min-height: unset;
  padding: 0;
  border: none;
  background: none;
}

/* Result panel */
.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--brand-light);
  border: 1.5px solid #BFDBFE;
}
.result-panel span { font-size: 0.85rem; font-weight: 700; color: var(--text-2); }
.result-panel strong { font-size: 1.5rem; font-weight: 800; color: var(--brand-dark); }

/* Buttons */
.button-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.primary-button, .secondary-button {
  height: 52px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform .12s, box-shadow .12s;
}
.primary-button:active, .secondary-button:active { transform: scale(.97); }

.primary-button {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.primary-button:hover { background: var(--brand-dark); }

.secondary-button {
  background: var(--surface-2);
  color: var(--brand);
  border: 1.5px solid var(--border);
}
.secondary-button:hover { border-color: var(--brand); }

/* ===================================================
   AGENDA SCREEN
   =================================================== */

#agenda-grupos { display: grid; gap: 20px; }

.agenda-group {}

.agenda-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.agenda-group-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.agenda-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--brand);
  color: #fff;
  border-radius: 11px;
  font-size: 0.72rem;
  font-weight: 800;
}
.agenda-badge.hidden { display: none; }

.agenda-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.agenda-list.hidden { display: none; }

.agenda-card {
  position: relative;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
}
.agenda-card-tipo {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  width: fit-content;
}
.agenda-card-tipo.entrada { background: var(--info-bg); color: var(--info-text); }
.agenda-card-tipo.saida   { background: var(--success-bg); color: var(--success-text); }
.agenda-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.agenda-card-time {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand);
}
.agenda-card-date { font-size: 0.88rem; color: var(--text-2); }
.agenda-card-address {
  font-size: 0.88rem;
  color: var(--text-2);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.agenda-card-obs { font-size: 0.82rem; color: var(--text-2); font-style: italic; }
.agenda-card .remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.agenda-card .remove-btn:hover { background: var(--danger); color: #fff; }

/* ===================================================
   RESUMO / DASHBOARD
   =================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dashboard-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.dashboard-card--today {
  background: linear-gradient(135deg, #0F2040, #2563EB);
  border-color: transparent;
  color: #fff;
}
.dashboard-card--today small { color: #93C5FD; }
.dashboard-card--today strong { color: #fff; }
.dashboard-card--today span { color: rgba(255,255,255,.7); }

.dashboard-card small {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.dashboard-card strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.1;
}
.dashboard-card span { font-size: 0.8rem; color: var(--text-2); font-weight: 600; }

/* Meta cards (progress) */
.meta-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 10px;
}
.meta-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.meta-label { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.meta-pct {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--brand);
}
.progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  border-radius: 4px;
  transition: width .6s ease;
  max-width: 100%;
}
.progress-fill--mensal {
  background: linear-gradient(90deg, #059669, var(--success));
}
.meta-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.metric-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.metric-card small {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.metric-card strong { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.metric-card span   { font-size: 0.78rem; color: var(--text-2); font-weight: 600; }
#melhor-dia-nome { color: var(--brand-dark); }

/* Historic list */
.historic-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.historic-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.hc-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.3;
}
.hc-icon.entrada { background: var(--info-bg); color: var(--info-text); }
.hc-icon.saida   { background: var(--success-bg); color: var(--success-text); }
.hc-details { flex: 1; min-width: 0; }
.hc-details strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hc-details small { font-size: 0.78rem; color: var(--text-2); }
.hc-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.hc-valor { font-size: 1rem; font-weight: 800; color: var(--brand); }
.remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  border: none;
}
.remove-btn:hover { background: var(--danger); color: #fff; }

/* ===================================================
   CONFIG SCREEN
   =================================================== */

.config-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.config-group-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.config-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.config-toggle-label { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.config-toggle-desc  { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background .3s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--brand); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(22px); }

/* ===================================================
   EMPTY STATE
   =================================================== */

.empty-state {
  padding: 24px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}
.empty-state.hidden { display: none; }

/* ===================================================
   SPLASH SCREEN
   =================================================== */

.splash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100%, 460px);
  height: min(100vh, 940px);
  max-height: 100dvh;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #0F2040;
  display: grid;
  place-items: center;
  z-index: 200;
  transition: opacity .45s ease-out, visibility .45s ease-out;
}
.splash.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-content { text-align: center; color: #fff; padding: 32px; }
.splash-logo {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: rgba(255,255,255,.1);
  padding: 18px;
  box-shadow: 0 8px 32px rgba(37,99,235,.4);
}
.splash-content h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 10px; }
.splash-content p  { font-size: 1rem; color: #93C5FD; font-weight: 600; margin-bottom: 40px; }
.splash-enter-btn {
  display: inline-block;
  padding: 14px 48px;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(37,99,235,.5);
  transition: background .2s, transform .1s;
}
.splash-enter-btn:active { transform: scale(.97); background: var(--brand-dark); }

/* ===================================================
   ONBOARDING
   =================================================== */

.onboarding-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100%, 460px);
  height: min(100vh, 940px);
  max-height: 100dvh;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 199;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 1;
  visibility: visible;
  transition: opacity .4s, visibility .4s;
  background: linear-gradient(170deg, #081C3A 0%, #0E4CB5 100%);
  color: #fff;
}
.onboarding-container.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.onboarding-cover-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.onboarding-scene    { width: 100%; height: 100%; display: block; }

.onboarding-cover-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 52px 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
}
.onboarding-cover-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  justify-content: flex-start;
  text-align: center;
}
.onboarding-logo-box {
  width: 64px;
  height: 64px;
  background: var(--brand);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(37,99,235,.5);
}
.onboarding-cover-title {
  font-size: 2.6rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}
.onboarding-cover-sub { font-size: 1rem; color: #C7DEFF; line-height: 1.5; }

.onboarding-card {
  background: rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(14px);
}
.onboarding-card h2 { font-size: 1.6rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.onboarding-card p  { color: #C7DEFF; font-size: 0.97rem; margin-bottom: 20px; }

.onboarding-button {
  width: 100%;
  height: 52px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .2s, background .2s;
}
.onboarding-button:hover   { background: var(--brand-dark); transform: scale(1.02); }
.onboarding-button:active  { transform: scale(.98); }

/* Onboarding tela 2 */
.onboarding-light { background: #F5F7FA; color: var(--text); }

.onboarding-content-light {
  width: 100%;
  max-width: 460px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-grow: 1;
  justify-content: center;
}
.onboarding-name-card {
  background: #fff;
  border-radius: 28px;
  padding: 36px 28px 28px;
  box-shadow: 0 8px 40px rgba(22,38,54,.1);
  text-align: left;
}
.onboarding-name-title { font-size: 2rem; font-weight: 800; color: #15202B; margin-bottom: 8px; }
.onboarding-name-desc  { font-size: 1.05rem; font-weight: 600; color: #15202B; margin-bottom: 4px; }
.onboarding-name-sub   { font-size: 0.92rem; color: #667585; margin-bottom: 28px; }

.onboarding-input-group { position: relative; margin-bottom: 16px; }
.onboarding-input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: #667585;
  pointer-events: none;
}
.onboarding-input-light {
  width: 100%;
  min-height: 54px;
  padding: 0 16px 0 46px;
  border: 1.5px solid #DFE7EE;
  border-radius: var(--radius);
  background: #F5F7FA;
  color: #15202B;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.onboarding-input-light::placeholder { color: #A0AEBA; }
.onboarding-input-light:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  background: #fff;
}

.onboarding-button-primary {
  width: 100%;
  height: 52px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .2s, background .2s;
  margin-bottom: 24px;
}
.onboarding-button-primary:hover  { background: var(--brand-dark); transform: scale(1.02); }
.onboarding-button-primary:active { transform: scale(.98); }
.btn-arrow { font-size: 1.3rem; line-height: 1; }

.onboarding-security-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #F0FAF4;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.security-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: #22C55E;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}
.security-text strong { font-size: 0.92rem; color: #15202B; display: block; margin-bottom: 3px; }
.security-text p      { font-size: 0.82rem; color: #667585; margin: 0; }

.onboarding-terms { font-size: 0.78rem; color: #A0AEBA; text-align: center; margin: 0; }
.onboarding-terms a { color: var(--brand); text-decoration: none; }
.onboarding-terms a:hover { text-decoration: underline; }

/* Back button */
.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background .15s;
  flex-shrink: 0;
}
.back-btn:hover  { transform: scale(1.1); }
.back-btn:active { transform: scale(.93); }

.back-btn-onboarding {
  position: absolute;
  top: calc(20px + var(--safe-top));
  left: calc(20px + var(--safe-left));
  z-index: 10;
  background: #E2E8F0;
  color: #15202B;
}
.back-btn-onboarding:hover { background: #CBD5E1; }

/* ===================================================
   WHATSAPP BUTTON
   =================================================== */

.whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  border-radius: var(--radius);
  background: #25D366;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 211, 102, .35);
  transition: transform .12s, box-shadow .12s;
}
.whatsapp-btn:active { transform: scale(.97); }

/* ===================================================
   BACKUP SECTION
   =================================================== */

.config-backup-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.5;
}
.backup-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.import-label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-align: center;
}

/* ===================================================
   UTILITIES
   =================================================== */

.hidden { display: none !important; }

/* ===================================================
   RESPONSIVE — MOBILE FULL SCREEN
   =================================================== */

@media (max-width: 460px) {
  .app-shell {
    display: block;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .phone {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .splash,
  .onboarding-container {
    border-radius: 0;
    box-shadow: none;
  }
  .splash {
    width: 100%;
    height: 100vh;
    height: 100dvh;
  }
  .onboarding-container { height: 100vh; height: 100dvh; }
}

@media (max-width: 380px) {
  .dashboard-grid,
  .metrics-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .switch-grid { grid-template-columns: 1fr; }
  .actions-grid { grid-template-columns: 1fr 1fr; }
}
.field-hint { min-height: 16px; font-size: .75rem; font-weight: 600; color: var(--text-2); }
.field-hint.loading { color: var(--brand); }
.field-hint.success { color: var(--success-text); }
.field-hint.error { color: var(--danger); }

/* ===================================================
   AUTENTICAÇÃO, SINCRONIZAÇÃO E AGENDA ONLINE
   =================================================== */
.auth-screen {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  overflow-x: hidden; overflow-y: auto; background: var(--bg);
}
.auth-screen.hidden { display: none; }
.auth-card {
  width: min(100%, 420px); display: grid; gap: 18px; padding: 30px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.auth-card > p { color: var(--text-2); line-height: 1.5; }
.auth-logo, .response-icon {
  display: grid; place-items: center; width: 60px; height: 60px;
  border-radius: 18px; background: var(--brand); color: #fff;
  font-size: 2rem; font-weight: 900;
}
.public-card { justify-items: center; text-align: center; }
.response-icon.error { background: var(--danger); }
.form-message.error, .config-warning { color: var(--danger); font-size: .86rem; }
.config-warning { padding: 12px; border-radius: var(--radius-sm); background: var(--danger-bg); }

.header-actions { display: flex; gap: 7px; }
.header-icon-button {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 11px;
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
}
.sync-strip {
  flex-shrink: 0; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 8px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.sync-strip button { border: 0; background: transparent; color: var(--brand); font-size: .72rem; font-weight: 800; }
.sync-status { font-size: .72rem; font-weight: 800; }
.sync-status.local { color: #a16207; }.sync-status.synced { color: #15803d; }.sync-status.error { color: var(--danger); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-button, .card-actions button {
  min-height: 38px; padding: 0 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--brand);
  font-size: .78rem; font-weight: 800;
}
.filter-button.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.filter-bar select { flex: 1 1 150px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.agenda-card-header { justify-content: space-between; align-items: flex-start; }
.agenda-card-header > div { display: grid; gap: 3px; }
.agenda-card-header small { color: var(--text-2); }
.status-badge { padding: 5px 8px; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); font-size: .68rem; white-space: nowrap; }
.inline-status { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: .78rem; font-weight: 700; }
.inline-status select { flex: 1; min-height: 38px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-actions button:first-child { color: #fff; background: #16a34a; border-color: #16a34a; }
.card-actions .danger-link { color: var(--danger); }

@media (max-width: 380px) {
  .card-actions { grid-template-columns: 1fr; }
  .sync-strip { align-items: flex-start; flex-direction: column; }
}

/* Garantia final: o atalho do assistente nunca ocupa a largura da tela. */
@media (max-width: 640px) {
  #assistant-btn {
    position: absolute !important;
    box-sizing: border-box !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    padding: 0 !important;
    flex: 0 0 48px !important;
    right: auto !important;
    left: 16px !important;
    bottom: calc(var(--nav-h) + 24px + var(--safe-bottom)) !important;
    z-index: 30 !important;
  }
}

/* ===================================================
   HOME - MATERIAL 3 REFRESH
   =================================================== */

.phone:has(#tela-home:not(.hidden)) .app-header {
  padding: 12px 20px;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid #E8ECF2;
}
.phone:has(#tela-home:not(.hidden)) .header-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #2563EB;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .2);
}
.phone:has(#tela-home:not(.hidden)) .header-title { color: var(--text); }
.phone:has(#tela-home:not(.hidden)) .profile-button,
.phone:has(#tela-home:not(.hidden)) .header-icon-button {
  width: 38px;
  height: 38px;
  color: #475569;
  background: #F1F5F9;
  border-color: transparent;
  border-radius: 12px;
}
.phone:has(#tela-home:not(.hidden)) .profile-button:hover,
.phone:has(#tela-home:not(.hidden)) .header-icon-button:hover { background: #E2E8F0; }
.phone:has(#tela-home:not(.hidden)) .sync-strip { background: #FFFFFF; }

#tela-home {
  min-height: 100%;
  background: #F5F7FA;
}
#tela-home .home-content {
  gap: 26px;
  padding: 26px 20px 28px;
}
#tela-home .home-greeting { align-items: center; }
#tela-home .greeting-period {
  margin-bottom: 5px;
  color: #64748B;
  font-size: .82rem;
  font-weight: 600;
}
#tela-home .greeting-name {
  color: #0F172A;
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: 0;
}
#tela-home .greeting-date {
  padding: 7px 10px;
  color: #475569;
  background: #FFFFFF;
  border: 1px solid #E8ECF2;
  border-radius: 12px;
  font-size: .72rem;
  line-height: 1.35;
}

#tela-home .today-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background: #2563EB;
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .2);
}
#tela-home .today-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -36px;
  top: -50px;
  border: 22px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  pointer-events: none;
}
#tela-home .today-card-header { margin-bottom: 14px; }
#tela-home .today-label {
  color: #DBEAFE;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
#tela-home .today-date-badge {
  padding: 5px 9px;
  color: #FFFFFF;
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
}
#tela-home .today-total {
  margin-bottom: 6px;
  font-size: 2.35rem;
  font-weight: 750;
  letter-spacing: 0;
}
#tela-home .today-count { color: #DBEAFE; font-weight: 500; }
#tela-home .today-progress-wrap { margin-top: 22px; }
#tela-home .today-progress-bar { height: 7px; background: rgba(255,255,255,.22); }
#tela-home .today-progress-fill { background: #FFFFFF; }
#tela-home .today-progress-labels { margin-top: 8px; color: #DBEAFE; }

#tela-home .section-label {
  margin-bottom: 12px;
  color: #334155;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
#tela-home .section-row { margin-bottom: 12px; }
#tela-home .next-card {
  padding: 20px;
  background: #FFFFFF;
  border: 1px solid #E8ECF2;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .055);
}
#tela-home .next-card-content { gap: 14px; }
#tela-home .next-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #EEF1F5;
}
#tela-home .next-time { color: #0F172A; font-size: 1.35rem; font-weight: 750; }
#tela-home .next-time span {
  display: block;
  margin-top: 3px;
  color: #64748B;
  font-size: .78rem;
  font-weight: 600;
}
#tela-home .next-tipo {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .7rem;
}
#tela-home .next-address {
  align-items: flex-start;
  gap: 10px;
  color: #64748B;
  font-size: .86rem;
  line-height: 1.45;
}
#tela-home .next-client { color: #1E293B; font-size: .95rem; }
#tela-home .next-detail-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #2563EB;
  background: #EFF6FF;
  border-radius: 10px;
}
#tela-home .next-detail-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#tela-home .next-card-empty { min-height: 86px; justify-content: center; }
#tela-home .link-btn { padding: 7px 10px; border-radius: 10px; }

#tela-home .actions-grid { gap: 12px; }
#tela-home .action-card {
  min-height: 112px;
  gap: 10px;
  padding: 18px 12px;
  background: #FFFFFF;
  border-color: #E8ECF2;
  border-radius: 18px;
  color: #1E293B;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
#tela-home .action-card:hover {
  transform: translateY(-2px);
  border-color: #BFDBFE;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .08);
}
#tela-home .action-card:active { transform: scale(.98); }
#tela-home .action-icon {
  width: 42px;
  height: 42px;
  color: #2563EB;
  background: #EFF6FF;
  border-radius: 13px;
}
#tela-home .action-icon svg { width: 20px; height: 20px; stroke-width: 2; }

#tela-home .recent-list { gap: 12px; }
#tela-home .recent-card {
  padding: 15px;
  background: #FFFFFF;
  border-color: #E8ECF2;
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .04);
}
#tela-home .recent-card-icon { border-radius: 12px; }
#tela-home .recent-card-info strong { color: #1E293B; }
#tela-home .recent-card-valor { color: #1D4ED8; font-weight: 750; }

[data-theme="dark"] #tela-home { background: var(--bg); }
[data-theme="dark"] #tela-home .greeting-name,
[data-theme="dark"] #tela-home .section-label,
[data-theme="dark"] #tela-home .next-time,
[data-theme="dark"] #tela-home .next-client,
[data-theme="dark"] #tela-home .action-card,
[data-theme="dark"] #tela-home .recent-card-info strong { color: var(--text); }
[data-theme="dark"] #tela-home .greeting-date,
[data-theme="dark"] #tela-home .next-card,
[data-theme="dark"] #tela-home .action-card,
[data-theme="dark"] #tela-home .recent-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .phone:has(#tela-home:not(.hidden)) .app-header,
[data-theme="dark"] .phone:has(#tela-home:not(.hidden)) .sync-strip { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .phone:has(#tela-home:not(.hidden)) .header-title { color: var(--text); }

@media (max-width: 380px) {
  #tela-home .home-content { gap: 22px; padding-inline: 16px; }
  #tela-home .greeting-name { font-size: 1.35rem; }
  #tela-home .today-total { font-size: 2rem; }
  #tela-home .action-card { min-height: 104px; }
}

/* Home polish: compact Material 3 shell and navigation */
.phone:has(#tela-home:not(.hidden)) .app-header {
  height: calc(64px + var(--safe-top));
  min-height: calc(64px + var(--safe-top));
  padding: var(--safe-top) calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left));
}
.phone:has(#tela-home:not(.hidden)) .header-left { gap: 0; }
.phone:has(#tela-home:not(.hidden)) .header-title { display: none; }
.phone:has(#tela-home:not(.hidden)) .profile-button { margin-left: auto; }
.phone:has(#tela-home:not(.hidden)) .header-actions { margin-left: 6px; gap: 4px; }
.phone:has(#tela-home:not(.hidden)) .profile-button,
.phone:has(#tela-home:not(.hidden)) .header-icon-button {
  width: 36px;
  height: 36px;
  padding: 8px;
  background: transparent;
}
.phone:has(#tela-home:not(.hidden)) .header-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.phone:has(#tela-home:not(.hidden)) .sync-strip {
  min-height: 34px;
  padding: 4px 16px;
  border-bottom-color: #EEF1F5;
}
.phone:has(#tela-home:not(.hidden)) .sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .68rem;
}
.phone:has(#tela-home:not(.hidden)) .sync-status.synced { color: #166534; background: #DCFCE7; }
.phone:has(#tela-home:not(.hidden)) .sync-status.local { color: #854D0E; background: #FEF9C3; }
.phone:has(#tela-home:not(.hidden)) .sync-status.error { color: #991B1B; background: #FEE2E2; }
.phone:has(#tela-home:not(.hidden)) .sync-strip button { padding: 4px 0; font-size: .68rem; }

#tela-home .home-content { gap: 24px; padding-top: 18px; }
#tela-home .home-greeting { min-height: 48px; }
#tela-home .greeting-period { margin-bottom: 2px; font-size: .78rem; }
#tela-home .greeting-name { font-size: 1.4rem; line-height: 1.12; }
#tela-home .greeting-date {
  padding: 0;
  color: #64748B;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: .75rem;
}
#tela-home .alertas-container { gap: 6px; }
#tela-home .alerta {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: .8rem;
  line-height: 1.3;
}
#tela-home .alerta::before { font-size: .9rem; }

#tela-home .today-card {
  padding: 22px;
  background: linear-gradient(135deg, #0B1F46 0%, #123B7A 55%, #1D4ED8 100%);
  box-shadow: 0 8px 20px rgba(11, 31, 70, .22);
}
#tela-home .today-card::after { display: none; }
#tela-home .today-total { font-size: 2.45rem; }
#tela-home .today-progress-wrap { margin-top: 18px; }
#tela-home .today-progress-bar { height: 9px; border-radius: 999px; }
#tela-home .today-progress-fill { border-radius: 999px; }
#tela-home .today-progress-labels { font-size: .68rem; font-weight: 500; opacity: .88; }
#tela-home .today-progress-labels span:last-child { opacity: .82; }

#tela-home .next-card { border-radius: 18px; box-shadow: 0 3px 12px rgba(15, 23, 42, .05); }
#tela-home .next-card-top { align-items: center; }
#tela-home .next-calendar-icon,
#tela-home .next-empty-icon {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #2563EB;
  background: #EFF6FF;
  border-radius: 14px;
}
#tela-home .next-calendar-icon svg,
#tela-home .next-empty-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#tela-home .next-card-top .next-time { flex: 1; }
#tela-home .next-card-empty { min-height: 164px; gap: 12px; }
#tela-home .next-card-empty p { color: #64748B; }
#tela-home .next-card-empty .link-btn {
  min-height: 40px;
  padding: 0 20px;
  color: #FFFFFF;
  background: #2563EB;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .2);
}
#tela-home .next-card-empty .link-btn:hover { background: #1D4ED8; }

.bottom-nav {
  height: calc(72px + var(--safe-bottom));
  padding: 5px calc(10px + var(--safe-right)) max(5px, var(--safe-bottom)) calc(10px + var(--safe-left));
  background: rgba(255, 255, 255, .97);
  border-top-color: #E8ECF2;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .045);
}
.nav-btn {
  position: relative;
  min-height: 56px;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 16px;
  font-size: .62rem;
  font-weight: 650;
}
.nav-btn svg { width: 24px; height: 24px; }
.nav-btn:not(.nav-btn-center).active { color: #1D4ED8; background: #EFF6FF; }
.nav-btn-center {
  width: 48px;
  height: 48px;
  min-height: 48px;
  border-radius: 16px;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .28);
}
.nav-btn-center svg { width: 24px; height: 24px; }

.fab-btn {
  right: calc(16px + var(--safe-right));
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  width: 44px;
  height: 44px;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .26);
}
.fab-btn svg { width: 22px; height: 22px; }

#assistant-btn {
  position: absolute !important;
  left: calc(16px + var(--safe-left)) !important;
  right: auto !important;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px) !important;
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: #2563EB;
  box-shadow: 0 5px 16px rgba(37, 99, 235, .28);
}
#assistant-btn .assistant-icon { width: 24px; height: 24px; }
#assistant-btn .assistant-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

[data-theme="dark"] .bottom-nav { background: rgba(22, 27, 34, .97); border-color: var(--border); }
[data-theme="dark"] .nav-btn:not(.nav-btn-center).active { background: var(--brand-light); }

@media (max-width: 380px) {
  .phone:has(#tela-home:not(.hidden)) .sync-strip { padding-inline: 12px; flex-direction: row; align-items: center; }
  #tela-home .today-total { font-size: 2.1rem; }
  #tela-home .next-card-top { align-items: flex-start; }
  #tela-home .next-calendar-icon { flex-basis: 40px; width: 40px; height: 40px; }
}

/* ===================================================
   HM ORIGENS — CAMADA VISUAL CONTROLADA
   =================================================== */
:root {
  --brand: #1D4ED8;
  --brand-dark: #0F2A5F;
  --brand-light: #EFF6FF;
  --hm-accent: #C58B3A;
  --hm-ink: #0F2040;
  --hm-soft: #F5F8FC;
  --shadow-card: 0 10px 30px rgba(15, 32, 64, .09);
}

[data-theme="dark"] {
  --brand: #60A5FA;
  --brand-dark: #3B82F6;
  --brand-light: #172B4D;
  --hm-accent: #E7C285;
  --hm-ink: #E7F4F3;
  --hm-soft: #122126;
  --shadow-card: 0 12px 30px rgba(0, 0, 0, .22);
}

.brand-logo {
  display: block;
  object-fit: contain;
}
.brand-logo--login {
  width: min(100%, 270px);
  height: auto;
  margin: 0 auto 4px;
}
.brand-logo--header {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}

.brand-lockup,
.header-brand {
  display: inline-flex;
  align-items: center;
}

.brand-lockup { gap: 13px; }
.brand-monogram {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, var(--hm-ink), #1D4ED8);
  box-shadow: 0 10px 24px rgba(18, 52, 59, .2);
  font-size: 1.05rem;
  font-weight: 850;
  letter-spacing: .08em;
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong,
.header-brand strong { letter-spacing: .12em; }
.brand-copy strong { color: var(--hm-ink); font-size: .98rem; }
.brand-copy small { color: var(--hm-accent); font-size: .9rem; font-weight: 750; letter-spacing: .03em; }

.auth-screen {
  padding: max(20px, var(--safe-top)) max(20px, var(--safe-right)) max(20px, var(--safe-bottom)) max(20px, var(--safe-left));
  background:
    radial-gradient(circle at 12% 8%, rgba(197, 139, 58, .12), transparent 30%),
    linear-gradient(155deg, #F8FBFA 0%, #EDF4F3 100%);
}
.auth-card {
  gap: 16px;
  padding: clamp(26px, 7vw, 38px);
  border: 1px solid rgba(18, 52, 59, .1);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(18, 52, 59, .14);
}
.auth-card h1 { margin-top: 10px; color: var(--hm-ink); font-size: clamp(1.65rem, 6vw, 2rem); letter-spacing: -.035em; }
.auth-card > p { margin-top: -7px; font-size: .93rem; }
.auth-card .field { gap: 7px; }
.auth-card .field span { color: #334D52; font-size: .79rem; letter-spacing: .02em; }
.auth-card .field input {
  min-height: 52px;
  padding-inline: 15px;
  border-radius: 13px;
  background: #FBFDFC;
  border-color: #CCDAD8;
}
.auth-card .field input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(22, 78, 99, .1); }
.auth-card .primary-button { width: 100%; margin-top: 3px; }
.primary-button:disabled { cursor: wait; opacity: .78; box-shadow: none; }
.primary-button[aria-busy="true"] { position: relative; padding-right: 48px; }
.primary-button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  right: 20px;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: hmSpin .75s linear infinite;
}
@keyframes hmSpin { to { transform: rotate(360deg); } }

.form-message.error,
.config-warning {
  padding: 11px 13px;
  border: 1px solid #F1C9C9;
  border-radius: 11px;
  background: var(--danger-bg);
  line-height: 1.42;
}
.form-message.error.hidden,
.config-warning.hidden { padding: 0; border: 0; }

.app-header {
  min-height: 68px;
  padding: 10px 18px;
  background: linear-gradient(120deg, #0B1833, #123B7A);
}
.header-logo { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); }
.header-identity { display: grid; gap: 1px; min-width: 0; }
.header-brand { display: grid; gap: 3px; color: #fff; line-height: 1; }
.header-brand strong { font-size: .72rem; }
.header-brand small { color: #E7C285; font-size: .68rem; font-weight: 750; }
.header-title { color: rgba(255,255,255,.7); font-size: .68rem; font-weight: 600; letter-spacing: .02em; }

.phone:has(#tela-home:not(.hidden)) .app-header {
  background: linear-gradient(120deg, #0B1833, #123B7A);
  border-bottom: 0;
}
.phone:has(#tela-home:not(.hidden)) .header-left { gap: 10px; }
.phone:has(#tela-home:not(.hidden)) .header-title { display: block; color: rgba(255,255,255,.7); }
.phone:has(#tela-home:not(.hidden)) .profile-button,
.phone:has(#tela-home:not(.hidden)) .header-icon-button { color: #fff; background: rgba(255,255,255,.08); }
.phone:has(#tela-home:not(.hidden)) .profile-button:hover,
.phone:has(#tela-home:not(.hidden)) .header-icon-button:hover { background: rgba(255,255,255,.16); }

.home-content { background: linear-gradient(180deg, #F5F9F8 0, var(--bg) 280px); }
#tela-home .today-card {
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(140deg, #0B1833 0%, #123B7A 62%, #B17A32 145%);
  box-shadow: 0 15px 35px rgba(18, 52, 59, .22);
}
#tela-home .next-card,
#tela-home .action-card,
#tela-home .recent-card,
.dashboard-card,
.meta-card,
.agenda-card,
.form-card {
  border-color: rgba(18, 52, 59, .1);
  box-shadow: var(--shadow-card);
}
#tela-home .action-card {
  min-height: 116px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  text-align: left;
}
#tela-home .action-icon { background: var(--brand-light); color: var(--brand); }
#tela-home .action-card:hover { border-color: rgba(22, 78, 99, .3); box-shadow: 0 14px 32px rgba(18,52,59,.12); }
.dashboard-card { min-height: 118px; align-content: space-between; padding: 18px; }
.dashboard-card--today { background: linear-gradient(140deg, #0B1833, #174EA6); }
.dashboard-card strong { color: var(--brand); }

.bottom-nav { border-top-color: rgba(18,52,59,.1); }
.nav-btn:not(.nav-btn-center).active { color: var(--brand); background: var(--brand-light); }
.nav-btn-center { background: linear-gradient(145deg, var(--brand), #123B7A); box-shadow: 0 7px 18px rgba(15,32,64,.28); }

.toast {
  width: max-content;
  max-width: calc(100vw - 32px - var(--safe-left) - var(--safe-right));
  white-space: normal;
  text-align: center;
  border-radius: 14px;
  background: #0F2040;
  box-shadow: 0 16px 36px rgba(18,52,59,.24);
}
.toast.toast-error { background: #A93131; }

[data-theme="dark"] .home-content { background: linear-gradient(180deg, #101D35 0, var(--bg) 280px); }
[data-theme="dark"] .auth-screen { background: linear-gradient(155deg, #0A1224, #111E38); }
[data-theme="dark"] .auth-card .field input { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .brand-copy strong { color: var(--hm-ink); }

.primary-button { background: linear-gradient(135deg, var(--brand), #123B7A); box-shadow: 0 7px 18px rgba(15,32,64,.22); }
.primary-button:hover { background: linear-gradient(135deg, var(--brand-dark), #0B2B64); }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 3px solid rgba(197,139,58,.35); outline-offset: 2px; }

@media (max-width: 460px) {
  .auth-screen { place-items: stretch; overflow-y: auto; }
  .auth-card { width: 100%; margin: auto 0; padding: 26px 22px; border-radius: 24px; }
  .app-header {
    min-height: calc(64px + var(--safe-top));
    padding: calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
  }
  .header-logo { width: 32px; height: 32px; }
  .header-actions { gap: 4px; }
  .profile-button, .header-icon-button { width: 38px; height: 38px; }
  .page-content, .home-content { padding-inline: 16px; }
  .form-card { padding: 16px; }
  .primary-button, .secondary-button { min-height: 52px; }
  .filter-button, .card-actions button { min-height: 44px; }
  .agenda-card { padding: 15px; }
  .bottom-nav { height: calc(72px + var(--safe-bottom)); }
}

@media (display-mode: standalone) and (max-width: 460px) {
  .auth-screen,
  .splash,
  .onboarding-container {
    padding-top: max(20px, var(--safe-top));
    padding-bottom: max(20px, var(--safe-bottom));
  }
}

@supports (height: 100dvh) {
  body,
  .app-shell { min-height: 100dvh; }

  @media (min-width: 461px) {
    .phone { height: min(940px, calc(100dvh - 36px)); }
    .splash,
    .onboarding-container { height: min(100dvh, 940px); }
  }
}

/* Faixa reservada: ações nunca cobrem cards, formulários ou navegação. */
.floating-actions {
  flex: 0 0 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px calc(16px + var(--safe-right)) 8px calc(16px + var(--safe-left));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 18;
}

.floating-actions #assistant-btn,
.floating-actions .fab-btn {
  position: static !important;
  inset: auto !important;
  margin: 0 !important;
  transform: none;
  pointer-events: auto;
}

.floating-actions #assistant-btn { order: 1; }
.floating-actions .fab-btn { order: 2; }

@media (max-width: 460px) {
  .floating-actions {
    flex-basis: 60px;
    min-height: 60px;
    padding-block: 6px;
  }
}

@media (max-width: 360px) {
  .brand-monogram { width: 48px; height: 48px; border-radius: 14px; }
  .header-brand strong { font-size: .66rem; }
  .header-brand small { font-size: .62rem; }
  .header-title { display: none !important; }
  .header-logo { display: none; }
  .brand-logo--header { width: 38px; height: 38px; flex-basis: 38px; }
  #tela-home .action-card { min-height: 102px; padding: 13px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-card { min-height: 106px; padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   BOTAO DE VISUALIZAR SENHA (OLHO)
   ============================================================ */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-input-wrapper input {
  width: 100%;
  padding-right: 48px !important;
}
.toggle-password-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.1s active;
  z-index: 10;
}
.toggle-password-btn:hover {
  color: var(--brand);
}
.toggle-password-btn:active {
  transform: scale(0.92);
}
.toggle-password-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.toggle-password-btn .hidden {
  display: none !important;
}
[data-theme="dark"] .toggle-password-btn {
  color: #94A3B8;
}
[data-theme="dark"] .toggle-password-btn:hover {
  color: var(--brand);
}
