:root {
  --navy: #0e2340;
  --navy-deep: #09182d;
  --navy-elevated: #163250;
  --navy-mid: #1c3d5c;
  --gold: #b69659;
  --gold-light: #d4b87a;
  --gold-deep: #9a7a42;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --border: rgba(182, 150, 89, 0.28);
  --font: "Montserrat", "Segoe UI", sans-serif;
}

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

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--white);
  background: var(--navy);
  -webkit-font-smoothing: antialiased;
}

.app-body {
  isolation: isolate;
  background: var(--navy-deep);
}

.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(182, 150, 89, 0.08), transparent 55%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}

/* ——— Login ——— */

.login-body {
  overflow-x: hidden;
}

.login {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2.5rem 1.25rem;
  isolation: isolate;
}

.login__atmosphere {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(28, 61, 92, 0.85), transparent 60%),
    radial-gradient(ellipse 70% 45% at 80% 100%, rgba(182, 150, 89, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 10% 80%, rgba(14, 45, 75, 0.45), transparent 45%),
    linear-gradient(165deg, #0e2340 0%, var(--navy-deep) 48%, #06101f 100%);
}

.login__glow {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0;
  animation: login-glow-in 1.4s ease 0.2s forwards;
}

.login__glow--top {
  top: -8%;
  left: 50%;
  width: min(70vw, 520px);
  height: min(40vw, 280px);
  transform: translateX(-50%);
  background: rgba(182, 150, 89, 0.14);
}

.login__glow--bottom {
  bottom: -12%;
  right: -5%;
  width: min(55vw, 420px);
  height: min(40vw, 320px);
  background: rgba(26, 70, 110, 0.35);
  animation-delay: 0.45s;
}

.login__panel {
  width: min(100%, 400px);
  text-align: center;
  animation: login-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login__brand {
  position: relative;
  margin-bottom: 1.75rem;
}

.login__brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: min(78vw, 300px);
  height: min(78vw, 300px);
  transform: translate(-50%, -52%);
  background: radial-gradient(circle, var(--navy) 55%, transparent 72%);
  pointer-events: none;
}

.login__logo {
  display: block;
  width: min(72vw, 260px);
  height: auto;
  margin: 0 auto -0.5rem;
  object-fit: contain;
  filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.35));
  animation: login-logo 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login__tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  animation: login-fade 1s ease 0.35s both;
}

.login__alert,
.login__notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 0.875rem;
  line-height: 1.4;
  animation: login-fade 0.45s ease both;
}

.login__alert {
  color: #f5d0d0;
  background: rgba(140, 40, 40, 0.28);
  border: 1px solid rgba(220, 120, 120, 0.35);
}

.login__notice {
  color: #dde8d4;
  background: rgba(60, 100, 50, 0.28);
  border: 1px solid rgba(140, 180, 120, 0.35);
}

.login__form {
  display: grid;
  gap: 1.25rem;
  text-align: left;
  animation: login-fade 1s ease 0.5s both;
}

.login__field {
  display: grid;
  gap: 0.5rem;
}

