:root {
  color-scheme: light;
  --ink: #12283d;
  --muted: #5b7085;
  --line: #d8e3ee;
  --surface: #ffffff;
  --canvas: #f5f8fc;
  --brand: #0a5a96;
  --brand-dark: #073f6b;
  --brand-soft: #e3eff9;
  --gold: #b07d10;
  --gold-soft: #fdf2d9;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --purple: #6750a4;
  --shadow: 0 12px 30px rgba(10, 42, 74, .10);
  --sky:
    radial-gradient(circle at 50% -12%, rgba(176, 125, 16, .16), transparent 42%),
    radial-gradient(circle at 12% 4%, rgba(10, 90, 150, .12), transparent 38%),
    linear-gradient(180deg, #eef4fb 0%, var(--canvas) 30%);
  --radius-lg: 22px;
  --radius-md: 15px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.auth-shell {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(180deg, #0a5a96 0%, #0d6cae 30%, #6ea3cd 46%, #dbe8f5 58%, var(--canvas) 100%);
}
/* Céu institucional: raios de sol saindo do topo e estrelas discretas (só CSS). */
.auth-shell::before {
  content: ""; position: absolute; inset: -10% -10% 45%; z-index: -2;
  background: repeating-conic-gradient(from 0deg at 50% 0%,
    rgba(255, 255, 255, .16) 0deg 2.4deg, transparent 2.4deg 9deg);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, rgba(0,0,0,.65) 45%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, rgba(0,0,0,.65) 45%, transparent 78%);
}
.auth-shell::after {
  content: ""; position: absolute; inset: 0 0 55%; z-index: -1; opacity: .9;
  background:
    radial-gradient(circle at 50% 2%, rgba(242, 199, 92, .55), rgba(242, 199, 92, 0) 26%),
    radial-gradient(1.6px 1.6px at 12% 22%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 26% 12%, rgba(255,255,255,.85), transparent),
    radial-gradient(1.8px 1.8px at 74% 16%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 88% 27%, rgba(255,255,255,.8), transparent),
    radial-gradient(1.2px 1.2px at 63% 30%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 35% 33%, rgba(255,255,255,.75), transparent);
}
.auth-shell .vegetal {
  position: absolute; left: 0; right: 0; bottom: 0; height: min(38vh, 300px); z-index: -1;
  background: url("bg-udv.svg") bottom center / cover no-repeat;
  pointer-events: none;
}
.auth-card { position: relative; z-index: 1; }
/* Na entrada há espaço para a identidade completa, mesmo no celular. */
.auth-brand .brand-subtitle, .auth-brand .brand-motto { display: block; }
.auth-card { width: min(100%, 460px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px 20px; box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 32px; }.auth-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 18px 0 0; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
/* Fundo institucional: céu azul suave com raios de sol, sem imagens externas. */
.app-shell { background: var(--sky); background-attachment: fixed; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #e6a634;
  outline-offset: 3px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #e6a634;
  background-color: #fffef0;
  box-shadow: 0 0 0 3px rgba(230, 166, 52, 0.1);
}
a { color: #0a5a96; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { color: #073f6b; text-decoration-thickness: 3px; }

.app-shell { min-height: 100vh; padding-bottom: 86px; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.topbar-inner { max-width: 1120px; margin: auto; padding: 14px 18px; display: flex; gap: 14px; align-items: center; justify-content: space-between; min-width: 0; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1 1 auto; overflow: hidden; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; color: inherit; }
.brand > span:last-child { min-width: 0; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
  box-shadow: 0 0 0 2px var(--gold), 0 4px 12px rgba(7, 63, 107, .3); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.auth-brand .brand-mark { width: 64px; height: 64px; }
.brand-motto { display: none; margin-top: 2px; font: 700 10px/1 "Plus Jakarta Sans", sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.brand-title { margin: 0; font: 800 17px/1.05 "Plus Jakarta Sans", sans-serif; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.brand-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.account { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; }
.account-copy { display: none; }
.account-copy strong { display: block; font-size: 13px; }
.account-copy span { font-size: 11px; color: var(--muted); }
.role-select { min-height: 44px; max-width: 132px; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 28px 8px 9px; color: var(--brand-dark); font-weight: 700; font-size: 12px; }

.page { max-width: 1120px; margin: auto; padding: 24px 18px; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3 { font-family: "Plus Jakarta Sans", sans-serif; letter-spacing: -.04em; }
h1 { font-size: clamp(32px, 6vw, 48px); margin: 6px 0 12px; line-height: 1.06; }
h2 { font-size: 24px; margin: 0; }
h3 { font-size: 18px; margin: 0; }
.lead { color: var(--muted); margin: 0; line-height: 1.5; }
.section-head { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 26px 0 13px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.notice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #b7d4ec; background: var(--brand-soft); padding: 13px 14px; border-radius: var(--radius-md); color: var(--brand-dark); font-size: 13px; line-height: 1.45; }
.notice strong { display: block; margin-bottom: 2px; }
.notice .button { align-self: flex-start; margin-top: 10px; }
.backup-notice > div { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.notice.warning { background: var(--gold-soft); border-color: #f0d196; color: #6d4809; }
.demo-tag { display: inline-flex; align-items: center; gap: 6px; background: #fff7e6; border: 1px solid #f2d39a; color: #80520c; border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 800; }
.live-status { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 800; }
.live-status.connected { color: #0d4c7d; background: #e6f0fa; }
.live-status.connecting { color: #80520c; background: #fff7e6; }
.live-status.offline { color: #9f2d2d; background: #fff0f0; }

.hero-row { display: flex; flex-direction: column; gap: 14px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button { min-height: 48px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 12px; padding: 12px 18px; color: white; background: var(--brand); font-weight: 800; transition: transform .15s, background .15s; }
.button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.button:active { transform: scale(0.98); }
.button:disabled, .nav-item:disabled { cursor: not-allowed; opacity: 1; background-color: #c7d3de; color: #6b7280; transform: none; }
.button.secondary { background: white; color: var(--brand-dark); border-color: var(--line); }
.button.secondary:hover { background: var(--brand-soft); }
.button.ghost { color: var(--muted); background: transparent; border-color: transparent; }
.button.danger { background: var(--danger); }
.button.small { min-height: 48px; padding: 10px 13px; font-size: 15px; }
.button.full { width: 100%; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 15px; box-shadow: var(--shadow); }
.stat-card, .campaign-card, .report-card, .member { min-width: 0; }
.stat-card .stat-label { color: var(--muted); font-size: 12px; display: block; }
.stat-value { display: block; margin-top: 5px; font: 800 22px/1.1 "Plus Jakarta Sans", sans-serif; }
.stat-note { display: block; color: var(--brand); margin-top: 7px; font-size: 11px; font-weight: 700; }

.campaign-grid { display: grid; gap: 14px; }
.campaign-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 17px; box-shadow: var(--shadow); }
.campaign-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.campaign-card-head > div, .report-card-header > div { min-width: 0; }
.campaign-card p { color: var(--muted); margin: 6px 0 16px; line-height: 1.4; font-size: 13px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 9px; background: var(--brand-soft); color: var(--brand-dark); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.gold { background: var(--gold-soft); color: #81530a; }
.progress-line { height: 9px; overflow: hidden; background: #e6efed; border-radius: 99px; }
.progress-line span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.progress-copy { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 700; }
.progress-copy span:last-child { color: var(--muted); font-weight: 500; }
.campaign-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.metric { background: #f6faf8; border-radius: 12px; padding: 10px; }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 3px; font-size: 15px; }
.card-actions { display: flex; gap: 8px; }
.card-actions .button:first-child { flex: 1; }

.empty-state { border: 1px dashed #b9cdc7; border-radius: var(--radius-lg); text-align: center; padding: 28px 18px; background: rgba(255,255,255,.55); }
.empty-state .empty-icon { font-size: 35px; }
.empty-state p { color: var(--muted); margin: 7px 0 15px; }

.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 7px max(10px, env(safe-area-inset-left)) max(7px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav-item { min-height: 56px; border: 0; background: transparent; color: var(--muted); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; }
.nav-item span:first-child { font-size: 20px; line-height: 1; }
.nav-item.active { color: var(--brand-dark); background: var(--brand-soft); }

.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--brand-dark); font-weight: 800; font-size: 13px; margin-bottom: 17px; }
.detail-head { display: flex; flex-direction: column; gap: 12px; }
.detail-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.detail-summary .stat-card { box-shadow: none; }
.tab-bar { display: flex; gap: 6px; overflow-x: auto; padding: 5px; margin: 22px 0 14px; background: #e9f3f0; border-radius: 14px; }
.tab-button { flex: 1; min-height: 44px; white-space: nowrap; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 800; font-size: 12px; padding: 8px 11px; }
.tab-button.active { background: white; color: var(--brand-dark); box-shadow: 0 2px 8px rgba(19,60,50,.09); }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 14px; }
.filter-button { min-height: 44px; flex: 0 0 auto; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 7px 11px; color: var(--muted); font-size: 12px; font-weight: 800; }
.filter-button.active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.number-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 7px; }
.number { aspect-ratio: 1; border: 0; border-radius: 11px; font-weight: 800; font-size: 13px; color: var(--ink); background: #e7f4ef; }
.number.available { background: #edf6fd; color: #195579; }
.number.pending { background: #fdf2d9; color: #7a4d08; }
.number.paid { background: #d9f1e7; color: #14614c; }
.number.selected { background: var(--brand); color: white; box-shadow: 0 0 0 3px #b6e0d5; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .available i { background: #b9def3; }.legend .paid i { background: var(--brand); }.legend .pending i { background: #e4a52a; }
.search { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfdfc; }
.buyer-list { display: grid; gap: 10px; }
.buyer-item { border: 1px solid var(--line); border-radius: 15px; padding: 13px; }
.buyer-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.buyer-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }.buyer-value { margin-top: 10px; font-weight: 800; }.buyer-actions { display: flex; gap: 7px; margin-top: 11px; flex-wrap: wrap; }

.report-grid { display: grid; gap: 12px; }
.report-card { border: 1px solid var(--line); background: white; border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.report-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }.report-card p { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 5px 0 14px; }
.report-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 15px; }.report-value { min-width: 0; background: #f5faf8; padding: 10px; border-radius: 11px; }.report-value span { display: block; color: var(--muted); font-size: 11px; }.report-value strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.team-list { display: grid; gap: 10px; }.member { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: white; }.member .avatar { width: 40px; height: 40px; }.member-info { flex: 1; min-width: 0; }.member-info strong { display: block; }.member-info small { display: block; color: var(--muted); margin-top: 3px; }.member-actions { color: var(--muted); font-size: 20px; }

.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; align-items: end; background: rgba(8, 28, 48, .5); padding: 0; }
.modal { width: 100%; max-height: 92vh; overflow: auto; background: white; border-radius: 24px 24px 0 0; padding: 20px 18px 28px; box-shadow: 0 -20px 60px rgba(0,0,0,.18); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }.modal-header p { color: var(--muted); margin: 5px 0 0; font-size: 13px; line-height: 1.4; }.close { flex: 0 0 44px; border: 0; background: #eef3f9; color: var(--muted); width: 44px; height: 44px; border-radius: 12px; font-size: 20px; }
.form-grid { display: grid; gap: 13px; }.field { display: grid; gap: 6px; }.field label { font-weight: 800; font-size: 13px; }.field small { color: var(--muted); font-size: 11px; }.field input, .field textarea, .field select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfdfc; }.field textarea { min-height: 84px; resize: vertical; }.two-col { display: grid; gap: 12px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.choice { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted); font-weight: 800; }.choice.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.campaign-picker { display: grid; gap: 10px; }.campaign-picker-item { width: 100%; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: white; color: var(--ink); }.campaign-picker-item:hover, .campaign-picker-item:focus-visible { border-color: var(--brand); background: var(--brand-soft); }.campaign-picker-item > span:first-child { min-width: 0; display: grid; gap: 4px; }.campaign-picker-item strong { overflow-wrap: anywhere; }.campaign-picker-item small { color: var(--muted); line-height: 1.35; }
.sale-campaign-context { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 17px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--brand-soft); }.sale-campaign-context > div { min-width: 0; display: grid; gap: 3px; }.sale-campaign-context span { color: var(--muted); font-size: 11px; }.sale-campaign-context strong { overflow-wrap: anywhere; color: var(--brand-dark); }
.modal-footer { display: flex; gap: 8px; margin-top: 18px; }.modal-footer .button { flex: 1; }
.report-preview { border: 1px solid var(--line); border-radius: 15px; background: #f7fafd; padding: 14px; font-size: 12px; line-height: 1.6; }.report-preview dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0; gap: 8px; }.report-preview dt { color: var(--muted); }.report-preview dd { margin: 0; text-align: right; font-weight: 800; }

.toast-region { position: fixed; z-index: 50; top: 75px; left: 14px; right: 14px; display: grid; gap: 8px; pointer-events: none; }.toast { pointer-events: auto; background: #0b3350; color: white; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px; animation: slide .2s ease-out; }.toast.error { background: var(--danger); }
@keyframes slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.app-footer { background: #eef3f9; border-top: 1px solid var(--line); padding: 14px 18px; font-size: 14px; text-align: center; color: var(--muted); }
.footer-content { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.footer-content span { display: block; }

/* Celular: o nome do app tem prioridade sobre a legenda no cabeçalho. */
@media (max-width: 480px) {
  .brand-subtitle { display: none; }
  .topbar-inner { padding-left: 14px; padding-right: 14px; gap: 10px; }
}

@media (max-width: 360px) {
  .topbar-inner { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .brand { gap: 8px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-subtitle { display: none; }
  .account { margin-left: auto; min-width: 0; }
  .role-select { max-width: 100px; padding-left: 7px; padding-right: 20px; font-size: 11px; }
  .page { padding-left: 14px; padding-right: 14px; }
  .campaign-card, .panel, .report-card { padding-left: 13px; padding-right: 13px; }
  .number-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-contrast: more) {
  .auth-shell::before, .auth-shell::after { display: none; }
}

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

@media (min-width: 640px) {
  .brand-motto { display: block; }
  .account-copy { display: block; }.hero-row { flex-direction: row; align-items: flex-end; justify-content: space-between; }.hero-row > div:first-child { max-width: 650px; }.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }.campaign-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.detail-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }.number-grid { grid-template-columns: repeat(8, minmax(0,1fr)); }.modal-backdrop { align-items: center; padding: 18px; }.modal { max-width: 560px; border-radius: 24px; margin: auto; }.two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }.report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.bottom-nav { left: 50%; right: auto; width: min(600px, 100%); transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}
@media (min-width: 960px) { .page { padding-top: 34px; }.campaign-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }.number-grid { grid-template-columns: repeat(10, minmax(0,1fr)); }.bottom-nav { width: 650px; } }
