:root {
  --red: #ED3237;
  --red-dark: #C9262B;
  --dark: #2E2E2E;
  --gray: #6B7280;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --green: #16A34A;
  --amber: #D97706;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--dark); min-height: 100vh;
  font-size: 15px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--dark); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(237,50,55,.12); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--gray); margin: 12px 0 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: #fff; border: none; border-radius: 10px;
  padding: 12px 20px; font-size: 15px; font-weight: 600; transition: background .15s;
}
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn.ghost:hover { background: rgba(237,50,55,.06); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.gray { background: #EDEEF1; color: var(--dark); }
.btn.gray:hover { background: #E2E4E8; }

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #fff 0%, #fbeaea 60%, #f7d7d8 100%);
}
.login-card {
  background: var(--card); width: 100%; max-width: 400px; border-radius: 20px;
  padding: 36px 30px; box-shadow: 0 18px 50px rgba(46,46,46,.14);
}
.login-card img.logo { display: block; max-width: 220px; margin: 0 auto 8px; }
.login-card h1 { font-size: 19px; text-align: center; margin-bottom: 4px; }
.login-card p.sub { text-align: center; color: var(--gray); font-size: 13.5px; margin-bottom: 18px; }

/* ---- App shell ---- */
header.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; position: sticky; top: 0; z-index: 20;
}
header.topbar img { height: 30px; }
header.topbar .who { font-size: 13px; color: var(--gray); text-align: right; line-height: 1.3; }
header.topbar .who b { color: var(--dark); display: block; font-size: 14px; }

main { max-width: 860px; margin: 0 auto; padding: 18px 16px 90px; }
h2.page-title { font-size: 20px; margin-bottom: 4px; }
p.page-sub { color: var(--gray); font-size: 13.5px; margin-bottom: 16px; }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav.tabs button {
  background: none; border: none; color: var(--gray); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 10px; border-radius: 10px;
  min-width: 62px;
}
nav.tabs button .ic { font-size: 20px; line-height: 1; }
nav.tabs button.active { color: var(--red); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.card h3 { font-size: 16px; margin-bottom: 10px; }

.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .info b { display: block; font-size: 15px; }
.list-item .info span { font-size: 12.5px; color: var(--gray); word-break: break-word; }
.list-item .actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.badge.red { background: rgba(237,50,55,.1); color: var(--red); }
.badge.green { background: rgba(22,163,74,.12); color: var(--green); }
.badge.amber { background: rgba(217,119,6,.12); color: var(--amber); }
.badge.gray { background: #EDEEF1; color: var(--gray); }

.empty { text-align: center; color: var(--gray); padding: 40px 16px; font-size: 14px; }
.empty .ic { font-size: 38px; display: block; margin-bottom: 10px; }

.msg { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin: 10px 0; display: none; }
.msg.err { background: rgba(237,50,55,.09); color: var(--red-dark); display: block; }
.msg.ok { background: rgba(22,163,74,.1); color: var(--green); display: block; }

/* financeiro */
.fin-hero {
  background: linear-gradient(135deg, var(--red) 0%, #b91e23 100%);
  color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 14px;
}
.fin-hero .plan { font-size: 13px; opacity: .85; }
.fin-hero .value { font-size: 32px; font-weight: 700; margin: 4px 0; }
.fin-hero .due { font-size: 14px; opacity: .95; }
.pix-box {
  background: #fff; border: 1.5px dashed var(--red); border-radius: 12px;
  padding: 14px; text-align: center; margin-top: 8px;
}
.pix-box .key { font-size: 17px; font-weight: 700; color: var(--red); word-break: break-all; }
.pix-box .lbl { font-size: 12px; color: var(--gray); margin-bottom: 4px; }

.notif-banner {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid var(--border); border-left: 4px solid var(--red);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 13.5px;
}

/* admin */
.seg {
  display: flex; gap: 6px; background: #EDEEF1; border-radius: 12px; padding: 4px;
  margin-bottom: 16px; overflow-x: auto;
}
.seg button {
  flex: 1; border: none; background: transparent; padding: 9px 12px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--gray); white-space: nowrap;
}
.seg button.active { background: #fff; color: var(--red); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

dialog {
  border: none; border-radius: 18px; padding: 24px; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(20,20,20,.45); }
dialog h3 { margin-bottom: 6px; }

.token-box {
  background: #F6F7F9; border-radius: 8px; padding: 10px; font-family: Consolas, monospace;
  font-size: 11.5px; word-break: break-all; margin-top: 6px;
}
.mt { margin-top: 14px; }
.link-btn { background: none; border: none; color: var(--red); font-size: 13.5px; font-weight: 600; text-decoration: underline; }