.login__label {
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.login__input {
  width: 100%;
  padding: 0.9rem 0;
  color: var(--white);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.login__input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.login__input:hover {
  border-bottom-color: rgba(182, 150, 89, 0.45);
}

.login__input:focus {
  border-bottom-color: var(--gold);
  box-shadow: 0 1px 0 0 var(--gold);
}

.login__submit {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  color: var(--navy-deep);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  border: none;
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 10px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.login__submit:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 14px 32px rgba(0, 0, 0, 0.35);
}

.login__submit:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.login__footer {
  margin-top: 2.5rem;
  animation: login-fade 1s ease 0.7s both;
}

.login__rule {
  display: block;
  width: 4.5rem;
  height: 1px;
  margin: 0 auto 1rem;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.login__footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

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

@keyframes login-logo {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes login-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes login-glow-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .login__panel,
  .login__logo,
  .login__tagline,
  .login__form,
  .login__footer,
  .login__glow {
    animation: none;
    opacity: 1;
  }

  .login__submit:hover {
    transform: none;
  }
}

/* ——— App chrome ——— */

.app-header {
  border-bottom: 1px solid var(--border);
  background: rgba(9, 24, 45, 0.55);
  backdrop-filter: blur(12px);
}

/* The nav sits on its own row: with the accounts payable links it no longer
   fits beside the brand inside the 1280px header. */
.app-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  width: min(100% - 2rem, 1280px);
  margin: 0 auto;
  padding: 0.9rem 0;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.app-header__logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.app-header__eyebrow {
  margin: 0 0 0.15rem;
  color: var(--gold);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.app-header__user {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  order: 3;
  width: 100%;
}

.app-nav__link {
  padding: 0.45rem 0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  transition: color 0.2s ease, background 0.2s ease;
}

.app-nav__link:hover,
.app-nav__link.is-active {
  color: var(--gold-light);
  background: rgba(182, 150, 89, 0.1);
}

.app-header__logout {
  margin-left: auto;
  padding: 0.5rem 0.9rem;
  color: var(--gold-light);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.app-header__logout:hover {
  background: rgba(182, 150, 89, 0.1);
  border-color: var(--gold);
}

/* Active account (empresa) and admin links, beside the logout button. */
.app-header__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.app-header__tools .app-header__logout {
  margin-left: 0;
}

.account-switcher {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  margin-right: 0.5rem;
}

.account-switcher__label {
  color: var(--gold);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.account-switcher__name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16rem;
}

.account-switcher__select {
  max-width: 16rem;
  padding: 0.3rem 1.6rem 0.3rem 0.55rem;
  color: var(--white);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-color: rgba(9, 24, 45, 0.6);
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.account-switcher__select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.account-switcher__select option {
  color: var(--navy-deep);
}

.app-header__tool {
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  transition: color 0.2s ease, background 0.2s ease;
}

.app-header__tool:hover,
.app-header__tool.is-active {
  color: var(--gold-light);
  background: rgba(182, 150, 89, 0.1);
}

/* ——— Users and accounts administration ——— */

.table-wrap--scroll {
  position: relative;
  overflow-x: auto;
}

.page__lede + .table-wrap {
  margin-top: 1.25rem;
}

.form-grid--spaced {
  margin-top: 1.5rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.6rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.role-pill--admin {
  color: var(--gold-light);
  background: rgba(182, 150, 89, 0.12);
  border-color: rgba(182, 150, 89, 0.28);
}

.role-pill--owner {
  color: var(--navy-deep);
  background: var(--gold);
  border-color: var(--gold);
}

.role-pill--system {
  margin-left: 0.4rem;
  color: #d6e2f0;
  background: rgba(80, 120, 170, 0.22);
  border-color: rgba(140, 175, 215, 0.35);
}

/* ——— Page ——— */

.page {
  width: min(100% - 2rem, 1080px);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.page--narrow {
  width: min(100% - 2rem, 760px);
}

.page--wide {
  width: min(100% - 2rem, 1280px);
}

.page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page__header h1,
.page__intro h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.page__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.page__lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.page__intro {
  margin-bottom: 2rem;
}

.page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.flash-region {
  width: min(100% - 2rem, 1080px);
  margin: 1.25rem auto 0;
}

.flash {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-radius: 2px;
}

.flash--notice {
  color: #dde8d4;
  background: rgba(60, 100, 50, 0.28);
  border: 1px solid rgba(140, 180, 120, 0.35);
}

.flash--alert {
  color: #f5d0d0;
  background: rgba(140, 40, 40, 0.28);
  border: 1px solid rgba(220, 120, 120, 0.35);
}

/* ——— Buttons ——— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn--primary {
  color: var(--navy-deep);
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.btn--primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn--ghost {
  color: var(--gold-light);
  background: transparent;
  border-color: var(--border);
}

.btn--ghost:hover {
  background: rgba(182, 150, 89, 0.1);
  border-color: var(--gold);
}

.btn--tiny {
  padding: 0.35rem 0.65rem;
  color: var(--gold-light);
  font-size: 0.62rem;
  background: transparent;
  border-color: var(--border);
}

.btn--tiny:hover {
  background: rgba(182, 150, 89, 0.1);
  border-color: var(--gold);
}

/* ——— Home modules ——— */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.module-card {
  display: block;
  padding: 1.4rem 1.35rem 1.5rem;
  color: inherit;
  text-decoration: none;
  background: rgba(22, 50, 80, 0.45);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(22, 50, 80, 0.7);
}

.module-card__eyebrow {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.module-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.2rem;
  font-weight: 500;
}

.module-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ——— Highlights ——— */

.highlight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.highlight-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(22, 50, 80, 0.45);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.highlight-card--wide {
  grid-column: 1 / -1;
}

.highlight-card__header {
  padding: 1.1rem 1.15rem 0.85rem;
}

.highlight-card__header h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.highlight-card__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.highlight-card .table-wrap--flush {
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.data-table--compact th,
.data-table--compact td {
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
}

.data-table--compact th {
  font-size: 0.6rem;
}

.data-table__num {
  text-align: right;
  white-space: nowrap;
}

.highlight-card__footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.7rem 1.05rem 0.85rem;
  margin-top: auto;
  border-top: 1px solid rgba(182, 150, 89, 0.12);
}

.highlight-card__more {
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.highlight-card__more:hover {
  color: var(--gold);
}

.highlight-card__more span {
  margin-left: 0.25rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 500;
}

/* ——— Search / table ——— */

.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-bar__input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 0;
  color: var(--white);
  font: inherit;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  outline: none;
}

.search-bar__input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.search-bar__input:focus {
  border-bottom-color: var(--gold);
  box-shadow: 0 1px 0 0 var(--gold);
}

.table-wrap {
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--gold-light);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(9, 24, 45, 0.45);
  border-bottom: 1px solid var(--border);
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.sort-link:hover,
.sort-link--active {
  color: var(--white);
}

.sort-link::after {
  content: "▲";
  font-size: 0.85em;
  opacity: 0;
}

.sort-link--desc::after {
  content: "▼";
}

.sort-link:hover::after,
.sort-link:focus-visible::after {
  opacity: 0.45;
}

.sort-link--active::after {
  opacity: 1;
}

.data-table td {
  border-top: 1px solid rgba(182, 150, 89, 0.12);
}

.data-table tbody tr:hover td {
  background: rgba(182, 150, 89, 0.05);
}

.data-table__row {
  cursor: pointer;
}

.data-table__link {
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
}

.data-table__link:hover {
  color: var(--gold-light);
}

.data-table__mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.data-table__empty {
  color: var(--muted);
  text-align: center;
}

.data-table__actions {
  text-align: right;
  white-space: nowrap;
}

.data-table__sub {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.summary-tile {
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(22, 50, 80, 0.45);
}

.summary-tile__label {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.summary-tile__value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.summary-tile__hint {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-tile--alert {
  border-color: rgba(220, 120, 120, 0.45);
}

.summary-tile--alert .summary-tile__value {
  color: #f5d0d0;
}

.paid-on-create__fields {
  margin-top: 1rem;
}

.data-table__action-group {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.table-wrap--spaced,
.empty-state--spaced {
  margin-top: 1.5rem;
}

.empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.contacts-hint {
  position: relative;
  display: inline-flex;
  cursor: default;
}

.contacts-hint__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.15rem 0.45rem;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.3;
  background: rgba(182, 150, 89, 0.12);
  border: 1px dashed rgba(182, 150, 89, 0.45);
  border-radius: 999px;
  cursor: default;
}

.contacts-hint__empty {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.contacts-hint__popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 20;
  min-width: 16rem;
  max-width: 22rem;
  padding: 0.85rem 0.95rem;
  color: var(--white);
  background: var(--navy-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.contacts-hint__popover::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0.5rem;
}

.contacts-hint:hover .contacts-hint__popover,
.contacts-hint:focus-within .contacts-hint__popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.contacts-hint__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.contacts-hint__item + .contacts-hint__item {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(182, 150, 89, 0.16);
}

.contacts-hint__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.contacts-hint__row + .contacts-hint__row {
  margin-top: 0.2rem;
}

.contacts-hint__name,
.contacts-hint__meta {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.contacts-hint__name {
  font-size: 0.9rem;
  font-weight: 500;
}

.contacts-hint__meta {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  word-break: break-word;
}

.copy-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 2px;
  opacity: 0.5;
  cursor: pointer;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  color: var(--gold-light);
  opacity: 1;
  outline: none;
}

.copy-btn__icon {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
}

.copy-btn__icon--done {
  display: none;
}

.copy-btn.is-copied {
  color: var(--gold-light);
  opacity: 1;
}

.copy-btn.is-copied .copy-btn__icon--copy {
  display: none;
}

.copy-btn.is-copied .copy-btn__icon--done {
  display: block;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 4px;
}

.empty-state h2 {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  font-weight: 500;
}

.empty-state p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

/* ——— Form ——— */

.form-card {
  padding: 1.75rem 1.5rem 1.5rem;
  background: rgba(22, 50, 80, 0.45);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem 1.5rem;
}

.field--wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  align-content: start;
  gap: 0.45rem;
}

.field__label {
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.field__input {
  width: 100%;
  padding: 0.75rem 0;
  color: var(--white);
  font: inherit;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  outline: none;
  color-scheme: dark;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.field__input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.field__input:hover {
  border-bottom-color: rgba(182, 150, 89, 0.45);
}

.field__input:focus {
  border-bottom-color: var(--gold);
  box-shadow: 0 1px 0 0 var(--gold);
}

.field__hint {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.78rem;
  margin: 0;
}

.field__input--select {
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 6px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 1.5rem;
}

.field__input--select option {
  color: var(--navy-deep);
}

.form-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(182, 150, 89, 0.16);
}

.form-section__header h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.form-section__header p {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.form-section__status {
  margin: -0.35rem 0 1.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.form-section__status.is-error {
  color: #f5d0d0;
}

.form-section__header--nested {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin: 1.5rem 0 1rem;
}

.form-section__header--nested h3 {
  margin: 0;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox-field__input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
  cursor: pointer;
}

.checkbox-field:hover {
  color: var(--white);
}

.contact-fields-list {
  display: grid;
  gap: 1rem;
}

.contact-fields {
  padding: 1rem 1rem 1.15rem;
  background: rgba(9, 24, 45, 0.28);
  border: 1px solid rgba(182, 150, 89, 0.16);
  border-radius: 4px;
}

.contact-fields__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.contact-fields__header h3 {
  margin: 0;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.form-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.form-errors {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  color: #f5d0d0;
  background: rgba(140, 40, 40, 0.28);
  border: 1px solid rgba(220, 120, 120, 0.35);
  border-radius: 2px;
}

.form-errors p {
  margin: 0 0 0.4rem;
  font-weight: 500;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.form-errors li + li {
  margin-top: 0.2rem;
}

.form-warning {
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  color: #f3e3bf;
  background: rgba(150, 110, 30, 0.28);
  border: 1px solid rgba(220, 180, 100, 0.4);
  border-radius: 2px;
}

turbo-frame#invoice_duplicates {
  display: block;
}

.form-warning[hidden] {
  display: none;
}

.form-warning p {
  margin: 0;
}

.form-warning p:first-child {
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.allocation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.allocation-header__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.allocation-filter {
  margin-bottom: 1.15rem;
}

.allocation-empty {
  margin: 0;
  padding: 1.35rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 4px;
}

.allocation-board {
  display: grid;
  gap: 0.75rem;
}

.allocation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.5rem;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  background: rgba(9, 24, 45, 0.28);
  border: 1px solid rgba(182, 150, 89, 0.16);
  border-radius: 4px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.allocation-row.is-allocated {
  border-color: rgba(182, 150, 89, 0.55);
  background: rgba(182, 150, 89, 0.1);
}

.allocation-row__eyebrow {
  margin: 0 0 0.3rem;
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.allocation-row__title {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 500;
}

.allocation-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.allocation-row__meta span {
  white-space: nowrap;
}

.allocation-row__balance {
  padding: 0;
  color: var(--gold-light);
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(182, 150, 89, 0.45);
  border-radius: 0;
  white-space: nowrap;
}

.allocation-row__balance:hover,
.allocation-row__balance:focus-visible {
  color: var(--gold);
  border-bottom-color: var(--gold);
  outline: none;
}

.allocation-row__amount .field__input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.allocation-balance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.15rem;
  padding: 1rem 1.15rem;
  border: 1px dashed var(--border);
  border-radius: 4px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.allocation-balance.is-balanced {
  border-style: solid;
  border-color: rgba(140, 180, 120, 0.45);
  background: rgba(60, 100, 50, 0.18);
}

.allocation-balance.is-unbalanced {
  border-style: solid;
  border-color: rgba(220, 120, 120, 0.35);
  background: rgba(140, 40, 40, 0.16);
}

.allocation-balance__label {
  margin: 0 0 0.3rem;
  color: var(--gold-light);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.allocation-balance__value {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
}

.allocation-balance__value[data-direction="short"] {
  color: var(--gold-light);
}

.allocation-balance__value[data-direction="over"] {
  color: #f5d0d0;
}

.allocation-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.allocation-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.allocation-list__item + .allocation-list__item {
  padding-top: 1rem;
  border-top: 1px solid rgba(182, 150, 89, 0.16);
}

.allocation-list__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.allocation-list__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 500;
}

.allocation-list__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.allocation-list__amount {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
}

.invoice-payments__alert {
  margin-top: 1rem;
}

.invoice-payments__alert + .invoice-payments {
  margin-top: 0.5rem;
}

.invoice-payments__alert-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.invoice-payments__alert-list {
  margin: 0;
  padding-left: 1.1rem;
}

.invoice-payments__alert a {
  color: inherit;
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  padding: 0.22rem 0.6rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-pill--pending,
.status-pill--open {
  color: var(--gold-light);
  background: rgba(182, 150, 89, 0.12);
  border-color: rgba(182, 150, 89, 0.28);
}

.status-pill--completed,
.status-pill--paid {
  color: #dde8d4;
  background: rgba(60, 100, 50, 0.28);
  border-color: rgba(140, 180, 120, 0.35);
}

.status-pill--partial {
  color: #cfe0f2;
  background: rgba(40, 90, 140, 0.3);
  border-color: rgba(120, 170, 220, 0.35);
}

.status-pill--canceled,
.status-pill--overdue {
  color: #f5d0d0;
  background: rgba(140, 40, 40, 0.28);
  border-color: rgba(220, 120, 120, 0.35);
}

.nature-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 3px;
}

.nature-tag--cost {
  color: #cfe0f2;
  background: rgba(40, 90, 140, 0.3);
}

.nature-tag--expense {
  color: var(--gold-light);
  background: rgba(182, 150, 89, 0.12);
}

.expense-group__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.expense-group .detail-card__header .data-table__action-group {
  flex-shrink: 0;
}

.expense-groups__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.expense-groups__footer p {
  margin: 0;
}

/* ——— Detail ——— */

.detail-card {
  padding: 1.5rem;
  background: rgba(22, 50, 80, 0.45);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.detail-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
  margin: 0;
}

.detail-list dt {
  margin: 0 0 0.3rem;
  color: var(--gold-light);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  font-size: 1rem;
}

.detail-card--spaced {
  margin-top: 1rem;
}

.detail-card__title {
  margin: 0 0 1.15rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.detail-card__empty {
  margin: 0;
  color: var(--muted);
}

.proposal-content {
  font-size: 0.95rem;
  line-height: 1.6;
}

.proposal-content p {
  margin: 0 0 1rem;
}

.proposal-content p:last-child {
  margin-bottom: 0;
}

.contact-list {
  display: grid;
  gap: 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list__item + .contact-list__item {
  padding-top: 1.15rem;
  border-top: 1px solid rgba(182, 150, 89, 0.16);
}

.contact-list__name {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 500;
}

.note-list {
  display: grid;
  gap: 1.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-list__item + .note-list__item {
  padding-top: 1.15rem;
  border-top: 1px solid rgba(182, 150, 89, 0.16);
}

.note-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.45rem;
  color: var(--gold-light);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.note-list__content {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Annual board ——— */

.app-body:has(.page--board) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.app-body:has(.page--board) .app-header,
.app-body:has(.page--board) .flash-region {
  flex-shrink: 0;
}

.page--board {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: calc(100% - 2rem);
  max-width: none;
  min-height: 0;
  padding-top: 1.5rem;
  padding-bottom: 1.25rem;
}

.page--board .page__header {
  flex-shrink: 0;
  margin-bottom: 1.15rem;
}

.page--board .page__header-actions {
  align-items: center;
}

.year-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.year-picker__label {
  margin: 0;
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.year-picker__select {
  width: auto;
  min-width: 6.5rem;
}

.board-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--navy-deep);
}

.board-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.board-table th,
.board-table td {
  white-space: nowrap;
  background: var(--navy-deep);
}

.board-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--border);
}

.board-table tbody tr:hover td {
  background: #12263f;
}

.board-table__sticky {
  position: sticky;
  z-index: 2;
}

.board-table thead .board-table__sticky {
  z-index: 4;
}

.board-table__sticky--client {
  left: 0;
  width: 14rem;
  min-width: 14rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-table__sticky--cnpj {
  left: 14rem;
  width: 11rem;
  min-width: 11rem;
  max-width: 11rem;
}

.board-table__sticky--since {
  left: 25rem;
  width: 8.5rem;
  min-width: 8.5rem;
  max-width: 8.5rem;
}

.board-table__sticky--due {
  left: 33.5rem;
  width: 5.5rem;
  min-width: 5.5rem;
  max-width: 5.5rem;
}

.board-table__sticky--amount {
  left: 39rem;
  width: 10rem;
  min-width: 10rem;
  max-width: 10rem;
  box-shadow: 6px 0 10px -8px rgba(0, 0, 0, 0.55);
}

.board-table__month {
  min-width: 7rem;
}

.board-table__dash {
  font-weight: 700;
}

.board-table__dash--missing {
  color: #e5534b;
}

.board-table__dash--pending,
.board-table__underpaid {
  color: #e8c547;
}

.board-table__dash--before_client,
.board-table__dash--waived {
  color: #4cb782;
}

.board-table__not-charged {
  color: var(--muted);
}

@media (max-width: 900px) {
  .board-table__sticky--cnpj,
  .board-table__sticky--since,
  .board-table__sticky--due,
  .board-table__sticky--amount {
    position: static;
    left: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    box-shadow: none;
  }
}

@media (max-width: 1100px) {
  .form-grid,
  .detail-list,
  .allocation-balance {
    grid-template-columns: 1fr;
  }

  .highlight-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .allocation-header {
    flex-direction: column;
  }

  .allocation-header__actions {
    justify-content: flex-start;
  }

  .allocation-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  .login__logo {
    width: min(78vw, 220px);
  }

  .page__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn--primary:hover,
  .module-card:hover {
    transform: none;
  }

  .contacts-hint__popover {
    transition: none;
  }
}

.page__header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.field__input--file {
  padding: 0.65rem 0;
}

.import-help {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.import-help__columns {
  margin: 0.35rem 0 0;
  color: var(--white);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-word;
}

.import-results {
  margin-top: 1.75rem;
}

/* ——— Checklists ——— */

.search-bar--filters {
  flex-wrap: wrap;
}

.search-bar__select {
  flex: 0 1 260px;
  min-width: 200px;
  padding: 0.8rem 1.5rem 0.8rem 0;
  font-size: 0.95rem;
}

.detail-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.detail-card__header .detail-card__title {
  margin-bottom: 0;
}

.detail-card__header-action {
  margin: 0;
}

.detail-card__hint {
  margin: -0.6rem 0 1.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.detail-list + .detail-card__hint {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.detail-card__hint a {
  color: var(--gold-light);
  text-decoration: none;
}

.detail-card__hint a:hover {
  text-decoration: underline;
}

.checklist-table td {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.detail-card .checklist-table {
  margin: 0 -0.5rem;
  width: calc(100% + 1rem);
}

.detail-card .checklist-table td {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.detail-card .checklist-table tr:first-child td {
  border-top: none;
}

.checklist-row__check {
  width: 2.5rem;
  padding-right: 0;
}

.checklist-row__name {
  width: 100%;
}

.checklist-toggle {
  display: flex;
  align-items: center;
  margin: 0;
}

.checklist-toggle__input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.checklist-row.is-completed .inline-edit__label {
  color: var(--muted);
  text-decoration: line-through;
}

.inline-edit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.inline-edit__label {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.25rem 0;
  color: var(--white);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  cursor: text;
  overflow-wrap: anywhere;
}

.inline-edit__label:hover,
.inline-edit__label:focus-visible {
  border-bottom-color: rgba(182, 150, 89, 0.45);
  outline: none;
}

.inline-edit__form {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.inline-edit__input {
  width: 100%;
  padding: 0.25rem 0;
  color: var(--white);
  font: inherit;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gold);
  border-radius: 0;
  outline: none;
  box-shadow: 0 1px 0 0 var(--gold);
}

.inline-edit .copy-btn {
  margin-left: auto;
}

.checklist-new {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.checklist-new__input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0;
  color: var(--white);
  font: inherit;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  outline: none;
}

.checklist-new__input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.checklist-new__input:focus {
  border-bottom-color: var(--gold);
  box-shadow: 0 1px 0 0 var(--gold);
}

.checklist-error {
  margin: 0.75rem 0 0;
  color: #f5d0d0;
  font-size: 0.85rem;
}

.remove-btn__form {
  display: inline-flex;
  margin: 0;
}

.remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 2px;
  opacity: 0.45;
  cursor: pointer;
}

.remove-btn:hover,
.remove-btn:focus-visible {
  color: #f5d0d0;
  opacity: 1;
  outline: none;
}

.remove-btn__icon {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.pagination__info {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.pagination__count {
  color: rgba(255, 255, 255, 0.4);
}

.btn.is-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.template-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.template-list__item:hover {
  background: rgba(182, 150, 89, 0.05);
}

.template-list__item.is-dragging {
  opacity: 0.4;
}

.template-list__item.is-drop-before {
  border-top-color: var(--gold);
}

.template-list__item.is-drop-after {
  border-bottom-color: var(--gold);
}

.template-list__item .inline-edit {
  flex: 1;
}

.template-list__handle {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: -0.2em;
  cursor: grab;
  user-select: none;
}

.template-list__item.is-dragging .template-list__handle {
  cursor: grabbing;
}

.template-list__position {
  min-width: 1.5rem;
  color: var(--gold-light);
  font-size: 0.7rem;
  text-align: right;
}

.template-list__move {
  display: none;
}

/* ——— Conciliação ——— */

.reconciliation {
  position: relative;
}

.reconciliation__columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7rem, 22%) minmax(0, 1fr);
  align-items: start;
}

.reconciliation__heading {
  margin: 0 0 1rem;
  color: var(--gold-light);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.reconciliation__list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reconciliation__item {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  background: rgba(14, 35, 64, 0.6);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.reconciliation__date {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.reconciliation__title {
  color: var(--white);
  font-size: 0.9rem;
  text-decoration: none;
}

.reconciliation__title:hover {
  color: var(--gold-light);
}

.reconciliation__amount {
  font-size: 0.9rem;
  font-weight: 600;
}

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

.reconciliation__item .status-pill {
  justify-self: start;
}

.reconciliation__arrows {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--gold);
  pointer-events: none;
  overflow: visible;
}

.reconciliation__arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.reconciliation__arrow rect {
  fill: var(--navy-deep);
  stroke: var(--border);
}

.reconciliation__arrow text {
  fill: var(--gold-light);
  font-size: 11px;
  font-weight: 600;
}

.reconciliation-page__print-meta {
  display: none;
}

/* ——— Impressão (Conciliação) ——— */

@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
  }

  .app-body::before,
  .app-header,
  .flash-region,
  .reconciliation-page .page__actions {
    display: none !important;
  }

  body,
  .app-body {
    color: #111;
    background: #fff !important;
  }

  .reconciliation-page {
    width: 100%;
    padding: 0;
  }

  .reconciliation-page .page__eyebrow {
    color: #555;
  }

  .reconciliation-page h1 {
    color: #111;
  }

  .reconciliation-page .page__header {
    margin-bottom: 0.75rem;
  }

  .reconciliation-page__print-meta {
    display: block;
    margin: 0 0 1rem;
    color: #555;
    font-size: 0.75rem;
  }

  .reconciliation-page .detail-card {
    padding: 0;
    background: none;
    border: 0;
  }

  .reconciliation__item {
    background: #fff;
    border-color: #999;
    break-inside: avoid;
  }

  .reconciliation__heading,
  .reconciliation__date,
  .reconciliation__note {
    color: #555;
  }

  .reconciliation__title {
    color: #111;
  }

  .reconciliation__arrows {
    color: #7a5d2a;
  }

  .reconciliation__arrow rect {
    fill: #fff;
    stroke: #bbb;
  }

  .reconciliation__arrow text {
    fill: #111;
  }

  .reconciliation .status-pill {
    color: #111;
    background: none;
    border-color: #999;
  }
}

/* ——— Conciliação: situação do lançamento ——— */

.reconciliation__item--paid {
  background: rgba(60, 100, 50, 0.28);
  border-color: rgba(140, 180, 120, 0.55);
}

.reconciliation__item--open {
  border-color: rgba(220, 120, 120, 0.55);
}

.reconciliation__status {
  font-size: 0.8rem;
  font-weight: 600;
}

.reconciliation__status--paid {
  color: #a9d68f;
}

.reconciliation__status--open {
  color: #f08a8a;
}

@media print {
  .reconciliation__item--paid {
    background: #e6f3df;
    border-color: #4c8a3a;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .reconciliation__item--open {
    border-color: #b33a3a;
  }

  .reconciliation__status--paid {
    color: #2c6b1a;
  }

  .reconciliation__status--open {
    color: #b02a2a;
  }
}

/* ——— Contract signature ——— */

.steps {
  display: grid;
  gap: 0.6rem;
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  line-height: 1.55;
}

.draft__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.draft__header .detail-card__title {
  margin: 0;
}

.draft__subject {
  display: grid;
  gap: 0.3rem;
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(182, 150, 89, 0.16);
}

.draft__subject span {
  color: var(--gold-light);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.draft__body {
  margin: 0 0 1rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
}

.signature-preview {
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--white);
  border-radius: 2px;
}

.signature-preview__image {
  max-width: 100%;
  max-height: 260px;
}

.signing-body {
  isolation: isolate;
  background: var(--navy-deep);
}

.signing-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(182, 150, 89, 0.1), transparent 55%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}

.signing {
  width: min(100% - 2rem, 720px);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.signing__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.signing__logo {
  width: 110px;
  height: auto;
}

.signing__welcome {
  margin-bottom: 1.75rem;
  text-align: center;
}

.signing__welcome h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.3;
}

.signing__summary {
  margin-bottom: 1rem;
}

.detail-list__wide {
  grid-column: 1 / -1;
}

.signing__form {
  margin-top: 1rem;
}

.signing__form .form-grid {
  margin-bottom: 1.75rem;
}

.signing__pad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.signing__canvas-wrap {
  position: relative;
  background: var(--white);
  border-radius: 2px;
}

.signing__canvas {
  display: block;
  width: 100%;
  height: 220px;
  touch-action: none;
  cursor: crosshair;
}

.signing__canvas-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(14, 35, 64, 0.35);
  font-size: 0.9rem;
  pointer-events: none;
}

.signing__pad-error {
  margin: 0.6rem 0 0;
  color: #f5d0d0;
  font-size: 0.85rem;
}

.signing__legal {
  margin: 1.25rem 0 0;
}

@media (max-width: 1100px) {
  .draft__header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.search-bar__clear {
  align-self: center;
  padding: 0 0.5rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;
}

.search-bar__clear:hover {
  color: var(--gold);
}
