:root {
  color-scheme: light;
  --ink: #16221f;
  --ink-soft: #243431;
  --muted: #5a6a66;
  --bg: #eef3f9;
  --bg-2: #d6e4f2;
  --accent: #05508a;
  --accent-dark: #043a66;
  --teal: #2b8f7f;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.75);
  --shadow: 0 28px 60px rgba(18, 30, 30, 0.14);
  --shadow-soft: 0 16px 30px rgba(18, 30, 30, 0.1);
  --radius: 26px;
  --page-gutter: clamp(12px, 4vw, 28px);
  --header-bg: rgba(247, 242, 236, 0.92);
  --header-border: rgba(22, 34, 31, 0.08);
  --ghost-bg: rgba(22, 34, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #dbe9f7 0%, var(--bg) 35%, var(--bg-2) 100%);
  min-height: 100vh;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e5e7eb;
  --ink-soft: #cbd5e1;
  --muted: #a3b0c2;
  --bg: #0d1117;
  --bg-2: #0b0f14;
  --accent: #4aa3ff;
  --accent-dark: #1d6fc2;
  --teal: #46c4a8;
  --surface: #131823;
  --glass: rgba(19, 24, 35, 0.85);
  --shadow: 0 28px 60px rgba(5, 6, 10, 0.6);
  --shadow-soft: 0 16px 30px rgba(5, 6, 10, 0.5);
  --header-bg: rgba(15, 19, 26, 0.94);
  --header-border: rgba(226, 232, 240, 0.08);
  --ghost-bg: rgba(226, 232, 240, 0.1);
}

:root[data-theme="dark"] body {
  background: radial-gradient(circle at top, rgba(30, 64, 175, 0.22) 0%, var(--bg) 35%, var(--bg-2) 100%);
}

.rca-body {
  position: relative;
  overflow-x: hidden;
}

.rca-body.rca-home {
  overflow: hidden;
  height: 100vh;
  min-height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
}

.glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(0);
  opacity: 0.6;
  z-index: 0;
}

.glow.g1 {
  background: radial-gradient(circle, rgba(110, 168, 216, 0.55), rgba(110, 168, 216, 0));
  top: -140px;
  right: -120px;
}

.glow.g2 {
  background: radial-gradient(circle, rgba(43, 143, 127, 0.45), rgba(43, 143, 127, 0));
  bottom: -160px;
  left: -120px;
}

.glow.g3 {
  background: radial-gradient(circle, rgba(173, 205, 236, 0.45), rgba(173, 205, 236, 0));
  top: 40%;
  left: 40%;
}

h1,
h2,
h3 {
  font-family: "Fraunces", "Georgia", serif;
  margin: 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
}

.reveal {
  animation: float-in 0.6s ease forwards;
  opacity: 0;
  transform: translateY(16px);
}

.reveal.delay-1 {
  animation-delay: 0.1s;
}

.reveal.delay-2 {
  animation-delay: 0.18s;
}

@keyframes float-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-eyebrow {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-dark);
  font-weight: 700;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(43, 143, 127, 0.14);
  color: var(--teal);
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 32px;
  padding: 64px clamp(20px, 6vw, 80px);
  align-items: center;
  min-height: 100vh;
}

.login-panel,
.login-side {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
}

.login-panel {
  display: grid;
  gap: 20px;
}

.login-panel h1 {
  font-size: clamp(2.4rem, 3vw, 3.2rem);
}

.login-panel p {
  font-size: 1rem;
}

.login-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(22, 34, 31, 0.18);
  font-size: 1rem;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  border-color: rgba(43, 143, 127, 0.6);
  box-shadow: 0 0 0 3px rgba(43, 143, 127, 0.18);
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(5, 80, 138, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(5, 80, 138, 0.35);
}

.status-line {
  font-size: 0.85rem;
  color: var(--muted);
}

.login-side {
  background: linear-gradient(160deg, rgba(43, 143, 127, 0.1), rgba(110, 168, 216, 0.16));
  display: grid;
  gap: 16px;
}

.login-side h2 {
  font-size: 1.6rem;
}

