:root {
  --bg: #0a120e;
  --surface: #12201a;
  --surface-2: #182a21;
  --line: rgba(217, 164, 65, 0.2);
  --gold: #d9a441;
  --gold-light: #f2cf7e;
  --sunset: #e0702c;
  --water: #3aa7c9;
  --text: #ece4d2;
  --muted: #a9b3a6;
  --ok: #8fd6a4;
  --bad: #f08a72;
  --display: "Cinzel", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(224, 112, 44, 0.12), transparent 70%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2 { font-family: var(--display); color: var(--gold-light); line-height: 1.2; }
.setup { padding: 32px 16px; max-width: 520px; margin: auto; }
.setup h1 { margin-bottom: 12px; }

/* Botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, #b9802a); color: #1b1307; border-color: transparent; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: rgba(240, 138, 114, 0.4); background: transparent; }
.btn.danger.armed { background: #a8432b; color: #fff; border-color: transparent; }
.link { background: none; border: 0; color: var(--gold-light); font: inherit; font-weight: 600; cursor: pointer; padding: 4px; }
.fld { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select {
  font: inherit; font-size: 15px; color: var(--text);
  background: rgba(10, 18, 14, 0.8); border: 1px solid rgba(217, 164, 65, 0.3);
  border-radius: 10px; padding: 10px 12px; outline: none; width: 100%;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.18); }
.note { color: var(--muted); font-size: 13px; }

/* Entrada */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.auth-brand { display: grid; justify-items: center; gap: 4px; margin-bottom: 20px; text-align: center; }
.auth-brand img { margin-bottom: 6px; }
.auth-brand b { font-family: var(--display); color: var(--gold-light); font-size: 20px; }
.auth-brand span { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--water); }
.auth-form { display: grid; gap: 14px; }
.auth-form h1 { font-size: 22px; text-align: center; }
.auth-msg { min-height: 1.3em; font-size: 13px; text-align: center; }
.auth-msg.erro { color: var(--bad); }
.auth-msg.ok { color: var(--ok); }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Topo e navegação */
.top { position: sticky; top: 0; z-index: 10; background: rgba(10, 18, 14, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1040px; margin: auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand b { font-family: var(--display); color: var(--gold-light); font-size: 16px; }
.brand span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--water); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.tab[aria-current="page"] { color: #1b1307; background: var(--gold); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.bottom { display: none; }

main { max-width: 1040px; margin: auto; padding: 24px 16px 100px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h1 { font-size: 26px; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .val { font-family: var(--display); font-size: 30px; color: var(--gold-light); font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { flex: 1; min-width: 220px; }
.chips { display: flex; gap: 6px; }
.chip { background: var(--surface); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.chip[aria-pressed="true"] { color: #1b1307; background: var(--gold); border-color: transparent; }

.lista { display: grid; gap: 8px; }
.cliente { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.cliente.off { opacity: 0.6; }
.c-nome { font-weight: 700; }
.c-info { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 2px; }
.zap { color: var(--ok); font-weight: 600; text-decoration: none; }
.zap:hover { text-decoration: underline; }
.c-data { font-size: 12px; color: #7d877b; margin-top: 2px; }
.badge { margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: rgba(240, 138, 114, 0.15); color: var(--bad); vertical-align: middle; }
.badge.novo { background: rgba(224, 112, 44, 0.2); color: var(--sunset); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.panel h2 { font-size: 16px; margin-bottom: 6px; }
.team { display: grid; gap: 8px; }
.member { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.member.pendente { border-color: var(--sunset); }
.member .nm { font-weight: 700; }
.member .em { font-size: 13px; color: var(--muted); }
.member select { width: auto; min-width: 190px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--gold-light); color: #1b1307; font-weight: 600; padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); z-index: 50; }

@media (max-width: 720px) {
  .tabs, .who { display: none; }
  .bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: rgba(10, 18, 14, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom .tab { flex: 1; display: grid; justify-items: center; gap: 2px; font-size: 11px; padding: 6px; border-radius: 12px; }
  .bottom .tab svg { width: 22px; height: 22px; }
  .bottom .tab[aria-current="page"] { background: none; color: var(--gold-light); }
  .kpis { gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .val { font-size: 24px; }
  .cliente, .member { flex-direction: column; align-items: stretch; }
  .member select { width: 100%; }
  .view-head .actions { width: 100%; }
  .view-head .actions .btn { flex: 1; }
}
