@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Space+Grotesk:wght@600;700&display=swap");

:root {
  --bg-dark: #0b141f;
  --bg-mid: #15334a;
  --bg-soft: #f2f8fc;
  --card: #ffffff;
  --text: #1c2b39;
  --text-muted: #5e7387;
  --line: #e1edf6;
  --brand: #0061a4;
  --brand-deep: #004677;
  --ok: #e6f8ef;
  --warn: #fff4dc;
  --err: #ffeaea;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", "Tahoma", sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(40, 124, 197, 0.25), transparent 38%),
    radial-gradient(circle at 88% 10%, rgba(15, 173, 160, 0.23), transparent 32%),
    linear-gradient(180deg, #edf5fb 0%, #f7fbfe 48%, #eef6fc 100%);
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(10, 30, 48, 0.84);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.topbar-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}


.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: inline-block;
}

.brand-text {
  color: #f2fbff;
  letter-spacing: 0.02em;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-nav > * {
  flex: 0 0 auto;
}

.main-nav a {
  text-decoration: none;
  color: #e9f2f9;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 0.8rem;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.menu-toggle {
  display: none;
  width: auto;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 30, 48, 0.4);
  box-shadow: none;
}

.menu-toggle-label {
  color: #f2fbff;
  font-size: 0.85rem;
  font-weight: 700;
}

.menu-toggle-icon,
.menu-toggle-icon::before,
.menu-toggle-icon::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #f2fbff;
  transition: transform 0.2s ease, opacity 0.2s ease;
  content: "";
}

.menu-toggle-icon {
  position: relative;
}

.menu-toggle-icon::before {
  position: absolute;
  top: -5px;
  left: 0;
}