.login-side ul {
  padding-left: 18px;
  margin: 0;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) var(--page-gutter) 8px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.topbar .brand strong {
  font-size: 1.1rem;
}

.quick-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.period-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid rgba(22, 34, 31, 0.12);
}

.period-selector:focus-within {
  border-color: rgba(43, 143, 127, 0.6);
  box-shadow: 0 0 0 3px rgba(43, 143, 127, 0.18);
}

.period-selector label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-dark);
  font-weight: 700;
}

.period-selector select {
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  outline: none;
}

.period-selector select:focus {
  outline: none;
}

.profile {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid rgba(22, 34, 31, 0.12);
  border-radius: 999px;
  cursor: pointer;
  width: max-content;
}

.profile-trigger:focus {
  outline: 2px solid rgba(43, 143, 127, 0.4);
  outline-offset: 2px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(43, 143, 127, 0.2) url("/assets/perfil.png") center / cover no-repeat;
  color: transparent;
  font-weight: 700;
  overflow: hidden;
}

.profile-text {
  display: grid;
  text-align: left;
  min-width: 0;
}

.profile-text span {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-text small {
  font-size: 0.72rem;
  color: var(--muted);
}

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--surface);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(22, 34, 31, 0.12);
  min-width: 210px;
  display: none;
  z-index: 4;
}

.profile-menu.is-open {
  display: grid;
  gap: 6px;
}

.menu-item {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-soft);
}

.menu-item:hover {
  background: rgba(43, 143, 127, 0.12);
}

.menu-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.menu-item.disabled:hover {
  background: transparent;
}

.menu-item.is-hidden {
  display: none;
}

.menu-note {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.info-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-block {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(22, 34, 31, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
}

.info-rca-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rca-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(5, 80, 138, 0.12);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.info-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(22, 34, 31, 0.08);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(18, 30, 30, 0.08);
}

.info-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-soft);
  word-break: break-word;
}

.info-empty {
  border: 2px dashed rgba(22, 34, 31, 0.18);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.secondary-btn {
  background: transparent;
  border: 1px solid rgba(22, 34, 31, 0.2);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 14, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 6;
}

.modal-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 7;
  padding: 20px;
}

.modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: min(520px, 92vw);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.modal-card.has-scroll {
  width: min(720px, 94vw);
  max-height: min(80vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.positivacao-modal-card {
  width: min(720px, 94vw);
}

.categoria-modal-card {
  width: min(720px, 94vw);
}

.fornecedores-modal-card {
  width: min(720px, 94vw);
}

.venda-geral-modal-card {
  width: min(720px, 94vw);
}

.apuracao-modal-card {
  width: min(720px, 94vw);
}

.deducoes-modal-card {
  width: min(720px, 94vw);
}

.folha-modal-card {
  width: min(520px, 92vw);
}

.folha-modal-card .modal-body {
  display: grid;
  gap: 16px;
}

.folha-modal-card .modal-actions {
  width: 100%;
}

.folha-modal-card .primary-btn {
  width: 100%;
  justify-content: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.primary-btn.is-disabled {
  opacity: 0.6;
  pointer-events: none;
  box-shadow: none;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-head h2 {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-card.has-scroll .modal-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(22, 34, 31, 0.08);
}

.modal-body {
  overflow: auto;
  padding-top: 6px;
}

.detail-section {
  display: grid;
  gap: 12px;
}

.detail-title {
  font-size: 1.05rem;
  margin: 0;
  color: var(--ink);
}

.detail-section + .detail-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(22, 34, 31, 0.08);
}

.dashboard {
  position: relative;
  z-index: 1;
  padding: 8px var(--page-gutter) calc(20px + env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  gap: 18px;
}

.hero {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  padding: 20px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 680px;
}

.kpi-section {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(22, 34, 31, 0.06);
  border-radius: 22px;
  padding: 16px;
  display: grid;
  gap: 14px;
  position: relative;
}

.kpi-section.is-draggable {
  cursor: grab;
}

.kpi-section.is-dragging {
  cursor: grabbing;
  opacity: 0.7;
  touch-action: none;
}

.kpi-section.is-drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

.kpi-drag-handle {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 1px solid rgba(22, 34, 31, 0.08);
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  cursor: grab;
}

.kpi-drag-handle:active {
  cursor: grabbing;
}

.kpi-section-head h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

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

.panel-empty {
  border: 2px dashed rgba(22, 34, 31, 0.16);
  border-radius: 20px;
  padding: 32px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  min-height: 220px;
}

.panel-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-actions .secondary-btn {
  padding: 10px 18px;
  font-size: 0.9rem;
}


.field select {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(22, 34, 31, 0.18);
  font-size: 0.95rem;
  outline: none;
  background: #fff;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.field select:focus {
  border-color: rgba(43, 143, 127, 0.6);
  box-shadow: 0 0 0 3px rgba(43, 143, 127, 0.18);
}

.field.compact label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  position: relative;
  z-index: 0;
}

.kpi-grid.is-loading {
  pointer-events: none;
}

.kpi-grid.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 251, 251, 0.75);
  border-radius: 18px;
}

.kpi-grid.is-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 3px solid rgba(5, 80, 138, 0.2);
  border-top-color: var(--accent);
  animation: rca-spin 0.9s linear infinite;
  z-index: 1;
}

