:root {
  color-scheme: dark;
  --bg: #05100f;
  --surface: rgba(8, 23, 24, 0.84);
  --surface-strong: rgba(12, 31, 31, 0.94);
  --surface-soft: rgba(15, 43, 41, 0.78);
  --line: rgba(128, 255, 80, 0.16);
  --line-strong: rgba(128, 255, 80, 0.34);
  --text: #eef8f1;
  --muted: #a6b9b1;
  --brand: #4bc40d;
  --brand-dark: #3aa408;
  --brand-soft: rgba(75, 196, 13, 0.14);
  --accent: #f6c846;
  --danger: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #7185d9;
  color: #122033;
  font-family: Arial, Helvetica, sans-serif;
}

body::before {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-header {
  display: grid;
  grid-template-columns: 270px minmax(430px, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 105px;
  padding: 16px clamp(18px, 3vw, 34px);
  background: #061f8e;
  border-bottom: 0;
  color: #fff;
  box-shadow: none;
  backdrop-filter: none;
}

.brand-block {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.app-logo {
  display: block;
  width: 205px;
  height: auto;
}

.brand-block span {
  display: block;
  max-width: 230px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  margin-left: 0;
}

.company-switcher {
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.company-switcher select {
  width: 190px;
  min-width: 190px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0b1713;
  font-size: 0.78rem;
  font-weight: 700;
}

.user-pill,
.logout-link {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.user-pill {
  max-width: 185px;
  overflow: hidden;
  background: #fff;
  color: #061f8e;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-link {
  background: #fff;
  color: #061f8e;
}

.logout-link:hover {
  background: #d8ff00;
  color: #061f8e;
}

.eyebrow {
  margin: 0 0 4px;
  color: #a7f280;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.eyebrow.dark {
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
}

.tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  min-width: 0;
}

.tab-button {
  border: 0;
  border-radius: 0;
  padding: 8px 0;
  background: transparent;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.tab-button.active,
.tab-button:hover {
  background: transparent;
  color: #d8ff00;
}

.nav-menu {
  position: relative;
}

.nav-menu::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 4;
  width: 220px;
  height: 12px;
}

.nav-menu-button::after {
  content: "  ▾";
  font-size: 0.78rem;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 5;
  display: none;
  min-width: 190px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.nav-menu:hover .nav-dropdown,
.nav-menu:focus-within .nav-dropdown {
  display: grid;
  gap: 6px;
}

.nav-dropdown .tab-button {
  width: 100%;
  border-radius: 8px;
  padding: 10px 12px;
  color: #102033;
  text-align: left;
}

.nav-dropdown .tab-button:hover {
  background: #eef4ff;
  color: #061f8e;
}

.nav-link-button {
  display: block;
}

.inline-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  text-decoration: none;
}

main {
  padding: 30px clamp(18px, 4vw, 56px) 48px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-toolbar .section-heading p {
  margin-bottom: 0;
}

.month-filter {
  width: min(240px, 100%);
}

.dashboard-sheet {
  margin-bottom: 24px;
}

.compact-heading {
  padding-top: 6px;
}

.summary-card,
.workspace {
  background: #ffffff;
  border: 1px solid #d6deef;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(20, 35, 78, 0.12);
  backdrop-filter: none;
}

.summary-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.summary-card::after {
  display: none;
}

.summary-card span {
  display: block;
  margin-bottom: 8px;
  color: #50627c;
  font-size: 0.92rem;
}

.summary-card strong {
  position: relative;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: #142033;
}

.workspace {
  padding: 24px;
}

.two-columns {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  gap: 24px;
}

.wide-left {
  grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 0.9fr);
}

.settings-layout {
  max-width: 760px;
}

.section-heading p {
  color: var(--muted);
  margin-bottom: 18px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-row p {
  margin-bottom: 0;
}

.form-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #122033;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 11px 12px;
  background: #ffffff;
  color: #0c1816;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(101, 255, 56, 0.84);
  box-shadow: 0 0 0 3px rgba(75, 196, 13, 0.2);
}

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

.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.primary-action {
  width: fit-content;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--brand);
  color: #06100f;
  font-weight: 800;
  cursor: pointer;
}

.primary-action:hover {
  background: var(--brand-dark);
}

.record-list {
  display: grid;
  gap: 12px;
}

.record-card {
  border: 1px solid #d6deef;
  border-radius: 8px;
  padding: 14px;
  background: #f8fbff;
}

.record-card.selected-card {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.record-card strong {
  display: block;
  margin-bottom: 6px;
  color: #142033;
}

.company-logo-thumb {
  display: block;
  max-width: 160px;
  max-height: 70px;
  margin-bottom: 12px;
  object-fit: contain;
}

.record-card p {
  margin-bottom: 4px;
  color: var(--muted);
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.secondary-action,
.danger-action {
  border: 1px solid #d6deef;
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: #142033;
  cursor: pointer;
}

.secondary-action:hover {
  border-color: var(--line-strong);
  background: var(--brand-soft);
}

.secondary-action:disabled,
.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.link-action {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.danger-action {
  color: var(--danger);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

thead {
  background: #eef3ff;
}

th,
td {
  border-bottom: 1px solid #d6deef;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #50627c;
  font-size: 0.86rem;
}

td {
  color: #142033;
}

.qr-thumb {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: contain;
}

.qr-box {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed #9db0d0;
  border-radius: 8px;
  background: #f8fbff;
  padding: 18px;
  text-align: center;
}

.qr-box img {
  display: none;
  width: min(230px, 100%);
  height: auto;
}

.qr-box.has-qr img {
  display: block;
}

.qr-box.has-qr #qrPlaceholder {
  display: none;
}

.accounts-list-workspace {
  margin-bottom: 22px;
}

.account-editor[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 20, 38, 0.52);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(420px, 100%);
  border: 1px solid #d6deef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 35, 78, 0.24);
  padding: 24px;
}

.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 44px));
}

.toast {
  border: 1px solid #d6deef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(20, 35, 78, 0.18);
  padding: 14px 16px;
  color: #122033;
  font-weight: 700;
}

.toast-success {
  border-color: #93d86c;
  background: #f4ffef;
}

.toast-warning {
  border-color: #f4c96b;
  background: #fff8e7;
}

.empty-state {
  border: 1px dashed #9db0d0;
  border-radius: 8px;
  padding: 22px;
  color: #50627c;
  text-align: center;
}

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

.login-page {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(0, 8, 7, 0.38), rgba(0, 14, 13, 0.08) 42%, rgba(0, 8, 7, 0.55)),
    url("assets/fundo.png") center / cover no-repeat;
  overflow: hidden;
}

.login-page::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 52% 22%, rgba(106, 255, 48, 0.18), transparent 28%),
    radial-gradient(circle at 50% 54%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(380px, 100%);
  padding: 0;
}

