:root {
  --color-primary: #002060;
  --color-background: #f8f9fa;
  --color-success: #28a745;
  --color-text: #1f2a37;
  --color-muted: #6b7280;
  --color-card: #ffffff;
  --shadow-soft: 0 10px 30px rgba(0, 32, 96, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Source Sans 3", sans-serif;
  background: radial-gradient(circle at top, rgba(0, 32, 96, 0.08), transparent 60%),
    linear-gradient(135deg, #eef2ff 0%, #f8f9fa 55%, #ffffff 100%);
  color: var(--color-text);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

.layout-auth .content-header {
  display: block; /* Restore visibility */
}

.layout-auth .content-header p,
.layout-auth .content-header h1 {
  color: #fff !important;
  text-align: left;
}

.layout-auth .content-header {
  position: absolute;
  top: 1.5rem;
  left: 2rem;
  text-align: left;
  margin: 0;
  width: auto;
}

.layout-auth .sidebar,
.layout-auth .sidebar-nav,
.layout-auth .logout-form,
.layout-auth .content-header .user-chip {
  display: none;
}



.app-shell {
  display: flex;
  min-height: 100vh;
}

.layout-auth .app-shell {
  display: block;
}

.sidebar {
  background: var(--color-primary);
  color: #fff;
  padding: 2rem 1.5rem;
  width: 280px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 10px 0 30px rgba(0, 32, 96, 0.25);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-user__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: block;
  background-image: url('../img/avatar.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.sidebar-user__label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 2.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  color: #e3e8ff;
  text-decoration: none;
  transition: background 0.2s ease;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.15);
}

.logout-form {
  margin-top: 1rem;
}

.content-area {
  background: var(--color-background);
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 280px;
  width: calc(100% - 280px);
}

.layout-auth .content-area {
  margin-left: 0;
  width: 100%;
  background: transparent;
  padding: 1rem;
  overflow: hidden; 
  display: flex;
  flex-direction: column;
}

.layout-auth .content-scroll {
  overflow: hidden; /* Remove internal scroll if content fits */
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.subtitle {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 3rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--color-card);
  border-radius: 1.25rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card--wide {
  width: min(100%, 960px);
  margin: 0 auto;
}

.card--accent {
  border: 1px solid rgba(0, 32, 96, 0.08);
  background: linear-gradient(145deg, #ffffff 0%, #f9fbff 60%, #ffffff 100%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header .eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--color-muted);
  letter-spacing: 0.08em;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 600;
}

.span-2 {
  grid-column: span 2;
}

.form-intro {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-intro p {
  color: var(--color-muted);
  max-width: 720px;
}

.form-section {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-block: 0.5rem 1.25rem;
  border-top: 1px solid #eef1f6;
}

.form-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.form-section h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select {
  border: 1px solid #d0d7e6;
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: #fff;
  transition: border 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  appearance: none;
  width: 100%;
}

.select-wrapper i {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.sector-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sector-input-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 0.75rem;
  align-items: center;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d0d7e6;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.checkbox-chip input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
}

.sector-count-input.is-disabled {
  background: #f4f6fb;
  color: #9aa3b2;
}

.btn {
  border: none;
  border-radius: 0.85rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background: var(--color-success);
  color: #fff;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.5rem;
  text-align: left;
}

.data-table thead th {
  background: #f1f4ff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.data-table tbody tr:nth-child(even) {
  background: #f9fbff;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 1.5rem 0;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.pagination button {
  background: #fff;
  border: 1px solid #d0d7e6;
  border-radius: 0.6rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

.pagination button.is-active {
  background: var(--color-primary);
  color: #fff;
}

.report-card {
  border: 1px solid #e1e5f0;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: inline-flex;
  gap: 1rem;
  align-items: center;
  background: #fdfdff;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
  min-width: 260px;
  max-width: 420px;
}
.report-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
}

.overview-main,
.overview-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.kpi-card {
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(0, 32, 96, 0.08), rgba(0, 32, 96, 0.02));
  border: 1px solid rgba(0, 32, 96, 0.05);
}

.kpi-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--color-muted);
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
}

.chart-panel {
  min-height: 360px;
}

.chart-panel canvas {
  width: 100% !important;
  height: 320px !important;
}

.trend-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eef1f6;
}

.trend-item:last-child {
  border-bottom: none;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0, 32, 96, 0.1);
  color: var(--color-primary);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recent-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eef1f6;
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-item strong {
  display: block;
  font-size: 1rem;
}

.recent-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.sector-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sector-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #e3e8f6;
}

.sector-row:last-child {
  border-bottom: none;
}

.content-card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.form-feedback {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.form-feedback--error {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.form-feedback--info {
  background: rgba(0, 32, 96, 0.12);
  color: var(--color-primary);
}

.report-card {
  border: 1px solid #e1e5f0;
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  background: #fdfdff;
  cursor: pointer;
  transition: border 0.2s ease;
}

.report-card:hover {
  border-color: var(--color-primary);
}

.screen-spinner {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  color: #fff;
  font-weight: 600;
  z-index: 999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.screen-spinner.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.auth-wrapper {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  text-align: center;
  /* Removed max-width here to let flexbox handle it in split layout */
}

/* Auth Page Custom Styles */
body.layout-auth {
  background-color: var(--color-primary) !important;
  background-image: none !important;
}

.auth-wrapper {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* Removido padding que poderia causar scroll */
  overflow: hidden;
}

body.layout-auth {
  background-color: var(--color-primary) !important;
  background-image: none !important;
  height: 100%; /* corrigido para 100% ou 100vh */
  margin: 0;
  overflow: hidden; /* Garante sem scroll */
}

.login-split {
  display: flex;
  width: 100%;
  max-width: 1200px; /* Aumentado para dar mais largura à caixa de login */
  align-items: stretch;
  gap: 3rem; /* Aumentado o gap */
}

.login-logo-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* Push logo near the card */
  padding-right: 2rem;
}

.login-card {
  flex: 1;
  /* Override previous definitions */
  margin: 0;
  max-width: none; 
}

.login-logo-side img {
  width: 100%;
  max-width: 320px; /* Adjust to match login card size roughly */
  height: auto;
}

.glass-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  padding: 3rem;
  color: #fff;
}

.glass-card h2 {
  color: #fff;
  margin-bottom: 0.5rem;
}

.glass-card p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
}

.glass-card .form-group label {
  color: #fff;
  text-align: left;
  display: block;
}

.glass-card .input-icon {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-card .input-icon i {
  color: rgba(255, 255, 255, 0.8);
}

.glass-card input {
  color: #fff !important; /* Força cor branca */
  background: transparent;
}

.glass-card .form-feedback--info {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-card .form-feedback--error {
  background: rgba(220, 53, 69, 0.2);
  color: #ffcccc;
  border: 1px solid rgba(220, 53, 69, 0.4);
}

.glass-card .btn-primary {
  background: #ffffff;
  color: #000000;
  margin-top: 1.5rem;
  border: none;
  font-weight: 700;
  display: block;
  width: 100%;
}

.glass-card .btn-primary:hover {
  background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 768px) {
  .login-split {
    flex-direction: column;
    max-width: 420px;
  }
  
  .login-logo-side {
    margin-bottom: 2rem;
  }
  
  .login-logo-side img {
    max-height: 80px;
  }
}


.attachment-list {
  display: flex;
  align-items: center;
}

.attachment-pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 32, 96, 0.12);
  color: var(--color-primary);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(0, 32, 96, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background-image: url('../img/anexo.png');
  background-size: 60%;
  background-position: center;
  background-repeat: no-repeat;
}

.attachment-pill:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(0, 32, 96, 0.2);
}

.table-actions {
  display: flex;
  gap: 0.4rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  z-index: 1000;
}

.modal.is-open {
  display: flex;
}

.modal__dialog {
  background: #fff;
  border-radius: 1.25rem;
  width: min(560px, 100%);
  box-shadow: var(--shadow-soft);
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem 0.75rem;
}

.modal__body {
  padding: 0 1.5rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.modal__footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.modal__body [data-edit-sector-group] {
  grid-column: 1 / -1;
}

.input-icon {
  display: flex;
  align-items: center;
  border: 1px solid #d0d7e6;
  border-radius: 0.75rem;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
}

.input-icon input {
  border: none;
  flex: 1;
  padding: 0.35rem 0;
}

.input-icon input:focus {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: 100%;
    box-shadow: none;
  }

  .content-area {
    margin-left: 0;
    width: 100%;
    padding: 1.5rem;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .overview-layout {
    grid-template-columns: 1fr;
  }

  .sector-input-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .span-2 {
    grid-column: span 1;
  }
}