.kpi-loading-message {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, 22px);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  z-index: 2;
  pointer-events: none;
}

.kpi-card {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(22, 34, 31, 0.06);
  box-shadow: 0 12px 24px rgba(18, 30, 30, 0.08);
  display: grid;
  gap: 12px;
  min-height: 160px;
  --kpi-accent: var(--accent);
}

.kpi-card.is-clickable {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card.is-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(18, 30, 30, 0.12);
}

.kpi-card[data-category="AA"] {
  --kpi-accent: #05508a;
}

.kpi-card[data-category="A"] {
  --kpi-accent: #0f6faf;
}

.kpi-card[data-category="B"] {
  --kpi-accent: #1b7e83;
}

.kpi-card[data-category="C"] {
  --kpi-accent: #2b8f7f;
}

.kpi-card[data-category="D"] {
  --kpi-accent: #3c7c6f;
}

.kpi-head {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 12px;
}

.venda-geral-card .kpi-head {
  justify-content: flex-end;
}

.kpi-title {
  font-size: 1.35rem;
  color: var(--kpi-accent);
  font-weight: 700;
}

.kpi-title.kpi-title-rca {
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 700;
}

.kpi-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 80, 138, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.apuracao-modal-card .kpi-card .kpi-head,
.venda-geral-modal-card .kpi-card .kpi-head {
  position: relative;
  justify-content: flex-start;
  padding-right: 72px;
}

.apuracao-modal-card .kpi-card .kpi-badge,
.venda-geral-modal-card .kpi-card .kpi-badge {
  position: absolute;
  top: 0;
  right: 0;
}

.positivacao-card .kpi-head {
  justify-content: space-between;
}

.fornecedor-card .kpi-head {
  justify-content: space-between;
}

.venda-geral-card .kpi-head {
  justify-content: space-between;
}

.deducoes-card .kpi-head {
  justify-content: space-between;
}

.categoria-card .kpi-head {
  justify-content: space-between;
}

.kpi-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kpi-chart {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
}

.meta-liquido-metrics {
  grid-template-columns: 1fr;
  gap: 14px;
}

.meta-liquido-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meta-liquido-value {
  display: grid;
  gap: 6px;
}

.meta-liquido-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  justify-self: center;
}

.meta-liquido-value strong {
  font-size: 1.25rem;
  color: var(--ink);
  justify-self: center;
}

.meta-liquido-gauge {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding-top: 6px;
}

.meta-liquido-gauge-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 600;
}

.meta-liquido-gauge-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: -6px;
}

.meta-liquido-gauge-range {
  position: relative;
  width: 100%;
  height: 0;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: -30px;
}

.meta-liquido-gauge-range span {
  position: absolute;
  bottom: 0;
  font-weight: 600;
}

.meta-liquido-gauge-range span:first-child {
  left: 0;
  transform: translate(-10%, -135%);
}

.meta-liquido-gauge-range span:last-child {
  right: 0;
  transform: translate(10%, -135%);
}

.meta-liquido-card svg {
  overflow: visible;
}

