:root {
  color-scheme: dark;
  --bg: #050905;
  --panel: #10160e;
  --panel-2: #161d13;
  --text: #f4f8ee;
  --muted: #9fa891;
  --line: #2d3824;
  --green: #91ff19;
  --green-2: #49c70d;
  --rust: #b3471f;
  --amber: #f1be42;
  --danger: #ff5b45;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(145, 255, 25, 0.07), rgba(5, 9, 5, 0) 280px),
    linear-gradient(135deg, rgba(179, 71, 31, 0.18), rgba(5, 9, 5, 0) 34%),
    var(--bg);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.login-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 430px);
  padding: 22px 18px 18px;
  border: 1px solid rgba(145, 255, 25, 0.25);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(17, 28, 12, 0.98), rgba(12, 14, 10, 0.96)),
    repeating-linear-gradient(90deg, rgba(145, 255, 25, 0.05) 0 1px, transparent 1px 12px);
  box-shadow: var(--shadow);
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.login-card h1 {
  max-width: 235px;
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 9vw, 2.55rem);
  line-height: 0.94;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(145, 255, 25, 0.3);
}

.login-alien {
  position: absolute;
  top: 16px;
  right: -10px;
  z-index: 0;
  width: 150px;
  height: 210px;
  opacity: 0.18;
  pointer-events: none;
  background:
    center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 220'%3E%3Cg fill='none' stroke='%2391ff19' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath fill='%2391ff19' fill-opacity='.14' d='M80 18c-31 0-59 27-59 69 0 28 13 54 34 72l-10 33 23-18c4 2 8 3 12 3s8-1 12-3l23 18-10-33c21-18 34-44 34-72 0-42-28-69-59-69Z'/%3E%3Cellipse cx='58' cy='88' rx='13' ry='24' transform='rotate(18 58 88)' fill='%23050905' fill-opacity='.82' stroke='%2391ff19' stroke-opacity='.55'/%3E%3Cellipse cx='102' cy='88' rx='13' ry='24' transform='rotate(-18 102 88)' fill='%23050905' fill-opacity='.82' stroke='%2391ff19' stroke-opacity='.55'/%3E%3Cpath d='M66 126c9 6 19 6 28 0' stroke-opacity='.7'/%3E%3Cpath d='M64 175h32' stroke-opacity='.45'/%3E%3Cpath d='M56 193h48' stroke-opacity='.28'/%3E%3C/g%3E%3C/svg%3E");
  filter: drop-shadow(0 0 28px rgba(145, 255, 25, 0.18));
}

.login-error {
  min-height: 20px;
  margin: 12px 2px 0;
  color: #ffd6cd;
  font-size: 0.9rem;
  font-weight: 800;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px calc(94px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(145, 255, 25, 0.25);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(17, 28, 12, 0.98), rgba(12, 14, 10, 0.96)),
    repeating-linear-gradient(90deg, rgba(145, 255, 25, 0.05) 0 1px, transparent 1px 12px);
  box-shadow: var(--shadow);
}

.topbar h1,
.section-head h2,
.panel-form h3,
.list-head h3 {
  margin: 0;
}

.topbar h1 {
  max-width: 235px;
  font-size: clamp(1.35rem, 6.3vw, 2.1rem);
  line-height: 0.94;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(145, 255, 25, 0.3);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.signal {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 2px solid rgba(145, 255, 25, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--green) 0 6px, rgba(145, 255, 25, 0.28) 7px 14px, transparent 15px),
    #0a1307;
  box-shadow: 0 0 24px rgba(145, 255, 25, 0.42);
}

