:root {
  --bg: #edf4f1;
  --panel: #ffffff;
  --line: #d6dde6;
  --text: #17202c;
  --muted: #627184;
  --accent: #157347;
  --accent-dark: #0f5a38;
  --nav: #102a33;
  --nav-soft: #1d3a45;
  --danger: #b42318;
  --warning: #925b00;
  --ok: #166534;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(21, 115, 71, 0.08), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(21, 115, 71, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(236, 245, 238, 0.78));
}

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

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

button.warning {
  border-color: var(--warning);
  background: var(--warning);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

input[readonly] {
  background: #eef2f6;
  color: var(--muted);
}

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

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

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

.support-copy {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.upload-panel {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.upload-panel span {
  color: var(--muted);
  font-weight: 700;
}

.upload-panel p {
  margin: 0;
  line-height: 1.45;
}

.company-register-location-panel {
  display: grid;
  gap: 10px;
}

.company-register-location-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.company-register-location-heading div {
  display: grid;
  gap: 4px;
}

.company-register-location-heading strong {
  color: var(--text);
}

.company-register-location-heading span,
.company-register-location-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.company-register-map {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe9de;
}

.company-register-location-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.company-register-location-status.error {
  color: var(--danger);
}

.company-register-location-status.ok {
  color: var(--accent-dark);
  font-weight: 700;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  min-height: 132px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 14px;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.upload-dropzone.drag-over {
  border-color: var(--ok);
  background: #f0fdf4;
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-dropzone small {
  color: var(--muted);
}

.upload-preview {
  display: grid;
  gap: 8px;
  margin: 0;
}

.upload-preview img {
  width: min(100%, 180px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.hidden {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(3, 16, 20, 0.34);
  backdrop-filter: blur(8px);
}

.loading-overlay.hidden {
  display: none !important;
}

.loading-overlay:not(.hidden)::before {
  content: "";
  position: absolute;
  width: min(230px, calc(100vw - 48px));
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(5, 16, 18, 0.82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.loading-overlay > * {
  position: relative;
  z-index: 1;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 48px;
  border: 3px solid rgba(255, 255, 255, 0.32);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: loading-spin 900ms linear infinite;
}

.loading-overlay strong {
  position: absolute;
  margin-top: 48px;
  color: #ffffff;
  font-size: 1rem;
  letter-spacing: 0;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: 16px;
  overflow-y: auto;
}

.login-panel {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(16, 42, 51, 0.12);
}

.login-panel h1 {
  margin: 0 0 18px;
  font-size: 24px;
}

.stack {
  display: grid;
  gap: 14px;
}

.auth-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 4px 6px;
}

.link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.app-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(21, 115, 71, 0.24), transparent 220px),
    var(--nav);
  color: #fff;
  padding: 18px;
}

.brand {
  display: grid;
  gap: 2px;
  padding: 10px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: #c0ccd8;
}

.brand small,
.active-company-nif {
  display: block;
  color: #8fa1b4;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.1;
}

.active-company-name {
  display: block;
  max-width: 190px;
  overflow: hidden;
  color: #d7e0ea;
  font-weight: 850;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav button,
.ghost-button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: #e7edf4;
  text-align: left;
}

.nav button.active,
.nav button:hover,
.ghost-button:hover {
  background: var(--nav-soft);
}

.nav button.active {
  box-shadow: inset 3px 0 0 #63d48b;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(214, 221, 230, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
  box-shadow: 0 12px 32px rgba(16, 42, 51, 0.08);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.company-pill {
  display: grid;
  gap: 2px;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 8px 10px;
}

.company-pill strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-pill span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.message {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.message.error,
.error {
  color: var(--danger);
}

.content {
  display: grid;
  gap: 16px;
}

.form-grid,
.stats-grid {
  display: grid;
  gap: 12px;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(16, 42, 51, 0.06);
}

.form-grid.embedded {
  border: 0;
  padding: 0;
  box-shadow: none;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.pec-guidance {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(21, 115, 71, 0.22);
  border-radius: 8px;
  background: #f4fbf7;
  color: var(--muted);
  padding: 12px;
  line-height: 1.45;
}

.pec-guidance p {
  margin: 0;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat {
  background:
    linear-gradient(135deg, rgba(21, 115, 71, 0.08), transparent),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(16, 42, 51, 0.06);
}

.stat span {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.stat strong {
  font-size: 26px;
}

.dashboard-hero,
.section-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 12px 30px rgba(16, 42, 51, 0.07);
}

.dashboard-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.dashboard-hero h2,
.section-heading h2 {
  margin: 4px 0;
  font-size: 22px;
}

.dashboard-hero p,
.section-heading p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-chip {
  border: 1px solid #b7e4c7;
  border-radius: 999px;
  background: #f0fdf4;
  color: var(--ok);
  padding: 6px 10px;
  font-weight: 800;
  white-space: nowrap;
}

.ops-grid,
.report-grid,
.lot-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.ops-card,
.section-card.compact {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 14px;
}

.ops-card.ok {
  border-color: #b7e4c7;
  background: #f0fdf4;
}

.company-showcase {
  display: grid;
  gap: 14px;
}

.company-showcase-shell {
  display: grid;
  grid-template-columns: minmax(300px, 1.15fr) minmax(240px, 0.78fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  border: 1px solid rgba(21, 115, 71, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 247, 0.96)),
    radial-gradient(circle at 12% 18%, rgba(100, 180, 96, 0.2), transparent 28%);
  padding: 14px;
  box-shadow: 0 20px 52px rgba(16, 42, 51, 0.12);
}

.company-showcase-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 210px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(5, 18, 18, 0.92), rgba(13, 44, 35, 0.8)),
    linear-gradient(135deg, #101820, #20352c 55%, #16241f);
  color: #ffffff;
  padding: 22px;
}

.company-showcase-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 72px);
  pointer-events: none;
}

.company-logo-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(170px, 28vw);
  aspect-ratio: 1;
  overflow: hidden;
  border: 4px solid rgba(100, 180, 96, 0.86);
  border-radius: 50%;
  background: rgba(5, 10, 12, 0.92);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

.company-logo-stage img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  object-position: center;
}

.company-logo-column {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.company-primary-actions {
  display: grid;
  width: 100%;
  gap: 6px;
}

.company-primary-actions .dashboard-small-action {
  width: 100%;
  justify-content: center;
}

.company-showcase-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
  align-content: center;
}

.company-showcase-copy h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.company-showcase-copy p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.98rem;
  line-height: 1.45;
}

.company-showcase-copy .eyebrow {
  color: #9fe18f;
}

.company-identity-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.company-identity-summary span {
  display: grid;
  min-width: 120px;
  gap: 2px;
  border: 1px solid rgba(159, 225, 143, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 11px;
}

.company-identity-summary small {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.company-identity-summary strong {
  color: #fff;
  font-size: 0.94rem;
}

.activation-rule-notice {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(21, 115, 71, 0.3);
  border-radius: 8px;
  background: #eff9f2;
  padding: 10px 12px;
}

.activation-rule-notice strong { color: var(--primary); }
.activation-rule-notice span { color: var(--muted); font-size: 0.82rem; }

.field-step {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 5px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}

.activation-map-step {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.activation-command-bar,
.scheduled-prizes-panel {
  position: sticky;
  z-index: 35;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  border: 2px solid rgba(21, 115, 71, 0.55);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  padding: 10px 12px;
  box-shadow: 0 12px 34px rgba(10, 49, 31, 0.24);
}

.scheduled-countdown {
  min-width: 92px;
  color: #b42318;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.visible-activation-clock {
  display: grid;
  min-width: 92px;
  place-items: center;
  border: 2px solid #b42318;
  border-radius: 8px;
  background: #fff5f4;
  padding: 5px 10px;
  color: #b42318;
  font-variant-numeric: tabular-nums;
}

.visible-activation-clock small { font-size: 0.6rem; font-weight: 900; letter-spacing: .08em; }
.visible-activation-clock strong { font-size: 1.35rem; line-height: 1; }

.activation-active-strip {
  position: sticky;
  z-index: 36;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  border: 2px solid #15803d;
  border-radius: 10px;
  background: #ecfdf3;
  padding: 11px 13px;
  box-shadow: 0 12px 34px rgba(10, 90, 45, 0.24);
  color: #116329;
}

.activation-active-strip > div { display: flex; align-items: center; gap: 9px; }
.activation-active-strip strong { font-size: 1.08rem; }
.activation-active-strip small { color: #356b45; }
.active-pulse { width: 12px; height: 12px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 5px rgba(34, 197, 94, .18); }

@media (max-width: 720px) {
  .activation-command-bar { align-items: flex-start; flex-direction: column; }
}

.company-showcase-branch-action {
  position: relative;
  z-index: 1;
  margin-left: auto;
  display: grid;
  gap: .45rem;
  justify-items: end;
  text-align: right;
}

.company-showcase-branch-action button {
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(20, 86, 184, .24);
}

.company-showcase-branch-action small {
  max-width: 15rem;
  color: rgba(255, 255, 255, .82);
}

.company-card,
.company-map-card,
.company-bingo-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(16, 42, 51, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 16px;
  box-shadow: 0 14px 32px rgba(16, 42, 51, 0.07);
}

.company-results-card {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.92), rgba(255, 255, 255, 0.96));
}

.result-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid rgba(16, 42, 51, 0.08);
}

.result-line:last-child {
  border-bottom: 0;
}

.result-line span {
  color: var(--muted);
  line-height: 1.25;
}

.result-line strong {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.company-profile-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.company-profile-card h3 {
  margin: 3px 0 13px;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1.15;
}

.company-profile-card div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
}

.company-profile-card dt {
  color: var(--muted);
}

.company-profile-card dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.campaign-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(18px, 1fr));
  align-items: end;
  gap: 7px;
  min-height: 125px;
  padding: 8px 2px 0;
}

.campaign-chart span {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 104px;
}

.campaign-chart span::before {
  content: "";
  display: block;
  height: var(--bar);
  min-height: 18px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #78c46d, #157347);
  box-shadow: 0 10px 24px rgba(21, 115, 71, 0.16);
}

.campaign-chart i {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  text-align: center;
}

.dashboard-branch-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.dashboard-branch-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.branch-logo-presentation { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.branch-logo-presentation img { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid rgba(15, 23, 42, .12); }
.access-manager-list { display: grid; gap: 12px; margin: 14px 0 24px; }
.access-manager-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto; gap: 16px; align-items: center; }
.access-manager-row > div { display: grid; gap: 4px; }
.access-manager-row code { font-weight: 800; letter-spacing: .08em; }
@media (max-width: 820px) { .access-manager-row { grid-template-columns: 1fr; } }
.access-branches-list { display: grid; gap: 8px; }
.access-branch-row { overflow: hidden; border: 1px solid rgba(15, 23, 42, .12); border-radius: 8px; background: #fff; }
.access-branch-row.open { border-color: rgba(21, 115, 71, .55); box-shadow: 0 10px 28px rgba(15, 23, 42, .08); }
.access-branch-summary { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(110px, .55fr) minmax(130px, .65fr) auto; gap: 12px; align-items: center; padding: 11px 12px; }
.access-branch-summary > div { display: grid; gap: 2px; }
.access-branch-summary span { color: var(--muted); font-size: .8rem; }
.branch-management-state { width: fit-content; margin-top: 3px; border-radius: 999px; padding: 3px 8px; font-weight: 800; }
.branch-management-state.parent { background: #dbeafe; color: #1d4ed8; }
.branch-management-state.delegated { background: #dcfce7; color: #166534; }
.access-branch-row.managed-by-parent { border-left: 5px solid #2563eb; }
.access-branch-row.managed-locally { border-left: 5px solid #16a34a; }
.access-branch-detail { display: grid; gap: 12px; border-top: 1px solid var(--line); background: #f8fbf8; padding: 14px; }
.branch-management-notice { display: grid; gap: 2px; border-radius: 8px; padding: 9px 11px; }
.branch-management-notice.parent { border: 1px solid #93c5fd; background: #eff6ff; color: #1e3a8a; }
.branch-management-notice.delegated { border: 1px solid #86efac; background: #f0fdf4; color: #14532d; }
.access-people-list { display: grid; gap: 8px; }
.access-person-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) auto; gap: 12px; align-items: center; border: 1px solid rgba(15, 23, 42, .1); border-radius: 8px; background: #fff; padding: 10px; }
.access-person-row > div { display: grid; gap: 3px; }
.access-person-row small, .access-person-row span { overflow-wrap: anywhere; }
.access-permissions-editor { grid-column: 1 / -1; margin-top: 4px; }
.compact-pending-list { max-height: 260px; overflow: auto; }
.parent-branch-management-banner { position: sticky; top: 8px; z-index: 900; display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; border: 2px solid #2563eb; border-radius: 8px; background: #eff6ff; padding: 10px 12px; box-shadow: 0 10px 28px rgba(37, 99, 235, .18); }
.parent-branch-management-banner > div { display: grid; gap: 2px; }
@media (max-width: 900px) {
  .access-branch-summary, .access-person-row { grid-template-columns: 1fr; }
  .access-branch-summary button { justify-self: start; }
  .parent-branch-management-banner { position: static; align-items: stretch; flex-direction: column; }
}
.branch-activity-panel { grid-column: 1 / -1; display: grid; gap: 18px; }
.branch-activity-global-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid #16a34a; border-radius: 14px; background: #f0fdf4; }
.branch-activity-kpis { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; }
.branch-activity-kpis > div { display: grid; gap: 5px; padding: 14px; border: 1px solid rgba(15, 23, 42, .1); border-radius: 14px; background: #f8fafc; }
.branch-activity-kpis span, .branch-activity-table small { color: #64748b; font-size: .8rem; }
.branch-activity-kpis b { font-size: 1.35rem; }
.branch-activity-chart { min-height: 190px; display: grid; grid-template-columns: repeat(12, minmax(28px, 1fr)); gap: 8px; align-items: end; padding: 18px 12px 8px; border-radius: 16px; background: linear-gradient(180deg, #eff6ff, #fff); overflow-x: auto; }
.branch-activity-chart > div { height: 150px; min-width: 32px; display: grid; grid-template-rows: 1fr auto auto; gap: 3px; text-align: center; }
.branch-activity-chart span { display: flex; align-items: end; justify-content: center; }
.branch-activity-chart i { width: min(28px, 72%); min-height: 2px; display: block; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg, #22c55e, #15803d); transition: height .3s ease; }
.branch-activity-chart b { font-size: .78rem; }
.branch-activity-chart small { color: #64748b; font-size: .68rem; }
.branch-activity-table-wrap { max-height: 420px; overflow: auto; border: 1px solid rgba(15, 23, 42, .1); border-radius: 14px; }
.branch-activity-table { width: 100%; margin: 0; }
.branch-activity-table thead { position: sticky; top: 0; z-index: 1; background: #f8fafc; }
.branch-activity-global-row { background: #f0fdf4; font-weight: 700; }
.branch-activity-table td:first-child { display: grid; gap: 2px; min-width: 170px; }
@media (max-width: 1050px) { .branch-activity-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .branch-activity-kpis { grid-template-columns: repeat(2, 1fr); } }
.generated-code-panel { position: fixed; z-index: 1500; top: 50%; left: 50%; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; transform: translate(-50%, -50%); margin: 0; padding: 24px; border: 3px solid #2563eb; border-radius: 18px; background: #eff6ff; box-shadow: 0 30px 90px rgba(15, 23, 42, .48); display: grid; gap: 16px; }

.branch-location-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.generated-code-panel dl { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0; }
.generated-code-panel dl div { display: grid; gap: 4px; }
.generated-code-panel dt { color: #475569; font-size: .82rem; }
.generated-access-code { font-size: 1.25rem; font-weight: 900; letter-spacing: .12em; }
.access-management-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(15, 23, 42, .68); padding: 24px; overflow: auto; }
.access-management-window { width: min(1180px, 100%); margin: 18px auto; background: #f8fafc; border-radius: 22px; box-shadow: 0 28px 80px rgba(15, 23, 42, .35); padding: 22px; }
.access-management-window-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }

.branch-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(4px);
}

.branch-modal-window {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .3);
}

.branch-location-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbf8;
}
.branch-profile-location-map { width: 100%; min-height: 300px; }
.branch-location-editor .error { color: #b42318; font-weight: 800; }
.branch-location-editor .ok { color: #146c43; font-weight: 800; }
@media (max-width: 620px) {
  .branch-modal-backdrop { padding: 8px; }
  .branch-modal-window { max-height: calc(100dvh - 16px); padding: 16px; }
  .branch-profile-location-map { min-height: 240px; }
}

.bingo-creation-window {
  max-width: 520px;
  text-align: center;
}

.bingo-creation-window .loading-spinner {
  display: block;
  margin: 20px auto 4px;
}

.bingo-creation-progress {
  display: block;
  margin-top: 14px;
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.dashboard-branch-register-form {
  margin-top: 18px;
  padding-bottom: 8px;
}

.branch-registration-map {
  min-height: 240px;
  height: 240px;
  max-height: 240px;
}

.branch-registration-actions {
  position: sticky;
  bottom: -24px;
  z-index: 1001;
  margin: 0 -24px -24px;
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(15, 23, 42, .12);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -12px 30px rgba(15, 23, 42, .08);
}

.form-error:empty { display: none; }
.form-error { color: #b42318; font-weight: 700; }

.dashboard-branch-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 14px;
  background: #fff;
  color: #172033;
  text-align: left;
}

.dashboard-branch-button span:first-child {
  display: grid;
  gap: 3px;
}

.dashboard-branch-button small {
  color: #667085;
  font-weight: 500;
}

.dashboard-branch-button:hover {
  border-color: #e94b5f;
  transform: translateY(-1px);
}

.welcome-offer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-color: rgba(233, 75, 95, .28);
  background: linear-gradient(135deg, #fff 0%, #fff6f7 100%);
}

.welcome-offer-card h3,
.welcome-offer-card p {
  margin: 4px 0 0;
}

.welcome-offer-deployment {
  display: grid;
  gap: 16px;
}

.welcome-offer-deployment input[type="range"] {
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 720px) {
  .welcome-offer-card {
    align-items: stretch;
    flex-direction: column;
  }
}

.company-map-card {
  grid-column: span 2;
  min-height: 306px;
  background: #091416;
  color: #ffffff;
}

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

.company-map-heading span {
  color: #ffffff;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.company-map-heading strong {
  color: #9fe18f;
  white-space: nowrap;
}

.company-map-counter {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(159, 225, 143, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.88rem;
}

.company-map-counter b {
  color: #9fe18f;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.company-dashboard-map {
  min-height: 252px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #dfe9de;
}

.company-dashboard-map .leaflet-control-zoom a {
  color: #102a33;
}

.company-coverage-label {
  display: grid;
  gap: 2px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(12, 22, 28, 0.78);
  color: #ffffff;
  padding: 8px 10px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
}

.company-coverage-label strong,
.company-coverage-label span,
.company-coverage-label small {
  display: block;
  line-height: 1.12;
}

.company-coverage-label strong {
  font-size: 0.85rem;
  text-transform: uppercase;
}

.company-coverage-label span {
  font-size: 0.78rem;
  font-weight: 800;
}

.company-coverage-label small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.7rem;
}

.company-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.company-map-legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.company-map-legend i {
  width: 12px;
  height: 12px;
  border: 2px solid var(--legend-color);
  border-radius: 50%;
  background: color-mix(in srgb, var(--legend-color) 18%, transparent);
}

.company-map-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
}

.company-showcase-footer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  gap: 16px;
  align-items: center;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(8, 22, 24, 0.96), rgba(22, 43, 45, 0.92));
  color: #ffffff;
  padding: 15px 18px;
}

.company-showcase-footer div {
  display: grid;
  gap: 3px;
}

.company-showcase-footer span {
  color: rgba(255, 255, 255, 0.76);
}

.offer-progress {
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.offer-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #78c46d, #f9c74f);
}

.company-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.company-card.compact,
.company-bingo-card.compact {
  min-height: 0;
}

.company-bingo-card {
  align-content: center;
  background:
    radial-gradient(circle at 82% 32%, rgba(234, 179, 8, 0.18), transparent 24%),
    linear-gradient(135deg, #14110a, #221b0d 58%, #070707);
  color: #ffffff;
}

.company-bingo-card .eyebrow,
.company-bingo-card strong {
  color: #f9c74f;
}

@media (max-width: 1180px) {
  .company-showcase-shell {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr);
  }

  .company-showcase-hero,
  .company-map-card,
  .company-showcase-footer {
    grid-column: 1 / -1;
  }
}

@media (max-width: 880px) {
  .company-showcase-shell,
  .company-support-grid {
    grid-template-columns: 1fr;
  }

  .company-showcase-hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .company-logo-stage {
    width: min(210px, 54vw);
  }

  .company-showcase-footer {
    grid-template-columns: 1fr;
  }

  .company-map-card {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .company-showcase-hero,
  .company-card,
  .company-map-card,
  .company-bingo-card,
  .company-showcase-footer {
    padding: 16px;
  }

  .company-profile-card div,
  .result-line,
  .company-map-heading {
    grid-template-columns: 1fr;
  }

  .company-map-heading {
    display: grid;
  }

  .company-map-heading strong {
    white-space: normal;
  }
}

/* Dashboard compacto: preserva o destaque da identidade e reduz os blocos operacionais. */
.dashboard-small-action {
  width: auto;
  min-width: 0;
  padding: 7px 12px;
  font-size: .82rem;
  white-space: nowrap;
}

.dashboard-qr-entry {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px 12px;
}

.dashboard-qr-entry > div { display: grid; gap: 2px; }
.dashboard-qr-entry > div > span:last-child { font-size: .78rem; }

.welcome-offer-card {
  min-height: 0;
  gap: 12px;
  padding: 10px 12px;
}

.welcome-offer-card h3 { margin-top: 2px; font-size: 1.05rem; }
.welcome-offer-card p { margin-top: 2px; font-size: .78rem; }

.company-showcase-hero {
  grid-column: span 2;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  min-height: 250px;
}

.company-logo-stage { width: min(255px, 34vw); }
.company-showcase-copy h2 { font-size: clamp(2.35rem, 4.8vw, 3.8rem); }
.company-profile-card { border-width: 2px; border-color: rgba(21, 115, 71, .48); box-shadow: 0 12px 30px rgba(16, 82, 49, .12); }
.company-profile-card { align-self: stretch; }
.company-profile-card dd { font-size: 1rem; }

.branch-activity-panel {
  gap: 8px;
  padding: 10px 12px;
}

.compact-activity-heading { margin: 0; }
.branch-activity-global-title {
  gap: 10px;
  padding: 6px 10px;
  border-width: 1px;
  border-radius: 8px;
}

.branch-activity-kpis > div {
  gap: 2px;
  padding: 7px 9px;
  border-radius: 8px;
}

.branch-activity-kpis b { font-size: 1.05rem; }
.branch-activity-chart {
  min-height: 0;
  height: 88px;
  gap: 6px;
  padding: 6px 10px 4px;
  border-radius: 8px;
}

.branch-activity-chart > div {
  height: 76px;
  min-width: 28px;
  gap: 1px;
}

.communication-message-actions { display: flex; justify-content: flex-end; }
.nav-unread-badge { display: inline-grid; min-width: 20px; height: 20px; margin-left: auto; place-items: center; border-radius: 999px; background: #dc2626; color: #fff; padding: 0 6px; font-size: .72rem; font-weight: 900; }
.communications-window { min-height: 520px; }
.communications-layout { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr); gap: 12px; }
.communications-sidebar { align-self: start; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.communications-sidebar > strong { display: block; padding: 10px 11px; }
.communications-sidebar > div { display: grid; max-height: 520px; overflow: auto; }
.communications-sidebar button { display: flex; justify-content: space-between; gap: 8px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--text); padding: 9px 10px; text-align: left; }
.communications-sidebar button.active { background: #dcfce7; color: #14532d; }
.communications-sidebar button span { display: flex; min-width: 0; align-items: center; gap: 6px; }
.communications-sidebar button img { width: 24px; height: 24px; border-radius: 50%; object-fit: contain; }
.communications-sidebar button b { display: grid; min-width: 20px; height: 20px; place-items: center; border-radius: 999px; background: #dc2626; color: #fff; font-size: .7rem; }
.communications-dialog { display: grid; min-width: 0; grid-template-rows: auto minmax(260px, 1fr) auto; gap: 10px; }
.communications-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.new-message-alert { border-radius: 999px; background: #fee2e2; color: #b91c1c; padding: 5px 9px; font-size: .78rem; font-weight: 900; }
.communication-thread { display: grid; max-height: 480px; overflow: auto; align-content: start; gap: 8px; padding-right: 4px; }
.communication-message { display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px; }
.communication-message.unread { border-left: 5px solid #dc2626; background: #fff7f7; }
.communication-message p { margin: 0; white-space: pre-wrap; }
.communication-attachment { width: fit-content; border-radius: 7px; background: #eff6ff; color: #1d4ed8; padding: 7px 9px; font-weight: 800; text-decoration: none; }
.communication-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, auto) auto; gap: 8px; align-items: end; border-top: 1px solid var(--line); padding-top: 10px; }
.communication-composer textarea { min-height: 72px; resize: vertical; }
.communication-attach-button { display: grid; width: 42px; height: 42px; cursor: pointer; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 1.2rem; }
.communication-attach-button input { display: none; }
.communication-readonly { border-radius: 8px; background: #f8fafc; padding: 10px; }
@media (max-width: 760px) { .communications-layout { grid-template-columns: 1fr; } .communications-sidebar > div { max-height: 210px; } .communication-composer { grid-template-columns: 1fr auto; } .communication-composer textarea { grid-column: 1 / -1; } }

@media (max-width: 1180px) {
  .company-showcase-hero { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .dashboard-qr-entry { grid-template-columns: 1fr; }
  .dashboard-small-action { justify-self: start; }
  .company-showcase-hero { grid-template-columns: 1fr; }
  .branch-activity-global-title { align-items: flex-start; flex-direction: column; }
}

.ops-card p,
.section-card.compact p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.lot-config-panel {
  align-content: start;
}

.lot-config-panel .form-grid.embedded {
  margin-top: 4px;
}

.lot-deployment-panel {
  border-color: rgba(21, 115, 71, 0.28);
  background:
    linear-gradient(135deg, rgba(21, 115, 71, 0.08), transparent 48%),
    var(--panel);
}

.reinforcement-list {
  display: grid;
  gap: 8px;
}

.reinforcement-option {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) repeat(3, minmax(70px, auto)) minmax(130px, auto);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.section-card.compact h3 {
  margin: 0;
  font-size: 16px;
}

.lot-data-grid {
  display: grid;
  gap: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(16, 42, 51, 0.06);
}

.lot-row,
.purchased-lot-row {
  display: grid;
  align-items: center;
  min-width: 840px;
  border-bottom: 1px solid var(--line);
}

.lot-row {
  grid-template-columns: minmax(180px, 1.25fr) minmax(92px, 0.65fr) minmax(78px, 0.55fr) minmax(86px, 0.58fr) minmax(92px, 0.62fr) minmax(92px, 0.62fr) minmax(150px, 0.8fr);
}

.purchased-lot-row {
  grid-template-columns: minmax(92px, 0.55fr) minmax(190px, 1.35fr) minmax(110px, 0.72fr) minmax(130px, 0.8fr) minmax(140px, 0.8fr) minmax(140px, 0.75fr);
}

.lot-grid-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f7f5;
  color: #355047;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.lot-grid-header span,
.lot-cell {
  padding: 10px 12px;
}

.lot-cell {
  min-width: 0;
  color: #18332d;
  font-size: 14px;
}

.lot-cell-main strong,
.lot-price {
  color: var(--accent-dark);
}

.lot-row:not(.lot-grid-header),
.purchased-lot-row:not(.lot-grid-header) {
  background: #fff;
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.lot-row:not(.lot-grid-header):hover,
.purchased-lot-row:not(.lot-grid-header):hover {
  background: #f8fbfd;
}

.lot-row.selected,
.purchased-lot-row.selected {
  background: #f0fdf4;
  box-shadow: inset 3px 0 0 var(--accent);
}

.lot-actions {
  display: flex;
  justify-content: flex-end;
}

.lot-actions button {
  min-height: 36px;
  padding: 8px 10px;
  white-space: nowrap;
}

.lot-detail {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(21, 115, 71, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(21, 115, 71, 0.08), transparent 42%),
    var(--panel);
  padding: 18px;
  box-shadow: 0 16px 38px rgba(16, 42, 51, 0.1);
}

.lot-management-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.lot-management-stats .stat strong {
  font-size: 18px;
}

.lot-management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lot-direct-activation-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.lot-subpanel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.lot-subpanel.compact-summary {
  background: #f8fbfd;
}

.activation-panel {
  gap: 14px;
}

.activation-controls {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.activation-controls label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.activation-controls input[type="range"] {
  width: 100%;
}

.activation-final-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  max-width: 520px;
}

.activation-final-controls button {
  flex: 0 0 auto;
}

.compact-button {
  min-height: 38px;
  padding-inline: 12px;
}

.activation-map-shell {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef7f2;
}

.activation-map {
  min-height: 320px;
}

.activation-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.activation-status-row strong {
  color: var(--accent-dark);
}

.activation-selection {
  display: grid;
  gap: 10px;
}

.selection-list {
  display: grid;
  gap: 8px;
}

.selection-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-empty {
  padding: 14px;
}

.qty-input {
  width: 72px;
  min-height: 36px;
}

.primary-wide {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.payment-methods-panel {
  margin-top: 16px;
}

.payment-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.payment-method-grid article {
  display: grid;
  gap: 6px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.payment-method-grid article p {
  margin: 0;
}

.payment-qr {
  display: grid;
  place-items: center;
  width: 96px;
  aspect-ratio: 1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #f8fafc 0 8px, #e2e8f0 8px 16px);
  color: var(--muted);
  font-weight: 800;
}

.test-payment-card {
  border-color: #f59e0b !important;
  background: #fffbeb !important;
}

.deployment-map {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 16px;
  align-items: center;
}

.deployment-map-stage {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(16, 42, 51, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 42, 51, 0.05) 1px, transparent 1px),
    #f7fbf8;
  background-size: 24px 24px;
  padding: 20px;
}

.leaflet-company-map {
  position: relative;
  width: 100%;
  min-height: 320px;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.deployment-area {
  position: absolute;
  inset: 12%;
  z-index: 1;
  display: block;
  border: 2px solid #f87171;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.08);
  pointer-events: none;
}

.deployment-area.accepted {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.deployment-circle {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid #fca5a5;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.08);
}

.deployment-circle.accepted {
  border-color: #86efac;
  background: rgba(34, 197, 94, 0.08);
}

.deployment-center,
.preview-flag {
  position: absolute;
  display: block;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.deployment-center {
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #102a33;
  box-shadow: 0 0 0 4px rgba(16, 42, 51, 0.12);
}

.preview-flag {
  width: 5px;
  height: 5px;
  background: var(--accent);
}

.deployment-result {
  border-left: 4px solid #f87171;
  background: #fff7f7;
  padding: 12px;
}

.deployment-result.accepted {
  border-left-color: #22c55e;
  background: #f0fdf4;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(16, 42, 51, 0.06);
}

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

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

th {
  background: #f3f7f5;
  color: #355047;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 8px;
  background: #fff;
  color: var(--muted);
}

.badge.active {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
  font-weight: 700;
}

.badge.pending,
.badge.scheduled,
.badge.draft {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--warning);
}

.badge.inactive,
.badge.cancelled,
.badge.expired,
.badge.redeemed {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

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

.empty-state {
  display: grid;
  gap: 4px;
  border: 1px dashed #c8d6cf;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 18px;
}

.empty-state strong {
  color: var(--text);
}

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

.code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  word-break: break-all;
}

.scanner-panel,
.policy-panel {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.scanner-panel h2,
.policy-panel h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.scanner-panel p,
.policy-panel p {
  margin: 0;
}

.qr-video {
  width: min(100%, 520px);
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  object-fit: cover;
}

@media (max-width: 820px) {
  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar-actions,
  .company-pill {
    width: 100%;
  }

  .dashboard-hero,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .deployment-map {
    grid-template-columns: 1fr;
  }

  .activation-controls {
    grid-template-columns: auto 1fr auto;
  }

  .activation-controls strong {
    grid-column: 1 / -1;
  }

  .activation-status-row,
  .activation-status-row .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .activation-final-controls,
  .activation-final-controls button {
    max-width: none;
    width: 100%;
  }

  .lot-data-grid {
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 8px;
    overflow: visible;
  }

  .lot-grid-header {
    display: none;
  }

  .lot-row,
  .purchased-lot-row {
    grid-template-columns: 1fr;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(16, 42, 51, 0.06);
  }

  .lot-catalog .catalog-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 6px;
  }

  .lot-catalog .catalog-row .lot-cell {
    min-height: 54px;
  }

  .lot-catalog .catalog-row .lot-cell-main,
  .lot-catalog .catalog-row .lot-actions {
    grid-column: 1 / -1;
  }

  .lot-cell {
    display: grid;
    grid-template-columns: minmax(92px, 0.55fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid #eef2f7;
    padding: 8px 10px;
  }

  .lot-cell::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .lot-actions {
    justify-content: stretch;
  }

  .lot-actions button {
    width: 100%;
    justify-content: center;
  }

  .reinforcement-option {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .login-panel h1 {
    font-size: 21px;
  }

  .sidebar {
    padding: 14px;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
  }

  .topbar button {
    width: 100%;
  }

  .form-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .actions button {
    flex: 1 1 140px;
  }

  table {
    min-width: 680px;
  }

  .qr-video {
    min-height: 220px;
  }
}

/* ZAP-FLAGS 009/1 visual identity */
:root {
  --bg: #eef4ef;
  --panel: #ffffff;
  --line: #d9e4dc;
  --text: #071113;
  --muted: #56666d;
  --accent: #3d8f24;
  --accent-dark: #145e2d;
  --nav: #082714;
  --nav-soft: #174f25;
  --ok: #2f7d1c;
}

body {
  background:
    linear-gradient(180deg, rgba(61, 143, 36, 0.08), rgba(255, 255, 255, 0)),
    var(--bg);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

.login-view {
  background:
    radial-gradient(circle at 14% 12%, rgba(61, 143, 36, 0.12), transparent 30%),
    linear-gradient(180deg, #f7faf7 0%, #eef5ee 100%);
}

.login-panel {
  border-color: rgba(61, 143, 36, 0.22);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 26px 70px rgba(8, 39, 20, 0.16);
  backdrop-filter: blur(18px);
}

.company-login-brand,
.company-page-title,
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-login-brand {
  margin-bottom: 14px;
  color: var(--accent-dark);
  font-weight: 900;
}

.company-login-brand img,
.brand img,
.company-page-title img,
.invoice-brand img {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.brand {
  padding: 10px 8px 18px;
}

.brand div {
  display: grid;
  gap: 2px;
}

.sidebar {
  border-right: 0;
  background:
    linear-gradient(180deg, rgba(61, 143, 36, 0.22), transparent 260px),
    var(--nav);
  box-shadow: 12px 0 38px rgba(8, 39, 20, 0.12);
}

.nav button,
.ghost-button {
  border-radius: 8px;
}

.nav button.active,
.nav button:hover,
.ghost-button:hover {
  background: linear-gradient(90deg, rgba(61, 143, 36, 0.95), rgba(33, 112, 39, 0.84));
}

.workspace {
  padding: 22px;
}

.topbar,
.dashboard-hero,
.section-card,
.form-grid,
.stat,
.company-pill,
.message {
  border-radius: 8px;
  border-color: rgba(8, 39, 20, 0.12);
  box-shadow: 0 12px 36px rgba(8, 39, 20, 0.08);
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.stat {
  background:
    linear-gradient(180deg, rgba(61, 143, 36, 0.08), rgba(255, 255, 255, 0)),
    #ffffff;
}

.stat strong {
  color: var(--text);
}

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

.dashboard-hero {
  background:
    radial-gradient(circle at 12% 14%, rgba(61, 143, 36, 0.1), transparent 30%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 244, 0.94));
}

.invoice-card {
  position: relative;
  overflow: hidden;
}

.invoice-card::before {
  content: "";
  position: absolute;
  inset: 8% 18%;
  background: url("/public/assets/larforyou-watermark.png") center / contain no-repeat;
  opacity: 0.12;
  pointer-events: none;
}

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

.invoice-brand,
.invoice-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-brand {
  color: var(--accent-dark);
  font-size: 1.2rem;
  font-weight: 900;
}

.invoice-footer {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding-top: 12px;
}

.invoice-actions {
  display: grid;
  gap: 4px;
  min-width: 120px;
}

.invoice-actions a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.test-invoice-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.test-document-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c74231;
  border-radius: 6px;
  background: #fff1ee;
  color: #9f281c;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  padding: 7px 10px;
}

.test-invoice-document {
  border: 1px solid rgba(8, 39, 20, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  overflow: hidden;
}

.test-invoice-document > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
}

.test-invoice-document > summary::-webkit-details-marker { display: none; }
.test-invoice-document > summary::after { content: "+"; color: var(--accent-dark); font-size: 1.35rem; font-weight: 900; }
.test-invoice-document[open] > summary::after { content: "−"; }
.test-invoice-document > summary span { display: grid; gap: 3px; }
.test-invoice-document > summary span:nth-child(2) { margin-left: auto; text-align: right; }
.test-invoice-document > summary small { color: var(--muted); }

.test-invoice-sheet {
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: #17221a;
  padding: clamp(16px, 3vw, 30px);
}

.test-invoice-warning {
  display: grid;
  gap: 3px;
  border: 2px solid #c74231;
  border-radius: 6px;
  background: #fff1ee;
  color: #932317;
  padding: 10px 14px;
  text-align: center;
}

.test-invoice-warning strong { font-size: 1rem; letter-spacing: 0.06em; }
.test-invoice-warning span { font-size: 0.82rem; }

.test-invoice-header,
.test-invoice-customer,
.test-invoice-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  gap: 24px;
}

.test-invoice-issuer p,
.test-invoice-customer p,
.test-invoice-payment p { margin: 3px 0; }

.test-invoice-identification,
.test-invoice-tax dl,
.test-invoice-totals {
  display: grid;
  gap: 7px;
  margin: 0;
}

.test-invoice-identification > div,
.test-invoice-tax dl > div,
.test-invoice-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #dbe4dc;
  padding-bottom: 6px;
}

.test-invoice-identification dt,
.test-invoice-tax dt,
.test-invoice-totals dt { color: #607065; }
.test-invoice-identification dd,
.test-invoice-tax dd,
.test-invoice-totals dd { margin: 0; font-weight: 800; text-align: right; }

.test-invoice-customer {
  border: 1px solid #dbe4dc;
  border-radius: 6px;
  padding: 14px;
}

.test-invoice-customer h4 { grid-column: 1 / -1; margin: 0; }
.test-invoice-lines table { min-width: 780px; }
.test-invoice-lines th { background: #edf5ed; color: #294532; }
.test-invoice-lines td:last-child { color: #163c21; }

.test-invoice-summary { align-items: start; }
.test-invoice-tax,
.test-invoice-totals,
.test-invoice-payment {
  border: 1px solid #dbe4dc;
  border-radius: 6px;
  padding: 14px;
}

.test-invoice-tax h4,
.test-invoice-payment h4 { margin: 0 0 10px; }
.test-invoice-totals .grand-total { border-bottom: 0; color: #153f20; font-size: 1.14rem; padding-top: 5px; }

.test-invoice-legal {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid #ccd8ce;
  color: #932317;
  font-size: 0.78rem;
  padding-top: 12px;
}

.branch-invoice-copies { margin-top: 20px; }

@media (max-width: 780px) {
  .company-page-title img {
    display: none;
  }

  .test-invoice-header,
  .test-invoice-customer,
  .test-invoice-summary { grid-template-columns: 1fr; }
  .test-invoice-customer h4 { grid-column: 1; }
  .test-invoice-legal { flex-direction: column; }
}

.pec-remaining-flags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(61, 143, 36, .3);
  border-radius: 8px;
  background: rgba(61, 143, 36, .08);
  padding: 11px 13px;
}

.pec-remaining-flags span { color: var(--muted); }
.pec-remaining-flags strong { color: var(--accent-dark); font-size: 1.35rem; }

.pec-lot-validity {
  display: grid;
  gap: 5px;
  border: 2px solid rgba(39, 93, 163, .28);
  border-radius: 8px;
  background: rgba(39, 93, 163, .08);
  padding: 11px 13px;
}

.pec-lot-validity span { color: #4c627c; font-weight: 750; }
.pec-lot-validity strong { color: #194d88; font-size: 1.35rem; }
.pec-lot-validity small { color: #4c627c; line-height: 1.35; }

/* --------------------------------------------------------------------------
   017-150 — Centro Empresarial ZAP-FLAGS
   Camada visual integral. Mantem os IDs, formularios e a logica existentes.
   -------------------------------------------------------------------------- */

:root {
  --bg: #edf3ee;
  --panel: #ffffff;
  --panel-soft: #f6faf6;
  --panel-tint: #edf7ef;
  --line: #d8e3da;
  --line-strong: #bfd1c2;
  --text: #10251b;
  --muted: #617269;
  --accent: #338f43;
  --accent-bright: #62b84f;
  --accent-dark: #185d31;
  --nav: #123d29;
  --nav-soft: #20593b;
  --danger: #b42318;
  --warning: #9a6700;
  --ok: #237a3b;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-soft: 0 10px 28px rgba(22, 58, 37, .08);
  --shadow-card: 0 18px 48px rgba(22, 58, 37, .10);
  --shadow-float: 0 28px 80px rgba(9, 37, 23, .22);
}

html { color-scheme: light; }

body {
  background:
    radial-gradient(circle at 78% -8%, rgba(98, 184, 79, .14), transparent 30rem),
    linear-gradient(180deg, #f5f8f5 0, var(--bg) 44rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: -.005em;
}

body::before {
  background:
    linear-gradient(rgba(18, 61, 41, .024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 61, 41, .024) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: .6;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 18px rgba(24, 93, 49, .15);
  color: #fff;
  padding: 0 16px;
  font-weight: 780;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

button:hover {
  background: linear-gradient(135deg, #3d9d4d, #14532d);
  box-shadow: 0 11px 24px rgba(24, 93, 49, .22);
  transform: translateY(-1px);
}

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

button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  box-shadow: 0 4px 12px rgba(20, 51, 34, .05);
  color: var(--accent-dark);
}

button.secondary:hover {
  border-color: var(--accent);
  background: var(--panel-tint);
}

button.danger { background: linear-gradient(135deg, #c4372b, #8f1d17); }
button.warning { background: linear-gradient(135deg, #b77b12, #815207); }

input,
select,
textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfdfb;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:hover,
select:hover,
textarea:hover { border-color: var(--line-strong); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(51, 143, 67, .12);
}

label {
  color: #506258;
  font-size: .78rem;
  font-weight: 760;
  letter-spacing: .01em;
}

/* Entrada e registo */

.login-view {
  display: grid;
  grid-template-columns: minmax(400px, 1.08fr) minmax(430px, .92fr);
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  overflow: visible;
  background: #f4f8f4;
}

.company-auth-showcase {
  position: sticky;
  top: 0;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(8, 45, 26, .34), rgba(8, 45, 26, .76)),
    url("./assets/zap-flags-entry-background.png") center / cover no-repeat;
  color: #fff;
}

.company-auth-showcase::before,
.company-auth-showcase::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
}

.company-auth-showcase::before { width: 34rem; height: 34rem; right: -12rem; top: -12rem; }
.company-auth-showcase::after { width: 22rem; height: 22rem; left: -9rem; bottom: -7rem; }

.company-auth-showcase-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 28% 20%, rgba(125, 214, 91, .28), transparent 25rem),
    linear-gradient(180deg, rgba(5, 34, 20, .10), rgba(5, 34, 20, .72));
}

.company-auth-showcase-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  min-height: 100%;
  padding: clamp(32px, 6vw, 82px);
}

.company-auth-showcase-brand,
.company-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-auth-showcase-brand img {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .18);
  object-fit: contain;
  padding: 7px;
}

.company-auth-showcase-brand div,
.company-login-brand div { display: grid; gap: 1px; }
.company-auth-showcase-brand strong { font-size: 1.1rem; letter-spacing: .08em; }
.company-auth-showcase-brand span { color: rgba(255, 255, 255, .74); }

.company-auth-showcase-copy { max-width: 650px; }
.company-auth-kicker {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
  padding: 7px 12px;
  color: #e9ffd9;
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.company-auth-showcase-copy h2 {
  max-width: 620px;
  margin: 20px 0 16px;
  color: #fff;
  font-size: clamp(2.55rem, 5vw, 5.3rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.company-auth-showcase-copy p {
  max-width: 570px;
  margin: 0;
  color: rgba(255, 255, 255, .82);
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  line-height: 1.55;
}

.company-auth-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.company-auth-feature-grid div {
  display: grid;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, .32);
  padding: 14px 4px 0;
}

.company-auth-feature-grid strong { color: #b9ec78; font-size: .78rem; }
.company-auth-feature-grid span { color: #fff; font-weight: 750; }
.company-auth-showcase-content > small { color: rgba(255, 255, 255, .68); }

.login-panel {
  align-self: start;
  width: min(760px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background: #f8fbf8;
  box-shadow: none;
  padding: clamp(34px, 7vw, 88px);
}

.company-login-brand {
  margin-bottom: 28px;
  color: var(--accent-dark);
}

.company-login-brand img {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 6px;
}

.company-login-brand strong { font-size: 1.05rem; }
.company-login-brand span { color: var(--muted); font-size: .76rem; }
.login-panel h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.045em; }
.login-panel > .support-copy { max-width: 560px; }
.login-panel .stack { gap: 16px; }
.login-panel #login-form { max-width: 510px; margin-top: 30px; }
.login-panel #register-company-form { max-width: 100%; }
.login-panel #register-company-form:not(.hidden) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* O registo e uma pagina de trabalho limpa: a apresentacao fotografica pertence
   apenas a entrada e nunca deve ficar visivel por tras do formulario. */
.login-view.company-registration-open {
  grid-template-columns: minmax(0, 1fr);
}

.login-view.company-registration-open .company-auth-showcase {
  display: none;
}

.login-view.company-registration-open .login-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
}

#register-company-form > h2,
#register-company-form > .auth-top-actions,
#register-company-form > .company-register-location-panel,
#register-company-form > .upload-panel,
#register-company-form > .checkbox-row,
#register-company-form > button,
#register-company-form > .error { grid-column: 1 / -1; }

.auth-top-actions { margin-bottom: 4px; }
.link-button { color: var(--accent-dark); font-weight: 780; box-shadow: none; }

/* A navegacao do registo permanece visivel mesmo num formulario longo. */
.company-register-navigation {
  position: sticky;
  top: 12px;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(248, 251, 248, .96);
  box-shadow: var(--shadow-soft);
  padding: 10px 12px;
  backdrop-filter: blur(12px);
}

.company-register-navigation .link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 0 14px;
  text-decoration: none;
}

.company-register-navigation .link-button:hover {
  border-color: var(--accent);
  background: #edf7ef;
  text-decoration: none;
}

/* Estrutura do portal */

.app-view {
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 20px;
  border: 0;
  background:
    radial-gradient(circle at 15% 5%, rgba(123, 205, 91, .24), transparent 18rem),
    linear-gradient(165deg, #174d33 0%, #0b2e1f 72%);
  box-shadow: 14px 0 44px rgba(10, 42, 27, .13);
  color: #fff;
  padding: 24px 18px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .13);
  padding: 3px 5px 21px;
}

.brand img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .17);
  object-fit: contain;
  padding: 6px;
}

.brand strong { color: #fff; font-size: 1.02rem; letter-spacing: .02em; }
.brand-portal-label { color: #a7d69d !important; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.active-company-name { max-width: 164px; color: #eef8ef !important; font-size: .85rem; }
.active-company-nif { color: rgba(226, 244, 230, .62) !important; }

.nav {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}

.nav button,
.ghost-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: rgba(242, 250, 244, .76);
  padding: 0 12px;
  font-weight: 690;
  text-align: left;
}

.nav button:hover,
.ghost-button:hover {
  border-color: rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .075);
  box-shadow: none;
  color: #fff;
  transform: none;
}

.nav button.active {
  border-color: rgba(170, 226, 132, .26);
  background: linear-gradient(90deg, rgba(107, 181, 75, .34), rgba(255, 255, 255, .08));
  box-shadow: inset 3px 0 0 #9add69, 0 9px 22px rgba(0, 0, 0, .11);
  color: #fff;
}

.nav-icon { width: 21px; height: 21px; flex: 0 0 auto; color: #9ed68a; }
.nav button.active .nav-icon { color: #cbf5aa; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-unread-badge { margin-left: auto; border: 2px solid #16462f; background: #e94b5f; }

.ghost-button {
  border-color: rgba(255, 255, 255, .13);
  color: rgba(255, 255, 255, .76);
}

.ghost-button::before {
  content: "↗";
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: #9ed68a;
  font-size: 1rem;
}

.workspace {
  min-width: 0;
  padding: 22px clamp(18px, 3vw, 42px) 44px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 35;
  min-height: 82px;
  margin-bottom: 24px;
  border: 1px solid rgba(190, 207, 194, .74);
  border-radius: var(--radius-lg);
  background: rgba(250, 253, 250, .88);
  box-shadow: 0 14px 38px rgba(24, 59, 37, .09);
  padding: 13px 15px 13px 20px;
  backdrop-filter: blur(18px) saturate(1.2);
}

.company-page-title { gap: 13px; }
.company-page-title > img {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--panel-tint);
  object-fit: contain;
  padding: 5px;
}

.topbar h1 { color: var(--text); font-size: clamp(1.45rem, 2.4vw, 2rem); letter-spacing: -.04em; }
.topbar p { color: var(--muted); font-size: .85rem; }

.company-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(20, 55, 35, .07);
  padding: 8px 12px 8px 8px;
}

.company-pill img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
}

.company-pill div { display: grid; gap: 2px; min-width: 0; }
.company-pill strong { max-width: 190px; }
.company-pill span { color: var(--accent-dark); font-weight: 800; }

.message {
  border: 1px solid #bcd6c2;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: #f7fcf7;
  box-shadow: var(--shadow-soft);
  padding: 13px 15px;
}

.content { gap: 20px; }
.content > * { animation: company-content-enter .28s ease both; }
@keyframes company-content-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Componentes globais */

.dashboard-hero,
.section-card,
.company-card,
.company-bingo-card,
.form-grid,
.scanner-panel,
.policy-panel,
.lot-detail,
.lot-subpanel,
.table-wrap,
.lot-data-grid {
  border-color: rgba(190, 207, 194, .72);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--shadow-soft);
}

.section-card,
.company-card,
.company-bingo-card,
.dashboard-hero { padding: clamp(17px, 2.4vw, 26px); }

.section-heading { gap: 18px; }
.section-heading h2,
.section-heading h3 { color: var(--text); letter-spacing: -.025em; }
.section-heading h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
.section-heading p { max-width: 760px; color: var(--muted); }

.eyebrow {
  color: var(--accent-dark);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.metric-chip {
  border: 1px solid #c7dfc9;
  border-radius: 999px;
  background: #eff8ef;
  color: var(--accent-dark);
  padding: 7px 11px;
  font-weight: 850;
}

.form-grid { gap: 15px; padding: clamp(17px, 2.4vw, 25px); }
.form-grid.embedded { background: transparent; padding: 0; box-shadow: none; }
.policy-panel { border-left: 5px solid var(--accent); }
.policy-panel.warning { border-left-color: #d59a1c; background: #fffaf0; }

.stats-grid { gap: 14px; }
.stat {
  min-height: 112px;
  border: 1px solid rgba(190, 207, 194, .72);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(86, 168, 74, .10), transparent 64%),
    #fff;
  box-shadow: var(--shadow-soft);
  padding: 17px;
}
.stat span { color: var(--muted); font-size: .8rem; }
.stat strong { color: var(--text); font-size: clamp(1.5rem, 2.7vw, 2rem); letter-spacing: -.04em; }

.table-wrap,
.lot-data-grid { overflow: auto; }
table { background: #fff; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom-color: #cddbd0;
  background: #eff5f0;
  color: #456052;
  font-size: .68rem;
  letter-spacing: .05em;
}
td { border-bottom-color: #e7eee8; color: #253b2e; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #f6faf6; }

.badge { border-radius: 999px; padding: 5px 9px; font-size: .73rem; font-weight: 760; }
.badge.active { border-color: #c3dfc7; background: #eaf7ec; color: #17652f; }
.badge.pending,
.badge.scheduled,
.badge.draft { border-color: #ead7a8; background: #fff7df; color: #815c0c; }
.badge.cancelled,
.badge.inactive,
.badge.expired,
.badge.redeemed { border-color: #efc5c1; background: #fff1ef; color: #a42920; }

.empty-state {
  border-color: #bdcfbf;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #fbfdfb, #f0f7f1);
  padding: 24px;
}

.activation-command-bar,
.activation-active-strip,
.parent-branch-management-banner,
.generated-code-panel {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.pec-direct-lot-activation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #b9d8bd;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f4faf5, #eaf5ec);
  padding: 16px 18px;
}

.pec-direct-lot-activation > div {
  display: grid;
  gap: 3px;
}

.pec-direct-lot-activation small { color: var(--muted); }

.pec-direct-lot-activation button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

/* Dashboard */

.company-showcase { gap: 20px; }
.company-showcase-shell {
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .58fr);
  gap: 18px;
}

.company-showcase-hero {
  min-height: 310px;
  border: 0;
  border-radius: 26px;
  background:
    radial-gradient(circle at 84% 15%, rgba(174, 231, 130, .26), transparent 15rem),
    linear-gradient(135deg, #1e653d 0%, #0d3825 78%);
  box-shadow: 0 24px 58px rgba(10, 55, 31, .19);
  color: #fff;
  padding: clamp(22px, 3vw, 35px);
}

.company-showcase-hero::after {
  right: -7rem;
  top: -9rem;
  width: 24rem;
  height: 24rem;
  border: 1px solid rgba(255, 255, 255, .13);
  background: transparent;
}

.company-logo-stage {
  width: min(220px, 31vw);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 22px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .20);
  padding: 13px;
}

.company-primary-actions { gap: 7px; }
.company-primary-actions .dashboard-small-action {
  min-height: 38px;
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.10);
  box-shadow: none;
  color: #fff;
  backdrop-filter: blur(8px);
}
.company-primary-actions .dashboard-small-action:hover { background: rgba(255,255,255,.18); }

.company-showcase-copy .eyebrow { color: #bce997; }
.company-showcase-copy h2 {
  color: #fff;
  font-size: clamp(2.3rem, 4.6vw, 4rem);
  letter-spacing: -.055em;
}
.company-showcase-copy p { color: rgba(255,255,255,.73); }

.company-identity-summary span {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
}
.company-identity-summary small { color: rgba(255,255,255,.62); }
.company-identity-summary strong { color: #fff; }

.company-profile-card,
.company-results-card,
.welcome-offer-card { border-radius: var(--radius-lg); }

.company-profile-card dl div { border-bottom-color: #e3ebe4; }
.company-results-card .result-line { border-color: #e1eae2; border-radius: 12px; background: #f7faf7; }

.company-map-card {
  grid-column: 1 / -1;
  border: 1px solid rgba(190, 207, 194, .72);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.company-map-heading strong { color: var(--text); }
.company-map-counter { border-radius: 12px; background: #f0f7f1; }
.company-dashboard-map { min-height: 410px; border-radius: var(--radius-md); }

.company-support-grid { gap: 18px; }
.branch-activity-panel { border-radius: var(--radius-lg); }
.branch-activity-global-title {
  border: 1px solid #bcd9c1;
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-md);
  background: #f0f8f1;
}
.branch-activity-kpis { gap: 9px; }
.branch-activity-kpis > div {
  min-height: 86px;
  border-color: #dce7dd;
  border-radius: 13px;
  background: #fbfdfb;
}
.branch-activity-chart {
  border: 1px solid #e0e9e2;
  border-radius: var(--radius-md);
  background:
    linear-gradient(rgba(50, 103, 67, .055) 1px, transparent 1px),
    linear-gradient(180deg, #f5faf6, #fff);
  background-size: 100% 38px, auto;
}
.branch-activity-chart i { background: linear-gradient(180deg, #86cf5f, #238344); }
.branch-activity-table-wrap { border-radius: var(--radius-md); }

/* Lotes, campanhas, perfil, filiais e comunicações */

.lot-row,
.purchased-lot-row { border-bottom-color: #e5ece6; }
.lot-grid-header { background: #eef5ef; color: #3f5e4c; }
.lot-row.selected,
.purchased-lot-row.selected { background: #edf8ef; box-shadow: inset 4px 0 0 var(--accent); }
.lot-detail { border-color: #c0d8c4; background: linear-gradient(145deg, #f2faf3, #fff 48%); }
.lot-subpanel { border-radius: var(--radius-md); }

.pec-guidance,
.pec-remaining-flags { border-color: #c0dbc4; border-radius: var(--radius-md); background: #f0f8f1; }
.pec-lot-validity { border-color: #bed2e8; border-radius: var(--radius-md); background: #f0f6fc; }
.activation-map-shell,
.leaflet-company-map { border-radius: var(--radius-md); }
.activation-map-step { border-radius: var(--radius-md); }
.field-step { background: var(--accent-dark); color: #fff; }

.company-profile-editor .form-grid { border: 0; box-shadow: none; }
.company-profile-editor .company-logo {
  width: 86px;
  height: 86px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  object-fit: contain;
  padding: 6px;
}
.profile-logo-manager {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid #c0dbc4;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #f0f8f1, #fff 62%);
}
.profile-logo-preview-card { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-logo-preview-card img {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  object-fit: contain;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.profile-logo-preview-card div { display: grid; gap: 5px; min-width: 0; }
.profile-logo-preview-card span { color: var(--muted); overflow-wrap: anywhere; }
.profile-logo-upload { margin: 0; }
.profile-logo-upload input[type="file"] { padding: 10px; background: #fff; }
.profile-logo-upload small { color: var(--muted); font-weight: 500; }
.profile-logo-remove { grid-column: 2; margin: 0; }
@media (max-width: 720px) {
  .profile-logo-manager { grid-template-columns: 1fr; }
  .profile-logo-remove { grid-column: 1; }
}

.communications-window { overflow: hidden; }
.communications-layout { gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); }
.communications-sidebar { border-right: 1px solid var(--line); background: #f0f6f1; padding: 13px; }
.communications-sidebar button { border-radius: 11px; box-shadow: none; }
.communications-sidebar button.active { background: var(--accent-dark); }
.communications-dialog { min-height: 560px; background: #fbfdfb; }
.communication-thread { background: linear-gradient(180deg, #f8fbf8, #f2f7f3); }
.communication-message { border-radius: 14px; box-shadow: 0 6px 16px rgba(19,53,33,.05); }
.communication-composer { border-top: 1px solid var(--line); background: #fff; padding: 12px; }

.access-branch-row,
.access-person-row,
.access-manager-row { border-radius: var(--radius-md); }
.access-branch-summary { border-radius: var(--radius-md); background: #f8fbf8; }
.access-branch-row.open { border-color: #aecaaf; box-shadow: var(--shadow-card); }
.branch-management-notice { border-radius: 13px; }
.generated-code-panel { border: 1px solid #b9d9bf; background: #eff9f1; }

.branch-modal-backdrop,
.access-management-backdrop {
  background: rgba(6, 29, 18, .52);
  backdrop-filter: blur(9px);
}
.branch-modal-window,
.access-management-window,
.bingo-creation-window {
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 24px;
  background: #f9fcf9;
  box-shadow: var(--shadow-float);
}

.loading-overlay { background: rgba(7, 35, 22, .46); }
.loading-overlay:not(.hidden)::before { border-radius: 20px; background: rgba(9, 42, 27, .94); }

@media (max-width: 1180px) {
  .login-view { grid-template-columns: minmax(330px, .8fr) minmax(430px, 1.2fr); }
  .company-auth-showcase-content { padding: 42px; }
  .company-auth-showcase-copy h2 { font-size: clamp(2.4rem, 5vw, 4rem); }
  .company-showcase-shell { grid-template-columns: 1fr; }
  .company-profile-card,
  .company-results-card,
  .welcome-offer-card { grid-column: auto; }
}

@media (max-width: 920px) {
  .login-view { display: block; }
  .company-auth-showcase { display: none; }
  .login-panel { width: min(760px, 100%); margin: 0 auto; }
  .app-view { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    height: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
  }
  .brand { border: 0; padding: 0; }
  .brand img { width: 42px; height: 42px; border-radius: 12px; }
  .brand div { display: none; }
  .nav { display: flex; gap: 5px; overflow-x: auto; padding: 0; }
  .nav button { width: auto; min-width: 46px; padding: 0 12px; }
  .nav-label { display: none; }
  .ghost-button { width: 46px; padding: 0; font-size: 0; }
  .ghost-button::before { margin: auto; font-size: 1rem; }
  .workspace { padding: 16px; }
  .topbar { top: 72px; }
}

@media (max-width: 760px) {
  .login-panel { padding: 26px 18px 42px; }
  .login-panel #register-company-form:not(.hidden) { grid-template-columns: 1fr; }
  #register-company-form > * { grid-column: 1 !important; }
  .company-register-navigation {
    top: 6px;
    justify-content: stretch;
    gap: 6px;
    padding: 8px;
  }
  .company-register-navigation .link-button { flex: 1 1 90px; padding: 0 8px; }
  .company-register-location-heading,
  .company-register-location-actions { align-items: stretch; flex-direction: column; }
  .topbar { align-items: stretch; min-height: auto; }
  .topbar-actions,
  .company-pill { width: 100%; }
  .company-page-title > img { display: block; }
  .company-showcase-hero { grid-template-columns: 1fr; }
  .company-logo-column { align-items: flex-start; }
  .company-logo-stage { width: 150px; }
  .company-primary-actions { width: 100%; }
  .company-primary-actions button { flex: 1 1 145px; }
  .company-showcase-copy h2 { font-size: 2.4rem; }
  .company-identity-summary { grid-template-columns: 1fr; }
  .company-support-grid { grid-template-columns: 1fr; }
  .branch-activity-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .communications-layout { grid-template-columns: 1fr; }
  .communications-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .communications-dialog { min-height: 460px; }
  .pec-direct-lot-activation { align-items: stretch; flex-direction: column; }
}

@media (max-width: 480px) {
  .workspace { padding: 12px; }
  .topbar { top: 66px; border-radius: 16px; padding: 11px; }
  .company-page-title > img { width: 36px; height: 36px; }
  .company-pill img { width: 38px; height: 38px; }
  .section-card,
  .company-card,
  .company-bingo-card,
  .dashboard-hero { padding: 15px; }
  .branch-activity-kpis { grid-template-columns: 1fr 1fr; }
  .company-dashboard-map { min-height: 330px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 020-3: contraste tipografico do Portal Empresa por superficie. */
.login-panel,
.company-workspace,
.workspace,
.content,
.section-card,
.access-management-window,
.generated-code-panel {
  color: #111111;
  font-weight: 700;
}
:is(.login-panel, .company-workspace, .workspace, .content, .section-card, .access-management-window, .generated-code-panel)
  :is(h1, h2, h3, h4, h5, h6, p, span, small, strong, b, em, label, a, input, textarea, select, option, li, dt, dd, th, td, code) {
  color: #111111;
  font-weight: 700;
}
:is(.login-panel, .company-workspace, .workspace, .content, .section-card, .access-management-window, .generated-code-panel)
  :is(input, textarea, select, option) {
  color: #111111;
  font-weight: 700;
}
.company-auth-showcase,
.company-auth-showcase-content,
.company-sidebar,
.sidebar,
.company-game-stage,
.company-game-map,
.company-map-overlay,
.company-auth-showcase :is(h1, h2, h3, p, span, small, strong, b, em, label, a),
:is(.company-sidebar, .sidebar, .company-game-stage, .company-game-map, .company-map-overlay)
  :is(h1, h2, h3, h4, p, span, small, strong, b, em, label, a, button, li, dt, dd) {
  color: #ffffff;
  font-weight: 400;
}
.login-panel button:not(.link-button):not(.secondary),
:is(.company-workspace, .workspace, .content, .section-card) button:not(.link-button):not(.secondary):not(.ghost-button) {
  color: #ffffff;
  font-weight: 400;
}
:is(.login-panel, .company-workspace, .workspace, .content, .section-card)
  :is(.link-button, .secondary, .ghost-button) {
  color: #111111;
  font-weight: 700;
}