.meta-liquido-card .kpi-head {
  justify-content: space-between;
}

.folha-card .kpi-head {
  justify-content: space-between;
}

.folha-metrics {
  grid-template-columns: 1fr;
}

.folha-card .kpi-label {
  font-size: 0.8rem;
}

.folha-card .kpi-value {
  font-size: 2rem;
  font-weight: 800;
}

.kpi-metric {
  display: grid;
  gap: 6px;
}

.kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.kpi-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}

.kpi-action {
  margin-left: auto;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kpi-action::after {
  content: ">";
  font-size: 0.8rem;
}

.kpi-empty {
  border: 1px dashed rgba(22, 34, 31, 0.2);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.kpi-empty.is-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
}

.kpi-empty-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b45309;
}

.panel-hint.is-hidden {
  display: none;
}

.apuracao-card .kpi-head {
  justify-content: space-between;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 8;
}

:root[data-theme="dark"] .toast {
  background: rgba(19, 24, 35, 0.98);
  color: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.12);
  box-shadow: 0 16px 30px rgba(5, 6, 10, 0.55);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rca-spin {
  to {
    transform: rotate(360deg);
  }
}

.pwa-prompt {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 20px;
  background: rgba(9, 15, 14, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9;
}

.pwa-prompt.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pwa-card {
  width: min(520px, 94vw);
  background: var(--surface, #fff);
  border-radius: 20px;
  padding: 20px 20px 18px;
  border: 1px solid rgba(22, 34, 31, 0.12);
  box-shadow: var(--shadow, 0 18px 36px rgba(18, 30, 30, 0.18));
  display: grid;
  gap: 12px;
}

.pwa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pwa-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-dark, #043a66);
  font-weight: 700;
  display: block;
}

.pwa-title {
  font-size: 1.1rem;
}

.pwa-text {
  margin: 0;
  color: var(--muted, #5a6a66);
  line-height: 1.5;
}

.pwa-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--muted, #5a6a66);
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

.pwa-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pwa-button {
  background: var(--accent, #05508a);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(5, 80, 138, 0.24);
}

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

.pwa-dismiss {
  background: transparent;
  border: 1px solid rgba(22, 34, 31, 0.2);
  color: var(--ink, #16221f);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.pwa-close {
  border: none;
  background: transparent;
  color: var(--muted, #5a6a66);
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
}

@media (max-width: 960px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding: 48px 20px;
    place-items: center;
    gap: 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: calc(16px + env(safe-area-inset-top)) var(--page-gutter) 8px;
    gap: 14px;
  }

  .profile-trigger {
    width: 100%;
    justify-content: space-between;
  }

  .period-selector {
    width: 100%;
    justify-content: space-between;
  }

  .topbar > * {
    width: 100%;
  }
}

@media (max-width: 640px) {
  :root {
    --page-gutter: 8px;
  }

  .login-panel,
  .login-side {
    width: min(480px, 92vw);
  }

  .login-panel,
  .login-side,
  .panel,
  .hero {
    padding: 16px;
  }

  .profile-menu {
    width: 100%;
    left: 0;
    right: 0;
  }

  .quick-status {
    width: 100%;
  }

  .period-selector {
    width: 100%;
  }

  .dashboard {
    padding: 4px var(--page-gutter) calc(36px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  .panel,
  .hero {
    border-radius: 20px;
  }

  .kpi-section {
    padding: 10px;
  }

  .kpi-card {
    padding: 12px;
  }

  .panel-actions {
    width: 100%;
    align-items: stretch;
  }

  .panel-actions .field,
  .panel-actions .secondary-btn {
    width: 100%;
  }

  .kpi-metrics {
    grid-template-columns: 1fr;
  }

  .profile {
    order: -1;
    width: 100%;
  }

  .brand {
    order: 0;
  }

  .quick-status {
    order: 1;
  }

  .period-selector {
    order: 2;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding: calc(12px + env(safe-area-inset-top)) var(--page-gutter) 6px;
    gap: 10px;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .dashboard {
    padding: 8px var(--page-gutter) calc(40px + env(safe-area-inset-bottom));
  }

  .panel,
  .hero {
    padding: 18px;
    border-radius: 18px;
  }

  .profile-trigger {
    padding: 8px 12px;
    gap: 10px;
  }

  .chip {
    font-size: 0.7rem;
    padding: 6px 12px;
  }
}

.login-body {
  display: grid;
  place-items: center;
  grid-template-rows: 1fr;
  min-height: 100vh;
  overflow: auto;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at 30% 30%, #c7dcf2, transparent 70%);
  top: -140px;
  left: -140px;
}

.orb-b {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle at 30% 30%, #b3efe6, transparent 70%);
  bottom: -180px;
  right: -140px;
}

.orb-c {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle at 60% 40%, #b7d0ec, transparent 70%);
  top: 35%;
  right: 20%;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(420px, 90vw);
  background: var(--surface);
  border-radius: 26px;
  border: 1px solid rgba(22, 34, 31, 0.12);
  padding: 32px;
  box-shadow: var(--shadow);
  display: block;
  grid-template-columns: none;
  gap: 0;
  align-items: stretch;
}

.login-panel {
  display: grid;
  gap: 12px;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  justify-self: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(5, 80, 138, 0.16);
  color: var(--accent-dark);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.login-panel h1 {
  margin: 14px 0 8px;
  font-size: 2.2rem;
}

.login-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .login-shell {
    padding: 24px;
  }

  .login-logo {
    width: 64px;
    height: 64px;
  }

  .login-panel h1 {
    font-size: 1.9rem;
  }
}

:root {
  --ink: #1f2428;
  --ink-soft: #2f3740;
  --muted: #6f7b86;
  --bg: #f6f2ec;
  --bg-2: #e9eef2;
  --accent: #0c3a5d;
  --accent-dark: #07263e;
  --accent-warm: #f0a044;
  --teal: #2f8f7c;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.75);
  --shadow: 0 20px 52px rgba(22, 28, 34, 0.18);
  --shadow-soft: 0 14px 28px rgba(22, 28, 34, 0.12);
  --radius: 22px;
  --page-gutter: clamp(14px, 4vw, 22px);
  --nav-height: 0px;
}

body {
  background: radial-gradient(circle at top, #f7efe5 0%, var(--bg) 50%, var(--bg-2) 100%);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

html,
body {
  max-width: 100%;
}

.rca-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.4), transparent 55%),
    linear-gradient(35deg, rgba(10, 58, 93, 0.08), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.glow {
  opacity: 0.25;
  filter: blur(6px);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow-x: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(14px);
}

@supports (-webkit-touch-callout: none) {
  .app-header {
    backdrop-filter: none;
  }
}

.app-header .topbar {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) var(--page-gutter) 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.app-header .quick-status,
.app-header .theme-row,
.app-header .period-selector {
  grid-column: 1 / -1;
}

.brand {
  gap: 10px;
}

.brand img {
  width: 38px;
  height: 38px;
}

.brand strong {
  font-size: 1rem;
}

.chip {
  background: rgba(240, 160, 68, 0.14);
  color: #b45c1d;
}

.period-selector {
  background: rgba(255, 255, 255, 0.7);
}

.profile-trigger {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 8px 12px;
}

.theme-row {
  display: flex;
  justify-content: flex-start;
}

.theme-toggle {
  border: 1px solid rgba(226, 232, 240, 0.12);
  background: var(--ghost-bg);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(10, 12, 18, 0.2);
}

.theme-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-menu {
  border-radius: 20px;
}

:root[data-theme="dark"] .profile-trigger {
  background: rgba(226, 232, 240, 0.08);
}

:root[data-theme="dark"] .period-selector {
  background: rgba(19, 24, 35, 0.85);
  border-color: rgba(226, 232, 240, 0.12);
}

:root[data-theme="dark"] .kpi-section {
  background: rgba(19, 24, 35, 0.7);
  border-color: rgba(226, 232, 240, 0.1);
}

:root[data-theme="dark"] .kpi-drag-handle {
  background: rgba(19, 24, 35, 0.85);
  border-color: rgba(226, 232, 240, 0.12);
}

:root[data-theme="dark"] .panel-empty {
  border-color: rgba(226, 232, 240, 0.18);
}

:root[data-theme="dark"] .field select {
  background: rgba(19, 24, 35, 0.95);
  border-color: rgba(226, 232, 240, 0.18);
  color: var(--ink);
}

:root[data-theme="dark"] .kpi-grid.is-loading::after {
  background: rgba(12, 16, 22, 0.72);
}

:root[data-theme="dark"] .kpi-loading-message {
  background: rgba(19, 24, 35, 0.9);
}

:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .modal-card,
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .device-guard-card {
  background: rgba(19, 24, 35, 0.92);
  box-shadow: 0 22px 46px rgba(5, 6, 10, 0.55);
}

:root[data-theme="dark"] .profile-menu {
  border-color: rgba(226, 232, 240, 0.12);
}

:root[data-theme="dark"] .menu-item:hover {
  background: rgba(70, 196, 168, 0.14);
}

:root[data-theme="dark"] .secondary-btn {
  border-color: rgba(226, 232, 240, 0.18);
  color: var(--ink);
}

:root[data-theme="dark"] .modal-backdrop {
  background: rgba(6, 8, 12, 0.6);
}

:root[data-theme="dark"] .kpi-card {
  border-color: rgba(226, 232, 240, 0.12);
  box-shadow: 0 12px 24px rgba(5, 6, 10, 0.5);
}

:root[data-theme="dark"] .panel-empty {
  background: rgba(19, 24, 35, 0.6);
}

.dashboard {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 12px var(--page-gutter) calc(20px + env(safe-area-inset-bottom));
  gap: 14px;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  height: calc(100dvh - var(--rca-header-height, 220px));
}

.rca-body.rca-home .dashboard {
  overflow: visible;
}

.app-hero {
  width: 100%;
  display: grid;
  gap: 14px;
  align-items: center;
  background: linear-gradient(140deg, rgba(12, 58, 93, 0.08), rgba(240, 160, 68, 0.14));
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(12, 58, 93, 0.08);
}

.hero-eyebrow {
  display: inline-flex;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-dark);
  font-weight: 700;
}

.app-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 6px 0 0;
}

.panel {
  border-radius: 20px;
  padding: 18px;
}

.panel-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.kpi-section {
  background: rgba(255, 255, 255, 0.86);
  border-radius: 20px;
  padding: 14px;
  touch-action: pan-y;
}

.kpi-section.is-hidden {
  display: none;
}

.kpi-card {
  border-radius: 18px;
  min-height: 140px;
}

.kpi-title {
  font-size: 1.2rem;
}

.kpi-value {
  font-size: 0.98rem;
}


.login-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px var(--page-gutter) calc(24px + env(safe-area-inset-bottom));
}

.login-body {
  display: block;
  min-height: 100vh;
  overflow: auto;
}

.login-card {
  width: min(440px, 92vw);
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.login-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.login-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.login-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-dark);
  font-weight: 700;
}

.login-options {
  display: grid;
  gap: 8px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.checkbox input {
  accent-color: var(--accent);
}

.primary-btn {
  background: var(--accent);
}

.secondary-btn {
  border-radius: 14px;
}

.toast {
  right: 16px;
  bottom: 16px;
}

.device-guard {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top, rgba(12, 58, 93, 0.18), rgba(10, 10, 10, 0.62));
  z-index: 100;
}

.device-guard[hidden] {
  display: none !important;
}

.device-guard-card {
  width: min(520px, 92vw);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 24px;
  padding: 24px;
  display: grid;
  gap: 12px;
  text-align: left;
  box-shadow: var(--shadow);
}

.device-guard-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-dark);
  font-weight: 700;
}

.device-guard-url {
  font-weight: 700;
  color: var(--accent);
  background: rgba(12, 58, 93, 0.08);
  padding: 10px 12px;
  border-radius: 12px;
  word-break: break-all;
}

.device-guard-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.is-guarded .app-shell {
  display: none;
}

@media (min-width: 700px) {
  .app-header .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .app-header .quick-status {
    grid-column: auto;
  }

  .app-header .period-selector {
    grid-column: auto;
  }

  .app-hero {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 420px) {
  :root {
    --page-gutter: 12px;
  }

  .app-hero {
    padding: 16px;
  }
}
