:root {
  --brand: #485B7C;
  --brand-dark: #36465F;
  --brand-soft: #5C7095;
  --brand-wash: #EEF1F6;
  --accent: #C98A3C;
  --accent-soft: #F3E5CE;
  --bg: #F5F4F1;
  --surface: #FFFFFF;
  --ink: #1E2530;
  --muted: #707A88;
  --line: #E7E6E2;
  --ok: #2E7D52;
  --ok-wash: #E4F2EA;
  --danger: #BB4239;
  --danger-wash: #F7E6E4;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(30,37,48,.05), 0 6px 20px rgba(30,37,48,.06);
  --shadow-lg: 0 8px 34px rgba(30,37,48,.16);
  --maxw: 540px;
  --nav-h: 66px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
svg { width: 22px; height: 22px; flex: none; }
html, body { height: 100%; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
.display { font-family: "Fraunces", Georgia, serif; font-optical-sizing: auto; letter-spacing: -.01em; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand); }

/* ---------- App shell ---------- */
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100%; position: relative; }

.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--brand);
  color: #fff;
}
.appbar .logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex: none; }
.appbar .titles { line-height: 1.15; }
.appbar .titles small { display: block; font-size: 11px; opacity: .72; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.appbar .titles strong { font-size: 16px; font-weight: 700; }
.appbar .spacer { flex: 1; }
.appbar .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 1px solid rgba(255,255,255,.25);
}
.appbar .iconbtn {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.25); flex: none;
}
.appbar .iconbtn svg { width: 19px; height: 19px; }
.sino-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px;
  background: var(--accent, #C98A3C); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid var(--brand);
}

.screen { padding: 18px 16px calc(var(--nav-h) + 28px); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin: 4px 2px 16px; }
.page-head h1 { font-size: 25px; font-weight: 600; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--maxw); z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px; font-size: 11px; font-weight: 600; color: var(--muted);
  height: var(--nav-h);
}
.bottomnav button svg { width: 23px; height: 23px; stroke: currentColor; }
.bottomnav button.active { color: var(--brand); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card.tight { padding: 14px; }

/* Home hero */
.hero {
  background: linear-gradient(150deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-radius: 20px; padding: 22px 20px; margin-bottom: 18px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,138,60,.35), transparent 68%);
}
.hero .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.hero h2 { font-size: 24px; font-weight: 500; margin: 6px 0 4px; line-height: 1.2; }
.hero p { font-size: 14px; opacity: .85; max-width: 32ch; }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 700; color: var(--brand); font-family: "Fraunces", serif; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 600; }

/* Menu grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: left; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; min-height: 110px;
  transition: transform .12s ease;
}
.tile:active { transform: scale(.975); }
.tile .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-wash); color: var(--brand); }
.tile .ic svg { width: 22px; height: 22px; stroke: currentColor; }
.tile.warm .ic { background: var(--accent-soft); color: var(--accent); }
.tile h3 { font-size: 15px; font-weight: 700; }
.tile p { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* ---------- Lists ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 10px; box-shadow: var(--shadow);
  text-align: left; width: 100%;
}
.list-item .av { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-wash); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.list-item .av svg { width: 22px; height: 22px; stroke: currentColor; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { font-size: 15px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow small { color: var(--muted); font-size: 12.5px; }
.list-item .chev { color: var(--muted); flex: none; width: 18px; height: 18px; }

/* Tags / badges */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--brand-wash); color: var(--brand); }
.tag.warm { background: var(--accent-soft); color: #9a6a26; }
.tag.ok { background: var(--ok-wash); color: var(--ok); }
.tag.muted { background: #EEE; color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge.pendente { background: var(--accent-soft); color: #9a6a26; }
.badge.aceito { background: var(--ok-wash); color: var(--ok); }
.badge.recusado { background: var(--danger-wash); color: var(--danger); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=url], textarea, select {
  width: 100%; padding: 12px 13px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); font-size: 15px;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }

.check { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.check.on { border-color: var(--brand); background: var(--brand-wash); }
.check .t b { font-size: 14.5px; display: block; }
.check .t span { font-size: 12.5px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border-radius: 13px; font-weight: 700; font-size: 15.5px;
  background: var(--brand); color: #fff; transition: filter .15s, transform .1s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; }
.btn.ghost { background: var(--brand-wash); color: var(--brand); }
.btn.accent { background: var(--accent); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--surface); color: var(--danger); border: 1.5px solid var(--danger-wash); }
.btn.sm { width: auto; padding: 10px 16px; font-size: 14px; border-radius: 11px; }
.btn-row { display: flex; gap: 10px; }
.btn svg { width: 19px; height: 19px; stroke: currentColor; }

.fab {
  position: fixed; right: max(16px, calc(50% - var(--maxw)/2 + 16px));
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 35;
  width: 56px; height: 56px; border-radius: 18px; background: var(--brand); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-lg);
}
.fab svg { width: 26px; height: 26px; stroke: currentColor; }

/* Search */
.search { position: relative; margin-bottom: 14px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--muted); }
.search input { padding-left: 40px; border-radius: 999px; }

/* Empty state */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; stroke: var(--line); stroke-width: 1.5; margin-bottom: 12px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty p { font-size: 13.5px; }

/* Tabs */
.tabs { display: flex; gap: 6px; background: var(--brand-wash); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--brand); }
.tabs button.active { background: var(--surface); box-shadow: var(--shadow); }

/* Info rows */
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--muted); }
.info-row b { text-align: right; font-weight: 600; }

/* PIX box */
.pix-box { background: var(--brand-wash); border: 1.5px dashed var(--brand-soft); border-radius: var(--radius-sm); padding: 14px; display: flex; align-items: center; gap: 12px; }
.pix-box .grow { flex: 1; min-width: 0; }
.pix-box small { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pix-box b { display: block; font-size: 15px; word-break: break-all; }

/* Media gallery */
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.media-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.media-card .thumb { aspect-ratio: 1; background: var(--brand-wash); display: grid; place-items: center; color: var(--brand-soft); }
.media-card img, .media-card video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.media-card .meta { padding: 9px 11px; }
.media-card .meta b { font-size: 13px; display: block; }
.media-card .meta small { font-size: 11.5px; color: var(--muted); }

/* Modal / sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,25,33,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--surface); width: 100%; max-width: var(--maxw); border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; animation: slideup .28s cubic-bezier(.2,.8,.2,1); }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet .handle { width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: -6px auto 14px; }
.sheet h2 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.sheet .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }

/* Auth */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 22px calc(28px + env(safe-area-inset-bottom)); background: linear-gradient(165deg, var(--brand) 0%, var(--brand-dark) 70%, #2A3549 100%); }
.auth-wrap { background: var(--surface); border-radius: 22px; padding: 26px 22px; box-shadow: var(--shadow-lg); }
.auth-logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 16px; box-shadow: var(--shadow); }
.auth h1 { text-align: center; font-size: 22px; font-weight: 600; }
.auth .tagline { text-align: center; color: var(--muted); font-size: 13.5px; margin: 4px 0 22px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-foot button { color: var(--brand); font-weight: 700; }

/* Toast */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 20px); z-index: 80; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90%; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }
#toast.ok { background: var(--ok); }

.muted-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--brand-wash); border-top-color: var(--brand); border-radius: 50%; animation: rot .7s linear infinite; margin: 40px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.section-label { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); text-align: center; margin: 24px 2px 12px; }

@media (min-width: 560px) {
  #app { box-shadow: 0 0 60px rgba(0,0,0,.08); }
}