.menu-toggle-icon::after {
  position: absolute;
  top: 5px;
  left: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::before {
  transform: translateY(5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::after {
  transform: translateY(-5px) rotate(-45deg);
}

.page-main {
  flex: 1;
  padding: 1.05rem 0 2.4rem;
}

.auth-page .page-main {
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 {
  margin: 0 0 0.95rem 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.35rem, 4.7vw, 2rem);
  line-height: 1.08;
}

h2 {
  margin: 0 0 0.8rem 0;
  font-size: clamp(1.02rem, 3.8vw, 1.22rem);
}

p {
  margin-top: 0;
  color: var(--text-muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(0.95rem, 2.7vw, 1.3rem);
  margin-bottom: 0.95rem;
  animation: rise 360ms ease both;
}

.narrow {
  max-width: 620px;
}

.turnstile-field {
  min-height: 4.1rem;
  margin: 1rem 0;
}

.card a {
  color: var(--brand-deep);
  font-weight: 700;
}

.card > a {
  display: inline-flex;
  margin-top: 0.3rem;
  border-radius: 999px;
  background: #eaf4ff;
  border: 1px solid #b9d9f5;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.stat {
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f8fcff;
}

.stat .label {
  margin: 0 0 0.2rem;
  color: #60778b;
  font-size: 0.82rem;
  font-weight: 700;
}

.stat .value {
  margin: 0;
  color: #12314d;
  font-weight: 800;
}


.renegotiation-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.readonly-panel {
  pointer-events: none;
}


.renegotiation-option {
  margin-bottom: 0.8rem;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.inline-checkbox span {
  font-size: 0.93rem;
  color: #355267;
  font-weight: 700;
}

.renegotiation-fields {
  margin-left: 1.4rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.68rem 0.52rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: #486179;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: #19334c;
  font-size: 0.95rem;
}


.loan-id-link {
  color: #0a3f79;
  font-weight: 800;
  text-decoration: underline;
}

.loan-id-link:hover {
  color: #072f5b;
}

form p {
  margin: 0 0 0.7rem 0;
}

form ul.errorlist {
  margin: 0 0 0.55rem;
  padding: 0.6rem 0.8rem 0.6rem 1.4rem;
  border-radius: 10px;
  border: 1px solid #f2b8b8;
  background: #fff2f2;
  color: #8b2020;
  font-size: 0.92rem;
}

form .helptext {
  display: block;
  margin-top: 0.24rem;
  color: #668197;
  font-size: 0.8rem;
}

label {
  display: block;
  margin: 0 0 0.3rem;
  color: #355267;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #c6d6e5;
  font-size: 1rem;
  font-family: "Manrope", "Segoe UI", "Tahoma", sans-serif;
}

input,
select,
textarea {
  min-height: 50px;
  padding: 0.72rem 0.82rem;
  background: #fff;
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  min-height: auto;
  padding: 0;
  border-radius: 0;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

button {
  min-height: 52px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(130deg, #0a72cf, #14a796);
  box-shadow: 0 12px 24px rgba(10, 114, 207, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

button:active {
  transform: translateY(0);
}


.chart-wrapper {
  position: relative;
  margin-top: 0.8rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fcff;
}

.chart-wrapper canvas {
  width: 100%;
  height: auto;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 8px));
  transition: opacity 0.15s ease;
  background: #12314d;
  color: #fff;
  font-size: 0.82rem;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  max-width: min(280px, calc(100% - 1rem));
  white-space: nowrap;
  z-index: 3;
}

.chart-tooltip.visible {
  opacity: 1;
}

.pix-copy-wrapper {
  display: grid;
  gap: 0.7rem;
}

.pix-copy-wrapper.centered {
  justify-items: center;
  text-align: center;
}

.pix-copy-code {
  margin: 0;
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  border: 1px solid #c6d6e5;
  background: #fff;
  color: #19334c;
  word-break: break-all;
}

.pix-copy-button {
  width: auto;
  justify-self: start;
  padding: 0.7rem 1rem;
  min-height: 44px;
}

.pix-copy-wrapper.centered .pix-copy-button {
  justify-self: center;
  margin-top: 0.9rem;
}

.pix-qrcode {
  display: block;
  margin-top: 0.4rem;
}

.expandable-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  color: #12314d;
  margin-bottom: 0.8rem;
}

.expandable-card summary::-webkit-details-marker {
  display: none;
}

.expand-arrow {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.expandable-card[open] .expand-arrow {
  transform: rotate(180deg);
}

.inline-form {
  margin: 0;
}

.inline-form button {
  width: auto;
  min-height: 38px;
  padding: 0.5rem 0.85rem;
  margin: 0;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
}


.table-actions {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.table-actions a {
  color: #d9ecff;
  font-weight: 700;
  text-decoration: underline;
}

.table-actions a:hover {
  color: #ffffff;
}

.inline-form-danger {
  display: grid;
  gap: 0.42rem;
  min-width: 240px;
}

.inline-form-danger label {
  margin: 0;
  font-size: 0.78rem;
}

.inline-form-danger input {
  min-height: 38px;
  padding: 0.45rem 0.62rem;
  font-size: 0.88rem;
}

.inline-form-danger .danger-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid #f3b5b5;
  color: #8d1f1f;
  background: #fff1f1;
  box-shadow: none;
}

.inline-form-danger .danger-button:hover {
  background: #ffe7e7;
  filter: none;
}

.messages {
  margin-bottom: 0.9rem;
}

.message {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.55rem;
  font-weight: 600;
}

.message.success {
  background: var(--ok);
}

.message.warning {
  background: var(--warn);
}

.message.error {
  background: var(--err);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-pill-ok {
  background: var(--ok);
  border-color: #a8dfbf;
  color: #135b35;
}

.status-pill-warn {
  background: var(--warn);
  border-color: #f2ca7f;
  color: #7b5616;
}

.status-pill-muted {
  background: #edf2f7;
  border-color: #cbd8e4;
  color: #516274;
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 860px) {
  .topbar {
    z-index: 100;
  }

  .topbar-inner {
    padding: 0.5rem 0;
    min-height: 64px;
    align-items: center;
    display: flex;
    justify-content: space-between;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: #f0f4f8;
    border: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    box-shadow: none;
    min-height: auto;
  }

  .menu-toggle:hover {
    background: #e1edf6;
    transform: none;
  }

  .menu-toggle span {
    font-size: 24px;
    color: var(--text);
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.25rem 1.25rem;
    gap: 0.5rem;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .main-nav.main-nav-open {
    display: flex;
    transform: translateX(0);
  }

  .main-nav a,
  .main-nav .inline-form button {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text) !important;
    border: 1px solid transparent;
    background: transparent;
  }

  .main-nav a span,
  .main-nav .inline-form button span {
    font-size: 20px;
    color: var(--text-muted);
  }

  .main-nav a:hover,
  .main-nav .inline-form button:hover {
    background: #f0f4f8;
    color: var(--brand) !important;
  }

  .main-nav a:hover span,
  .main-nav .inline-form button:hover span {
    color: var(--brand);
  }

  .main-nav .inline-form button {
    width: 100%;
    justify-content: flex-start;
    min-height: auto;
    font-weight: 700;
    box-shadow: none;
    padding: 0.8rem 1rem;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(900px, 94vw);
  }

  .card {
    border-radius: 16px;
    padding: 0.85rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    margin-bottom: 0.65rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.3rem 0.45rem;
    background: #fbfdff;
  }

  .responsive-table td {
    border-bottom: 0;
    padding: 0.36rem 0.2rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: #567087;
    font-weight: 800;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 0 0 42%;
  }

  .responsive-table td[data-label="Ações"],
  .responsive-table td[data-label="Data"] {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .responsive-table td[data-label="Ações"]::before,
  .responsive-table td[data-label="Data"]::before {
    flex: 1 0 auto;
    margin-bottom: 0.25rem;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-pill-ok {
  background: var(--ok);
  border-color: #a8dfbf;
  color: #135b35;
}

.status-pill-warn {
  background: var(--warn);
  border-color: #f2ca7f;
  color: #7b5616;
}

.status-pill-muted {
  background: #edf2f7;
  border-color: #cbd8e4;
  color: #516274;
}

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

/* --- Material Design 3 Utilities & Styles --- */

body {
  font-family: "Roboto", "Segoe UI", sans-serif !important;
}

/* Material Header & Topbar adjustments */
.md-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.md-header-container h1 {
  margin: 0;
}

/* Material Buttons */
.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  border: none;
  min-height: 48px;
}

.md-btn-primary {
  background: var(--brand-deep);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.md-btn-primary:hover {
  background: #00375f;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.md-btn-secondary {
  background: #eaf4ff;
  color: var(--brand-deep);
  border: 1px solid #b9d9f5;
}

.md-btn-secondary:hover {
  background: #d8ecff;
  transform: translateY(-1px);
}

.md-btn-small {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  background: #eaf4ff;
  color: var(--brand-deep);
  border: 1px solid #b9d9f5;
  transition: background 0.15s ease;
}

.md-btn-small:hover {
  background: #d8ecff;
}

/* Metric Cards Grid */
.md-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.md-metric-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.15rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.md-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(7, 27, 46, 0.07);
}

.card-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon-wrapper span {
  font-size: 24px;
}

/* Color palettes for indicators */
.color-primary {
  background: rgba(0, 97, 164, 0.08);
  color: #0061a4;
}

.color-success {
  background: rgba(19, 91, 53, 0.08);
  color: #135b35;
}

.color-warning {
  background: rgba(123, 86, 22, 0.08);
  color: #7b5616;
}

.color-error {
  background: rgba(186, 26, 26, 0.08);
  color: #ba1a1a;
}

.color-info {
  background: rgba(0, 150, 180, 0.08);
  color: #008099;
}

.font-weight-bold {
  font-weight: 700;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-info .label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-info .value {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

/* Double column layout */
.md-two-column-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .md-two-column-layout {
    grid-template-columns: 1.2fr 1fr;
  }
}

.md-card-full {
  margin-bottom: 0 !important;
}

.card-header-with-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.card-header-with-badge h2 {
  margin: 0;
  display: flex;
  align-items: center;
}

.header-icon {
  margin-right: 0.5rem;
  font-size: 1.4rem;
}

/* Overdue debts details */
.row-highlight-error {
  background-color: rgba(255, 234, 234, 0.25);
}

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

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

/* Modernized Tables */
table {
  border-spacing: 0;
}

th {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 0.85rem 0.6rem;
  border-bottom: 2px solid var(--line);
}

td {
  padding: 0.95rem 0.6rem;
}

tr:hover td {
  background-color: rgba(0, 97, 164, 0.02);
}

/* Navigation Material Revamp */
.topbar {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--line);
}

.brand-text {
  color: var(--text);
}

.main-nav a {
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  padding: 0.45rem 1rem;
}

.main-nav a:hover {
  background: #f0f4f8;
  color: var(--brand);
}

.main-nav .inline-form button {
  color: var(--text-muted);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  background: transparent;
  font-weight: 700;
  padding: 0.45rem 1rem;
  min-height: auto;
  box-shadow: none;
}

.main-nav .inline-form button:hover {
  background: #fff2f2;
  color: #d32f2f;
  transform: none;
}

/* Forms Outlined Fields */
input, select, textarea {
  border: 1px solid #b9ccd9;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  padding: 0.75rem 1.05rem;
  border-radius: 8px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 97, 164, 0.15);
}