.login-panel {
  background: rgba(8, 20, 23, 0.78);
  border: 1px solid rgba(124, 255, 57, 0.16);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
  padding: 32px 34px 36px;
  backdrop-filter: blur(12px);
}

.login-logo {
  display: block;
  width: min(270px, 100%);
  height: auto;
  margin: 0 auto 28px;
}

.login-form .primary-action,
.inline-action {
  width: 100%;
  text-align: center;
}

.login-form {
  gap: 18px;
}

.login-form label {
  color: #f7fff1;
  font-size: 0;
}

.login-form input {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #0d1720;
  font-size: 1rem;
  font-weight: 500;
}

.login-form input::placeholder {
  color: #657386;
}

.login-form .primary-action {
  min-height: 48px;
  border-radius: 12px;
  background: #49c40b;
  color: #07120b;
  font-size: 1.05rem;
  font-weight: 800;
}

.login-form .primary-action:hover {
  background: #63df1a;
}

.inline-action {
  display: block;
  text-decoration: none;
}

.alert {
  border: 1px solid rgba(255, 107, 107, 0.38);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 107, 107, 0.12);
  color: #ffd6d6;
}

.alert.success {
  border-color: rgba(128, 255, 80, 0.36);
  background: rgba(75, 196, 13, 0.12);
  color: #c8f4bb;
  margin-bottom: 14px;
}

@media (max-width: 860px) {
  .app-header {
    align-items: start;
    display: flex;
    flex-direction: column;
  }

  .header-actions {
    align-items: stretch;
    flex-wrap: wrap;
    margin-left: 0;
    width: 100%;
  }

  .tabs {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .company-switcher,
  .company-switcher select {
    width: 100%;
  }

  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .month-filter {
    width: 100%;
  }

  .summary-grid,
  .two-columns,
  .wide-left,
  .field-row {
    grid-template-columns: 1fr;
  }

  .primary-action {
    width: 100%;
  }
}