.topbar-tools {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.session-card {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.logout-action {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(145, 255, 25, 0.24);
  border-radius: 7px;
  color: var(--green);
  background: rgba(145, 255, 25, 0.06);
  font-size: 0.72rem;
  font-weight: 900;
}

main {
  padding-top: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.manager-shell {
  display: none;
}

.role-gerente .app-shell {
  max-width: 560px;
  padding-bottom: 28px;
}

.role-gerente .signal,
.role-gerente .bottom-nav,
.role-gerente .view {
  display: none !important;
}

.role-gerente .manager-shell {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.section-head h2 {
  font-size: 1.45rem;
  line-height: 1.1;
}

.budget-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.operational-metrics,
.action-stack {
  display: grid;
  gap: 12px;
}

.budget-card,
.panel-form,
.visitor-card,
.projection-card,
.integration-panel,
.closing-summary,
.list-panel,
.manager-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 22, 14, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.budget-card {
  padding: 14px;
}

.budget-top,
.budget-values,
.list-head,
.entry-main,
.entry-meta,
.closing-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.budget-top strong {
  font-size: 1.05rem;
}

.budget-pill {
  padding: 5px 9px;
  border: 1px solid rgba(145, 255, 25, 0.28);
  border-radius: 999px;
  color: var(--green);
  background: rgba(145, 255, 25, 0.07);
  font-size: 0.75rem;
  font-weight: 800;
}

.budget-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  margin-top: 12px;
}

.budget-values span,
.visitor-card > span,
.projection-card > span,
.closing-summary span,
.difference-box span,
.entry-meta,
.fine-print {
  color: var(--muted);
  font-size: 0.78rem;
}

.budget-values strong,
.visitor-card strong,
.projection-card strong,
.closing-summary strong,
.difference-box strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.budget-values div:last-child {
  text-align: right;
}

.progress-track {
  overflow: hidden;
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: #26301e;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-2), var(--green));
  box-shadow: 0 0 16px rgba(145, 255, 25, 0.55);
  transition: width 180ms ease;
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--amber), var(--rust));
}

.progress-fill.danger {
  background: linear-gradient(90deg, var(--rust), var(--danger));
}

.panel-form,
.list-panel,
.closing-summary,
.manager-shell {
  margin-top: 14px;
  padding: 14px;
}

.manager-head {
  margin-bottom: 0;
}

.manager-date {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.manager-panel {
  margin-top: 16px;
}

.manager-summary {
  margin-top: 12px;
}

.closing-summary.manager-summary > .manager-cell,
.closing-summary.manager-summary > .manager-justification-display {
  text-align: left;
}

.manager-summary-single {
  display: block;
}

.manager-summary-stack {
  display: grid;
  gap: 12px;
}

.closing-summary.manager-summary-single > div,
.closing-summary.manager-summary-stack > div {
  text-align: left;
}

.closing-summary.manager-summary-single > div:last-child,
.closing-summary.manager-summary-stack > div:last-child {
  text-align: left;
}

.manager-result-message,
.manager-lock-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.manager-value-subtle {
  color: #d4ddc6;
  font-weight: 800;
}

.manager-cell-emphasis strong,
.manager-justification-display p {
  color: var(--text);
}

.manager-cell-emphasis strong {
  font-size: clamp(1.15rem, 4.8vw, 1.5rem);
}

.manager-justification-display {
  padding-top: 12px;
  border-top: 1px solid rgba(145, 255, 25, 0.12);
}

.manager-justification-display p {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.manager-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.panel-form h3,
.list-head h3 {
  font-size: 1rem;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #34442a;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #0a0f08;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(145, 255, 25, 0.72);
  box-shadow: 0 0 0 3px rgba(145, 255, 25, 0.12);
}

.primary-action,
.closing-button,
.ghost-action,
.delete-action {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action,
.closing-button {
  width: 100%;
  margin-top: 14px;
  color: #081006;
  background: linear-gradient(180deg, var(--green), #67dc12);
  box-shadow: 0 12px 24px rgba(73, 199, 13, 0.22);
}

.closing-button {
  text-transform: uppercase;
}

.ghost-action,
.delete-action {
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  border: 1px solid var(--line);
  background: #0b1009;
}

.delete-action {
  color: #ffd6cd;
  border-color: rgba(255, 91, 69, 0.35);
}

.visitor-card,
.projection-card {
  margin-top: 14px;
  padding: 18px;
}

.visitor-card {
  min-height: 178px;
  background:
    linear-gradient(135deg, rgba(145, 255, 25, 0.12), rgba(16, 22, 14, 0.94) 48%),
    rgba(16, 22, 14, 0.92);
}

.visitor-card strong {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
  color: var(--green);
  font-size: clamp(3.4rem, 18vw, 5rem);
  line-height: 0.92;
  text-shadow: 0 0 22px rgba(145, 255, 25, 0.32);
}

.visitor-card strong em {
  color: var(--text);
  font-size: clamp(1.4rem, 7vw, 2.15rem);
  font-style: normal;
}

.visitor-card small {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 9px;
  border: 1px solid rgba(145, 255, 25, 0.22);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(5, 9, 5, 0.42);
  font-size: 0.75rem;
  font-weight: 800;
}

.projection-card strong {
  margin-top: 8px;
  font-size: clamp(2.3rem, 11vw, 3.45rem);
  line-height: 1;
}

.integration-panel {
  margin-top: 14px;
  padding: 13px 14px;
}

.integration-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 900;
}

.integration-panel form {
  margin-top: 10px;
}

.widget-frame-wrap {
  display: none;
  overflow: hidden;
  height: 180px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.widget-frame-wrap.active {
  display: block;
}

.widget-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.closing-summary {
  align-items: stretch;
}

.closing-summary div {
  flex: 1;
}

.closing-summary div:last-child {
  text-align: right;
}

.difference-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(145, 255, 25, 0.18);
  border-radius: 8px;
  background: rgba(145, 255, 25, 0.06);
}

.difference-box.negative {
  border-color: rgba(255, 91, 69, 0.42);
  background: rgba(255, 91, 69, 0.08);
}

.difference-box.positive {
  border-color: rgba(241, 190, 66, 0.42);
  background: rgba(241, 190, 66, 0.08);
}

.difference-box.neutral {
  border-color: rgba(145, 255, 25, 0.18);
  background: rgba(145, 255, 25, 0.06);
}

.entry-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.entry-list li {
  padding: 12px;
  border: 1px solid rgba(45, 56, 36, 0.9);
  border-radius: 8px;
  background: #0a0f08;
}

.operator-closing-card {
  display: grid;
  gap: 14px;
  padding: 16px !important;
}

.operator-closing-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.operator-closing-top strong {
  display: block;
  color: var(--text);
  font-size: 1.2rem;
}

.operator-closing-top p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.operator-closing-status {
  padding: 6px 10px;
  border: 1px solid rgba(145, 255, 25, 0.2);
  border-radius: 999px;
  color: var(--text);
  background: rgba(145, 255, 25, 0.06);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.operator-closing-status.status-ok {
  border-color: rgba(145, 255, 25, 0.3);
  color: var(--green);
}

.operator-closing-status.status-warning {
  border-color: rgba(241, 190, 66, 0.34);
  color: #ffe3a0;
}

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

.operator-closing-metric {
  min-width: 0;
}

.operator-closing-metric span,
.operator-closing-focus span,
.operator-closing-justification span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.operator-closing-metric strong {
  display: block;
  margin-top: 6px;
  color: #dce7d1;
  font-size: 1.05rem;
  line-height: 1.25;
}

.operator-closing-focus {
  padding: 14px;
  border: 1px solid rgba(145, 255, 25, 0.18);
  border-radius: 8px;
  background: rgba(145, 255, 25, 0.06);
}

.operator-closing-focus.negative {
  border-color: rgba(255, 91, 69, 0.42);
  background: rgba(255, 91, 69, 0.08);
}

.operator-closing-focus.positive {
  border-color: rgba(241, 190, 66, 0.42);
  background: rgba(241, 190, 66, 0.08);
}

.operator-closing-focus strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1.15;
}

.operator-closing-justification {
  padding-top: 2px;
}

.operator-closing-justification p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
}

.entry-main strong {
  overflow-wrap: anywhere;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.entry-date {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.entry-note {
  margin: 8px 0 0;
  color: #dce7d1;
  font-size: 0.9rem;
  line-height: 1.35;
}

.entry-detail {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.role-pill {
  padding: 5px 9px;
  border: 1px solid rgba(145, 255, 25, 0.24);
  border-radius: 999px;
  color: var(--green);
  background: rgba(145, 255, 25, 0.06);
  font-size: 0.72rem;
  font-weight: 900;
}

.role-operator-only {
  display: none;
}

.role-operador .role-operator-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.role-admin-only {
  display: none;
}

.role-admin .role-admin-only {
  display: block;
}

.role-operador .operator-readonly-hidden {
  display: none !important;
}

.user-list {
  gap: 12px;
}

.user-card {
  display: grid;
  gap: 14px;
}

.user-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.user-card-head strong {
  display: block;
  color: var(--text);
  font-size: 1.02rem;
}

.user-card-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.user-status {
  padding: 6px 10px;
  border: 1px solid rgba(145, 255, 25, 0.22);
  border-radius: 999px;
  background: rgba(145, 255, 25, 0.06);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 900;
}

.user-status.active {
  color: var(--green);
}

.user-status.inactive {
  border-color: rgba(255, 91, 69, 0.28);
  color: #ffd6cd;
  background: rgba(255, 91, 69, 0.08);
}

.user-card-meta span {
  color: var(--muted);
  font-size: 0.78rem;
}

.user-card-meta strong {
  display: block;
  margin-top: 5px;
  color: #dce7d1;
  font-size: 0.96rem;
}

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

.user-password-form label {
  margin-top: 0;
}

.user-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.user-card-actions .ghost-action {
  min-height: 46px;
}

.modal {
  width: min(calc(100% - 32px), 430px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
}

.modal-card {
  padding: 18px;
  border: 1px solid rgba(145, 255, 25, 0.28);
  border-radius: 8px;
  background: #0b1009;
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.modal-actions .primary-action {
  margin-top: 0;
}

.modal-actions .ghost-action {
  min-height: 46px;
}

.empty-state {
  display: none;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state.visible {
  display: block;
}

.fine-print {
  margin: 12px 2px 0;
  line-height: 1.4;
}

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 22, 14, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.metric-card > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: #eef7e1;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 0.98;
}

.metric-card strong em {
  color: var(--text);
  font-size: clamp(1rem, 4.6vw, 1.45rem);
  font-style: normal;
}

.metric-card-primary {
  background:
    linear-gradient(135deg, rgba(145, 255, 25, 0.12), rgba(16, 22, 14, 0.94) 48%),
    rgba(16, 22, 14, 0.92);
}

.metric-card-primary strong {
  color: var(--green);
  text-shadow: 0 0 22px rgba(145, 255, 25, 0.28);
}

.action-stack {
  margin-top: 14px;
}

.quick-action {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 900;
}

.manager-exit {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: calc(100% - 32px);
  max-width: 448px;
  padding: 7px;
  border: 1px solid rgba(145, 255, 25, 0.2);
  border-radius: 8px;
  background: rgba(7, 11, 6, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.role-admin .bottom-nav {
  grid-template-columns: repeat(4, 1fr);
}

.nav-item {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: clamp(0.62rem, 2.6vw, 0.78rem);
  font-weight: 900;
}

.nav-item.active {
  color: #071005;
  background: var(--green);
}

@media (min-width: 420px) {
  .topbar h1 {
    max-width: 270px;
  }

  .signal {
    width: 44px;
    height: 44px;
  }

  .manager-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 28px;
  }
}
